resend 6.21.0 → 6.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +38 -1
- package/dist/index.d.cts +151 -3
- package/dist/index.d.mts +151 -3
- package/dist/index.mjs +38 -1
- package/package.json +14 -16
package/dist/index.cjs
CHANGED
|
@@ -25,7 +25,7 @@ let postal_mime = require("postal-mime");
|
|
|
25
25
|
postal_mime = __toESM(postal_mime);
|
|
26
26
|
let standardwebhooks = require("standardwebhooks");
|
|
27
27
|
//#region package.json
|
|
28
|
-
var version = "6.
|
|
28
|
+
var version = "6.22.1";
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/common/utils/build-pagination-query.ts
|
|
31
31
|
function buildPaginationUrl(base, options) {
|
|
@@ -309,6 +309,14 @@ var Broadcasts = class {
|
|
|
309
309
|
async get(id) {
|
|
310
310
|
return await this.resend.get(`/broadcasts/${id}`);
|
|
311
311
|
}
|
|
312
|
+
async recipients(id, options) {
|
|
313
|
+
const url = `/broadcasts/${id}/recipients?${buildRecipientsQuery(options)}`;
|
|
314
|
+
return await this.resend.get(url);
|
|
315
|
+
}
|
|
316
|
+
async clickedLinks(id, options = {}) {
|
|
317
|
+
const url = buildPaginationUrl(`/broadcasts/${id}/clicked-links`, options);
|
|
318
|
+
return await this.resend.get(url);
|
|
319
|
+
}
|
|
312
320
|
async remove(id) {
|
|
313
321
|
return await this.resend.delete(`/broadcasts/${id}`);
|
|
314
322
|
}
|
|
@@ -331,6 +339,14 @@ var Broadcasts = class {
|
|
|
331
339
|
});
|
|
332
340
|
}
|
|
333
341
|
};
|
|
342
|
+
function buildRecipientsQuery(options) {
|
|
343
|
+
const { type, email, bounceType, ...pagination } = options;
|
|
344
|
+
const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
|
|
345
|
+
searchParams.set("type", type);
|
|
346
|
+
if (email !== void 0) searchParams.set("email", email);
|
|
347
|
+
if (bounceType !== void 0) searchParams.set("bounce_type", bounceType);
|
|
348
|
+
return searchParams.toString();
|
|
349
|
+
}
|
|
334
350
|
//#endregion
|
|
335
351
|
//#region src/common/utils/parse-contact-properties-to-api-options.ts
|
|
336
352
|
function parseContactPropertyFromApi(contactProperty) {
|
|
@@ -896,7 +912,28 @@ var Emails = class {
|
|
|
896
912
|
async share(id, payload) {
|
|
897
913
|
return await this.resend.post(`/emails/${id}/share`, { expires_in: payload?.expiresIn });
|
|
898
914
|
}
|
|
915
|
+
async metrics(options = {}) {
|
|
916
|
+
const queryString = buildMetricsQuery(options);
|
|
917
|
+
const url = queryString ? `/emails/metrics?${queryString}` : "/emails/metrics";
|
|
918
|
+
return await this.resend.get(url);
|
|
919
|
+
}
|
|
899
920
|
};
|
|
921
|
+
function buildMetricsQuery(options) {
|
|
922
|
+
const params = {
|
|
923
|
+
start_date: options.startDate,
|
|
924
|
+
end_date: options.endDate,
|
|
925
|
+
timezone: options.timezone,
|
|
926
|
+
granularity: options.granularity,
|
|
927
|
+
metrics: options.metrics?.join(","),
|
|
928
|
+
dimensions: options.dimensions?.join(","),
|
|
929
|
+
domain_id: options.domainId?.join(","),
|
|
930
|
+
email_id: options.emailId?.join(","),
|
|
931
|
+
broadcast_id: options.broadcastId?.join(",")
|
|
932
|
+
};
|
|
933
|
+
const searchParams = new URLSearchParams();
|
|
934
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
|
|
935
|
+
return searchParams.toString();
|
|
936
|
+
}
|
|
900
937
|
//#endregion
|
|
901
938
|
//#region src/events/events.ts
|
|
902
939
|
var Events = class {
|
package/dist/index.d.cts
CHANGED
|
@@ -829,6 +829,65 @@ interface GetBroadcastResponseSuccess extends Broadcast {
|
|
|
829
829
|
}
|
|
830
830
|
type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;
|
|
831
831
|
//#endregion
|
|
832
|
+
//#region src/broadcasts/interfaces/list-broadcast-clicked-links.interface.d.ts
|
|
833
|
+
type ListBroadcastClickedLinksOptions = PaginationOptions;
|
|
834
|
+
type BroadcastClickedLink = {
|
|
835
|
+
/**
|
|
836
|
+
* `id` is an opaque cursor for this row, used only for pagination.
|
|
837
|
+
* It does not identify any entity in Resend.
|
|
838
|
+
*/
|
|
839
|
+
id: string;
|
|
840
|
+
url: string;
|
|
841
|
+
clicks: number;
|
|
842
|
+
unique_clicks: number;
|
|
843
|
+
};
|
|
844
|
+
type ListBroadcastClickedLinksResponseSuccess = PaginatedData<BroadcastClickedLink[]>;
|
|
845
|
+
type ListBroadcastClickedLinksResponse = Response<ListBroadcastClickedLinksResponseSuccess>;
|
|
846
|
+
//#endregion
|
|
847
|
+
//#region src/broadcasts/interfaces/list-broadcast-recipients.interface.d.ts
|
|
848
|
+
type BroadcastRecipientEventType = 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
|
|
849
|
+
type BroadcastRecipientBounceType = 'permanent' | 'transient' | 'undetermined';
|
|
850
|
+
type ListBroadcastRecipientsOptions<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginationOptions & {
|
|
851
|
+
type: T;
|
|
852
|
+
email?: string;
|
|
853
|
+
bounceType?: T extends 'bounced' ? BroadcastRecipientBounceType : never;
|
|
854
|
+
};
|
|
855
|
+
interface BroadcastRecipientClickedLink {
|
|
856
|
+
url: string;
|
|
857
|
+
clicks: number;
|
|
858
|
+
}
|
|
859
|
+
type BroadcastRecipientBase = {
|
|
860
|
+
id: string;
|
|
861
|
+
contact_id: string | null;
|
|
862
|
+
email: string;
|
|
863
|
+
};
|
|
864
|
+
type BroadcastRecipientLoose = BroadcastRecipientBase & {
|
|
865
|
+
count?: number;
|
|
866
|
+
clicked_links?: BroadcastRecipientClickedLink[];
|
|
867
|
+
bounce_type?: BroadcastRecipientBounceType;
|
|
868
|
+
};
|
|
869
|
+
type IsUnion<T, B = T> = T extends B ? ([B] extends [T] ? false : true) : never;
|
|
870
|
+
type BroadcastRecipientFieldsByType = {
|
|
871
|
+
sent: unknown;
|
|
872
|
+
delivered: unknown;
|
|
873
|
+
opened: {
|
|
874
|
+
count: number;
|
|
875
|
+
};
|
|
876
|
+
clicked: {
|
|
877
|
+
count: number;
|
|
878
|
+
clicked_links: BroadcastRecipientClickedLink[];
|
|
879
|
+
};
|
|
880
|
+
bounced: {
|
|
881
|
+
bounce_type: BroadcastRecipientBounceType;
|
|
882
|
+
};
|
|
883
|
+
complained: unknown;
|
|
884
|
+
unsubscribed: unknown;
|
|
885
|
+
suppressed: unknown;
|
|
886
|
+
};
|
|
887
|
+
type BroadcastRecipient<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = IsUnion<T> extends true ? BroadcastRecipientLoose : BroadcastRecipientBase & BroadcastRecipientFieldsByType[T];
|
|
888
|
+
type ListBroadcastRecipientsResponseSuccess<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginatedData<BroadcastRecipient<T>[]>;
|
|
889
|
+
type ListBroadcastRecipientsResponse<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = Response<ListBroadcastRecipientsResponseSuccess<T>>;
|
|
890
|
+
//#endregion
|
|
832
891
|
//#region src/broadcasts/interfaces/list-broadcasts.interface.d.ts
|
|
833
892
|
type ListBroadcastsOptions = PaginationOptions;
|
|
834
893
|
type ListBroadcastsResponseSuccess = {
|
|
@@ -1419,6 +1478,92 @@ interface GetEmailResponseSuccess {
|
|
|
1419
1478
|
}
|
|
1420
1479
|
type GetEmailResponse = Response<GetEmailResponseSuccess>;
|
|
1421
1480
|
//#endregion
|
|
1481
|
+
//#region src/emails/interfaces/get-metrics.interface.d.ts
|
|
1482
|
+
type EmailMetric = 'received' | 'delivered' | 'complained' | 'suppressed' | 'bounced' | 'bounced_transient' | 'bounced_permanent' | 'bounced_undetermined' | 'opened' | 'clicked' | 'unsubscribed' | 'delivery_delayed' | 'failed' | 'sent' | 'unique_opened' | 'unique_clicked' | 'delivery_rate' | 'open_rate' | 'click_rate' | 'bounce_rate' | 'complaint_rate' | 'unsubscribe_rate';
|
|
1483
|
+
type EmailMetricsDimension = 'period' | 'domain' | 'email' | 'broadcast';
|
|
1484
|
+
type EmailMetricsGranularity = 'hourly' | 'daily' | 'weekly' | 'monthly';
|
|
1485
|
+
type EmailMetricsCommonOptions = {
|
|
1486
|
+
/**
|
|
1487
|
+
* The start of the date range, as an ISO 8601 date or datetime.
|
|
1488
|
+
* Defaults to 6 days before `endDate`.
|
|
1489
|
+
*
|
|
1490
|
+
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1491
|
+
*/
|
|
1492
|
+
startDate?: string;
|
|
1493
|
+
/**
|
|
1494
|
+
* The end of the date range, as an ISO 8601 date or datetime.
|
|
1495
|
+
* Defaults to now.
|
|
1496
|
+
*
|
|
1497
|
+
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1498
|
+
*/
|
|
1499
|
+
endDate?: string;
|
|
1500
|
+
/**
|
|
1501
|
+
* The IANA timezone used to bucket periods when `period` is in `dimensions`.
|
|
1502
|
+
* Defaults to `UTC`.
|
|
1503
|
+
*/
|
|
1504
|
+
timezone?: string;
|
|
1505
|
+
/**
|
|
1506
|
+
* The bucket size used when `period` is in `dimensions`.
|
|
1507
|
+
* Defaults to `daily`.
|
|
1508
|
+
*/
|
|
1509
|
+
granularity?: EmailMetricsGranularity;
|
|
1510
|
+
/**
|
|
1511
|
+
* The metrics to include in the response. Defaults to all metrics.
|
|
1512
|
+
*/
|
|
1513
|
+
metrics?: EmailMetric[];
|
|
1514
|
+
/**
|
|
1515
|
+
* Restrict the response to these sending domain IDs.
|
|
1516
|
+
*/
|
|
1517
|
+
domainId?: string[];
|
|
1518
|
+
};
|
|
1519
|
+
type GetEmailsMetricsOptions = EmailMetricsCommonOptions & ({
|
|
1520
|
+
/**
|
|
1521
|
+
* The dimensions to break the response down by. Defaults to `[]`,
|
|
1522
|
+
* which returns a single `totals` row for the whole range, with no
|
|
1523
|
+
* `data`. Cannot combine `broadcast` with `email`/`emailId`.
|
|
1524
|
+
*/
|
|
1525
|
+
dimensions?: Exclude<EmailMetricsDimension, 'broadcast'>[];
|
|
1526
|
+
/**
|
|
1527
|
+
* Restrict the response to these email IDs. Cannot be combined with
|
|
1528
|
+
* the `broadcast` dimension or `broadcastId`.
|
|
1529
|
+
*/
|
|
1530
|
+
emailId?: string[];
|
|
1531
|
+
broadcastId?: never;
|
|
1532
|
+
} | {
|
|
1533
|
+
/**
|
|
1534
|
+
* The dimensions to break the response down by. Defaults to `[]`,
|
|
1535
|
+
* which returns a single `totals` row for the whole range, with no
|
|
1536
|
+
* `data`. Cannot combine `email` with `broadcast`/`broadcastId`.
|
|
1537
|
+
*/
|
|
1538
|
+
dimensions?: Exclude<EmailMetricsDimension, 'email'>[];
|
|
1539
|
+
emailId?: never;
|
|
1540
|
+
/**
|
|
1541
|
+
* Restrict the response to these broadcast IDs. Cannot be combined
|
|
1542
|
+
* with the `email` dimension or `emailId`.
|
|
1543
|
+
*/
|
|
1544
|
+
broadcastId?: string[];
|
|
1545
|
+
});
|
|
1546
|
+
type EmailMetricsTotals = Partial<Record<EmailMetric, number>>;
|
|
1547
|
+
type EmailMetricsDataRow = EmailMetricsTotals & {
|
|
1548
|
+
period?: string;
|
|
1549
|
+
domain_id?: string;
|
|
1550
|
+
domain_name?: string;
|
|
1551
|
+
email_id?: string;
|
|
1552
|
+
broadcast_id?: string;
|
|
1553
|
+
broadcast_name?: string;
|
|
1554
|
+
};
|
|
1555
|
+
interface GetEmailsMetricsResponseSuccess {
|
|
1556
|
+
object: 'metrics';
|
|
1557
|
+
start_date: string;
|
|
1558
|
+
end_date: string;
|
|
1559
|
+
metrics: EmailMetric[];
|
|
1560
|
+
dimensions: EmailMetricsDimension[];
|
|
1561
|
+
granularity: EmailMetricsGranularity;
|
|
1562
|
+
totals: EmailMetricsTotals;
|
|
1563
|
+
data?: EmailMetricsDataRow[];
|
|
1564
|
+
}
|
|
1565
|
+
type GetEmailsMetricsResponse = Response<GetEmailsMetricsResponseSuccess>;
|
|
1566
|
+
//#endregion
|
|
1422
1567
|
//#region src/emails/interfaces/list-emails-options.interface.d.ts
|
|
1423
1568
|
type ListEmailsOptions = PaginationOptions;
|
|
1424
1569
|
type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
|
|
@@ -1716,6 +1861,8 @@ declare class Broadcasts {
|
|
|
1716
1861
|
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
1717
1862
|
list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
|
|
1718
1863
|
get(id: string): Promise<GetBroadcastResponse>;
|
|
1864
|
+
recipients<T extends BroadcastRecipientEventType>(id: string, options: ListBroadcastRecipientsOptions<T>): Promise<ListBroadcastRecipientsResponse<T>>;
|
|
1865
|
+
clickedLinks(id: string, options?: ListBroadcastClickedLinksOptions): Promise<ListBroadcastClickedLinksResponse>;
|
|
1719
1866
|
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
1720
1867
|
cancel(id: string): Promise<CancelBroadcastResponse>;
|
|
1721
1868
|
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
@@ -1839,6 +1986,7 @@ declare class Emails {
|
|
|
1839
1986
|
update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
|
|
1840
1987
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1841
1988
|
share(id: string, payload?: ShareEmailOptions): Promise<ShareEmailResponse>;
|
|
1989
|
+
metrics(options?: GetEmailsMetricsOptions): Promise<GetEmailsMetricsResponse>;
|
|
1842
1990
|
}
|
|
1843
1991
|
//#endregion
|
|
1844
1992
|
//#region src/events/events.d.ts
|
|
@@ -2240,8 +2388,8 @@ interface ContactEventData {
|
|
|
2240
2388
|
created_at: string;
|
|
2241
2389
|
updated_at: string;
|
|
2242
2390
|
email: string;
|
|
2243
|
-
first_name?: string;
|
|
2244
|
-
last_name?: string;
|
|
2391
|
+
first_name?: string | null;
|
|
2392
|
+
last_name?: string | null;
|
|
2245
2393
|
unsubscribed: boolean;
|
|
2246
2394
|
}
|
|
2247
2395
|
interface DomainRecord {
|
|
@@ -2495,4 +2643,4 @@ declare class Resend {
|
|
|
2495
2643
|
delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
|
|
2496
2644
|
}
|
|
2497
2645
|
//#endregion
|
|
2498
|
-
export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, CancelBroadcastResponse, CancelBroadcastResponseSuccess, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateAutomationResponse, DuplicateAutomationResponseSuccess, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactImportsOptions, ListContactImportsResponse, ListContactImportsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListEventsOptions, ListEventsResponse, ListEventsResponseSuccess, ListLogsOptions, ListLogsResponse, ListLogsResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListSuppressionsOptions, ListSuppressionsResponse, ListSuppressionsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, OAuthGrant, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveAutomationResponse, RemoveAutomationResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveEventResponse, RemoveEventResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveSuppressionResponse, RemoveSuppressionResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type ResendOptions, type Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, ShareEmailOptions, ShareEmailResponse, ShareEmailResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Suppression, SuppressionAddedEvent, SuppressionListEntry, SuppressionOrigin, SuppressionRemovedEvent, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, UpdateApiKeyOptions, UpdateApiKeyResponse, UpdateApiKeyResponseSuccess, UpdateAutomationOptions, UpdateAutomationResponse, UpdateAutomationResponseSuccess, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateEventOptions, UpdateEventResponse, UpdateEventResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainClaimResponse, VerifyDomainClaimResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
|
|
2646
|
+
export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, BroadcastClickedLink, BroadcastRecipient, BroadcastRecipientBounceType, BroadcastRecipientClickedLink, BroadcastRecipientEventType, CancelBroadcastResponse, CancelBroadcastResponseSuccess, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateAutomationResponse, DuplicateAutomationResponseSuccess, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailMetric, EmailMetricsDataRow, EmailMetricsDimension, EmailMetricsGranularity, EmailMetricsTotals, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEmailsMetricsOptions, GetEmailsMetricsResponse, GetEmailsMetricsResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, ListBroadcastClickedLinksOptions, ListBroadcastClickedLinksResponse, ListBroadcastClickedLinksResponseSuccess, ListBroadcastRecipientsOptions, ListBroadcastRecipientsResponse, ListBroadcastRecipientsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactImportsOptions, ListContactImportsResponse, ListContactImportsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListEventsOptions, ListEventsResponse, ListEventsResponseSuccess, ListLogsOptions, ListLogsResponse, ListLogsResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListSuppressionsOptions, ListSuppressionsResponse, ListSuppressionsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, OAuthGrant, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveAutomationResponse, RemoveAutomationResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveEventResponse, RemoveEventResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveSuppressionResponse, RemoveSuppressionResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type ResendOptions, type Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, ShareEmailOptions, ShareEmailResponse, ShareEmailResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Suppression, SuppressionAddedEvent, SuppressionListEntry, SuppressionOrigin, SuppressionRemovedEvent, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, UpdateApiKeyOptions, UpdateApiKeyResponse, UpdateApiKeyResponseSuccess, UpdateAutomationOptions, UpdateAutomationResponse, UpdateAutomationResponseSuccess, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateEventOptions, UpdateEventResponse, UpdateEventResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainClaimResponse, VerifyDomainClaimResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
|
package/dist/index.d.mts
CHANGED
|
@@ -829,6 +829,65 @@ interface GetBroadcastResponseSuccess extends Broadcast {
|
|
|
829
829
|
}
|
|
830
830
|
type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;
|
|
831
831
|
//#endregion
|
|
832
|
+
//#region src/broadcasts/interfaces/list-broadcast-clicked-links.interface.d.ts
|
|
833
|
+
type ListBroadcastClickedLinksOptions = PaginationOptions;
|
|
834
|
+
type BroadcastClickedLink = {
|
|
835
|
+
/**
|
|
836
|
+
* `id` is an opaque cursor for this row, used only for pagination.
|
|
837
|
+
* It does not identify any entity in Resend.
|
|
838
|
+
*/
|
|
839
|
+
id: string;
|
|
840
|
+
url: string;
|
|
841
|
+
clicks: number;
|
|
842
|
+
unique_clicks: number;
|
|
843
|
+
};
|
|
844
|
+
type ListBroadcastClickedLinksResponseSuccess = PaginatedData<BroadcastClickedLink[]>;
|
|
845
|
+
type ListBroadcastClickedLinksResponse = Response<ListBroadcastClickedLinksResponseSuccess>;
|
|
846
|
+
//#endregion
|
|
847
|
+
//#region src/broadcasts/interfaces/list-broadcast-recipients.interface.d.ts
|
|
848
|
+
type BroadcastRecipientEventType = 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
|
|
849
|
+
type BroadcastRecipientBounceType = 'permanent' | 'transient' | 'undetermined';
|
|
850
|
+
type ListBroadcastRecipientsOptions<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginationOptions & {
|
|
851
|
+
type: T;
|
|
852
|
+
email?: string;
|
|
853
|
+
bounceType?: T extends 'bounced' ? BroadcastRecipientBounceType : never;
|
|
854
|
+
};
|
|
855
|
+
interface BroadcastRecipientClickedLink {
|
|
856
|
+
url: string;
|
|
857
|
+
clicks: number;
|
|
858
|
+
}
|
|
859
|
+
type BroadcastRecipientBase = {
|
|
860
|
+
id: string;
|
|
861
|
+
contact_id: string | null;
|
|
862
|
+
email: string;
|
|
863
|
+
};
|
|
864
|
+
type BroadcastRecipientLoose = BroadcastRecipientBase & {
|
|
865
|
+
count?: number;
|
|
866
|
+
clicked_links?: BroadcastRecipientClickedLink[];
|
|
867
|
+
bounce_type?: BroadcastRecipientBounceType;
|
|
868
|
+
};
|
|
869
|
+
type IsUnion<T, B = T> = T extends B ? ([B] extends [T] ? false : true) : never;
|
|
870
|
+
type BroadcastRecipientFieldsByType = {
|
|
871
|
+
sent: unknown;
|
|
872
|
+
delivered: unknown;
|
|
873
|
+
opened: {
|
|
874
|
+
count: number;
|
|
875
|
+
};
|
|
876
|
+
clicked: {
|
|
877
|
+
count: number;
|
|
878
|
+
clicked_links: BroadcastRecipientClickedLink[];
|
|
879
|
+
};
|
|
880
|
+
bounced: {
|
|
881
|
+
bounce_type: BroadcastRecipientBounceType;
|
|
882
|
+
};
|
|
883
|
+
complained: unknown;
|
|
884
|
+
unsubscribed: unknown;
|
|
885
|
+
suppressed: unknown;
|
|
886
|
+
};
|
|
887
|
+
type BroadcastRecipient<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = IsUnion<T> extends true ? BroadcastRecipientLoose : BroadcastRecipientBase & BroadcastRecipientFieldsByType[T];
|
|
888
|
+
type ListBroadcastRecipientsResponseSuccess<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginatedData<BroadcastRecipient<T>[]>;
|
|
889
|
+
type ListBroadcastRecipientsResponse<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = Response<ListBroadcastRecipientsResponseSuccess<T>>;
|
|
890
|
+
//#endregion
|
|
832
891
|
//#region src/broadcasts/interfaces/list-broadcasts.interface.d.ts
|
|
833
892
|
type ListBroadcastsOptions = PaginationOptions;
|
|
834
893
|
type ListBroadcastsResponseSuccess = {
|
|
@@ -1419,6 +1478,92 @@ interface GetEmailResponseSuccess {
|
|
|
1419
1478
|
}
|
|
1420
1479
|
type GetEmailResponse = Response<GetEmailResponseSuccess>;
|
|
1421
1480
|
//#endregion
|
|
1481
|
+
//#region src/emails/interfaces/get-metrics.interface.d.ts
|
|
1482
|
+
type EmailMetric = 'received' | 'delivered' | 'complained' | 'suppressed' | 'bounced' | 'bounced_transient' | 'bounced_permanent' | 'bounced_undetermined' | 'opened' | 'clicked' | 'unsubscribed' | 'delivery_delayed' | 'failed' | 'sent' | 'unique_opened' | 'unique_clicked' | 'delivery_rate' | 'open_rate' | 'click_rate' | 'bounce_rate' | 'complaint_rate' | 'unsubscribe_rate';
|
|
1483
|
+
type EmailMetricsDimension = 'period' | 'domain' | 'email' | 'broadcast';
|
|
1484
|
+
type EmailMetricsGranularity = 'hourly' | 'daily' | 'weekly' | 'monthly';
|
|
1485
|
+
type EmailMetricsCommonOptions = {
|
|
1486
|
+
/**
|
|
1487
|
+
* The start of the date range, as an ISO 8601 date or datetime.
|
|
1488
|
+
* Defaults to 6 days before `endDate`.
|
|
1489
|
+
*
|
|
1490
|
+
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1491
|
+
*/
|
|
1492
|
+
startDate?: string;
|
|
1493
|
+
/**
|
|
1494
|
+
* The end of the date range, as an ISO 8601 date or datetime.
|
|
1495
|
+
* Defaults to now.
|
|
1496
|
+
*
|
|
1497
|
+
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1498
|
+
*/
|
|
1499
|
+
endDate?: string;
|
|
1500
|
+
/**
|
|
1501
|
+
* The IANA timezone used to bucket periods when `period` is in `dimensions`.
|
|
1502
|
+
* Defaults to `UTC`.
|
|
1503
|
+
*/
|
|
1504
|
+
timezone?: string;
|
|
1505
|
+
/**
|
|
1506
|
+
* The bucket size used when `period` is in `dimensions`.
|
|
1507
|
+
* Defaults to `daily`.
|
|
1508
|
+
*/
|
|
1509
|
+
granularity?: EmailMetricsGranularity;
|
|
1510
|
+
/**
|
|
1511
|
+
* The metrics to include in the response. Defaults to all metrics.
|
|
1512
|
+
*/
|
|
1513
|
+
metrics?: EmailMetric[];
|
|
1514
|
+
/**
|
|
1515
|
+
* Restrict the response to these sending domain IDs.
|
|
1516
|
+
*/
|
|
1517
|
+
domainId?: string[];
|
|
1518
|
+
};
|
|
1519
|
+
type GetEmailsMetricsOptions = EmailMetricsCommonOptions & ({
|
|
1520
|
+
/**
|
|
1521
|
+
* The dimensions to break the response down by. Defaults to `[]`,
|
|
1522
|
+
* which returns a single `totals` row for the whole range, with no
|
|
1523
|
+
* `data`. Cannot combine `broadcast` with `email`/`emailId`.
|
|
1524
|
+
*/
|
|
1525
|
+
dimensions?: Exclude<EmailMetricsDimension, 'broadcast'>[];
|
|
1526
|
+
/**
|
|
1527
|
+
* Restrict the response to these email IDs. Cannot be combined with
|
|
1528
|
+
* the `broadcast` dimension or `broadcastId`.
|
|
1529
|
+
*/
|
|
1530
|
+
emailId?: string[];
|
|
1531
|
+
broadcastId?: never;
|
|
1532
|
+
} | {
|
|
1533
|
+
/**
|
|
1534
|
+
* The dimensions to break the response down by. Defaults to `[]`,
|
|
1535
|
+
* which returns a single `totals` row for the whole range, with no
|
|
1536
|
+
* `data`. Cannot combine `email` with `broadcast`/`broadcastId`.
|
|
1537
|
+
*/
|
|
1538
|
+
dimensions?: Exclude<EmailMetricsDimension, 'email'>[];
|
|
1539
|
+
emailId?: never;
|
|
1540
|
+
/**
|
|
1541
|
+
* Restrict the response to these broadcast IDs. Cannot be combined
|
|
1542
|
+
* with the `email` dimension or `emailId`.
|
|
1543
|
+
*/
|
|
1544
|
+
broadcastId?: string[];
|
|
1545
|
+
});
|
|
1546
|
+
type EmailMetricsTotals = Partial<Record<EmailMetric, number>>;
|
|
1547
|
+
type EmailMetricsDataRow = EmailMetricsTotals & {
|
|
1548
|
+
period?: string;
|
|
1549
|
+
domain_id?: string;
|
|
1550
|
+
domain_name?: string;
|
|
1551
|
+
email_id?: string;
|
|
1552
|
+
broadcast_id?: string;
|
|
1553
|
+
broadcast_name?: string;
|
|
1554
|
+
};
|
|
1555
|
+
interface GetEmailsMetricsResponseSuccess {
|
|
1556
|
+
object: 'metrics';
|
|
1557
|
+
start_date: string;
|
|
1558
|
+
end_date: string;
|
|
1559
|
+
metrics: EmailMetric[];
|
|
1560
|
+
dimensions: EmailMetricsDimension[];
|
|
1561
|
+
granularity: EmailMetricsGranularity;
|
|
1562
|
+
totals: EmailMetricsTotals;
|
|
1563
|
+
data?: EmailMetricsDataRow[];
|
|
1564
|
+
}
|
|
1565
|
+
type GetEmailsMetricsResponse = Response<GetEmailsMetricsResponseSuccess>;
|
|
1566
|
+
//#endregion
|
|
1422
1567
|
//#region src/emails/interfaces/list-emails-options.interface.d.ts
|
|
1423
1568
|
type ListEmailsOptions = PaginationOptions;
|
|
1424
1569
|
type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
|
|
@@ -1716,6 +1861,8 @@ declare class Broadcasts {
|
|
|
1716
1861
|
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
1717
1862
|
list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
|
|
1718
1863
|
get(id: string): Promise<GetBroadcastResponse>;
|
|
1864
|
+
recipients<T extends BroadcastRecipientEventType>(id: string, options: ListBroadcastRecipientsOptions<T>): Promise<ListBroadcastRecipientsResponse<T>>;
|
|
1865
|
+
clickedLinks(id: string, options?: ListBroadcastClickedLinksOptions): Promise<ListBroadcastClickedLinksResponse>;
|
|
1719
1866
|
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
1720
1867
|
cancel(id: string): Promise<CancelBroadcastResponse>;
|
|
1721
1868
|
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
@@ -1839,6 +1986,7 @@ declare class Emails {
|
|
|
1839
1986
|
update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
|
|
1840
1987
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1841
1988
|
share(id: string, payload?: ShareEmailOptions): Promise<ShareEmailResponse>;
|
|
1989
|
+
metrics(options?: GetEmailsMetricsOptions): Promise<GetEmailsMetricsResponse>;
|
|
1842
1990
|
}
|
|
1843
1991
|
//#endregion
|
|
1844
1992
|
//#region src/events/events.d.ts
|
|
@@ -2240,8 +2388,8 @@ interface ContactEventData {
|
|
|
2240
2388
|
created_at: string;
|
|
2241
2389
|
updated_at: string;
|
|
2242
2390
|
email: string;
|
|
2243
|
-
first_name?: string;
|
|
2244
|
-
last_name?: string;
|
|
2391
|
+
first_name?: string | null;
|
|
2392
|
+
last_name?: string | null;
|
|
2245
2393
|
unsubscribed: boolean;
|
|
2246
2394
|
}
|
|
2247
2395
|
interface DomainRecord {
|
|
@@ -2495,4 +2643,4 @@ declare class Resend {
|
|
|
2495
2643
|
delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
|
|
2496
2644
|
}
|
|
2497
2645
|
//#endregion
|
|
2498
|
-
export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, CancelBroadcastResponse, CancelBroadcastResponseSuccess, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateAutomationResponse, DuplicateAutomationResponseSuccess, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactImportsOptions, ListContactImportsResponse, ListContactImportsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListEventsOptions, ListEventsResponse, ListEventsResponseSuccess, ListLogsOptions, ListLogsResponse, ListLogsResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListSuppressionsOptions, ListSuppressionsResponse, ListSuppressionsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, OAuthGrant, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveAutomationResponse, RemoveAutomationResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveEventResponse, RemoveEventResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveSuppressionResponse, RemoveSuppressionResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type ResendOptions, type Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, ShareEmailOptions, ShareEmailResponse, ShareEmailResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Suppression, SuppressionAddedEvent, SuppressionListEntry, SuppressionOrigin, SuppressionRemovedEvent, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, UpdateApiKeyOptions, UpdateApiKeyResponse, UpdateApiKeyResponseSuccess, UpdateAutomationOptions, UpdateAutomationResponse, UpdateAutomationResponseSuccess, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateEventOptions, UpdateEventResponse, UpdateEventResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainClaimResponse, VerifyDomainClaimResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
|
|
2646
|
+
export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, BroadcastClickedLink, BroadcastRecipient, BroadcastRecipientBounceType, BroadcastRecipientClickedLink, BroadcastRecipientEventType, CancelBroadcastResponse, CancelBroadcastResponseSuccess, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateAutomationResponse, DuplicateAutomationResponseSuccess, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailMetric, EmailMetricsDataRow, EmailMetricsDimension, EmailMetricsGranularity, EmailMetricsTotals, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEmailsMetricsOptions, GetEmailsMetricsResponse, GetEmailsMetricsResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, ListBroadcastClickedLinksOptions, ListBroadcastClickedLinksResponse, ListBroadcastClickedLinksResponseSuccess, ListBroadcastRecipientsOptions, ListBroadcastRecipientsResponse, ListBroadcastRecipientsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactImportsOptions, ListContactImportsResponse, ListContactImportsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListEventsOptions, ListEventsResponse, ListEventsResponseSuccess, ListLogsOptions, ListLogsResponse, ListLogsResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListSuppressionsOptions, ListSuppressionsResponse, ListSuppressionsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, OAuthGrant, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveAutomationResponse, RemoveAutomationResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveEventResponse, RemoveEventResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveSuppressionResponse, RemoveSuppressionResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type ResendOptions, type Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, ShareEmailOptions, ShareEmailResponse, ShareEmailResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Suppression, SuppressionAddedEvent, SuppressionListEntry, SuppressionOrigin, SuppressionRemovedEvent, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, UpdateApiKeyOptions, UpdateApiKeyResponse, UpdateApiKeyResponseSuccess, UpdateAutomationOptions, UpdateAutomationResponse, UpdateAutomationResponseSuccess, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateEventOptions, UpdateEventResponse, UpdateEventResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainClaimResponse, VerifyDomainClaimResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import PostalMime from "postal-mime";
|
|
2
2
|
import { Webhook } from "standardwebhooks";
|
|
3
3
|
//#region package.json
|
|
4
|
-
var version = "6.
|
|
4
|
+
var version = "6.22.1";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/common/utils/build-pagination-query.ts
|
|
7
7
|
function buildPaginationUrl(base, options) {
|
|
@@ -285,6 +285,14 @@ var Broadcasts = class {
|
|
|
285
285
|
async get(id) {
|
|
286
286
|
return await this.resend.get(`/broadcasts/${id}`);
|
|
287
287
|
}
|
|
288
|
+
async recipients(id, options) {
|
|
289
|
+
const url = `/broadcasts/${id}/recipients?${buildRecipientsQuery(options)}`;
|
|
290
|
+
return await this.resend.get(url);
|
|
291
|
+
}
|
|
292
|
+
async clickedLinks(id, options = {}) {
|
|
293
|
+
const url = buildPaginationUrl(`/broadcasts/${id}/clicked-links`, options);
|
|
294
|
+
return await this.resend.get(url);
|
|
295
|
+
}
|
|
288
296
|
async remove(id) {
|
|
289
297
|
return await this.resend.delete(`/broadcasts/${id}`);
|
|
290
298
|
}
|
|
@@ -307,6 +315,14 @@ var Broadcasts = class {
|
|
|
307
315
|
});
|
|
308
316
|
}
|
|
309
317
|
};
|
|
318
|
+
function buildRecipientsQuery(options) {
|
|
319
|
+
const { type, email, bounceType, ...pagination } = options;
|
|
320
|
+
const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
|
|
321
|
+
searchParams.set("type", type);
|
|
322
|
+
if (email !== void 0) searchParams.set("email", email);
|
|
323
|
+
if (bounceType !== void 0) searchParams.set("bounce_type", bounceType);
|
|
324
|
+
return searchParams.toString();
|
|
325
|
+
}
|
|
310
326
|
//#endregion
|
|
311
327
|
//#region src/common/utils/parse-contact-properties-to-api-options.ts
|
|
312
328
|
function parseContactPropertyFromApi(contactProperty) {
|
|
@@ -872,7 +888,28 @@ var Emails = class {
|
|
|
872
888
|
async share(id, payload) {
|
|
873
889
|
return await this.resend.post(`/emails/${id}/share`, { expires_in: payload?.expiresIn });
|
|
874
890
|
}
|
|
891
|
+
async metrics(options = {}) {
|
|
892
|
+
const queryString = buildMetricsQuery(options);
|
|
893
|
+
const url = queryString ? `/emails/metrics?${queryString}` : "/emails/metrics";
|
|
894
|
+
return await this.resend.get(url);
|
|
895
|
+
}
|
|
875
896
|
};
|
|
897
|
+
function buildMetricsQuery(options) {
|
|
898
|
+
const params = {
|
|
899
|
+
start_date: options.startDate,
|
|
900
|
+
end_date: options.endDate,
|
|
901
|
+
timezone: options.timezone,
|
|
902
|
+
granularity: options.granularity,
|
|
903
|
+
metrics: options.metrics?.join(","),
|
|
904
|
+
dimensions: options.dimensions?.join(","),
|
|
905
|
+
domain_id: options.domainId?.join(","),
|
|
906
|
+
email_id: options.emailId?.join(","),
|
|
907
|
+
broadcast_id: options.broadcastId?.join(",")
|
|
908
|
+
};
|
|
909
|
+
const searchParams = new URLSearchParams();
|
|
910
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
|
|
911
|
+
return searchParams.toString();
|
|
912
|
+
}
|
|
876
913
|
//#endregion
|
|
877
914
|
//#region src/events/events.ts
|
|
878
915
|
var Events = class {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resend",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.22.1",
|
|
4
4
|
"description": "Node.js library for the Resend API",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -29,19 +29,6 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "tsdown src/index.ts --format esm,cjs --dts",
|
|
34
|
-
"integration:nextjs": "cd ./e2e/nextjs && next build --turbopack",
|
|
35
|
-
"lint": "biome check .",
|
|
36
|
-
"lint:fix": "biome check . --write",
|
|
37
|
-
"prepublishOnly": "pnpm run build",
|
|
38
|
-
"test": "vitest run --exclude e2e",
|
|
39
|
-
"test:dev": "cross-env TEST_MODE=dev vitest run --exclude e2e",
|
|
40
|
-
"test:e2e": "vitest run e2e",
|
|
41
|
-
"test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run --exclude e2e",
|
|
42
|
-
"test:watch": "vitest --exclude e2e",
|
|
43
|
-
"typecheck": "tsc --noEmit"
|
|
44
|
-
},
|
|
45
32
|
"repository": {
|
|
46
33
|
"type": "git",
|
|
47
34
|
"url": "git+https://github.com/resend/resend-node.git"
|
|
@@ -83,5 +70,16 @@
|
|
|
83
70
|
"vitest": "4.1.10",
|
|
84
71
|
"vitest-fetch-mock": "0.4.5"
|
|
85
72
|
},
|
|
86
|
-
"
|
|
87
|
-
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "tsdown src/index.ts --format esm,cjs --dts",
|
|
75
|
+
"integration:nextjs": "cd ./e2e/nextjs && next build --turbopack",
|
|
76
|
+
"lint": "biome check .",
|
|
77
|
+
"lint:fix": "biome check . --write",
|
|
78
|
+
"test": "vitest run --exclude e2e",
|
|
79
|
+
"test:dev": "cross-env TEST_MODE=dev vitest run --exclude e2e",
|
|
80
|
+
"test:e2e": "vitest run e2e",
|
|
81
|
+
"test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run --exclude e2e",
|
|
82
|
+
"test:watch": "vitest --exclude e2e",
|
|
83
|
+
"typecheck": "tsc --noEmit"
|
|
84
|
+
}
|
|
85
|
+
}
|