resend 6.19.0-preview-usage.0 → 6.19.0-preview-headless-dashboard.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 +55 -1
- package/dist/index.d.cts +220 -1
- package/dist/index.d.mts +220 -1
- package/dist/index.mjs +55 -1
- package/package.json +16 -14
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.19.0-preview-
|
|
28
|
+
var version = "6.19.0-preview-headless-dashboard.1";
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/common/utils/build-pagination-query.ts
|
|
31
31
|
/**
|
|
@@ -301,6 +301,13 @@ var Broadcasts = class {
|
|
|
301
301
|
async get(id) {
|
|
302
302
|
return await this.resend.get(`/broadcasts/${id}`);
|
|
303
303
|
}
|
|
304
|
+
async metrics(id) {
|
|
305
|
+
return await this.resend.get(`/broadcasts/${id}/metrics`);
|
|
306
|
+
}
|
|
307
|
+
async recipients(id, options) {
|
|
308
|
+
const url = `/broadcasts/${id}/recipients?${buildRecipientsQuery(options)}`;
|
|
309
|
+
return await this.resend.get(url);
|
|
310
|
+
}
|
|
304
311
|
async remove(id) {
|
|
305
312
|
return await this.resend.delete(`/broadcasts/${id}`);
|
|
306
313
|
}
|
|
@@ -320,6 +327,14 @@ var Broadcasts = class {
|
|
|
320
327
|
});
|
|
321
328
|
}
|
|
322
329
|
};
|
|
330
|
+
function buildRecipientsQuery(options) {
|
|
331
|
+
const { type, email, bounceType, ...pagination } = options;
|
|
332
|
+
const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
|
|
333
|
+
searchParams.set("type", type);
|
|
334
|
+
if (email !== void 0) searchParams.set("email", email);
|
|
335
|
+
if (bounceType !== void 0) searchParams.set("bounce_type", bounceType);
|
|
336
|
+
return searchParams.toString();
|
|
337
|
+
}
|
|
323
338
|
//#endregion
|
|
324
339
|
//#region src/common/utils/parse-contact-properties-to-api-options.ts
|
|
325
340
|
function parseContactPropertyFromApi(contactProperty) {
|
|
@@ -894,7 +909,29 @@ var Emails = class {
|
|
|
894
909
|
async cancel(id) {
|
|
895
910
|
return await this.resend.post(`/emails/${id}/cancel`);
|
|
896
911
|
}
|
|
912
|
+
async metrics(options = {}) {
|
|
913
|
+
const queryString = buildMetricsQuery$1(options);
|
|
914
|
+
const url = queryString ? `/emails/metrics?${queryString}` : "/emails/metrics";
|
|
915
|
+
return await this.resend.get(url);
|
|
916
|
+
}
|
|
897
917
|
};
|
|
918
|
+
function buildMetricsQuery$1(options) {
|
|
919
|
+
const params = {
|
|
920
|
+
start_date: options.startDate,
|
|
921
|
+
end_date: options.endDate,
|
|
922
|
+
timezone: options.timezone,
|
|
923
|
+
granularity: options.granularity,
|
|
924
|
+
metrics: options.metrics?.join(","),
|
|
925
|
+
dimensions: options.dimensions?.join(","),
|
|
926
|
+
"filter[domain_id]": options.filter?.domainId?.join(","),
|
|
927
|
+
"filter[email_id]": options.filter?.emailId?.join(","),
|
|
928
|
+
sort_by: options.sortBy,
|
|
929
|
+
sort_order: options.sortOrder
|
|
930
|
+
};
|
|
931
|
+
const searchParams = new URLSearchParams();
|
|
932
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
|
|
933
|
+
return searchParams.toString();
|
|
934
|
+
}
|
|
898
935
|
//#endregion
|
|
899
936
|
//#region src/events/events.ts
|
|
900
937
|
var Events = class {
|
|
@@ -972,7 +1009,24 @@ var Segments = class {
|
|
|
972
1009
|
async remove(id) {
|
|
973
1010
|
return await this.resend.delete(`/segments/${id}`);
|
|
974
1011
|
}
|
|
1012
|
+
async metrics(options = {}) {
|
|
1013
|
+
const queryString = buildMetricsQuery(options);
|
|
1014
|
+
const url = queryString ? `/segments/metrics?${queryString}` : "/segments/metrics";
|
|
1015
|
+
return await this.resend.get(url);
|
|
1016
|
+
}
|
|
975
1017
|
};
|
|
1018
|
+
function buildMetricsQuery(options) {
|
|
1019
|
+
const params = {
|
|
1020
|
+
metrics: options.metrics?.join(","),
|
|
1021
|
+
dimensions: options.dimensions?.join(","),
|
|
1022
|
+
"filter[segment_id]": options.filter?.segmentId?.join(","),
|
|
1023
|
+
sort_by: options.sortBy,
|
|
1024
|
+
sort_order: options.sortOrder
|
|
1025
|
+
};
|
|
1026
|
+
const searchParams = new URLSearchParams();
|
|
1027
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
|
|
1028
|
+
return searchParams.toString();
|
|
1029
|
+
}
|
|
976
1030
|
//#endregion
|
|
977
1031
|
//#region src/suppressions/batch/batch.ts
|
|
978
1032
|
var Batch = class {
|
package/dist/index.d.cts
CHANGED
|
@@ -801,6 +801,82 @@ interface GetBroadcastResponseSuccess extends Broadcast {
|
|
|
801
801
|
}
|
|
802
802
|
type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;
|
|
803
803
|
//#endregion
|
|
804
|
+
//#region src/broadcasts/interfaces/get-broadcast-metrics.interface.d.ts
|
|
805
|
+
interface BroadcastMetricCounter {
|
|
806
|
+
total: number;
|
|
807
|
+
percentage: number;
|
|
808
|
+
}
|
|
809
|
+
interface BroadcastMetricsClickedLink {
|
|
810
|
+
url: string;
|
|
811
|
+
clicks: number;
|
|
812
|
+
unique_clicks: number;
|
|
813
|
+
percentage: number;
|
|
814
|
+
}
|
|
815
|
+
interface GetBroadcastMetricsResponseSuccess {
|
|
816
|
+
object: 'broadcast_metrics';
|
|
817
|
+
broadcast_id: string;
|
|
818
|
+
status: Broadcast['status'];
|
|
819
|
+
created_at: string;
|
|
820
|
+
scheduled_at: string | null;
|
|
821
|
+
sent_at: string | null;
|
|
822
|
+
total: number;
|
|
823
|
+
sent: number;
|
|
824
|
+
remaining: number;
|
|
825
|
+
delivered: BroadcastMetricCounter;
|
|
826
|
+
opened: BroadcastMetricCounter;
|
|
827
|
+
clicked: BroadcastMetricCounter;
|
|
828
|
+
unsubscribed: BroadcastMetricCounter;
|
|
829
|
+
bounced: BroadcastMetricCounter;
|
|
830
|
+
complained: BroadcastMetricCounter;
|
|
831
|
+
suppressed: BroadcastMetricCounter;
|
|
832
|
+
clicked_links: BroadcastMetricsClickedLink[];
|
|
833
|
+
}
|
|
834
|
+
type GetBroadcastMetricsResponse = Response<GetBroadcastMetricsResponseSuccess>;
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/broadcasts/interfaces/list-broadcast-recipients.interface.d.ts
|
|
837
|
+
type BroadcastRecipientEventType = 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
|
|
838
|
+
type BroadcastRecipientBounceType = 'permanent' | 'transient' | 'undetermined';
|
|
839
|
+
type ListBroadcastRecipientsOptions<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginationOptions & {
|
|
840
|
+
type: T;
|
|
841
|
+
email?: string;
|
|
842
|
+
bounceType?: T extends 'bounced' ? BroadcastRecipientBounceType : never;
|
|
843
|
+
};
|
|
844
|
+
interface BroadcastRecipientClickedLink {
|
|
845
|
+
url: string;
|
|
846
|
+
clicks: number;
|
|
847
|
+
}
|
|
848
|
+
type BroadcastRecipientBase = {
|
|
849
|
+
id: string;
|
|
850
|
+
contact_id: string | null;
|
|
851
|
+
email: string;
|
|
852
|
+
};
|
|
853
|
+
type BroadcastRecipientLoose = BroadcastRecipientBase & {
|
|
854
|
+
count?: number;
|
|
855
|
+
clicked_links?: BroadcastRecipientClickedLink[];
|
|
856
|
+
bounce_type?: BroadcastRecipientBounceType;
|
|
857
|
+
};
|
|
858
|
+
type IsUnion<T, B = T> = T extends B ? ([B] extends [T] ? false : true) : never;
|
|
859
|
+
type BroadcastRecipientFieldsByType = {
|
|
860
|
+
sent: unknown;
|
|
861
|
+
delivered: unknown;
|
|
862
|
+
opened: {
|
|
863
|
+
count: number;
|
|
864
|
+
};
|
|
865
|
+
clicked: {
|
|
866
|
+
count: number;
|
|
867
|
+
clicked_links: BroadcastRecipientClickedLink[];
|
|
868
|
+
};
|
|
869
|
+
bounced: {
|
|
870
|
+
bounce_type: BroadcastRecipientBounceType;
|
|
871
|
+
};
|
|
872
|
+
complained: unknown;
|
|
873
|
+
unsubscribed: unknown;
|
|
874
|
+
suppressed: unknown;
|
|
875
|
+
};
|
|
876
|
+
type BroadcastRecipient<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = IsUnion<T> extends true ? BroadcastRecipientLoose : BroadcastRecipientBase & BroadcastRecipientFieldsByType[T];
|
|
877
|
+
type ListBroadcastRecipientsResponseSuccess<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginatedData<BroadcastRecipient<T>[]>;
|
|
878
|
+
type ListBroadcastRecipientsResponse<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = Response<ListBroadcastRecipientsResponseSuccess<T>>;
|
|
879
|
+
//#endregion
|
|
804
880
|
//#region src/broadcasts/interfaces/list-broadcasts.interface.d.ts
|
|
805
881
|
type ListBroadcastsOptions = PaginationOptions;
|
|
806
882
|
type ListBroadcastsResponseSuccess = {
|
|
@@ -1391,6 +1467,91 @@ interface GetEmailResponseSuccess {
|
|
|
1391
1467
|
}
|
|
1392
1468
|
type GetEmailResponse = Response<GetEmailResponseSuccess>;
|
|
1393
1469
|
//#endregion
|
|
1470
|
+
//#region src/emails/interfaces/get-metrics.interface.d.ts
|
|
1471
|
+
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';
|
|
1472
|
+
type EmailMetricsDimension = 'period' | 'domain' | 'email';
|
|
1473
|
+
type EmailMetricsGranularity = 'hourly' | 'daily' | 'weekly';
|
|
1474
|
+
type EmailMetricsSortBy = 'date' | EmailMetric;
|
|
1475
|
+
type EmailMetricsSortOrder = 'asc' | 'desc';
|
|
1476
|
+
type GetEmailsMetricsOptions = {
|
|
1477
|
+
/**
|
|
1478
|
+
* The start of the date range, as an ISO 8601 date or datetime.
|
|
1479
|
+
* Defaults to 6 days before `endDate`.
|
|
1480
|
+
*
|
|
1481
|
+
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1482
|
+
*/
|
|
1483
|
+
startDate?: string;
|
|
1484
|
+
/**
|
|
1485
|
+
* The end of the date range, as an ISO 8601 date or datetime.
|
|
1486
|
+
* Defaults to now.
|
|
1487
|
+
*
|
|
1488
|
+
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1489
|
+
*/
|
|
1490
|
+
endDate?: string;
|
|
1491
|
+
/**
|
|
1492
|
+
* The IANA timezone used to bucket periods when `period` is in `dimensions`.
|
|
1493
|
+
* Defaults to `UTC`.
|
|
1494
|
+
*/
|
|
1495
|
+
timezone?: string;
|
|
1496
|
+
/**
|
|
1497
|
+
* The bucket size used when `period` is in `dimensions`.
|
|
1498
|
+
* Defaults to `daily`.
|
|
1499
|
+
*/
|
|
1500
|
+
granularity?: EmailMetricsGranularity;
|
|
1501
|
+
/**
|
|
1502
|
+
* The metrics to include in the response. Defaults to all metrics.
|
|
1503
|
+
*/
|
|
1504
|
+
metrics?: EmailMetric[];
|
|
1505
|
+
/**
|
|
1506
|
+
* The dimensions to break the response down by. Defaults to `[]`, which
|
|
1507
|
+
* returns a single `totals` row for the whole range, with no `data`.
|
|
1508
|
+
*/
|
|
1509
|
+
dimensions?: EmailMetricsDimension[];
|
|
1510
|
+
filter?: {
|
|
1511
|
+
/**
|
|
1512
|
+
* Restrict the response to these sending domain IDs.
|
|
1513
|
+
*/
|
|
1514
|
+
domainId?: string[];
|
|
1515
|
+
/**
|
|
1516
|
+
* Restrict the response to these email IDs. Cannot be combined with the
|
|
1517
|
+
* `domain` dimension.
|
|
1518
|
+
*/
|
|
1519
|
+
emailId?: string[];
|
|
1520
|
+
};
|
|
1521
|
+
/**
|
|
1522
|
+
* What to sort `data` by. Defaults to `date` when `dimensions` includes
|
|
1523
|
+
* `period`, or `sent` otherwise.
|
|
1524
|
+
*
|
|
1525
|
+
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1526
|
+
*/
|
|
1527
|
+
sortBy?: EmailMetricsSortBy;
|
|
1528
|
+
/**
|
|
1529
|
+
* The sort direction for `sortBy`. Defaults to `asc` when `dimensions`
|
|
1530
|
+
* includes `period`, `desc` otherwise.
|
|
1531
|
+
*/
|
|
1532
|
+
sortOrder?: EmailMetricsSortOrder;
|
|
1533
|
+
};
|
|
1534
|
+
type EmailMetricsTotals = Partial<Record<EmailMetric, number>>;
|
|
1535
|
+
type EmailMetricsDataRow = EmailMetricsTotals & {
|
|
1536
|
+
period?: string;
|
|
1537
|
+
domain_id?: string;
|
|
1538
|
+
domain_name?: string;
|
|
1539
|
+
email_id?: string;
|
|
1540
|
+
};
|
|
1541
|
+
interface GetEmailsMetricsResponseSuccess {
|
|
1542
|
+
object: 'metrics';
|
|
1543
|
+
start_date: string;
|
|
1544
|
+
end_date: string;
|
|
1545
|
+
metrics: EmailMetric[];
|
|
1546
|
+
dimensions: EmailMetricsDimension[];
|
|
1547
|
+
granularity: EmailMetricsGranularity;
|
|
1548
|
+
sort_by: EmailMetricsSortBy;
|
|
1549
|
+
sort_order: EmailMetricsSortOrder;
|
|
1550
|
+
totals: EmailMetricsTotals;
|
|
1551
|
+
data?: EmailMetricsDataRow[];
|
|
1552
|
+
}
|
|
1553
|
+
type GetEmailsMetricsResponse = Response<GetEmailsMetricsResponseSuccess>;
|
|
1554
|
+
//#endregion
|
|
1394
1555
|
//#region src/emails/interfaces/list-emails-options.interface.d.ts
|
|
1395
1556
|
type ListEmailsOptions = PaginationOptions;
|
|
1396
1557
|
type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
|
|
@@ -1675,6 +1836,8 @@ declare class Broadcasts {
|
|
|
1675
1836
|
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
1676
1837
|
list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
|
|
1677
1838
|
get(id: string): Promise<GetBroadcastResponse>;
|
|
1839
|
+
metrics(id: string): Promise<GetBroadcastMetricsResponse>;
|
|
1840
|
+
recipients<T extends BroadcastRecipientEventType>(id: string, options: ListBroadcastRecipientsOptions<T>): Promise<ListBroadcastRecipientsResponse<T>>;
|
|
1678
1841
|
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
1679
1842
|
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
1680
1843
|
}
|
|
@@ -1796,6 +1959,7 @@ declare class Emails {
|
|
|
1796
1959
|
list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
|
|
1797
1960
|
update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
|
|
1798
1961
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1962
|
+
metrics(options?: GetEmailsMetricsOptions): Promise<GetEmailsMetricsResponse>;
|
|
1799
1963
|
}
|
|
1800
1964
|
//#endregion
|
|
1801
1965
|
//#region src/events/events.d.ts
|
|
@@ -1836,6 +2000,60 @@ interface CreateSegmentResponseSuccess extends Pick<Segment, 'name' | 'id'> {
|
|
|
1836
2000
|
}
|
|
1837
2001
|
type CreateSegmentResponse = Response<CreateSegmentResponseSuccess>;
|
|
1838
2002
|
//#endregion
|
|
2003
|
+
//#region src/segments/interfaces/get-metrics.interface.d.ts
|
|
2004
|
+
type SegmentMetric = 'all_contacts' | 'subscribers' | 'unsubscribers';
|
|
2005
|
+
type SegmentMetricsDimension = 'segment';
|
|
2006
|
+
type SegmentMetricsSortBy = 'date' | SegmentMetric;
|
|
2007
|
+
type SegmentMetricsSortOrder = 'asc' | 'desc';
|
|
2008
|
+
type GetSegmentsMetricsOptions = {
|
|
2009
|
+
/**
|
|
2010
|
+
* The metrics to include in the response. Defaults to all metrics.
|
|
2011
|
+
*
|
|
2012
|
+
* @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
|
|
2013
|
+
*/
|
|
2014
|
+
metrics?: SegmentMetric[];
|
|
2015
|
+
/**
|
|
2016
|
+
* The dimensions to break `data` down by. Defaults to `[]`, which returns
|
|
2017
|
+
* only `totals` with no `data`.
|
|
2018
|
+
*/
|
|
2019
|
+
dimensions?: SegmentMetricsDimension[];
|
|
2020
|
+
filter?: {
|
|
2021
|
+
/**
|
|
2022
|
+
* Restrict `totals` (and `data`, when requested) to these segment IDs,
|
|
2023
|
+
* without double-counting contacts that belong to more than one.
|
|
2024
|
+
*/
|
|
2025
|
+
segmentId?: string[];
|
|
2026
|
+
};
|
|
2027
|
+
/**
|
|
2028
|
+
* What to sort the segment breakdown by: `date` (each segment's creation
|
|
2029
|
+
* date), or a metric key to sort by that value instead. Only applies to
|
|
2030
|
+
* `data` (when `dimensions` includes `segment`) — `totals` ignores sort
|
|
2031
|
+
* params. Defaults to `date`.
|
|
2032
|
+
*
|
|
2033
|
+
* @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
|
|
2034
|
+
*/
|
|
2035
|
+
sortBy?: SegmentMetricsSortBy;
|
|
2036
|
+
/**
|
|
2037
|
+
* The sort direction for `sortBy`. Defaults to `desc`.
|
|
2038
|
+
*/
|
|
2039
|
+
sortOrder?: SegmentMetricsSortOrder;
|
|
2040
|
+
};
|
|
2041
|
+
type SegmentMetricsTotals = Partial<Record<SegmentMetric, number>>;
|
|
2042
|
+
type SegmentMetricsDataRow = SegmentMetricsTotals & {
|
|
2043
|
+
segment_id: string;
|
|
2044
|
+
segment_name: string;
|
|
2045
|
+
};
|
|
2046
|
+
interface GetSegmentsMetricsResponseSuccess {
|
|
2047
|
+
object: 'segments_metrics';
|
|
2048
|
+
metrics: SegmentMetric[];
|
|
2049
|
+
dimensions: SegmentMetricsDimension[];
|
|
2050
|
+
sort_by: SegmentMetricsSortBy;
|
|
2051
|
+
sort_order: SegmentMetricsSortOrder;
|
|
2052
|
+
totals: SegmentMetricsTotals;
|
|
2053
|
+
data?: SegmentMetricsDataRow[];
|
|
2054
|
+
}
|
|
2055
|
+
type GetSegmentsMetricsResponse = Response<GetSegmentsMetricsResponseSuccess>;
|
|
2056
|
+
//#endregion
|
|
1839
2057
|
//#region src/segments/interfaces/get-segment.interface.d.ts
|
|
1840
2058
|
interface GetSegmentResponseSuccess extends Pick<Segment, 'id' | 'name' | 'created_at'> {
|
|
1841
2059
|
object: 'segment';
|
|
@@ -1866,6 +2084,7 @@ declare class Segments {
|
|
|
1866
2084
|
list(options?: ListSegmentsOptions): Promise<ListSegmentsResponse>;
|
|
1867
2085
|
get(id: string): Promise<GetSegmentResponse>;
|
|
1868
2086
|
remove(id: string): Promise<RemoveSegmentResponse>;
|
|
2087
|
+
metrics(options?: GetSegmentsMetricsOptions): Promise<GetSegmentsMetricsResponse>;
|
|
1869
2088
|
}
|
|
1870
2089
|
//#endregion
|
|
1871
2090
|
//#region src/suppressions/batch/interfaces/batch-add-suppressions.interface.d.ts
|
|
@@ -2512,4 +2731,4 @@ declare class Resend {
|
|
|
2512
2731
|
delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
|
|
2513
2732
|
}
|
|
2514
2733
|
//#endregion
|
|
2515
|
-
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, 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, 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, GetUsageResponse, GetUsageResponseSuccess, 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, StopAutomationResponse, StopAutomationResponseSuccess, Suppression, SuppressionAddedEvent, SuppressionListEntry, SuppressionOrigin, SuppressionRemovedEvent, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, 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 };
|
|
2734
|
+
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, BroadcastMetricCounter, BroadcastMetricsClickedLink, BroadcastRecipient, BroadcastRecipientBounceType, BroadcastRecipientClickedLink, BroadcastRecipientEventType, 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, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailMetric, EmailMetricsDataRow, EmailMetricsDimension, EmailMetricsGranularity, EmailMetricsSortBy, EmailMetricsSortOrder, EmailMetricsTotals, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastMetricsResponse, GetBroadcastMetricsResponseSuccess, 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, GetSegmentsMetricsOptions, GetSegmentsMetricsResponse, GetSegmentsMetricsResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetUsageResponse, GetUsageResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, 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, SegmentMetric, SegmentMetricsDataRow, SegmentMetricsDimension, SegmentMetricsSortBy, SegmentMetricsSortOrder, SegmentMetricsTotals, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Suppression, SuppressionAddedEvent, SuppressionListEntry, SuppressionOrigin, SuppressionRemovedEvent, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, 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
|
@@ -801,6 +801,82 @@ interface GetBroadcastResponseSuccess extends Broadcast {
|
|
|
801
801
|
}
|
|
802
802
|
type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;
|
|
803
803
|
//#endregion
|
|
804
|
+
//#region src/broadcasts/interfaces/get-broadcast-metrics.interface.d.ts
|
|
805
|
+
interface BroadcastMetricCounter {
|
|
806
|
+
total: number;
|
|
807
|
+
percentage: number;
|
|
808
|
+
}
|
|
809
|
+
interface BroadcastMetricsClickedLink {
|
|
810
|
+
url: string;
|
|
811
|
+
clicks: number;
|
|
812
|
+
unique_clicks: number;
|
|
813
|
+
percentage: number;
|
|
814
|
+
}
|
|
815
|
+
interface GetBroadcastMetricsResponseSuccess {
|
|
816
|
+
object: 'broadcast_metrics';
|
|
817
|
+
broadcast_id: string;
|
|
818
|
+
status: Broadcast['status'];
|
|
819
|
+
created_at: string;
|
|
820
|
+
scheduled_at: string | null;
|
|
821
|
+
sent_at: string | null;
|
|
822
|
+
total: number;
|
|
823
|
+
sent: number;
|
|
824
|
+
remaining: number;
|
|
825
|
+
delivered: BroadcastMetricCounter;
|
|
826
|
+
opened: BroadcastMetricCounter;
|
|
827
|
+
clicked: BroadcastMetricCounter;
|
|
828
|
+
unsubscribed: BroadcastMetricCounter;
|
|
829
|
+
bounced: BroadcastMetricCounter;
|
|
830
|
+
complained: BroadcastMetricCounter;
|
|
831
|
+
suppressed: BroadcastMetricCounter;
|
|
832
|
+
clicked_links: BroadcastMetricsClickedLink[];
|
|
833
|
+
}
|
|
834
|
+
type GetBroadcastMetricsResponse = Response<GetBroadcastMetricsResponseSuccess>;
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/broadcasts/interfaces/list-broadcast-recipients.interface.d.ts
|
|
837
|
+
type BroadcastRecipientEventType = 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
|
|
838
|
+
type BroadcastRecipientBounceType = 'permanent' | 'transient' | 'undetermined';
|
|
839
|
+
type ListBroadcastRecipientsOptions<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginationOptions & {
|
|
840
|
+
type: T;
|
|
841
|
+
email?: string;
|
|
842
|
+
bounceType?: T extends 'bounced' ? BroadcastRecipientBounceType : never;
|
|
843
|
+
};
|
|
844
|
+
interface BroadcastRecipientClickedLink {
|
|
845
|
+
url: string;
|
|
846
|
+
clicks: number;
|
|
847
|
+
}
|
|
848
|
+
type BroadcastRecipientBase = {
|
|
849
|
+
id: string;
|
|
850
|
+
contact_id: string | null;
|
|
851
|
+
email: string;
|
|
852
|
+
};
|
|
853
|
+
type BroadcastRecipientLoose = BroadcastRecipientBase & {
|
|
854
|
+
count?: number;
|
|
855
|
+
clicked_links?: BroadcastRecipientClickedLink[];
|
|
856
|
+
bounce_type?: BroadcastRecipientBounceType;
|
|
857
|
+
};
|
|
858
|
+
type IsUnion<T, B = T> = T extends B ? ([B] extends [T] ? false : true) : never;
|
|
859
|
+
type BroadcastRecipientFieldsByType = {
|
|
860
|
+
sent: unknown;
|
|
861
|
+
delivered: unknown;
|
|
862
|
+
opened: {
|
|
863
|
+
count: number;
|
|
864
|
+
};
|
|
865
|
+
clicked: {
|
|
866
|
+
count: number;
|
|
867
|
+
clicked_links: BroadcastRecipientClickedLink[];
|
|
868
|
+
};
|
|
869
|
+
bounced: {
|
|
870
|
+
bounce_type: BroadcastRecipientBounceType;
|
|
871
|
+
};
|
|
872
|
+
complained: unknown;
|
|
873
|
+
unsubscribed: unknown;
|
|
874
|
+
suppressed: unknown;
|
|
875
|
+
};
|
|
876
|
+
type BroadcastRecipient<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = IsUnion<T> extends true ? BroadcastRecipientLoose : BroadcastRecipientBase & BroadcastRecipientFieldsByType[T];
|
|
877
|
+
type ListBroadcastRecipientsResponseSuccess<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginatedData<BroadcastRecipient<T>[]>;
|
|
878
|
+
type ListBroadcastRecipientsResponse<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = Response<ListBroadcastRecipientsResponseSuccess<T>>;
|
|
879
|
+
//#endregion
|
|
804
880
|
//#region src/broadcasts/interfaces/list-broadcasts.interface.d.ts
|
|
805
881
|
type ListBroadcastsOptions = PaginationOptions;
|
|
806
882
|
type ListBroadcastsResponseSuccess = {
|
|
@@ -1391,6 +1467,91 @@ interface GetEmailResponseSuccess {
|
|
|
1391
1467
|
}
|
|
1392
1468
|
type GetEmailResponse = Response<GetEmailResponseSuccess>;
|
|
1393
1469
|
//#endregion
|
|
1470
|
+
//#region src/emails/interfaces/get-metrics.interface.d.ts
|
|
1471
|
+
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';
|
|
1472
|
+
type EmailMetricsDimension = 'period' | 'domain' | 'email';
|
|
1473
|
+
type EmailMetricsGranularity = 'hourly' | 'daily' | 'weekly';
|
|
1474
|
+
type EmailMetricsSortBy = 'date' | EmailMetric;
|
|
1475
|
+
type EmailMetricsSortOrder = 'asc' | 'desc';
|
|
1476
|
+
type GetEmailsMetricsOptions = {
|
|
1477
|
+
/**
|
|
1478
|
+
* The start of the date range, as an ISO 8601 date or datetime.
|
|
1479
|
+
* Defaults to 6 days before `endDate`.
|
|
1480
|
+
*
|
|
1481
|
+
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1482
|
+
*/
|
|
1483
|
+
startDate?: string;
|
|
1484
|
+
/**
|
|
1485
|
+
* The end of the date range, as an ISO 8601 date or datetime.
|
|
1486
|
+
* Defaults to now.
|
|
1487
|
+
*
|
|
1488
|
+
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1489
|
+
*/
|
|
1490
|
+
endDate?: string;
|
|
1491
|
+
/**
|
|
1492
|
+
* The IANA timezone used to bucket periods when `period` is in `dimensions`.
|
|
1493
|
+
* Defaults to `UTC`.
|
|
1494
|
+
*/
|
|
1495
|
+
timezone?: string;
|
|
1496
|
+
/**
|
|
1497
|
+
* The bucket size used when `period` is in `dimensions`.
|
|
1498
|
+
* Defaults to `daily`.
|
|
1499
|
+
*/
|
|
1500
|
+
granularity?: EmailMetricsGranularity;
|
|
1501
|
+
/**
|
|
1502
|
+
* The metrics to include in the response. Defaults to all metrics.
|
|
1503
|
+
*/
|
|
1504
|
+
metrics?: EmailMetric[];
|
|
1505
|
+
/**
|
|
1506
|
+
* The dimensions to break the response down by. Defaults to `[]`, which
|
|
1507
|
+
* returns a single `totals` row for the whole range, with no `data`.
|
|
1508
|
+
*/
|
|
1509
|
+
dimensions?: EmailMetricsDimension[];
|
|
1510
|
+
filter?: {
|
|
1511
|
+
/**
|
|
1512
|
+
* Restrict the response to these sending domain IDs.
|
|
1513
|
+
*/
|
|
1514
|
+
domainId?: string[];
|
|
1515
|
+
/**
|
|
1516
|
+
* Restrict the response to these email IDs. Cannot be combined with the
|
|
1517
|
+
* `domain` dimension.
|
|
1518
|
+
*/
|
|
1519
|
+
emailId?: string[];
|
|
1520
|
+
};
|
|
1521
|
+
/**
|
|
1522
|
+
* What to sort `data` by. Defaults to `date` when `dimensions` includes
|
|
1523
|
+
* `period`, or `sent` otherwise.
|
|
1524
|
+
*
|
|
1525
|
+
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1526
|
+
*/
|
|
1527
|
+
sortBy?: EmailMetricsSortBy;
|
|
1528
|
+
/**
|
|
1529
|
+
* The sort direction for `sortBy`. Defaults to `asc` when `dimensions`
|
|
1530
|
+
* includes `period`, `desc` otherwise.
|
|
1531
|
+
*/
|
|
1532
|
+
sortOrder?: EmailMetricsSortOrder;
|
|
1533
|
+
};
|
|
1534
|
+
type EmailMetricsTotals = Partial<Record<EmailMetric, number>>;
|
|
1535
|
+
type EmailMetricsDataRow = EmailMetricsTotals & {
|
|
1536
|
+
period?: string;
|
|
1537
|
+
domain_id?: string;
|
|
1538
|
+
domain_name?: string;
|
|
1539
|
+
email_id?: string;
|
|
1540
|
+
};
|
|
1541
|
+
interface GetEmailsMetricsResponseSuccess {
|
|
1542
|
+
object: 'metrics';
|
|
1543
|
+
start_date: string;
|
|
1544
|
+
end_date: string;
|
|
1545
|
+
metrics: EmailMetric[];
|
|
1546
|
+
dimensions: EmailMetricsDimension[];
|
|
1547
|
+
granularity: EmailMetricsGranularity;
|
|
1548
|
+
sort_by: EmailMetricsSortBy;
|
|
1549
|
+
sort_order: EmailMetricsSortOrder;
|
|
1550
|
+
totals: EmailMetricsTotals;
|
|
1551
|
+
data?: EmailMetricsDataRow[];
|
|
1552
|
+
}
|
|
1553
|
+
type GetEmailsMetricsResponse = Response<GetEmailsMetricsResponseSuccess>;
|
|
1554
|
+
//#endregion
|
|
1394
1555
|
//#region src/emails/interfaces/list-emails-options.interface.d.ts
|
|
1395
1556
|
type ListEmailsOptions = PaginationOptions;
|
|
1396
1557
|
type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
|
|
@@ -1675,6 +1836,8 @@ declare class Broadcasts {
|
|
|
1675
1836
|
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
1676
1837
|
list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
|
|
1677
1838
|
get(id: string): Promise<GetBroadcastResponse>;
|
|
1839
|
+
metrics(id: string): Promise<GetBroadcastMetricsResponse>;
|
|
1840
|
+
recipients<T extends BroadcastRecipientEventType>(id: string, options: ListBroadcastRecipientsOptions<T>): Promise<ListBroadcastRecipientsResponse<T>>;
|
|
1678
1841
|
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
1679
1842
|
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
1680
1843
|
}
|
|
@@ -1796,6 +1959,7 @@ declare class Emails {
|
|
|
1796
1959
|
list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
|
|
1797
1960
|
update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
|
|
1798
1961
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1962
|
+
metrics(options?: GetEmailsMetricsOptions): Promise<GetEmailsMetricsResponse>;
|
|
1799
1963
|
}
|
|
1800
1964
|
//#endregion
|
|
1801
1965
|
//#region src/events/events.d.ts
|
|
@@ -1836,6 +2000,60 @@ interface CreateSegmentResponseSuccess extends Pick<Segment, 'name' | 'id'> {
|
|
|
1836
2000
|
}
|
|
1837
2001
|
type CreateSegmentResponse = Response<CreateSegmentResponseSuccess>;
|
|
1838
2002
|
//#endregion
|
|
2003
|
+
//#region src/segments/interfaces/get-metrics.interface.d.ts
|
|
2004
|
+
type SegmentMetric = 'all_contacts' | 'subscribers' | 'unsubscribers';
|
|
2005
|
+
type SegmentMetricsDimension = 'segment';
|
|
2006
|
+
type SegmentMetricsSortBy = 'date' | SegmentMetric;
|
|
2007
|
+
type SegmentMetricsSortOrder = 'asc' | 'desc';
|
|
2008
|
+
type GetSegmentsMetricsOptions = {
|
|
2009
|
+
/**
|
|
2010
|
+
* The metrics to include in the response. Defaults to all metrics.
|
|
2011
|
+
*
|
|
2012
|
+
* @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
|
|
2013
|
+
*/
|
|
2014
|
+
metrics?: SegmentMetric[];
|
|
2015
|
+
/**
|
|
2016
|
+
* The dimensions to break `data` down by. Defaults to `[]`, which returns
|
|
2017
|
+
* only `totals` with no `data`.
|
|
2018
|
+
*/
|
|
2019
|
+
dimensions?: SegmentMetricsDimension[];
|
|
2020
|
+
filter?: {
|
|
2021
|
+
/**
|
|
2022
|
+
* Restrict `totals` (and `data`, when requested) to these segment IDs,
|
|
2023
|
+
* without double-counting contacts that belong to more than one.
|
|
2024
|
+
*/
|
|
2025
|
+
segmentId?: string[];
|
|
2026
|
+
};
|
|
2027
|
+
/**
|
|
2028
|
+
* What to sort the segment breakdown by: `date` (each segment's creation
|
|
2029
|
+
* date), or a metric key to sort by that value instead. Only applies to
|
|
2030
|
+
* `data` (when `dimensions` includes `segment`) — `totals` ignores sort
|
|
2031
|
+
* params. Defaults to `date`.
|
|
2032
|
+
*
|
|
2033
|
+
* @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
|
|
2034
|
+
*/
|
|
2035
|
+
sortBy?: SegmentMetricsSortBy;
|
|
2036
|
+
/**
|
|
2037
|
+
* The sort direction for `sortBy`. Defaults to `desc`.
|
|
2038
|
+
*/
|
|
2039
|
+
sortOrder?: SegmentMetricsSortOrder;
|
|
2040
|
+
};
|
|
2041
|
+
type SegmentMetricsTotals = Partial<Record<SegmentMetric, number>>;
|
|
2042
|
+
type SegmentMetricsDataRow = SegmentMetricsTotals & {
|
|
2043
|
+
segment_id: string;
|
|
2044
|
+
segment_name: string;
|
|
2045
|
+
};
|
|
2046
|
+
interface GetSegmentsMetricsResponseSuccess {
|
|
2047
|
+
object: 'segments_metrics';
|
|
2048
|
+
metrics: SegmentMetric[];
|
|
2049
|
+
dimensions: SegmentMetricsDimension[];
|
|
2050
|
+
sort_by: SegmentMetricsSortBy;
|
|
2051
|
+
sort_order: SegmentMetricsSortOrder;
|
|
2052
|
+
totals: SegmentMetricsTotals;
|
|
2053
|
+
data?: SegmentMetricsDataRow[];
|
|
2054
|
+
}
|
|
2055
|
+
type GetSegmentsMetricsResponse = Response<GetSegmentsMetricsResponseSuccess>;
|
|
2056
|
+
//#endregion
|
|
1839
2057
|
//#region src/segments/interfaces/get-segment.interface.d.ts
|
|
1840
2058
|
interface GetSegmentResponseSuccess extends Pick<Segment, 'id' | 'name' | 'created_at'> {
|
|
1841
2059
|
object: 'segment';
|
|
@@ -1866,6 +2084,7 @@ declare class Segments {
|
|
|
1866
2084
|
list(options?: ListSegmentsOptions): Promise<ListSegmentsResponse>;
|
|
1867
2085
|
get(id: string): Promise<GetSegmentResponse>;
|
|
1868
2086
|
remove(id: string): Promise<RemoveSegmentResponse>;
|
|
2087
|
+
metrics(options?: GetSegmentsMetricsOptions): Promise<GetSegmentsMetricsResponse>;
|
|
1869
2088
|
}
|
|
1870
2089
|
//#endregion
|
|
1871
2090
|
//#region src/suppressions/batch/interfaces/batch-add-suppressions.interface.d.ts
|
|
@@ -2512,4 +2731,4 @@ declare class Resend {
|
|
|
2512
2731
|
delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
|
|
2513
2732
|
}
|
|
2514
2733
|
//#endregion
|
|
2515
|
-
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, 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, 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, GetUsageResponse, GetUsageResponseSuccess, 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, StopAutomationResponse, StopAutomationResponseSuccess, Suppression, SuppressionAddedEvent, SuppressionListEntry, SuppressionOrigin, SuppressionRemovedEvent, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, 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 };
|
|
2734
|
+
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, BroadcastMetricCounter, BroadcastMetricsClickedLink, BroadcastRecipient, BroadcastRecipientBounceType, BroadcastRecipientClickedLink, BroadcastRecipientEventType, 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, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailMetric, EmailMetricsDataRow, EmailMetricsDimension, EmailMetricsGranularity, EmailMetricsSortBy, EmailMetricsSortOrder, EmailMetricsTotals, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastMetricsResponse, GetBroadcastMetricsResponseSuccess, 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, GetSegmentsMetricsOptions, GetSegmentsMetricsResponse, GetSegmentsMetricsResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetUsageResponse, GetUsageResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, 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, SegmentMetric, SegmentMetricsDataRow, SegmentMetricsDimension, SegmentMetricsSortBy, SegmentMetricsSortOrder, SegmentMetricsTotals, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Suppression, SuppressionAddedEvent, SuppressionListEntry, SuppressionOrigin, SuppressionRemovedEvent, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, 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.19.0-preview-
|
|
4
|
+
var version = "6.19.0-preview-headless-dashboard.1";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/common/utils/build-pagination-query.ts
|
|
7
7
|
/**
|
|
@@ -277,6 +277,13 @@ var Broadcasts = class {
|
|
|
277
277
|
async get(id) {
|
|
278
278
|
return await this.resend.get(`/broadcasts/${id}`);
|
|
279
279
|
}
|
|
280
|
+
async metrics(id) {
|
|
281
|
+
return await this.resend.get(`/broadcasts/${id}/metrics`);
|
|
282
|
+
}
|
|
283
|
+
async recipients(id, options) {
|
|
284
|
+
const url = `/broadcasts/${id}/recipients?${buildRecipientsQuery(options)}`;
|
|
285
|
+
return await this.resend.get(url);
|
|
286
|
+
}
|
|
280
287
|
async remove(id) {
|
|
281
288
|
return await this.resend.delete(`/broadcasts/${id}`);
|
|
282
289
|
}
|
|
@@ -296,6 +303,14 @@ var Broadcasts = class {
|
|
|
296
303
|
});
|
|
297
304
|
}
|
|
298
305
|
};
|
|
306
|
+
function buildRecipientsQuery(options) {
|
|
307
|
+
const { type, email, bounceType, ...pagination } = options;
|
|
308
|
+
const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
|
|
309
|
+
searchParams.set("type", type);
|
|
310
|
+
if (email !== void 0) searchParams.set("email", email);
|
|
311
|
+
if (bounceType !== void 0) searchParams.set("bounce_type", bounceType);
|
|
312
|
+
return searchParams.toString();
|
|
313
|
+
}
|
|
299
314
|
//#endregion
|
|
300
315
|
//#region src/common/utils/parse-contact-properties-to-api-options.ts
|
|
301
316
|
function parseContactPropertyFromApi(contactProperty) {
|
|
@@ -870,7 +885,29 @@ var Emails = class {
|
|
|
870
885
|
async cancel(id) {
|
|
871
886
|
return await this.resend.post(`/emails/${id}/cancel`);
|
|
872
887
|
}
|
|
888
|
+
async metrics(options = {}) {
|
|
889
|
+
const queryString = buildMetricsQuery$1(options);
|
|
890
|
+
const url = queryString ? `/emails/metrics?${queryString}` : "/emails/metrics";
|
|
891
|
+
return await this.resend.get(url);
|
|
892
|
+
}
|
|
873
893
|
};
|
|
894
|
+
function buildMetricsQuery$1(options) {
|
|
895
|
+
const params = {
|
|
896
|
+
start_date: options.startDate,
|
|
897
|
+
end_date: options.endDate,
|
|
898
|
+
timezone: options.timezone,
|
|
899
|
+
granularity: options.granularity,
|
|
900
|
+
metrics: options.metrics?.join(","),
|
|
901
|
+
dimensions: options.dimensions?.join(","),
|
|
902
|
+
"filter[domain_id]": options.filter?.domainId?.join(","),
|
|
903
|
+
"filter[email_id]": options.filter?.emailId?.join(","),
|
|
904
|
+
sort_by: options.sortBy,
|
|
905
|
+
sort_order: options.sortOrder
|
|
906
|
+
};
|
|
907
|
+
const searchParams = new URLSearchParams();
|
|
908
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
|
|
909
|
+
return searchParams.toString();
|
|
910
|
+
}
|
|
874
911
|
//#endregion
|
|
875
912
|
//#region src/events/events.ts
|
|
876
913
|
var Events = class {
|
|
@@ -948,7 +985,24 @@ var Segments = class {
|
|
|
948
985
|
async remove(id) {
|
|
949
986
|
return await this.resend.delete(`/segments/${id}`);
|
|
950
987
|
}
|
|
988
|
+
async metrics(options = {}) {
|
|
989
|
+
const queryString = buildMetricsQuery(options);
|
|
990
|
+
const url = queryString ? `/segments/metrics?${queryString}` : "/segments/metrics";
|
|
991
|
+
return await this.resend.get(url);
|
|
992
|
+
}
|
|
951
993
|
};
|
|
994
|
+
function buildMetricsQuery(options) {
|
|
995
|
+
const params = {
|
|
996
|
+
metrics: options.metrics?.join(","),
|
|
997
|
+
dimensions: options.dimensions?.join(","),
|
|
998
|
+
"filter[segment_id]": options.filter?.segmentId?.join(","),
|
|
999
|
+
sort_by: options.sortBy,
|
|
1000
|
+
sort_order: options.sortOrder
|
|
1001
|
+
};
|
|
1002
|
+
const searchParams = new URLSearchParams();
|
|
1003
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
|
|
1004
|
+
return searchParams.toString();
|
|
1005
|
+
}
|
|
952
1006
|
//#endregion
|
|
953
1007
|
//#region src/suppressions/batch/batch.ts
|
|
954
1008
|
var Batch = class {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resend",
|
|
3
|
-
"version": "6.19.0-preview-
|
|
3
|
+
"version": "6.19.0-preview-headless-dashboard.1",
|
|
4
4
|
"description": "Node.js library for the Resend API",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -29,6 +29,19 @@
|
|
|
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
|
+
},
|
|
32
45
|
"repository": {
|
|
33
46
|
"type": "git",
|
|
34
47
|
"url": "git+https://github.com/resend/resend-node.git"
|
|
@@ -70,16 +83,5 @@
|
|
|
70
83
|
"vitest": "4.1.10",
|
|
71
84
|
"vitest-fetch-mock": "0.4.5"
|
|
72
85
|
},
|
|
73
|
-
"
|
|
74
|
-
|
|
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
|
-
}
|
|
86
|
+
"packageManager": "pnpm@11.12.0"
|
|
87
|
+
}
|