resend 6.19.0-preview-headless-dashboard.5 → 6.19.0
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 +3 -98
- package/dist/index.d.cts +3 -356
- package/dist/index.d.mts +3 -356
- package/dist/index.mjs +3 -98
- package/package.json +1 -1
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
|
|
28
|
+
var version = "6.19.0";
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/common/utils/build-pagination-query.ts
|
|
31
31
|
function buildPaginationUrl(base, options) {
|
|
@@ -303,13 +303,6 @@ var Broadcasts = class {
|
|
|
303
303
|
async get(id) {
|
|
304
304
|
return await this.resend.get(`/broadcasts/${id}`);
|
|
305
305
|
}
|
|
306
|
-
async metrics(id) {
|
|
307
|
-
return await this.resend.get(`/broadcasts/${id}/metrics`);
|
|
308
|
-
}
|
|
309
|
-
async recipients(id, options) {
|
|
310
|
-
const url = `/broadcasts/${id}/recipients?${buildRecipientsQuery(options)}`;
|
|
311
|
-
return await this.resend.get(url);
|
|
312
|
-
}
|
|
313
306
|
async remove(id) {
|
|
314
307
|
return await this.resend.delete(`/broadcasts/${id}`);
|
|
315
308
|
}
|
|
@@ -332,14 +325,6 @@ var Broadcasts = class {
|
|
|
332
325
|
});
|
|
333
326
|
}
|
|
334
327
|
};
|
|
335
|
-
function buildRecipientsQuery(options) {
|
|
336
|
-
const { type, email, bounceType, ...pagination } = options;
|
|
337
|
-
const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
|
|
338
|
-
searchParams.set("type", type);
|
|
339
|
-
if (email !== void 0) searchParams.set("email", email);
|
|
340
|
-
if (bounceType !== void 0) searchParams.set("bounce_type", bounceType);
|
|
341
|
-
return searchParams.toString();
|
|
342
|
-
}
|
|
343
328
|
//#endregion
|
|
344
329
|
//#region src/common/utils/parse-contact-properties-to-api-options.ts
|
|
345
330
|
function parseContactPropertyFromApi(contactProperty) {
|
|
@@ -902,32 +887,10 @@ var Emails = class {
|
|
|
902
887
|
async cancel(id) {
|
|
903
888
|
return await this.resend.post(`/emails/${id}/cancel`);
|
|
904
889
|
}
|
|
905
|
-
async metrics(options = {}) {
|
|
906
|
-
const queryString = buildMetricsQuery$1(options);
|
|
907
|
-
const url = queryString ? `/emails/metrics?${queryString}` : "/emails/metrics";
|
|
908
|
-
return await this.resend.get(url);
|
|
909
|
-
}
|
|
910
890
|
};
|
|
911
|
-
function buildMetricsQuery$1(options) {
|
|
912
|
-
const params = {
|
|
913
|
-
start_date: options.startDate,
|
|
914
|
-
end_date: options.endDate,
|
|
915
|
-
timezone: options.timezone,
|
|
916
|
-
granularity: options.granularity,
|
|
917
|
-
metrics: options.metrics?.join(","),
|
|
918
|
-
dimensions: options.dimensions?.join(","),
|
|
919
|
-
domain_id: options.filter?.domainId?.join(","),
|
|
920
|
-
email_id: options.filter?.emailId?.join(","),
|
|
921
|
-
sort_by: options.sortBy,
|
|
922
|
-
sort_order: options.sortOrder
|
|
923
|
-
};
|
|
924
|
-
const searchParams = new URLSearchParams();
|
|
925
|
-
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
|
|
926
|
-
return searchParams.toString();
|
|
927
|
-
}
|
|
928
891
|
//#endregion
|
|
929
892
|
//#region src/events/events.ts
|
|
930
|
-
var Events
|
|
893
|
+
var Events = class {
|
|
931
894
|
constructor(resend) {
|
|
932
895
|
this.resend = resend;
|
|
933
896
|
}
|
|
@@ -998,24 +961,7 @@ var Segments = class {
|
|
|
998
961
|
async remove(id) {
|
|
999
962
|
return await this.resend.delete(`/segments/${id}`);
|
|
1000
963
|
}
|
|
1001
|
-
async metrics(options = {}) {
|
|
1002
|
-
const queryString = buildMetricsQuery(options);
|
|
1003
|
-
const url = queryString ? `/segments/metrics?${queryString}` : "/segments/metrics";
|
|
1004
|
-
return await this.resend.get(url);
|
|
1005
|
-
}
|
|
1006
964
|
};
|
|
1007
|
-
function buildMetricsQuery(options) {
|
|
1008
|
-
const params = {
|
|
1009
|
-
metrics: options.metrics?.join(","),
|
|
1010
|
-
dimensions: options.dimensions?.join(","),
|
|
1011
|
-
segment_id: options.filter?.segmentId?.join(","),
|
|
1012
|
-
sort_by: options.sortBy,
|
|
1013
|
-
sort_order: options.sortOrder
|
|
1014
|
-
};
|
|
1015
|
-
const searchParams = new URLSearchParams();
|
|
1016
|
-
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
|
|
1017
|
-
return searchParams.toString();
|
|
1018
|
-
}
|
|
1019
965
|
//#endregion
|
|
1020
966
|
//#region src/suppressions/batch/batch.ts
|
|
1021
967
|
var Batch = class {
|
|
@@ -1205,50 +1151,10 @@ var Topics = class {
|
|
|
1205
1151
|
}
|
|
1206
1152
|
};
|
|
1207
1153
|
//#endregion
|
|
1208
|
-
//#region src/usage/usage.ts
|
|
1209
|
-
var Usage = class {
|
|
1210
|
-
constructor(resend) {
|
|
1211
|
-
this.resend = resend;
|
|
1212
|
-
}
|
|
1213
|
-
async get() {
|
|
1214
|
-
return await this.resend.get("/usage");
|
|
1215
|
-
}
|
|
1216
|
-
};
|
|
1217
|
-
//#endregion
|
|
1218
|
-
//#region src/webhooks/events/attempts/attempts.ts
|
|
1219
|
-
var Attempts = class {
|
|
1220
|
-
constructor(resend) {
|
|
1221
|
-
this.resend = resend;
|
|
1222
|
-
}
|
|
1223
|
-
async list(options) {
|
|
1224
|
-
const { webhookId, eventId } = options;
|
|
1225
|
-
const url = buildPaginationUrl(`/webhooks/${webhookId}/events/${eventId}/attempts`, options);
|
|
1226
|
-
return await this.resend.get(url);
|
|
1227
|
-
}
|
|
1228
|
-
};
|
|
1229
|
-
//#endregion
|
|
1230
|
-
//#region src/webhooks/events/events.ts
|
|
1231
|
-
var Events = class {
|
|
1232
|
-
constructor(resend) {
|
|
1233
|
-
this.resend = resend;
|
|
1234
|
-
this.attempts = new Attempts(resend);
|
|
1235
|
-
}
|
|
1236
|
-
async list(options) {
|
|
1237
|
-
const { webhookId } = options;
|
|
1238
|
-
const url = buildPaginationUrl(`/webhooks/${webhookId}/events`, options);
|
|
1239
|
-
return await this.resend.get(url);
|
|
1240
|
-
}
|
|
1241
|
-
async get(options) {
|
|
1242
|
-
const { webhookId, eventId } = options;
|
|
1243
|
-
return await this.resend.get(`/webhooks/${webhookId}/events/${eventId}`);
|
|
1244
|
-
}
|
|
1245
|
-
};
|
|
1246
|
-
//#endregion
|
|
1247
1154
|
//#region src/webhooks/webhooks.ts
|
|
1248
1155
|
var Webhooks = class {
|
|
1249
1156
|
constructor(resend) {
|
|
1250
1157
|
this.resend = resend;
|
|
1251
|
-
this.events = new Events(resend);
|
|
1252
1158
|
}
|
|
1253
1159
|
async create(payload, options = {}) {
|
|
1254
1160
|
return await this.resend.post("/webhooks", payload, options);
|
|
@@ -1297,13 +1203,12 @@ var Resend = class {
|
|
|
1297
1203
|
this.contacts = new Contacts(this);
|
|
1298
1204
|
this.domains = new Domains(this);
|
|
1299
1205
|
this.emails = new Emails(this);
|
|
1300
|
-
this.events = new Events
|
|
1206
|
+
this.events = new Events(this);
|
|
1301
1207
|
this.logs = new Logs(this);
|
|
1302
1208
|
this.oauthGrants = new OAuthGrants(this);
|
|
1303
1209
|
this.suppressions = new Suppressions(this);
|
|
1304
1210
|
this.templates = new Templates(this);
|
|
1305
1211
|
this.topics = new Topics(this);
|
|
1306
|
-
this.usage = new Usage(this);
|
|
1307
1212
|
this.webhooks = new Webhooks(this);
|
|
1308
1213
|
if (!key) {
|
|
1309
1214
|
if (typeof process !== "undefined" && process.env) this.key = process.env.RESEND_API_KEY;
|
package/dist/index.d.cts
CHANGED
|
@@ -813,82 +813,6 @@ interface GetBroadcastResponseSuccess extends Broadcast {
|
|
|
813
813
|
}
|
|
814
814
|
type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;
|
|
815
815
|
//#endregion
|
|
816
|
-
//#region src/broadcasts/interfaces/get-broadcast-metrics.interface.d.ts
|
|
817
|
-
interface BroadcastMetricCounter {
|
|
818
|
-
total: number;
|
|
819
|
-
percentage: number;
|
|
820
|
-
}
|
|
821
|
-
interface BroadcastMetricsClickedLink {
|
|
822
|
-
url: string;
|
|
823
|
-
clicks: number;
|
|
824
|
-
unique_clicks: number;
|
|
825
|
-
percentage: number;
|
|
826
|
-
}
|
|
827
|
-
interface GetBroadcastMetricsResponseSuccess {
|
|
828
|
-
object: 'broadcast_metrics';
|
|
829
|
-
broadcast_id: string;
|
|
830
|
-
status: Broadcast['status'];
|
|
831
|
-
created_at: string;
|
|
832
|
-
scheduled_at: string | null;
|
|
833
|
-
sent_at: string | null;
|
|
834
|
-
total: number;
|
|
835
|
-
sent: number;
|
|
836
|
-
remaining: number;
|
|
837
|
-
delivered: BroadcastMetricCounter;
|
|
838
|
-
opened: BroadcastMetricCounter;
|
|
839
|
-
clicked: BroadcastMetricCounter;
|
|
840
|
-
unsubscribed: BroadcastMetricCounter;
|
|
841
|
-
bounced: BroadcastMetricCounter;
|
|
842
|
-
complained: BroadcastMetricCounter;
|
|
843
|
-
suppressed: BroadcastMetricCounter;
|
|
844
|
-
clicked_links: BroadcastMetricsClickedLink[];
|
|
845
|
-
}
|
|
846
|
-
type GetBroadcastMetricsResponse = Response<GetBroadcastMetricsResponseSuccess>;
|
|
847
|
-
//#endregion
|
|
848
|
-
//#region src/broadcasts/interfaces/list-broadcast-recipients.interface.d.ts
|
|
849
|
-
type BroadcastRecipientEventType = 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
|
|
850
|
-
type BroadcastRecipientBounceType = 'permanent' | 'transient' | 'undetermined';
|
|
851
|
-
type ListBroadcastRecipientsOptions<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginationOptions & {
|
|
852
|
-
type: T;
|
|
853
|
-
email?: string;
|
|
854
|
-
bounceType?: T extends 'bounced' ? BroadcastRecipientBounceType : never;
|
|
855
|
-
};
|
|
856
|
-
interface BroadcastRecipientClickedLink {
|
|
857
|
-
url: string;
|
|
858
|
-
clicks: number;
|
|
859
|
-
}
|
|
860
|
-
type BroadcastRecipientBase = {
|
|
861
|
-
id: string;
|
|
862
|
-
contact_id: string | null;
|
|
863
|
-
email: string;
|
|
864
|
-
};
|
|
865
|
-
type BroadcastRecipientLoose = BroadcastRecipientBase & {
|
|
866
|
-
count?: number;
|
|
867
|
-
clicked_links?: BroadcastRecipientClickedLink[];
|
|
868
|
-
bounce_type?: BroadcastRecipientBounceType;
|
|
869
|
-
};
|
|
870
|
-
type IsUnion<T, B = T> = T extends B ? ([B] extends [T] ? false : true) : never;
|
|
871
|
-
type BroadcastRecipientFieldsByType = {
|
|
872
|
-
sent: unknown;
|
|
873
|
-
delivered: unknown;
|
|
874
|
-
opened: {
|
|
875
|
-
count: number;
|
|
876
|
-
};
|
|
877
|
-
clicked: {
|
|
878
|
-
count: number;
|
|
879
|
-
clicked_links: BroadcastRecipientClickedLink[];
|
|
880
|
-
};
|
|
881
|
-
bounced: {
|
|
882
|
-
bounce_type: BroadcastRecipientBounceType;
|
|
883
|
-
};
|
|
884
|
-
complained: unknown;
|
|
885
|
-
unsubscribed: unknown;
|
|
886
|
-
suppressed: unknown;
|
|
887
|
-
};
|
|
888
|
-
type BroadcastRecipient<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = IsUnion<T> extends true ? BroadcastRecipientLoose : BroadcastRecipientBase & BroadcastRecipientFieldsByType[T];
|
|
889
|
-
type ListBroadcastRecipientsResponseSuccess<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginatedData<BroadcastRecipient<T>[]>;
|
|
890
|
-
type ListBroadcastRecipientsResponse<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = Response<ListBroadcastRecipientsResponseSuccess<T>>;
|
|
891
|
-
//#endregion
|
|
892
816
|
//#region src/broadcasts/interfaces/list-broadcasts.interface.d.ts
|
|
893
817
|
type ListBroadcastsOptions = PaginationOptions;
|
|
894
818
|
type ListBroadcastsResponseSuccess = {
|
|
@@ -1479,91 +1403,6 @@ interface GetEmailResponseSuccess {
|
|
|
1479
1403
|
}
|
|
1480
1404
|
type GetEmailResponse = Response<GetEmailResponseSuccess>;
|
|
1481
1405
|
//#endregion
|
|
1482
|
-
//#region src/emails/interfaces/get-metrics.interface.d.ts
|
|
1483
|
-
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';
|
|
1484
|
-
type EmailMetricsDimension = 'period' | 'domain' | 'email';
|
|
1485
|
-
type EmailMetricsGranularity = 'hourly' | 'daily' | 'weekly' | 'monthly';
|
|
1486
|
-
type EmailMetricsSortBy = 'date' | EmailMetric;
|
|
1487
|
-
type EmailMetricsSortOrder = 'asc' | 'desc';
|
|
1488
|
-
type GetEmailsMetricsOptions = {
|
|
1489
|
-
/**
|
|
1490
|
-
* The start of the date range, as an ISO 8601 date or datetime.
|
|
1491
|
-
* Defaults to 6 days before `endDate`.
|
|
1492
|
-
*
|
|
1493
|
-
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1494
|
-
*/
|
|
1495
|
-
startDate?: string;
|
|
1496
|
-
/**
|
|
1497
|
-
* The end of the date range, as an ISO 8601 date or datetime.
|
|
1498
|
-
* Defaults to now.
|
|
1499
|
-
*
|
|
1500
|
-
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1501
|
-
*/
|
|
1502
|
-
endDate?: string;
|
|
1503
|
-
/**
|
|
1504
|
-
* The IANA timezone used to bucket periods when `period` is in `dimensions`.
|
|
1505
|
-
* Defaults to `UTC`.
|
|
1506
|
-
*/
|
|
1507
|
-
timezone?: string;
|
|
1508
|
-
/**
|
|
1509
|
-
* The bucket size used when `period` is in `dimensions`.
|
|
1510
|
-
* Defaults to `daily`.
|
|
1511
|
-
*/
|
|
1512
|
-
granularity?: EmailMetricsGranularity;
|
|
1513
|
-
/**
|
|
1514
|
-
* The metrics to include in the response. Defaults to all metrics.
|
|
1515
|
-
*/
|
|
1516
|
-
metrics?: EmailMetric[];
|
|
1517
|
-
/**
|
|
1518
|
-
* The dimensions to break the response down by. Defaults to `[]`, which
|
|
1519
|
-
* returns a single `totals` row for the whole range, with no `data`.
|
|
1520
|
-
*/
|
|
1521
|
-
dimensions?: EmailMetricsDimension[];
|
|
1522
|
-
filter?: {
|
|
1523
|
-
/**
|
|
1524
|
-
* Restrict the response to these sending domain IDs.
|
|
1525
|
-
*/
|
|
1526
|
-
domainId?: string[];
|
|
1527
|
-
/**
|
|
1528
|
-
* Restrict the response to these email IDs. Cannot be combined with the
|
|
1529
|
-
* `domain` dimension.
|
|
1530
|
-
*/
|
|
1531
|
-
emailId?: string[];
|
|
1532
|
-
};
|
|
1533
|
-
/**
|
|
1534
|
-
* What to sort `data` by. Defaults to `date` when `dimensions` includes
|
|
1535
|
-
* `period`, or `sent` otherwise.
|
|
1536
|
-
*
|
|
1537
|
-
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1538
|
-
*/
|
|
1539
|
-
sortBy?: EmailMetricsSortBy;
|
|
1540
|
-
/**
|
|
1541
|
-
* The sort direction for `sortBy`. Defaults to `asc` when `dimensions`
|
|
1542
|
-
* includes `period`, `desc` otherwise.
|
|
1543
|
-
*/
|
|
1544
|
-
sortOrder?: EmailMetricsSortOrder;
|
|
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
|
-
};
|
|
1553
|
-
interface GetEmailsMetricsResponseSuccess {
|
|
1554
|
-
object: 'metrics';
|
|
1555
|
-
start_date: string;
|
|
1556
|
-
end_date: string;
|
|
1557
|
-
metrics: EmailMetric[];
|
|
1558
|
-
dimensions: EmailMetricsDimension[];
|
|
1559
|
-
granularity: EmailMetricsGranularity;
|
|
1560
|
-
sort_by: EmailMetricsSortBy;
|
|
1561
|
-
sort_order: EmailMetricsSortOrder;
|
|
1562
|
-
totals: EmailMetricsTotals;
|
|
1563
|
-
data?: EmailMetricsDataRow[];
|
|
1564
|
-
}
|
|
1565
|
-
type GetEmailsMetricsResponse = Response<GetEmailsMetricsResponseSuccess>;
|
|
1566
|
-
//#endregion
|
|
1567
1406
|
//#region src/emails/interfaces/list-emails-options.interface.d.ts
|
|
1568
1407
|
type ListEmailsOptions = PaginationOptions;
|
|
1569
1408
|
type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
|
|
@@ -1848,8 +1687,6 @@ declare class Broadcasts {
|
|
|
1848
1687
|
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
1849
1688
|
list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
|
|
1850
1689
|
get(id: string): Promise<GetBroadcastResponse>;
|
|
1851
|
-
metrics(id: string): Promise<GetBroadcastMetricsResponse>;
|
|
1852
|
-
recipients<T extends BroadcastRecipientEventType>(id: string, options: ListBroadcastRecipientsOptions<T>): Promise<ListBroadcastRecipientsResponse<T>>;
|
|
1853
1690
|
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
1854
1691
|
cancel(id: string): Promise<CancelBroadcastResponse>;
|
|
1855
1692
|
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
@@ -1972,11 +1809,10 @@ declare class Emails {
|
|
|
1972
1809
|
list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
|
|
1973
1810
|
update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
|
|
1974
1811
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1975
|
-
metrics(options?: GetEmailsMetricsOptions): Promise<GetEmailsMetricsResponse>;
|
|
1976
1812
|
}
|
|
1977
1813
|
//#endregion
|
|
1978
1814
|
//#region src/events/events.d.ts
|
|
1979
|
-
declare class Events
|
|
1815
|
+
declare class Events {
|
|
1980
1816
|
private readonly resend;
|
|
1981
1817
|
constructor(resend: Resend);
|
|
1982
1818
|
send(payload: SendEventOptions): Promise<SendEventResponse>;
|
|
@@ -2013,60 +1849,6 @@ interface CreateSegmentResponseSuccess extends Pick<Segment, 'name' | 'id'> {
|
|
|
2013
1849
|
}
|
|
2014
1850
|
type CreateSegmentResponse = Response<CreateSegmentResponseSuccess>;
|
|
2015
1851
|
//#endregion
|
|
2016
|
-
//#region src/segments/interfaces/get-metrics.interface.d.ts
|
|
2017
|
-
type SegmentMetric = 'all_contacts' | 'subscribers' | 'unsubscribers';
|
|
2018
|
-
type SegmentMetricsDimension = 'segment';
|
|
2019
|
-
type SegmentMetricsSortBy = 'date' | SegmentMetric;
|
|
2020
|
-
type SegmentMetricsSortOrder = 'asc' | 'desc';
|
|
2021
|
-
type GetSegmentsMetricsOptions = {
|
|
2022
|
-
/**
|
|
2023
|
-
* The metrics to include in the response. Defaults to all metrics.
|
|
2024
|
-
*
|
|
2025
|
-
* @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
|
|
2026
|
-
*/
|
|
2027
|
-
metrics?: SegmentMetric[];
|
|
2028
|
-
/**
|
|
2029
|
-
* The dimensions to break `data` down by. Defaults to `[]`, which returns
|
|
2030
|
-
* only `totals` with no `data`.
|
|
2031
|
-
*/
|
|
2032
|
-
dimensions?: SegmentMetricsDimension[];
|
|
2033
|
-
filter?: {
|
|
2034
|
-
/**
|
|
2035
|
-
* Restrict `totals` (and `data`, when requested) to these segment IDs,
|
|
2036
|
-
* without double-counting contacts that belong to more than one.
|
|
2037
|
-
*/
|
|
2038
|
-
segmentId?: string[];
|
|
2039
|
-
};
|
|
2040
|
-
/**
|
|
2041
|
-
* What to sort the segment breakdown by: `date` (each segment's creation
|
|
2042
|
-
* date), or a metric key to sort by that value instead. Only applies to
|
|
2043
|
-
* `data` (when `dimensions` includes `segment`) — `totals` ignores sort
|
|
2044
|
-
* params. Defaults to `date`.
|
|
2045
|
-
*
|
|
2046
|
-
* @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
|
|
2047
|
-
*/
|
|
2048
|
-
sortBy?: SegmentMetricsSortBy;
|
|
2049
|
-
/**
|
|
2050
|
-
* The sort direction for `sortBy`. Defaults to `desc`.
|
|
2051
|
-
*/
|
|
2052
|
-
sortOrder?: SegmentMetricsSortOrder;
|
|
2053
|
-
};
|
|
2054
|
-
type SegmentMetricsTotals = Partial<Record<SegmentMetric, number>>;
|
|
2055
|
-
type SegmentMetricsDataRow = SegmentMetricsTotals & {
|
|
2056
|
-
segment_id: string;
|
|
2057
|
-
segment_name: string;
|
|
2058
|
-
};
|
|
2059
|
-
interface GetSegmentsMetricsResponseSuccess {
|
|
2060
|
-
object: 'segments_metrics';
|
|
2061
|
-
metrics: SegmentMetric[];
|
|
2062
|
-
dimensions: SegmentMetricsDimension[];
|
|
2063
|
-
sort_by: SegmentMetricsSortBy;
|
|
2064
|
-
sort_order: SegmentMetricsSortOrder;
|
|
2065
|
-
totals: SegmentMetricsTotals;
|
|
2066
|
-
data?: SegmentMetricsDataRow[];
|
|
2067
|
-
}
|
|
2068
|
-
type GetSegmentsMetricsResponse = Response<GetSegmentsMetricsResponseSuccess>;
|
|
2069
|
-
//#endregion
|
|
2070
1852
|
//#region src/segments/interfaces/get-segment.interface.d.ts
|
|
2071
1853
|
interface GetSegmentResponseSuccess extends Pick<Segment, 'id' | 'name' | 'created_at'> {
|
|
2072
1854
|
object: 'segment';
|
|
@@ -2097,7 +1879,6 @@ declare class Segments {
|
|
|
2097
1879
|
list(options?: ListSegmentsOptions): Promise<ListSegmentsResponse>;
|
|
2098
1880
|
get(id: string): Promise<GetSegmentResponse>;
|
|
2099
1881
|
remove(id: string): Promise<RemoveSegmentResponse>;
|
|
2100
|
-
metrics(options?: GetSegmentsMetricsOptions): Promise<GetSegmentsMetricsResponse>;
|
|
2101
1882
|
}
|
|
2102
1883
|
//#endregion
|
|
2103
1884
|
//#region src/suppressions/batch/interfaces/batch-add-suppressions.interface.d.ts
|
|
@@ -2372,86 +2153,6 @@ declare class Topics {
|
|
|
2372
2153
|
remove(id: string): Promise<RemoveTopicResponse>;
|
|
2373
2154
|
}
|
|
2374
2155
|
//#endregion
|
|
2375
|
-
//#region src/usage/interfaces/get-usage.interface.d.ts
|
|
2376
|
-
type GetUsageResponseSuccess = {
|
|
2377
|
-
object: 'usage';
|
|
2378
|
-
generated_at: string;
|
|
2379
|
-
emails: {
|
|
2380
|
-
daily: {
|
|
2381
|
-
used: number;
|
|
2382
|
-
limit: number | null;
|
|
2383
|
-
sent: number;
|
|
2384
|
-
received: number;
|
|
2385
|
-
resets_at: string;
|
|
2386
|
-
};
|
|
2387
|
-
monthly: {
|
|
2388
|
-
used: number;
|
|
2389
|
-
limit: number;
|
|
2390
|
-
sent: number;
|
|
2391
|
-
received: number;
|
|
2392
|
-
resets_at: string;
|
|
2393
|
-
};
|
|
2394
|
-
};
|
|
2395
|
-
contacts: {
|
|
2396
|
-
used: number;
|
|
2397
|
-
limit: number;
|
|
2398
|
-
};
|
|
2399
|
-
segments: {
|
|
2400
|
-
used: number;
|
|
2401
|
-
limit: number | null;
|
|
2402
|
-
};
|
|
2403
|
-
broadcasts: {
|
|
2404
|
-
used: number;
|
|
2405
|
-
limit: null;
|
|
2406
|
-
};
|
|
2407
|
-
ai_credits: {
|
|
2408
|
-
used: number;
|
|
2409
|
-
limit: number;
|
|
2410
|
-
next_increase_at: string | null;
|
|
2411
|
-
};
|
|
2412
|
-
automation_runs: {
|
|
2413
|
-
used: number;
|
|
2414
|
-
limit: number;
|
|
2415
|
-
resets_at: string;
|
|
2416
|
-
};
|
|
2417
|
-
domains: {
|
|
2418
|
-
used: number;
|
|
2419
|
-
limit: number | null;
|
|
2420
|
-
};
|
|
2421
|
-
rate_limit: {
|
|
2422
|
-
limit: number;
|
|
2423
|
-
duration: string;
|
|
2424
|
-
};
|
|
2425
|
-
};
|
|
2426
|
-
type GetUsageResponse = Response<GetUsageResponseSuccess>;
|
|
2427
|
-
//#endregion
|
|
2428
|
-
//#region src/usage/usage.d.ts
|
|
2429
|
-
declare class Usage {
|
|
2430
|
-
private readonly resend;
|
|
2431
|
-
constructor(resend: Resend);
|
|
2432
|
-
get(): Promise<GetUsageResponse>;
|
|
2433
|
-
}
|
|
2434
|
-
//#endregion
|
|
2435
|
-
//#region src/webhooks/interfaces/list-webhook-events.interface.d.ts
|
|
2436
|
-
type WebhookEventLogStatus = 'success' | 'pending' | 'failed' | 'attempting';
|
|
2437
|
-
interface WebhookEventLog {
|
|
2438
|
-
id: string;
|
|
2439
|
-
type: string;
|
|
2440
|
-
created_at: string;
|
|
2441
|
-
status: WebhookEventLogStatus;
|
|
2442
|
-
}
|
|
2443
|
-
type ListWebhookEventsOptions = {
|
|
2444
|
-
webhookId: string;
|
|
2445
|
-
limit?: number;
|
|
2446
|
-
after?: string;
|
|
2447
|
-
};
|
|
2448
|
-
type ListWebhookEventsResponseSuccess = {
|
|
2449
|
-
object: 'list';
|
|
2450
|
-
has_more: boolean;
|
|
2451
|
-
data: WebhookEventLog[];
|
|
2452
|
-
};
|
|
2453
|
-
type ListWebhookEventsResponse = Response<ListWebhookEventsResponseSuccess>;
|
|
2454
|
-
//#endregion
|
|
2455
2156
|
//#region src/webhooks/interfaces/webhook-event.interface.d.ts
|
|
2456
2157
|
type WebhookEvent = 'email.sent' | 'email.scheduled' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'email.suppressed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'domain.created' | 'domain.updated' | 'domain.deleted' | 'suppression.added' | 'suppression.removed';
|
|
2457
2158
|
interface BaseEmailEventData {
|
|
@@ -2642,58 +2343,6 @@ interface SuppressionRemovedEvent {
|
|
|
2642
2343
|
}
|
|
2643
2344
|
type WebhookEventPayload = EmailSentEvent | EmailScheduledEvent | EmailDeliveredEvent | EmailDeliveryDelayedEvent | EmailComplainedEvent | EmailBouncedEvent | EmailOpenedEvent | EmailClickedEvent | EmailReceivedEvent | EmailFailedEvent | EmailSuppressedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | DomainCreatedEvent | DomainUpdatedEvent | DomainDeletedEvent | SuppressionAddedEvent | SuppressionRemovedEvent;
|
|
2644
2345
|
//#endregion
|
|
2645
|
-
//#region src/webhooks/interfaces/get-webhook-event.interface.d.ts
|
|
2646
|
-
interface GetWebhookEventOptions {
|
|
2647
|
-
webhookId: string;
|
|
2648
|
-
eventId: string;
|
|
2649
|
-
}
|
|
2650
|
-
interface GetWebhookEventResponseSuccess {
|
|
2651
|
-
object: 'webhook_event';
|
|
2652
|
-
id: string;
|
|
2653
|
-
type: WebhookEvent;
|
|
2654
|
-
created_at: string;
|
|
2655
|
-
status: WebhookEventLogStatus;
|
|
2656
|
-
next_attempt_at: string | null;
|
|
2657
|
-
payload: WebhookEventPayload;
|
|
2658
|
-
}
|
|
2659
|
-
type GetWebhookEventResponse = Response<GetWebhookEventResponseSuccess>;
|
|
2660
|
-
//#endregion
|
|
2661
|
-
//#region src/webhooks/interfaces/list-webhook-event-attempts.interface.d.ts
|
|
2662
|
-
interface WebhookEventAttempt {
|
|
2663
|
-
id: string;
|
|
2664
|
-
http_status_code: number;
|
|
2665
|
-
response: string;
|
|
2666
|
-
sent_at: string;
|
|
2667
|
-
}
|
|
2668
|
-
type ListWebhookEventAttemptsOptions = {
|
|
2669
|
-
webhookId: string;
|
|
2670
|
-
eventId: string;
|
|
2671
|
-
limit?: number;
|
|
2672
|
-
after?: string;
|
|
2673
|
-
};
|
|
2674
|
-
type ListWebhookEventAttemptsResponseSuccess = {
|
|
2675
|
-
object: 'list';
|
|
2676
|
-
has_more: boolean;
|
|
2677
|
-
data: WebhookEventAttempt[];
|
|
2678
|
-
};
|
|
2679
|
-
type ListWebhookEventAttemptsResponse = Response<ListWebhookEventAttemptsResponseSuccess>;
|
|
2680
|
-
//#endregion
|
|
2681
|
-
//#region src/webhooks/events/attempts/attempts.d.ts
|
|
2682
|
-
declare class Attempts {
|
|
2683
|
-
private readonly resend;
|
|
2684
|
-
constructor(resend: Resend);
|
|
2685
|
-
list(options: ListWebhookEventAttemptsOptions): Promise<ListWebhookEventAttemptsResponse>;
|
|
2686
|
-
}
|
|
2687
|
-
//#endregion
|
|
2688
|
-
//#region src/webhooks/events/events.d.ts
|
|
2689
|
-
declare class Events {
|
|
2690
|
-
private readonly resend;
|
|
2691
|
-
readonly attempts: Attempts;
|
|
2692
|
-
constructor(resend: Resend);
|
|
2693
|
-
list(options: ListWebhookEventsOptions): Promise<ListWebhookEventsResponse>;
|
|
2694
|
-
get(options: GetWebhookEventOptions): Promise<GetWebhookEventResponse>;
|
|
2695
|
-
}
|
|
2696
|
-
//#endregion
|
|
2697
2346
|
//#region src/webhooks/interfaces/create-webhook-options.interface.d.ts
|
|
2698
2347
|
interface CreateWebhookOptions {
|
|
2699
2348
|
endpoint: string;
|
|
@@ -2767,7 +2416,6 @@ interface VerifyWebhookOptions {
|
|
|
2767
2416
|
}
|
|
2768
2417
|
declare class Webhooks {
|
|
2769
2418
|
private readonly resend;
|
|
2770
|
-
readonly events: Events;
|
|
2771
2419
|
constructor(resend: Resend);
|
|
2772
2420
|
create(payload: CreateWebhookOptions, options?: CreateWebhookRequestOptions): Promise<CreateWebhookResponse>;
|
|
2773
2421
|
get(id: string): Promise<GetWebhookResponse>;
|
|
@@ -2800,13 +2448,12 @@ declare class Resend {
|
|
|
2800
2448
|
readonly contacts: Contacts;
|
|
2801
2449
|
readonly domains: Domains;
|
|
2802
2450
|
readonly emails: Emails;
|
|
2803
|
-
readonly events: Events
|
|
2451
|
+
readonly events: Events;
|
|
2804
2452
|
readonly logs: Logs;
|
|
2805
2453
|
readonly oauthGrants: OAuthGrants;
|
|
2806
2454
|
readonly suppressions: Suppressions;
|
|
2807
2455
|
readonly templates: Templates;
|
|
2808
2456
|
readonly topics: Topics;
|
|
2809
|
-
readonly usage: Usage;
|
|
2810
2457
|
readonly webhooks: Webhooks;
|
|
2811
2458
|
constructor(key?: string | undefined, options?: ResendOptions);
|
|
2812
2459
|
private logError;
|
|
@@ -2818,4 +2465,4 @@ declare class Resend {
|
|
|
2818
2465
|
delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
|
|
2819
2466
|
}
|
|
2820
2467
|
//#endregion
|
|
2821
|
-
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, 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, 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, GetWebhookEventOptions, GetWebhookEventResponse, GetWebhookEventResponseSuccess, 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, ListWebhookEventAttemptsOptions, ListWebhookEventAttemptsResponse, ListWebhookEventAttemptsResponseSuccess, ListWebhookEventsOptions, ListWebhookEventsResponse, ListWebhookEventsResponseSuccess, 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, WebhookEventAttempt, WebhookEventLog, WebhookEventLogStatus, WebhookEventPayload };
|
|
2468
|
+
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, 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, 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
|
@@ -813,82 +813,6 @@ interface GetBroadcastResponseSuccess extends Broadcast {
|
|
|
813
813
|
}
|
|
814
814
|
type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;
|
|
815
815
|
//#endregion
|
|
816
|
-
//#region src/broadcasts/interfaces/get-broadcast-metrics.interface.d.ts
|
|
817
|
-
interface BroadcastMetricCounter {
|
|
818
|
-
total: number;
|
|
819
|
-
percentage: number;
|
|
820
|
-
}
|
|
821
|
-
interface BroadcastMetricsClickedLink {
|
|
822
|
-
url: string;
|
|
823
|
-
clicks: number;
|
|
824
|
-
unique_clicks: number;
|
|
825
|
-
percentage: number;
|
|
826
|
-
}
|
|
827
|
-
interface GetBroadcastMetricsResponseSuccess {
|
|
828
|
-
object: 'broadcast_metrics';
|
|
829
|
-
broadcast_id: string;
|
|
830
|
-
status: Broadcast['status'];
|
|
831
|
-
created_at: string;
|
|
832
|
-
scheduled_at: string | null;
|
|
833
|
-
sent_at: string | null;
|
|
834
|
-
total: number;
|
|
835
|
-
sent: number;
|
|
836
|
-
remaining: number;
|
|
837
|
-
delivered: BroadcastMetricCounter;
|
|
838
|
-
opened: BroadcastMetricCounter;
|
|
839
|
-
clicked: BroadcastMetricCounter;
|
|
840
|
-
unsubscribed: BroadcastMetricCounter;
|
|
841
|
-
bounced: BroadcastMetricCounter;
|
|
842
|
-
complained: BroadcastMetricCounter;
|
|
843
|
-
suppressed: BroadcastMetricCounter;
|
|
844
|
-
clicked_links: BroadcastMetricsClickedLink[];
|
|
845
|
-
}
|
|
846
|
-
type GetBroadcastMetricsResponse = Response<GetBroadcastMetricsResponseSuccess>;
|
|
847
|
-
//#endregion
|
|
848
|
-
//#region src/broadcasts/interfaces/list-broadcast-recipients.interface.d.ts
|
|
849
|
-
type BroadcastRecipientEventType = 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
|
|
850
|
-
type BroadcastRecipientBounceType = 'permanent' | 'transient' | 'undetermined';
|
|
851
|
-
type ListBroadcastRecipientsOptions<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginationOptions & {
|
|
852
|
-
type: T;
|
|
853
|
-
email?: string;
|
|
854
|
-
bounceType?: T extends 'bounced' ? BroadcastRecipientBounceType : never;
|
|
855
|
-
};
|
|
856
|
-
interface BroadcastRecipientClickedLink {
|
|
857
|
-
url: string;
|
|
858
|
-
clicks: number;
|
|
859
|
-
}
|
|
860
|
-
type BroadcastRecipientBase = {
|
|
861
|
-
id: string;
|
|
862
|
-
contact_id: string | null;
|
|
863
|
-
email: string;
|
|
864
|
-
};
|
|
865
|
-
type BroadcastRecipientLoose = BroadcastRecipientBase & {
|
|
866
|
-
count?: number;
|
|
867
|
-
clicked_links?: BroadcastRecipientClickedLink[];
|
|
868
|
-
bounce_type?: BroadcastRecipientBounceType;
|
|
869
|
-
};
|
|
870
|
-
type IsUnion<T, B = T> = T extends B ? ([B] extends [T] ? false : true) : never;
|
|
871
|
-
type BroadcastRecipientFieldsByType = {
|
|
872
|
-
sent: unknown;
|
|
873
|
-
delivered: unknown;
|
|
874
|
-
opened: {
|
|
875
|
-
count: number;
|
|
876
|
-
};
|
|
877
|
-
clicked: {
|
|
878
|
-
count: number;
|
|
879
|
-
clicked_links: BroadcastRecipientClickedLink[];
|
|
880
|
-
};
|
|
881
|
-
bounced: {
|
|
882
|
-
bounce_type: BroadcastRecipientBounceType;
|
|
883
|
-
};
|
|
884
|
-
complained: unknown;
|
|
885
|
-
unsubscribed: unknown;
|
|
886
|
-
suppressed: unknown;
|
|
887
|
-
};
|
|
888
|
-
type BroadcastRecipient<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = IsUnion<T> extends true ? BroadcastRecipientLoose : BroadcastRecipientBase & BroadcastRecipientFieldsByType[T];
|
|
889
|
-
type ListBroadcastRecipientsResponseSuccess<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginatedData<BroadcastRecipient<T>[]>;
|
|
890
|
-
type ListBroadcastRecipientsResponse<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = Response<ListBroadcastRecipientsResponseSuccess<T>>;
|
|
891
|
-
//#endregion
|
|
892
816
|
//#region src/broadcasts/interfaces/list-broadcasts.interface.d.ts
|
|
893
817
|
type ListBroadcastsOptions = PaginationOptions;
|
|
894
818
|
type ListBroadcastsResponseSuccess = {
|
|
@@ -1479,91 +1403,6 @@ interface GetEmailResponseSuccess {
|
|
|
1479
1403
|
}
|
|
1480
1404
|
type GetEmailResponse = Response<GetEmailResponseSuccess>;
|
|
1481
1405
|
//#endregion
|
|
1482
|
-
//#region src/emails/interfaces/get-metrics.interface.d.ts
|
|
1483
|
-
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';
|
|
1484
|
-
type EmailMetricsDimension = 'period' | 'domain' | 'email';
|
|
1485
|
-
type EmailMetricsGranularity = 'hourly' | 'daily' | 'weekly' | 'monthly';
|
|
1486
|
-
type EmailMetricsSortBy = 'date' | EmailMetric;
|
|
1487
|
-
type EmailMetricsSortOrder = 'asc' | 'desc';
|
|
1488
|
-
type GetEmailsMetricsOptions = {
|
|
1489
|
-
/**
|
|
1490
|
-
* The start of the date range, as an ISO 8601 date or datetime.
|
|
1491
|
-
* Defaults to 6 days before `endDate`.
|
|
1492
|
-
*
|
|
1493
|
-
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1494
|
-
*/
|
|
1495
|
-
startDate?: string;
|
|
1496
|
-
/**
|
|
1497
|
-
* The end of the date range, as an ISO 8601 date or datetime.
|
|
1498
|
-
* Defaults to now.
|
|
1499
|
-
*
|
|
1500
|
-
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1501
|
-
*/
|
|
1502
|
-
endDate?: string;
|
|
1503
|
-
/**
|
|
1504
|
-
* The IANA timezone used to bucket periods when `period` is in `dimensions`.
|
|
1505
|
-
* Defaults to `UTC`.
|
|
1506
|
-
*/
|
|
1507
|
-
timezone?: string;
|
|
1508
|
-
/**
|
|
1509
|
-
* The bucket size used when `period` is in `dimensions`.
|
|
1510
|
-
* Defaults to `daily`.
|
|
1511
|
-
*/
|
|
1512
|
-
granularity?: EmailMetricsGranularity;
|
|
1513
|
-
/**
|
|
1514
|
-
* The metrics to include in the response. Defaults to all metrics.
|
|
1515
|
-
*/
|
|
1516
|
-
metrics?: EmailMetric[];
|
|
1517
|
-
/**
|
|
1518
|
-
* The dimensions to break the response down by. Defaults to `[]`, which
|
|
1519
|
-
* returns a single `totals` row for the whole range, with no `data`.
|
|
1520
|
-
*/
|
|
1521
|
-
dimensions?: EmailMetricsDimension[];
|
|
1522
|
-
filter?: {
|
|
1523
|
-
/**
|
|
1524
|
-
* Restrict the response to these sending domain IDs.
|
|
1525
|
-
*/
|
|
1526
|
-
domainId?: string[];
|
|
1527
|
-
/**
|
|
1528
|
-
* Restrict the response to these email IDs. Cannot be combined with the
|
|
1529
|
-
* `domain` dimension.
|
|
1530
|
-
*/
|
|
1531
|
-
emailId?: string[];
|
|
1532
|
-
};
|
|
1533
|
-
/**
|
|
1534
|
-
* What to sort `data` by. Defaults to `date` when `dimensions` includes
|
|
1535
|
-
* `period`, or `sent` otherwise.
|
|
1536
|
-
*
|
|
1537
|
-
* @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
|
|
1538
|
-
*/
|
|
1539
|
-
sortBy?: EmailMetricsSortBy;
|
|
1540
|
-
/**
|
|
1541
|
-
* The sort direction for `sortBy`. Defaults to `asc` when `dimensions`
|
|
1542
|
-
* includes `period`, `desc` otherwise.
|
|
1543
|
-
*/
|
|
1544
|
-
sortOrder?: EmailMetricsSortOrder;
|
|
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
|
-
};
|
|
1553
|
-
interface GetEmailsMetricsResponseSuccess {
|
|
1554
|
-
object: 'metrics';
|
|
1555
|
-
start_date: string;
|
|
1556
|
-
end_date: string;
|
|
1557
|
-
metrics: EmailMetric[];
|
|
1558
|
-
dimensions: EmailMetricsDimension[];
|
|
1559
|
-
granularity: EmailMetricsGranularity;
|
|
1560
|
-
sort_by: EmailMetricsSortBy;
|
|
1561
|
-
sort_order: EmailMetricsSortOrder;
|
|
1562
|
-
totals: EmailMetricsTotals;
|
|
1563
|
-
data?: EmailMetricsDataRow[];
|
|
1564
|
-
}
|
|
1565
|
-
type GetEmailsMetricsResponse = Response<GetEmailsMetricsResponseSuccess>;
|
|
1566
|
-
//#endregion
|
|
1567
1406
|
//#region src/emails/interfaces/list-emails-options.interface.d.ts
|
|
1568
1407
|
type ListEmailsOptions = PaginationOptions;
|
|
1569
1408
|
type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
|
|
@@ -1848,8 +1687,6 @@ declare class Broadcasts {
|
|
|
1848
1687
|
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
1849
1688
|
list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
|
|
1850
1689
|
get(id: string): Promise<GetBroadcastResponse>;
|
|
1851
|
-
metrics(id: string): Promise<GetBroadcastMetricsResponse>;
|
|
1852
|
-
recipients<T extends BroadcastRecipientEventType>(id: string, options: ListBroadcastRecipientsOptions<T>): Promise<ListBroadcastRecipientsResponse<T>>;
|
|
1853
1690
|
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
1854
1691
|
cancel(id: string): Promise<CancelBroadcastResponse>;
|
|
1855
1692
|
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
@@ -1972,11 +1809,10 @@ declare class Emails {
|
|
|
1972
1809
|
list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
|
|
1973
1810
|
update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
|
|
1974
1811
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1975
|
-
metrics(options?: GetEmailsMetricsOptions): Promise<GetEmailsMetricsResponse>;
|
|
1976
1812
|
}
|
|
1977
1813
|
//#endregion
|
|
1978
1814
|
//#region src/events/events.d.ts
|
|
1979
|
-
declare class Events
|
|
1815
|
+
declare class Events {
|
|
1980
1816
|
private readonly resend;
|
|
1981
1817
|
constructor(resend: Resend);
|
|
1982
1818
|
send(payload: SendEventOptions): Promise<SendEventResponse>;
|
|
@@ -2013,60 +1849,6 @@ interface CreateSegmentResponseSuccess extends Pick<Segment, 'name' | 'id'> {
|
|
|
2013
1849
|
}
|
|
2014
1850
|
type CreateSegmentResponse = Response<CreateSegmentResponseSuccess>;
|
|
2015
1851
|
//#endregion
|
|
2016
|
-
//#region src/segments/interfaces/get-metrics.interface.d.ts
|
|
2017
|
-
type SegmentMetric = 'all_contacts' | 'subscribers' | 'unsubscribers';
|
|
2018
|
-
type SegmentMetricsDimension = 'segment';
|
|
2019
|
-
type SegmentMetricsSortBy = 'date' | SegmentMetric;
|
|
2020
|
-
type SegmentMetricsSortOrder = 'asc' | 'desc';
|
|
2021
|
-
type GetSegmentsMetricsOptions = {
|
|
2022
|
-
/**
|
|
2023
|
-
* The metrics to include in the response. Defaults to all metrics.
|
|
2024
|
-
*
|
|
2025
|
-
* @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
|
|
2026
|
-
*/
|
|
2027
|
-
metrics?: SegmentMetric[];
|
|
2028
|
-
/**
|
|
2029
|
-
* The dimensions to break `data` down by. Defaults to `[]`, which returns
|
|
2030
|
-
* only `totals` with no `data`.
|
|
2031
|
-
*/
|
|
2032
|
-
dimensions?: SegmentMetricsDimension[];
|
|
2033
|
-
filter?: {
|
|
2034
|
-
/**
|
|
2035
|
-
* Restrict `totals` (and `data`, when requested) to these segment IDs,
|
|
2036
|
-
* without double-counting contacts that belong to more than one.
|
|
2037
|
-
*/
|
|
2038
|
-
segmentId?: string[];
|
|
2039
|
-
};
|
|
2040
|
-
/**
|
|
2041
|
-
* What to sort the segment breakdown by: `date` (each segment's creation
|
|
2042
|
-
* date), or a metric key to sort by that value instead. Only applies to
|
|
2043
|
-
* `data` (when `dimensions` includes `segment`) — `totals` ignores sort
|
|
2044
|
-
* params. Defaults to `date`.
|
|
2045
|
-
*
|
|
2046
|
-
* @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
|
|
2047
|
-
*/
|
|
2048
|
-
sortBy?: SegmentMetricsSortBy;
|
|
2049
|
-
/**
|
|
2050
|
-
* The sort direction for `sortBy`. Defaults to `desc`.
|
|
2051
|
-
*/
|
|
2052
|
-
sortOrder?: SegmentMetricsSortOrder;
|
|
2053
|
-
};
|
|
2054
|
-
type SegmentMetricsTotals = Partial<Record<SegmentMetric, number>>;
|
|
2055
|
-
type SegmentMetricsDataRow = SegmentMetricsTotals & {
|
|
2056
|
-
segment_id: string;
|
|
2057
|
-
segment_name: string;
|
|
2058
|
-
};
|
|
2059
|
-
interface GetSegmentsMetricsResponseSuccess {
|
|
2060
|
-
object: 'segments_metrics';
|
|
2061
|
-
metrics: SegmentMetric[];
|
|
2062
|
-
dimensions: SegmentMetricsDimension[];
|
|
2063
|
-
sort_by: SegmentMetricsSortBy;
|
|
2064
|
-
sort_order: SegmentMetricsSortOrder;
|
|
2065
|
-
totals: SegmentMetricsTotals;
|
|
2066
|
-
data?: SegmentMetricsDataRow[];
|
|
2067
|
-
}
|
|
2068
|
-
type GetSegmentsMetricsResponse = Response<GetSegmentsMetricsResponseSuccess>;
|
|
2069
|
-
//#endregion
|
|
2070
1852
|
//#region src/segments/interfaces/get-segment.interface.d.ts
|
|
2071
1853
|
interface GetSegmentResponseSuccess extends Pick<Segment, 'id' | 'name' | 'created_at'> {
|
|
2072
1854
|
object: 'segment';
|
|
@@ -2097,7 +1879,6 @@ declare class Segments {
|
|
|
2097
1879
|
list(options?: ListSegmentsOptions): Promise<ListSegmentsResponse>;
|
|
2098
1880
|
get(id: string): Promise<GetSegmentResponse>;
|
|
2099
1881
|
remove(id: string): Promise<RemoveSegmentResponse>;
|
|
2100
|
-
metrics(options?: GetSegmentsMetricsOptions): Promise<GetSegmentsMetricsResponse>;
|
|
2101
1882
|
}
|
|
2102
1883
|
//#endregion
|
|
2103
1884
|
//#region src/suppressions/batch/interfaces/batch-add-suppressions.interface.d.ts
|
|
@@ -2372,86 +2153,6 @@ declare class Topics {
|
|
|
2372
2153
|
remove(id: string): Promise<RemoveTopicResponse>;
|
|
2373
2154
|
}
|
|
2374
2155
|
//#endregion
|
|
2375
|
-
//#region src/usage/interfaces/get-usage.interface.d.ts
|
|
2376
|
-
type GetUsageResponseSuccess = {
|
|
2377
|
-
object: 'usage';
|
|
2378
|
-
generated_at: string;
|
|
2379
|
-
emails: {
|
|
2380
|
-
daily: {
|
|
2381
|
-
used: number;
|
|
2382
|
-
limit: number | null;
|
|
2383
|
-
sent: number;
|
|
2384
|
-
received: number;
|
|
2385
|
-
resets_at: string;
|
|
2386
|
-
};
|
|
2387
|
-
monthly: {
|
|
2388
|
-
used: number;
|
|
2389
|
-
limit: number;
|
|
2390
|
-
sent: number;
|
|
2391
|
-
received: number;
|
|
2392
|
-
resets_at: string;
|
|
2393
|
-
};
|
|
2394
|
-
};
|
|
2395
|
-
contacts: {
|
|
2396
|
-
used: number;
|
|
2397
|
-
limit: number;
|
|
2398
|
-
};
|
|
2399
|
-
segments: {
|
|
2400
|
-
used: number;
|
|
2401
|
-
limit: number | null;
|
|
2402
|
-
};
|
|
2403
|
-
broadcasts: {
|
|
2404
|
-
used: number;
|
|
2405
|
-
limit: null;
|
|
2406
|
-
};
|
|
2407
|
-
ai_credits: {
|
|
2408
|
-
used: number;
|
|
2409
|
-
limit: number;
|
|
2410
|
-
next_increase_at: string | null;
|
|
2411
|
-
};
|
|
2412
|
-
automation_runs: {
|
|
2413
|
-
used: number;
|
|
2414
|
-
limit: number;
|
|
2415
|
-
resets_at: string;
|
|
2416
|
-
};
|
|
2417
|
-
domains: {
|
|
2418
|
-
used: number;
|
|
2419
|
-
limit: number | null;
|
|
2420
|
-
};
|
|
2421
|
-
rate_limit: {
|
|
2422
|
-
limit: number;
|
|
2423
|
-
duration: string;
|
|
2424
|
-
};
|
|
2425
|
-
};
|
|
2426
|
-
type GetUsageResponse = Response<GetUsageResponseSuccess>;
|
|
2427
|
-
//#endregion
|
|
2428
|
-
//#region src/usage/usage.d.ts
|
|
2429
|
-
declare class Usage {
|
|
2430
|
-
private readonly resend;
|
|
2431
|
-
constructor(resend: Resend);
|
|
2432
|
-
get(): Promise<GetUsageResponse>;
|
|
2433
|
-
}
|
|
2434
|
-
//#endregion
|
|
2435
|
-
//#region src/webhooks/interfaces/list-webhook-events.interface.d.ts
|
|
2436
|
-
type WebhookEventLogStatus = 'success' | 'pending' | 'failed' | 'attempting';
|
|
2437
|
-
interface WebhookEventLog {
|
|
2438
|
-
id: string;
|
|
2439
|
-
type: string;
|
|
2440
|
-
created_at: string;
|
|
2441
|
-
status: WebhookEventLogStatus;
|
|
2442
|
-
}
|
|
2443
|
-
type ListWebhookEventsOptions = {
|
|
2444
|
-
webhookId: string;
|
|
2445
|
-
limit?: number;
|
|
2446
|
-
after?: string;
|
|
2447
|
-
};
|
|
2448
|
-
type ListWebhookEventsResponseSuccess = {
|
|
2449
|
-
object: 'list';
|
|
2450
|
-
has_more: boolean;
|
|
2451
|
-
data: WebhookEventLog[];
|
|
2452
|
-
};
|
|
2453
|
-
type ListWebhookEventsResponse = Response<ListWebhookEventsResponseSuccess>;
|
|
2454
|
-
//#endregion
|
|
2455
2156
|
//#region src/webhooks/interfaces/webhook-event.interface.d.ts
|
|
2456
2157
|
type WebhookEvent = 'email.sent' | 'email.scheduled' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'email.suppressed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'domain.created' | 'domain.updated' | 'domain.deleted' | 'suppression.added' | 'suppression.removed';
|
|
2457
2158
|
interface BaseEmailEventData {
|
|
@@ -2642,58 +2343,6 @@ interface SuppressionRemovedEvent {
|
|
|
2642
2343
|
}
|
|
2643
2344
|
type WebhookEventPayload = EmailSentEvent | EmailScheduledEvent | EmailDeliveredEvent | EmailDeliveryDelayedEvent | EmailComplainedEvent | EmailBouncedEvent | EmailOpenedEvent | EmailClickedEvent | EmailReceivedEvent | EmailFailedEvent | EmailSuppressedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | DomainCreatedEvent | DomainUpdatedEvent | DomainDeletedEvent | SuppressionAddedEvent | SuppressionRemovedEvent;
|
|
2644
2345
|
//#endregion
|
|
2645
|
-
//#region src/webhooks/interfaces/get-webhook-event.interface.d.ts
|
|
2646
|
-
interface GetWebhookEventOptions {
|
|
2647
|
-
webhookId: string;
|
|
2648
|
-
eventId: string;
|
|
2649
|
-
}
|
|
2650
|
-
interface GetWebhookEventResponseSuccess {
|
|
2651
|
-
object: 'webhook_event';
|
|
2652
|
-
id: string;
|
|
2653
|
-
type: WebhookEvent;
|
|
2654
|
-
created_at: string;
|
|
2655
|
-
status: WebhookEventLogStatus;
|
|
2656
|
-
next_attempt_at: string | null;
|
|
2657
|
-
payload: WebhookEventPayload;
|
|
2658
|
-
}
|
|
2659
|
-
type GetWebhookEventResponse = Response<GetWebhookEventResponseSuccess>;
|
|
2660
|
-
//#endregion
|
|
2661
|
-
//#region src/webhooks/interfaces/list-webhook-event-attempts.interface.d.ts
|
|
2662
|
-
interface WebhookEventAttempt {
|
|
2663
|
-
id: string;
|
|
2664
|
-
http_status_code: number;
|
|
2665
|
-
response: string;
|
|
2666
|
-
sent_at: string;
|
|
2667
|
-
}
|
|
2668
|
-
type ListWebhookEventAttemptsOptions = {
|
|
2669
|
-
webhookId: string;
|
|
2670
|
-
eventId: string;
|
|
2671
|
-
limit?: number;
|
|
2672
|
-
after?: string;
|
|
2673
|
-
};
|
|
2674
|
-
type ListWebhookEventAttemptsResponseSuccess = {
|
|
2675
|
-
object: 'list';
|
|
2676
|
-
has_more: boolean;
|
|
2677
|
-
data: WebhookEventAttempt[];
|
|
2678
|
-
};
|
|
2679
|
-
type ListWebhookEventAttemptsResponse = Response<ListWebhookEventAttemptsResponseSuccess>;
|
|
2680
|
-
//#endregion
|
|
2681
|
-
//#region src/webhooks/events/attempts/attempts.d.ts
|
|
2682
|
-
declare class Attempts {
|
|
2683
|
-
private readonly resend;
|
|
2684
|
-
constructor(resend: Resend);
|
|
2685
|
-
list(options: ListWebhookEventAttemptsOptions): Promise<ListWebhookEventAttemptsResponse>;
|
|
2686
|
-
}
|
|
2687
|
-
//#endregion
|
|
2688
|
-
//#region src/webhooks/events/events.d.ts
|
|
2689
|
-
declare class Events {
|
|
2690
|
-
private readonly resend;
|
|
2691
|
-
readonly attempts: Attempts;
|
|
2692
|
-
constructor(resend: Resend);
|
|
2693
|
-
list(options: ListWebhookEventsOptions): Promise<ListWebhookEventsResponse>;
|
|
2694
|
-
get(options: GetWebhookEventOptions): Promise<GetWebhookEventResponse>;
|
|
2695
|
-
}
|
|
2696
|
-
//#endregion
|
|
2697
2346
|
//#region src/webhooks/interfaces/create-webhook-options.interface.d.ts
|
|
2698
2347
|
interface CreateWebhookOptions {
|
|
2699
2348
|
endpoint: string;
|
|
@@ -2767,7 +2416,6 @@ interface VerifyWebhookOptions {
|
|
|
2767
2416
|
}
|
|
2768
2417
|
declare class Webhooks {
|
|
2769
2418
|
private readonly resend;
|
|
2770
|
-
readonly events: Events;
|
|
2771
2419
|
constructor(resend: Resend);
|
|
2772
2420
|
create(payload: CreateWebhookOptions, options?: CreateWebhookRequestOptions): Promise<CreateWebhookResponse>;
|
|
2773
2421
|
get(id: string): Promise<GetWebhookResponse>;
|
|
@@ -2800,13 +2448,12 @@ declare class Resend {
|
|
|
2800
2448
|
readonly contacts: Contacts;
|
|
2801
2449
|
readonly domains: Domains;
|
|
2802
2450
|
readonly emails: Emails;
|
|
2803
|
-
readonly events: Events
|
|
2451
|
+
readonly events: Events;
|
|
2804
2452
|
readonly logs: Logs;
|
|
2805
2453
|
readonly oauthGrants: OAuthGrants;
|
|
2806
2454
|
readonly suppressions: Suppressions;
|
|
2807
2455
|
readonly templates: Templates;
|
|
2808
2456
|
readonly topics: Topics;
|
|
2809
|
-
readonly usage: Usage;
|
|
2810
2457
|
readonly webhooks: Webhooks;
|
|
2811
2458
|
constructor(key?: string | undefined, options?: ResendOptions);
|
|
2812
2459
|
private logError;
|
|
@@ -2818,4 +2465,4 @@ declare class Resend {
|
|
|
2818
2465
|
delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
|
|
2819
2466
|
}
|
|
2820
2467
|
//#endregion
|
|
2821
|
-
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, 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, 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, GetWebhookEventOptions, GetWebhookEventResponse, GetWebhookEventResponseSuccess, 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, ListWebhookEventAttemptsOptions, ListWebhookEventAttemptsResponse, ListWebhookEventAttemptsResponseSuccess, ListWebhookEventsOptions, ListWebhookEventsResponse, ListWebhookEventsResponseSuccess, 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, WebhookEventAttempt, WebhookEventLog, WebhookEventLogStatus, WebhookEventPayload };
|
|
2468
|
+
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, 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, 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
|
|
4
|
+
var version = "6.19.0";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/common/utils/build-pagination-query.ts
|
|
7
7
|
function buildPaginationUrl(base, options) {
|
|
@@ -279,13 +279,6 @@ var Broadcasts = class {
|
|
|
279
279
|
async get(id) {
|
|
280
280
|
return await this.resend.get(`/broadcasts/${id}`);
|
|
281
281
|
}
|
|
282
|
-
async metrics(id) {
|
|
283
|
-
return await this.resend.get(`/broadcasts/${id}/metrics`);
|
|
284
|
-
}
|
|
285
|
-
async recipients(id, options) {
|
|
286
|
-
const url = `/broadcasts/${id}/recipients?${buildRecipientsQuery(options)}`;
|
|
287
|
-
return await this.resend.get(url);
|
|
288
|
-
}
|
|
289
282
|
async remove(id) {
|
|
290
283
|
return await this.resend.delete(`/broadcasts/${id}`);
|
|
291
284
|
}
|
|
@@ -308,14 +301,6 @@ var Broadcasts = class {
|
|
|
308
301
|
});
|
|
309
302
|
}
|
|
310
303
|
};
|
|
311
|
-
function buildRecipientsQuery(options) {
|
|
312
|
-
const { type, email, bounceType, ...pagination } = options;
|
|
313
|
-
const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
|
|
314
|
-
searchParams.set("type", type);
|
|
315
|
-
if (email !== void 0) searchParams.set("email", email);
|
|
316
|
-
if (bounceType !== void 0) searchParams.set("bounce_type", bounceType);
|
|
317
|
-
return searchParams.toString();
|
|
318
|
-
}
|
|
319
304
|
//#endregion
|
|
320
305
|
//#region src/common/utils/parse-contact-properties-to-api-options.ts
|
|
321
306
|
function parseContactPropertyFromApi(contactProperty) {
|
|
@@ -878,32 +863,10 @@ var Emails = class {
|
|
|
878
863
|
async cancel(id) {
|
|
879
864
|
return await this.resend.post(`/emails/${id}/cancel`);
|
|
880
865
|
}
|
|
881
|
-
async metrics(options = {}) {
|
|
882
|
-
const queryString = buildMetricsQuery$1(options);
|
|
883
|
-
const url = queryString ? `/emails/metrics?${queryString}` : "/emails/metrics";
|
|
884
|
-
return await this.resend.get(url);
|
|
885
|
-
}
|
|
886
866
|
};
|
|
887
|
-
function buildMetricsQuery$1(options) {
|
|
888
|
-
const params = {
|
|
889
|
-
start_date: options.startDate,
|
|
890
|
-
end_date: options.endDate,
|
|
891
|
-
timezone: options.timezone,
|
|
892
|
-
granularity: options.granularity,
|
|
893
|
-
metrics: options.metrics?.join(","),
|
|
894
|
-
dimensions: options.dimensions?.join(","),
|
|
895
|
-
domain_id: options.filter?.domainId?.join(","),
|
|
896
|
-
email_id: options.filter?.emailId?.join(","),
|
|
897
|
-
sort_by: options.sortBy,
|
|
898
|
-
sort_order: options.sortOrder
|
|
899
|
-
};
|
|
900
|
-
const searchParams = new URLSearchParams();
|
|
901
|
-
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
|
|
902
|
-
return searchParams.toString();
|
|
903
|
-
}
|
|
904
867
|
//#endregion
|
|
905
868
|
//#region src/events/events.ts
|
|
906
|
-
var Events
|
|
869
|
+
var Events = class {
|
|
907
870
|
constructor(resend) {
|
|
908
871
|
this.resend = resend;
|
|
909
872
|
}
|
|
@@ -974,24 +937,7 @@ var Segments = class {
|
|
|
974
937
|
async remove(id) {
|
|
975
938
|
return await this.resend.delete(`/segments/${id}`);
|
|
976
939
|
}
|
|
977
|
-
async metrics(options = {}) {
|
|
978
|
-
const queryString = buildMetricsQuery(options);
|
|
979
|
-
const url = queryString ? `/segments/metrics?${queryString}` : "/segments/metrics";
|
|
980
|
-
return await this.resend.get(url);
|
|
981
|
-
}
|
|
982
940
|
};
|
|
983
|
-
function buildMetricsQuery(options) {
|
|
984
|
-
const params = {
|
|
985
|
-
metrics: options.metrics?.join(","),
|
|
986
|
-
dimensions: options.dimensions?.join(","),
|
|
987
|
-
segment_id: options.filter?.segmentId?.join(","),
|
|
988
|
-
sort_by: options.sortBy,
|
|
989
|
-
sort_order: options.sortOrder
|
|
990
|
-
};
|
|
991
|
-
const searchParams = new URLSearchParams();
|
|
992
|
-
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
|
|
993
|
-
return searchParams.toString();
|
|
994
|
-
}
|
|
995
941
|
//#endregion
|
|
996
942
|
//#region src/suppressions/batch/batch.ts
|
|
997
943
|
var Batch = class {
|
|
@@ -1181,50 +1127,10 @@ var Topics = class {
|
|
|
1181
1127
|
}
|
|
1182
1128
|
};
|
|
1183
1129
|
//#endregion
|
|
1184
|
-
//#region src/usage/usage.ts
|
|
1185
|
-
var Usage = class {
|
|
1186
|
-
constructor(resend) {
|
|
1187
|
-
this.resend = resend;
|
|
1188
|
-
}
|
|
1189
|
-
async get() {
|
|
1190
|
-
return await this.resend.get("/usage");
|
|
1191
|
-
}
|
|
1192
|
-
};
|
|
1193
|
-
//#endregion
|
|
1194
|
-
//#region src/webhooks/events/attempts/attempts.ts
|
|
1195
|
-
var Attempts = class {
|
|
1196
|
-
constructor(resend) {
|
|
1197
|
-
this.resend = resend;
|
|
1198
|
-
}
|
|
1199
|
-
async list(options) {
|
|
1200
|
-
const { webhookId, eventId } = options;
|
|
1201
|
-
const url = buildPaginationUrl(`/webhooks/${webhookId}/events/${eventId}/attempts`, options);
|
|
1202
|
-
return await this.resend.get(url);
|
|
1203
|
-
}
|
|
1204
|
-
};
|
|
1205
|
-
//#endregion
|
|
1206
|
-
//#region src/webhooks/events/events.ts
|
|
1207
|
-
var Events = class {
|
|
1208
|
-
constructor(resend) {
|
|
1209
|
-
this.resend = resend;
|
|
1210
|
-
this.attempts = new Attempts(resend);
|
|
1211
|
-
}
|
|
1212
|
-
async list(options) {
|
|
1213
|
-
const { webhookId } = options;
|
|
1214
|
-
const url = buildPaginationUrl(`/webhooks/${webhookId}/events`, options);
|
|
1215
|
-
return await this.resend.get(url);
|
|
1216
|
-
}
|
|
1217
|
-
async get(options) {
|
|
1218
|
-
const { webhookId, eventId } = options;
|
|
1219
|
-
return await this.resend.get(`/webhooks/${webhookId}/events/${eventId}`);
|
|
1220
|
-
}
|
|
1221
|
-
};
|
|
1222
|
-
//#endregion
|
|
1223
1130
|
//#region src/webhooks/webhooks.ts
|
|
1224
1131
|
var Webhooks = class {
|
|
1225
1132
|
constructor(resend) {
|
|
1226
1133
|
this.resend = resend;
|
|
1227
|
-
this.events = new Events(resend);
|
|
1228
1134
|
}
|
|
1229
1135
|
async create(payload, options = {}) {
|
|
1230
1136
|
return await this.resend.post("/webhooks", payload, options);
|
|
@@ -1273,13 +1179,12 @@ var Resend = class {
|
|
|
1273
1179
|
this.contacts = new Contacts(this);
|
|
1274
1180
|
this.domains = new Domains(this);
|
|
1275
1181
|
this.emails = new Emails(this);
|
|
1276
|
-
this.events = new Events
|
|
1182
|
+
this.events = new Events(this);
|
|
1277
1183
|
this.logs = new Logs(this);
|
|
1278
1184
|
this.oauthGrants = new OAuthGrants(this);
|
|
1279
1185
|
this.suppressions = new Suppressions(this);
|
|
1280
1186
|
this.templates = new Templates(this);
|
|
1281
1187
|
this.topics = new Topics(this);
|
|
1282
|
-
this.usage = new Usage(this);
|
|
1283
1188
|
this.webhooks = new Webhooks(this);
|
|
1284
1189
|
if (!key) {
|
|
1285
1190
|
if (typeof process !== "undefined" && process.env) this.key = process.env.RESEND_API_KEY;
|