Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Resend.Webhooks/ContactEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ public class ContactEventData : IWebhookData
[JsonPropertyName( "id" )]
public Guid ContactId { get; set; }

/// <summary />
[JsonPropertyName( "audience_id" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public string? AudienceId { get; set; }

/// <summary />
[JsonPropertyName( "segment_ids" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
Expand Down
27 changes: 27 additions & 0 deletions src/Resend.Webhooks/EmailEventAttachment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Text.Json.Serialization;

namespace Resend.Webhooks;

/// <summary />
public class EmailEventAttachment
{
/// <summary />
[JsonPropertyName( "id" )]
public Guid Id { get; set; }

/// <summary />
[JsonPropertyName( "filename" )]
public string Filename { get; set; } = default!;

/// <summary />
[JsonPropertyName( "content_type" )]
public string ContentType { get; set; } = default!;

/// <summary />
[JsonPropertyName( "content_disposition" )]
public string ContentDisposition { get; set; } = default!;

/// <summary />
[JsonPropertyName( "content_id" )]
public string ContentId { get; set; } = default!;
}
93 changes: 92 additions & 1 deletion src/Resend.Webhooks/EmailEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,57 @@ public class EmailEventData : IWebhookData
[JsonPropertyName( "to" )]
public EmailAddressList To { get; set; } = default!;

/// <summary />
/// <remarks>
/// Only set for <see cref="WebhookEventType.EmailReceived" />, otherwise is null.
/// </remarks>
[JsonPropertyName( "bcc" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public EmailAddressList? Bcc { get; set; } = default!;

/// <summary />
/// <remarks>
/// Only set for <see cref="WebhookEventType.EmailReceived" />, otherwise is null.
/// </remarks>
[JsonPropertyName( "cc" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public EmailAddressList? Cc { get; set; } = default!;

/// <summary />
/// <remarks>
/// Only set for <see cref="WebhookEventType.EmailReceived" />, otherwise is null.
/// </remarks>
[JsonPropertyName( "message_id" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public string? MessageId { get; set; }

/// <summary />
[JsonPropertyName( "subject" )]
public string Subject { get; set; } = default!;

/// <summary />
[JsonPropertyName( "broadcast_id" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public string? BroadcastId { get; set; }
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.

/// <summary />
[JsonPropertyName( "template_id" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public string? TemplateId { get; set; }

/// <summary />
[JsonPropertyName( "tags" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public Dictionary<string, string>? Tags { get; set; }

/// <summary />
/// <remarks>
/// Only set for <see cref="WebhookEventType.EmailReceived" />, otherwise is null.
/// </remarks>
[JsonPropertyName( "attachments" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public List<EmailEventAttachment>? Attachments { get; set; }

/// <summary />
/// <remarks>
/// Only set for <see cref="WebhookEventType.EmailClicked" />, otherwise is null.
Expand All @@ -41,6 +88,22 @@ public class EmailEventData : IWebhookData
[JsonPropertyName( "bounce" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public EmailBounceData? Bounce { get; set; }

/// <summary />
/// <remarks>
/// Only set for <see cref="WebhookEventType.EmailFailed"/>
/// </remarks>
[JsonPropertyName( "failed" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public EmailFailedData? Failed { get; set; }

/// <summary />
/// <remarks>
/// Only set for <see cref="WebhookEventType.EmailSuppressed"/>
/// </remarks>
[JsonPropertyName( "suppressed" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public EmailSuppressedData? Suppressed { get; set; }
}


Expand All @@ -60,7 +123,12 @@ public class EmailBounceData
/// <remarks>TODO: What are the possible values?</remarks>
[JsonPropertyName( "type" )]
public string Type { get; set; } = default!;
}

/// <summary />
[JsonPropertyName( "diagnosticCode" )]
[JsonIgnore( Condition = JsonIgnoreCondition.WhenWritingNull )]
public List<string>? DiagnosticCode { get; set; }
}


/// <summary />
Expand All @@ -82,4 +150,27 @@ public class EmailClickData
/// <summary />
[JsonPropertyName( "userAgent" )]
public string UserAgent { get; set; } = default!;
}


/// <summary />
public class EmailFailedData
{
/// <summary />
[JsonPropertyName( "reason" )]
public string Reason { get; set; } = default!;
}


/// <summary />
public class EmailSuppressedData
{
/// <summary />
[JsonPropertyName( "message" )]
public string Message { get; set; } = default!;

/// <summary />
/// <remarks>TODO: What are the possible values?</remarks>
[JsonPropertyName( "type" )]
public string Type { get; set; } = default!;
}
Loading