resend 6.19.0-preview-headless-dashboard.4 → 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 CHANGED
@@ -25,7 +25,7 @@ let postal_mime = require("postal-mime");
25
25
  postal_mime = __toESM(postal_mime);
26
26
  let standardwebhooks = require("standardwebhooks");
27
27
  //#region package.json
28
- var version = "6.19.0-preview-headless-dashboard.4";
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,16 +303,12 @@ 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
  }
309
+ async cancel(id) {
310
+ return await this.resend.post(`/broadcasts/${id}/cancel`);
311
+ }
316
312
  async update(id, payload) {
317
313
  const html = payload.react ? await render(payload.react) : payload.html;
318
314
  return await this.resend.patch(`/broadcasts/${id}`, {
@@ -329,14 +325,6 @@ var Broadcasts = class {
329
325
  });
330
326
  }
331
327
  };
332
- function buildRecipientsQuery(options) {
333
- const { type, email, bounceType, ...pagination } = options;
334
- const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
335
- searchParams.set("type", type);
336
- if (email !== void 0) searchParams.set("email", email);
337
- if (bounceType !== void 0) searchParams.set("bounce_type", bounceType);
338
- return searchParams.toString();
339
- }
340
328
  //#endregion
341
329
  //#region src/common/utils/parse-contact-properties-to-api-options.ts
342
330
  function parseContactPropertyFromApi(contactProperty) {
@@ -899,32 +887,10 @@ var Emails = class {
899
887
  async cancel(id) {
900
888
  return await this.resend.post(`/emails/${id}/cancel`);
901
889
  }
902
- async metrics(options = {}) {
903
- const queryString = buildMetricsQuery$1(options);
904
- const url = queryString ? `/emails/metrics?${queryString}` : "/emails/metrics";
905
- return await this.resend.get(url);
906
- }
907
890
  };
908
- function buildMetricsQuery$1(options) {
909
- const params = {
910
- start_date: options.startDate,
911
- end_date: options.endDate,
912
- timezone: options.timezone,
913
- granularity: options.granularity,
914
- metrics: options.metrics?.join(","),
915
- dimensions: options.dimensions?.join(","),
916
- domain_id: options.filter?.domainId?.join(","),
917
- email_id: options.filter?.emailId?.join(","),
918
- sort_by: options.sortBy,
919
- sort_order: options.sortOrder
920
- };
921
- const searchParams = new URLSearchParams();
922
- for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
923
- return searchParams.toString();
924
- }
925
891
  //#endregion
926
892
  //#region src/events/events.ts
927
- var Events$1 = class {
893
+ var Events = class {
928
894
  constructor(resend) {
929
895
  this.resend = resend;
930
896
  }
@@ -995,24 +961,7 @@ var Segments = class {
995
961
  async remove(id) {
996
962
  return await this.resend.delete(`/segments/${id}`);
997
963
  }
998
- async metrics(options = {}) {
999
- const queryString = buildMetricsQuery(options);
1000
- const url = queryString ? `/segments/metrics?${queryString}` : "/segments/metrics";
1001
- return await this.resend.get(url);
1002
- }
1003
964
  };
1004
- function buildMetricsQuery(options) {
1005
- const params = {
1006
- metrics: options.metrics?.join(","),
1007
- dimensions: options.dimensions?.join(","),
1008
- segment_id: options.filter?.segmentId?.join(","),
1009
- sort_by: options.sortBy,
1010
- sort_order: options.sortOrder
1011
- };
1012
- const searchParams = new URLSearchParams();
1013
- for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
1014
- return searchParams.toString();
1015
- }
1016
965
  //#endregion
1017
966
  //#region src/suppressions/batch/batch.ts
1018
967
  var Batch = class {
@@ -1202,50 +1151,10 @@ var Topics = class {
1202
1151
  }
1203
1152
  };
1204
1153
  //#endregion
1205
- //#region src/usage/usage.ts
1206
- var Usage = class {
1207
- constructor(resend) {
1208
- this.resend = resend;
1209
- }
1210
- async get() {
1211
- return await this.resend.get("/usage");
1212
- }
1213
- };
1214
- //#endregion
1215
- //#region src/webhooks/events/attempts/attempts.ts
1216
- var Attempts = class {
1217
- constructor(resend) {
1218
- this.resend = resend;
1219
- }
1220
- async list(options) {
1221
- const { webhookId, eventId } = options;
1222
- const url = buildPaginationUrl(`/webhooks/${webhookId}/events/${eventId}/attempts`, options);
1223
- return await this.resend.get(url);
1224
- }
1225
- };
1226
- //#endregion
1227
- //#region src/webhooks/events/events.ts
1228
- var Events = class {
1229
- constructor(resend) {
1230
- this.resend = resend;
1231
- this.attempts = new Attempts(resend);
1232
- }
1233
- async list(options) {
1234
- const { webhookId } = options;
1235
- const url = buildPaginationUrl(`/webhooks/${webhookId}/events`, options);
1236
- return await this.resend.get(url);
1237
- }
1238
- async get(options) {
1239
- const { webhookId, eventId } = options;
1240
- return await this.resend.get(`/webhooks/${webhookId}/events/${eventId}`);
1241
- }
1242
- };
1243
- //#endregion
1244
1154
  //#region src/webhooks/webhooks.ts
1245
1155
  var Webhooks = class {
1246
1156
  constructor(resend) {
1247
1157
  this.resend = resend;
1248
- this.events = new Events(resend);
1249
1158
  }
1250
1159
  async create(payload, options = {}) {
1251
1160
  return await this.resend.post("/webhooks", payload, options);
@@ -1294,13 +1203,12 @@ var Resend = class {
1294
1203
  this.contacts = new Contacts(this);
1295
1204
  this.domains = new Domains(this);
1296
1205
  this.emails = new Emails(this);
1297
- this.events = new Events$1(this);
1206
+ this.events = new Events(this);
1298
1207
  this.logs = new Logs(this);
1299
1208
  this.oauthGrants = new OAuthGrants(this);
1300
1209
  this.suppressions = new Suppressions(this);
1301
1210
  this.templates = new Templates(this);
1302
1211
  this.topics = new Topics(this);
1303
- this.usage = new Usage(this);
1304
1212
  this.webhooks = new Webhooks(this);
1305
1213
  if (!key) {
1306
1214
  if (typeof process !== "undefined" && process.env) this.key = process.env.RESEND_API_KEY;
package/dist/index.d.cts CHANGED
@@ -689,6 +689,12 @@ interface Broadcast {
689
689
  text: string | null;
690
690
  }
691
691
  //#endregion
692
+ //#region src/broadcasts/interfaces/cancel-broadcast.interface.d.ts
693
+ interface CancelBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
694
+ object: 'broadcast';
695
+ }
696
+ type CancelBroadcastResponse = Response<CancelBroadcastResponseSuccess>;
697
+ //#endregion
692
698
  //#region src/broadcasts/interfaces/create-broadcast-options.interface.d.ts
693
699
  interface EmailRenderOptions {
694
700
  /**
@@ -807,82 +813,6 @@ interface GetBroadcastResponseSuccess extends Broadcast {
807
813
  }
808
814
  type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;
809
815
  //#endregion
810
- //#region src/broadcasts/interfaces/get-broadcast-metrics.interface.d.ts
811
- interface BroadcastMetricCounter {
812
- total: number;
813
- percentage: number;
814
- }
815
- interface BroadcastMetricsClickedLink {
816
- url: string;
817
- clicks: number;
818
- unique_clicks: number;
819
- percentage: number;
820
- }
821
- interface GetBroadcastMetricsResponseSuccess {
822
- object: 'broadcast_metrics';
823
- broadcast_id: string;
824
- status: Broadcast['status'];
825
- created_at: string;
826
- scheduled_at: string | null;
827
- sent_at: string | null;
828
- total: number;
829
- sent: number;
830
- remaining: number;
831
- delivered: BroadcastMetricCounter;
832
- opened: BroadcastMetricCounter;
833
- clicked: BroadcastMetricCounter;
834
- unsubscribed: BroadcastMetricCounter;
835
- bounced: BroadcastMetricCounter;
836
- complained: BroadcastMetricCounter;
837
- suppressed: BroadcastMetricCounter;
838
- clicked_links: BroadcastMetricsClickedLink[];
839
- }
840
- type GetBroadcastMetricsResponse = Response<GetBroadcastMetricsResponseSuccess>;
841
- //#endregion
842
- //#region src/broadcasts/interfaces/list-broadcast-recipients.interface.d.ts
843
- type BroadcastRecipientEventType = 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
844
- type BroadcastRecipientBounceType = 'permanent' | 'transient' | 'undetermined';
845
- type ListBroadcastRecipientsOptions<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginationOptions & {
846
- type: T;
847
- email?: string;
848
- bounceType?: T extends 'bounced' ? BroadcastRecipientBounceType : never;
849
- };
850
- interface BroadcastRecipientClickedLink {
851
- url: string;
852
- clicks: number;
853
- }
854
- type BroadcastRecipientBase = {
855
- id: string;
856
- contact_id: string | null;
857
- email: string;
858
- };
859
- type BroadcastRecipientLoose = BroadcastRecipientBase & {
860
- count?: number;
861
- clicked_links?: BroadcastRecipientClickedLink[];
862
- bounce_type?: BroadcastRecipientBounceType;
863
- };
864
- type IsUnion<T, B = T> = T extends B ? ([B] extends [T] ? false : true) : never;
865
- type BroadcastRecipientFieldsByType = {
866
- sent: unknown;
867
- delivered: unknown;
868
- opened: {
869
- count: number;
870
- };
871
- clicked: {
872
- count: number;
873
- clicked_links: BroadcastRecipientClickedLink[];
874
- };
875
- bounced: {
876
- bounce_type: BroadcastRecipientBounceType;
877
- };
878
- complained: unknown;
879
- unsubscribed: unknown;
880
- suppressed: unknown;
881
- };
882
- type BroadcastRecipient<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = IsUnion<T> extends true ? BroadcastRecipientLoose : BroadcastRecipientBase & BroadcastRecipientFieldsByType[T];
883
- type ListBroadcastRecipientsResponseSuccess<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginatedData<BroadcastRecipient<T>[]>;
884
- type ListBroadcastRecipientsResponse<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = Response<ListBroadcastRecipientsResponseSuccess<T>>;
885
- //#endregion
886
816
  //#region src/broadcasts/interfaces/list-broadcasts.interface.d.ts
887
817
  type ListBroadcastsOptions = PaginationOptions;
888
818
  type ListBroadcastsResponseSuccess = {
@@ -1473,91 +1403,6 @@ interface GetEmailResponseSuccess {
1473
1403
  }
1474
1404
  type GetEmailResponse = Response<GetEmailResponseSuccess>;
1475
1405
  //#endregion
1476
- //#region src/emails/interfaces/get-metrics.interface.d.ts
1477
- 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';
1478
- type EmailMetricsDimension = 'period' | 'domain' | 'email';
1479
- type EmailMetricsGranularity = 'hourly' | 'daily' | 'weekly' | 'monthly';
1480
- type EmailMetricsSortBy = 'date' | EmailMetric;
1481
- type EmailMetricsSortOrder = 'asc' | 'desc';
1482
- type GetEmailsMetricsOptions = {
1483
- /**
1484
- * The start of the date range, as an ISO 8601 date or datetime.
1485
- * Defaults to 6 days before `endDate`.
1486
- *
1487
- * @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
1488
- */
1489
- startDate?: string;
1490
- /**
1491
- * The end of the date range, as an ISO 8601 date or datetime.
1492
- * Defaults to now.
1493
- *
1494
- * @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
1495
- */
1496
- endDate?: string;
1497
- /**
1498
- * The IANA timezone used to bucket periods when `period` is in `dimensions`.
1499
- * Defaults to `UTC`.
1500
- */
1501
- timezone?: string;
1502
- /**
1503
- * The bucket size used when `period` is in `dimensions`.
1504
- * Defaults to `daily`.
1505
- */
1506
- granularity?: EmailMetricsGranularity;
1507
- /**
1508
- * The metrics to include in the response. Defaults to all metrics.
1509
- */
1510
- metrics?: EmailMetric[];
1511
- /**
1512
- * The dimensions to break the response down by. Defaults to `[]`, which
1513
- * returns a single `totals` row for the whole range, with no `data`.
1514
- */
1515
- dimensions?: EmailMetricsDimension[];
1516
- filter?: {
1517
- /**
1518
- * Restrict the response to these sending domain IDs.
1519
- */
1520
- domainId?: string[];
1521
- /**
1522
- * Restrict the response to these email IDs. Cannot be combined with the
1523
- * `domain` dimension.
1524
- */
1525
- emailId?: string[];
1526
- };
1527
- /**
1528
- * What to sort `data` by. Defaults to `date` when `dimensions` includes
1529
- * `period`, or `sent` otherwise.
1530
- *
1531
- * @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
1532
- */
1533
- sortBy?: EmailMetricsSortBy;
1534
- /**
1535
- * The sort direction for `sortBy`. Defaults to `asc` when `dimensions`
1536
- * includes `period`, `desc` otherwise.
1537
- */
1538
- sortOrder?: EmailMetricsSortOrder;
1539
- };
1540
- type EmailMetricsTotals = Partial<Record<EmailMetric, number>>;
1541
- type EmailMetricsDataRow = EmailMetricsTotals & {
1542
- period?: string;
1543
- domain_id?: string;
1544
- domain_name?: string;
1545
- email_id?: string;
1546
- };
1547
- interface GetEmailsMetricsResponseSuccess {
1548
- object: 'metrics';
1549
- start_date: string;
1550
- end_date: string;
1551
- metrics: EmailMetric[];
1552
- dimensions: EmailMetricsDimension[];
1553
- granularity: EmailMetricsGranularity;
1554
- sort_by: EmailMetricsSortBy;
1555
- sort_order: EmailMetricsSortOrder;
1556
- totals: EmailMetricsTotals;
1557
- data?: EmailMetricsDataRow[];
1558
- }
1559
- type GetEmailsMetricsResponse = Response<GetEmailsMetricsResponseSuccess>;
1560
- //#endregion
1561
1406
  //#region src/emails/interfaces/list-emails-options.interface.d.ts
1562
1407
  type ListEmailsOptions = PaginationOptions;
1563
1408
  type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
@@ -1842,9 +1687,8 @@ declare class Broadcasts {
1842
1687
  send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
1843
1688
  list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
1844
1689
  get(id: string): Promise<GetBroadcastResponse>;
1845
- metrics(id: string): Promise<GetBroadcastMetricsResponse>;
1846
- recipients<T extends BroadcastRecipientEventType>(id: string, options: ListBroadcastRecipientsOptions<T>): Promise<ListBroadcastRecipientsResponse<T>>;
1847
1690
  remove(id: string): Promise<RemoveBroadcastResponse>;
1691
+ cancel(id: string): Promise<CancelBroadcastResponse>;
1848
1692
  update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
1849
1693
  }
1850
1694
  //#endregion
@@ -1965,11 +1809,10 @@ declare class Emails {
1965
1809
  list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
1966
1810
  update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
1967
1811
  cancel(id: string): Promise<CancelEmailResponse>;
1968
- metrics(options?: GetEmailsMetricsOptions): Promise<GetEmailsMetricsResponse>;
1969
1812
  }
1970
1813
  //#endregion
1971
1814
  //#region src/events/events.d.ts
1972
- declare class Events$1 {
1815
+ declare class Events {
1973
1816
  private readonly resend;
1974
1817
  constructor(resend: Resend);
1975
1818
  send(payload: SendEventOptions): Promise<SendEventResponse>;
@@ -2006,60 +1849,6 @@ interface CreateSegmentResponseSuccess extends Pick<Segment, 'name' | 'id'> {
2006
1849
  }
2007
1850
  type CreateSegmentResponse = Response<CreateSegmentResponseSuccess>;
2008
1851
  //#endregion
2009
- //#region src/segments/interfaces/get-metrics.interface.d.ts
2010
- type SegmentMetric = 'all_contacts' | 'subscribers' | 'unsubscribers';
2011
- type SegmentMetricsDimension = 'segment';
2012
- type SegmentMetricsSortBy = 'date' | SegmentMetric;
2013
- type SegmentMetricsSortOrder = 'asc' | 'desc';
2014
- type GetSegmentsMetricsOptions = {
2015
- /**
2016
- * The metrics to include in the response. Defaults to all metrics.
2017
- *
2018
- * @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
2019
- */
2020
- metrics?: SegmentMetric[];
2021
- /**
2022
- * The dimensions to break `data` down by. Defaults to `[]`, which returns
2023
- * only `totals` with no `data`.
2024
- */
2025
- dimensions?: SegmentMetricsDimension[];
2026
- filter?: {
2027
- /**
2028
- * Restrict `totals` (and `data`, when requested) to these segment IDs,
2029
- * without double-counting contacts that belong to more than one.
2030
- */
2031
- segmentId?: string[];
2032
- };
2033
- /**
2034
- * What to sort the segment breakdown by: `date` (each segment's creation
2035
- * date), or a metric key to sort by that value instead. Only applies to
2036
- * `data` (when `dimensions` includes `segment`) — `totals` ignores sort
2037
- * params. Defaults to `date`.
2038
- *
2039
- * @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
2040
- */
2041
- sortBy?: SegmentMetricsSortBy;
2042
- /**
2043
- * The sort direction for `sortBy`. Defaults to `desc`.
2044
- */
2045
- sortOrder?: SegmentMetricsSortOrder;
2046
- };
2047
- type SegmentMetricsTotals = Partial<Record<SegmentMetric, number>>;
2048
- type SegmentMetricsDataRow = SegmentMetricsTotals & {
2049
- segment_id: string;
2050
- segment_name: string;
2051
- };
2052
- interface GetSegmentsMetricsResponseSuccess {
2053
- object: 'segments_metrics';
2054
- metrics: SegmentMetric[];
2055
- dimensions: SegmentMetricsDimension[];
2056
- sort_by: SegmentMetricsSortBy;
2057
- sort_order: SegmentMetricsSortOrder;
2058
- totals: SegmentMetricsTotals;
2059
- data?: SegmentMetricsDataRow[];
2060
- }
2061
- type GetSegmentsMetricsResponse = Response<GetSegmentsMetricsResponseSuccess>;
2062
- //#endregion
2063
1852
  //#region src/segments/interfaces/get-segment.interface.d.ts
2064
1853
  interface GetSegmentResponseSuccess extends Pick<Segment, 'id' | 'name' | 'created_at'> {
2065
1854
  object: 'segment';
@@ -2090,7 +1879,6 @@ declare class Segments {
2090
1879
  list(options?: ListSegmentsOptions): Promise<ListSegmentsResponse>;
2091
1880
  get(id: string): Promise<GetSegmentResponse>;
2092
1881
  remove(id: string): Promise<RemoveSegmentResponse>;
2093
- metrics(options?: GetSegmentsMetricsOptions): Promise<GetSegmentsMetricsResponse>;
2094
1882
  }
2095
1883
  //#endregion
2096
1884
  //#region src/suppressions/batch/interfaces/batch-add-suppressions.interface.d.ts
@@ -2365,86 +2153,6 @@ declare class Topics {
2365
2153
  remove(id: string): Promise<RemoveTopicResponse>;
2366
2154
  }
2367
2155
  //#endregion
2368
- //#region src/usage/interfaces/get-usage.interface.d.ts
2369
- type GetUsageResponseSuccess = {
2370
- object: 'usage';
2371
- generated_at: string;
2372
- emails: {
2373
- daily: {
2374
- used: number;
2375
- limit: number | null;
2376
- sent: number;
2377
- received: number;
2378
- resets_at: string;
2379
- };
2380
- monthly: {
2381
- used: number;
2382
- limit: number;
2383
- sent: number;
2384
- received: number;
2385
- resets_at: string;
2386
- };
2387
- };
2388
- contacts: {
2389
- used: number;
2390
- limit: number;
2391
- };
2392
- segments: {
2393
- used: number;
2394
- limit: number | null;
2395
- };
2396
- broadcasts: {
2397
- used: number;
2398
- limit: null;
2399
- };
2400
- ai_credits: {
2401
- used: number;
2402
- limit: number;
2403
- next_increase_at: string | null;
2404
- };
2405
- automation_runs: {
2406
- used: number;
2407
- limit: number;
2408
- resets_at: string;
2409
- };
2410
- domains: {
2411
- used: number;
2412
- limit: number | null;
2413
- };
2414
- rate_limit: {
2415
- limit: number;
2416
- duration: string;
2417
- };
2418
- };
2419
- type GetUsageResponse = Response<GetUsageResponseSuccess>;
2420
- //#endregion
2421
- //#region src/usage/usage.d.ts
2422
- declare class Usage {
2423
- private readonly resend;
2424
- constructor(resend: Resend);
2425
- get(): Promise<GetUsageResponse>;
2426
- }
2427
- //#endregion
2428
- //#region src/webhooks/interfaces/list-webhook-events.interface.d.ts
2429
- type WebhookEventLogStatus = 'success' | 'pending' | 'failed' | 'attempting';
2430
- interface WebhookEventLog {
2431
- id: string;
2432
- type: string;
2433
- created_at: string;
2434
- status: WebhookEventLogStatus;
2435
- }
2436
- type ListWebhookEventsOptions = {
2437
- webhookId: string;
2438
- limit?: number;
2439
- after?: string;
2440
- };
2441
- type ListWebhookEventsResponseSuccess = {
2442
- object: 'list';
2443
- has_more: boolean;
2444
- data: WebhookEventLog[];
2445
- };
2446
- type ListWebhookEventsResponse = Response<ListWebhookEventsResponseSuccess>;
2447
- //#endregion
2448
2156
  //#region src/webhooks/interfaces/webhook-event.interface.d.ts
2449
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';
2450
2158
  interface BaseEmailEventData {
@@ -2635,58 +2343,6 @@ interface SuppressionRemovedEvent {
2635
2343
  }
2636
2344
  type WebhookEventPayload = EmailSentEvent | EmailScheduledEvent | EmailDeliveredEvent | EmailDeliveryDelayedEvent | EmailComplainedEvent | EmailBouncedEvent | EmailOpenedEvent | EmailClickedEvent | EmailReceivedEvent | EmailFailedEvent | EmailSuppressedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | DomainCreatedEvent | DomainUpdatedEvent | DomainDeletedEvent | SuppressionAddedEvent | SuppressionRemovedEvent;
2637
2345
  //#endregion
2638
- //#region src/webhooks/interfaces/get-webhook-event.interface.d.ts
2639
- interface GetWebhookEventOptions {
2640
- webhookId: string;
2641
- eventId: string;
2642
- }
2643
- interface GetWebhookEventResponseSuccess {
2644
- object: 'webhook_event';
2645
- id: string;
2646
- type: WebhookEvent;
2647
- created_at: string;
2648
- status: WebhookEventLogStatus;
2649
- next_attempt_at: string | null;
2650
- payload: WebhookEventPayload;
2651
- }
2652
- type GetWebhookEventResponse = Response<GetWebhookEventResponseSuccess>;
2653
- //#endregion
2654
- //#region src/webhooks/interfaces/list-webhook-event-attempts.interface.d.ts
2655
- interface WebhookEventAttempt {
2656
- id: string;
2657
- http_status_code: number;
2658
- response: string;
2659
- sent_at: string;
2660
- }
2661
- type ListWebhookEventAttemptsOptions = {
2662
- webhookId: string;
2663
- eventId: string;
2664
- limit?: number;
2665
- after?: string;
2666
- };
2667
- type ListWebhookEventAttemptsResponseSuccess = {
2668
- object: 'list';
2669
- has_more: boolean;
2670
- data: WebhookEventAttempt[];
2671
- };
2672
- type ListWebhookEventAttemptsResponse = Response<ListWebhookEventAttemptsResponseSuccess>;
2673
- //#endregion
2674
- //#region src/webhooks/events/attempts/attempts.d.ts
2675
- declare class Attempts {
2676
- private readonly resend;
2677
- constructor(resend: Resend);
2678
- list(options: ListWebhookEventAttemptsOptions): Promise<ListWebhookEventAttemptsResponse>;
2679
- }
2680
- //#endregion
2681
- //#region src/webhooks/events/events.d.ts
2682
- declare class Events {
2683
- private readonly resend;
2684
- readonly attempts: Attempts;
2685
- constructor(resend: Resend);
2686
- list(options: ListWebhookEventsOptions): Promise<ListWebhookEventsResponse>;
2687
- get(options: GetWebhookEventOptions): Promise<GetWebhookEventResponse>;
2688
- }
2689
- //#endregion
2690
2346
  //#region src/webhooks/interfaces/create-webhook-options.interface.d.ts
2691
2347
  interface CreateWebhookOptions {
2692
2348
  endpoint: string;
@@ -2760,7 +2416,6 @@ interface VerifyWebhookOptions {
2760
2416
  }
2761
2417
  declare class Webhooks {
2762
2418
  private readonly resend;
2763
- readonly events: Events;
2764
2419
  constructor(resend: Resend);
2765
2420
  create(payload: CreateWebhookOptions, options?: CreateWebhookRequestOptions): Promise<CreateWebhookResponse>;
2766
2421
  get(id: string): Promise<GetWebhookResponse>;
@@ -2793,13 +2448,12 @@ declare class Resend {
2793
2448
  readonly contacts: Contacts;
2794
2449
  readonly domains: Domains;
2795
2450
  readonly emails: Emails;
2796
- readonly events: Events$1;
2451
+ readonly events: Events;
2797
2452
  readonly logs: Logs;
2798
2453
  readonly oauthGrants: OAuthGrants;
2799
2454
  readonly suppressions: Suppressions;
2800
2455
  readonly templates: Templates;
2801
2456
  readonly topics: Topics;
2802
- readonly usage: Usage;
2803
2457
  readonly webhooks: Webhooks;
2804
2458
  constructor(key?: string | undefined, options?: ResendOptions);
2805
2459
  private logError;
@@ -2811,4 +2465,4 @@ declare class Resend {
2811
2465
  delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
2812
2466
  }
2813
2467
  //#endregion
2814
- export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, BroadcastMetricCounter, BroadcastMetricsClickedLink, BroadcastRecipient, BroadcastRecipientBounceType, BroadcastRecipientClickedLink, BroadcastRecipientEventType, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailMetric, EmailMetricsDataRow, EmailMetricsDimension, EmailMetricsGranularity, EmailMetricsSortBy, EmailMetricsSortOrder, EmailMetricsTotals, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastMetricsResponse, GetBroadcastMetricsResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEmailsMetricsOptions, GetEmailsMetricsResponse, GetEmailsMetricsResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSegmentsMetricsOptions, GetSegmentsMetricsResponse, GetSegmentsMetricsResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetUsageResponse, GetUsageResponseSuccess, 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
@@ -689,6 +689,12 @@ interface Broadcast {
689
689
  text: string | null;
690
690
  }
691
691
  //#endregion
692
+ //#region src/broadcasts/interfaces/cancel-broadcast.interface.d.ts
693
+ interface CancelBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
694
+ object: 'broadcast';
695
+ }
696
+ type CancelBroadcastResponse = Response<CancelBroadcastResponseSuccess>;
697
+ //#endregion
692
698
  //#region src/broadcasts/interfaces/create-broadcast-options.interface.d.ts
693
699
  interface EmailRenderOptions {
694
700
  /**
@@ -807,82 +813,6 @@ interface GetBroadcastResponseSuccess extends Broadcast {
807
813
  }
808
814
  type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;
809
815
  //#endregion
810
- //#region src/broadcasts/interfaces/get-broadcast-metrics.interface.d.ts
811
- interface BroadcastMetricCounter {
812
- total: number;
813
- percentage: number;
814
- }
815
- interface BroadcastMetricsClickedLink {
816
- url: string;
817
- clicks: number;
818
- unique_clicks: number;
819
- percentage: number;
820
- }
821
- interface GetBroadcastMetricsResponseSuccess {
822
- object: 'broadcast_metrics';
823
- broadcast_id: string;
824
- status: Broadcast['status'];
825
- created_at: string;
826
- scheduled_at: string | null;
827
- sent_at: string | null;
828
- total: number;
829
- sent: number;
830
- remaining: number;
831
- delivered: BroadcastMetricCounter;
832
- opened: BroadcastMetricCounter;
833
- clicked: BroadcastMetricCounter;
834
- unsubscribed: BroadcastMetricCounter;
835
- bounced: BroadcastMetricCounter;
836
- complained: BroadcastMetricCounter;
837
- suppressed: BroadcastMetricCounter;
838
- clicked_links: BroadcastMetricsClickedLink[];
839
- }
840
- type GetBroadcastMetricsResponse = Response<GetBroadcastMetricsResponseSuccess>;
841
- //#endregion
842
- //#region src/broadcasts/interfaces/list-broadcast-recipients.interface.d.ts
843
- type BroadcastRecipientEventType = 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
844
- type BroadcastRecipientBounceType = 'permanent' | 'transient' | 'undetermined';
845
- type ListBroadcastRecipientsOptions<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginationOptions & {
846
- type: T;
847
- email?: string;
848
- bounceType?: T extends 'bounced' ? BroadcastRecipientBounceType : never;
849
- };
850
- interface BroadcastRecipientClickedLink {
851
- url: string;
852
- clicks: number;
853
- }
854
- type BroadcastRecipientBase = {
855
- id: string;
856
- contact_id: string | null;
857
- email: string;
858
- };
859
- type BroadcastRecipientLoose = BroadcastRecipientBase & {
860
- count?: number;
861
- clicked_links?: BroadcastRecipientClickedLink[];
862
- bounce_type?: BroadcastRecipientBounceType;
863
- };
864
- type IsUnion<T, B = T> = T extends B ? ([B] extends [T] ? false : true) : never;
865
- type BroadcastRecipientFieldsByType = {
866
- sent: unknown;
867
- delivered: unknown;
868
- opened: {
869
- count: number;
870
- };
871
- clicked: {
872
- count: number;
873
- clicked_links: BroadcastRecipientClickedLink[];
874
- };
875
- bounced: {
876
- bounce_type: BroadcastRecipientBounceType;
877
- };
878
- complained: unknown;
879
- unsubscribed: unknown;
880
- suppressed: unknown;
881
- };
882
- type BroadcastRecipient<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = IsUnion<T> extends true ? BroadcastRecipientLoose : BroadcastRecipientBase & BroadcastRecipientFieldsByType[T];
883
- type ListBroadcastRecipientsResponseSuccess<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginatedData<BroadcastRecipient<T>[]>;
884
- type ListBroadcastRecipientsResponse<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = Response<ListBroadcastRecipientsResponseSuccess<T>>;
885
- //#endregion
886
816
  //#region src/broadcasts/interfaces/list-broadcasts.interface.d.ts
887
817
  type ListBroadcastsOptions = PaginationOptions;
888
818
  type ListBroadcastsResponseSuccess = {
@@ -1473,91 +1403,6 @@ interface GetEmailResponseSuccess {
1473
1403
  }
1474
1404
  type GetEmailResponse = Response<GetEmailResponseSuccess>;
1475
1405
  //#endregion
1476
- //#region src/emails/interfaces/get-metrics.interface.d.ts
1477
- 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';
1478
- type EmailMetricsDimension = 'period' | 'domain' | 'email';
1479
- type EmailMetricsGranularity = 'hourly' | 'daily' | 'weekly' | 'monthly';
1480
- type EmailMetricsSortBy = 'date' | EmailMetric;
1481
- type EmailMetricsSortOrder = 'asc' | 'desc';
1482
- type GetEmailsMetricsOptions = {
1483
- /**
1484
- * The start of the date range, as an ISO 8601 date or datetime.
1485
- * Defaults to 6 days before `endDate`.
1486
- *
1487
- * @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
1488
- */
1489
- startDate?: string;
1490
- /**
1491
- * The end of the date range, as an ISO 8601 date or datetime.
1492
- * Defaults to now.
1493
- *
1494
- * @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
1495
- */
1496
- endDate?: string;
1497
- /**
1498
- * The IANA timezone used to bucket periods when `period` is in `dimensions`.
1499
- * Defaults to `UTC`.
1500
- */
1501
- timezone?: string;
1502
- /**
1503
- * The bucket size used when `period` is in `dimensions`.
1504
- * Defaults to `daily`.
1505
- */
1506
- granularity?: EmailMetricsGranularity;
1507
- /**
1508
- * The metrics to include in the response. Defaults to all metrics.
1509
- */
1510
- metrics?: EmailMetric[];
1511
- /**
1512
- * The dimensions to break the response down by. Defaults to `[]`, which
1513
- * returns a single `totals` row for the whole range, with no `data`.
1514
- */
1515
- dimensions?: EmailMetricsDimension[];
1516
- filter?: {
1517
- /**
1518
- * Restrict the response to these sending domain IDs.
1519
- */
1520
- domainId?: string[];
1521
- /**
1522
- * Restrict the response to these email IDs. Cannot be combined with the
1523
- * `domain` dimension.
1524
- */
1525
- emailId?: string[];
1526
- };
1527
- /**
1528
- * What to sort `data` by. Defaults to `date` when `dimensions` includes
1529
- * `period`, or `sent` otherwise.
1530
- *
1531
- * @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
1532
- */
1533
- sortBy?: EmailMetricsSortBy;
1534
- /**
1535
- * The sort direction for `sortBy`. Defaults to `asc` when `dimensions`
1536
- * includes `period`, `desc` otherwise.
1537
- */
1538
- sortOrder?: EmailMetricsSortOrder;
1539
- };
1540
- type EmailMetricsTotals = Partial<Record<EmailMetric, number>>;
1541
- type EmailMetricsDataRow = EmailMetricsTotals & {
1542
- period?: string;
1543
- domain_id?: string;
1544
- domain_name?: string;
1545
- email_id?: string;
1546
- };
1547
- interface GetEmailsMetricsResponseSuccess {
1548
- object: 'metrics';
1549
- start_date: string;
1550
- end_date: string;
1551
- metrics: EmailMetric[];
1552
- dimensions: EmailMetricsDimension[];
1553
- granularity: EmailMetricsGranularity;
1554
- sort_by: EmailMetricsSortBy;
1555
- sort_order: EmailMetricsSortOrder;
1556
- totals: EmailMetricsTotals;
1557
- data?: EmailMetricsDataRow[];
1558
- }
1559
- type GetEmailsMetricsResponse = Response<GetEmailsMetricsResponseSuccess>;
1560
- //#endregion
1561
1406
  //#region src/emails/interfaces/list-emails-options.interface.d.ts
1562
1407
  type ListEmailsOptions = PaginationOptions;
1563
1408
  type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
@@ -1842,9 +1687,8 @@ declare class Broadcasts {
1842
1687
  send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
1843
1688
  list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
1844
1689
  get(id: string): Promise<GetBroadcastResponse>;
1845
- metrics(id: string): Promise<GetBroadcastMetricsResponse>;
1846
- recipients<T extends BroadcastRecipientEventType>(id: string, options: ListBroadcastRecipientsOptions<T>): Promise<ListBroadcastRecipientsResponse<T>>;
1847
1690
  remove(id: string): Promise<RemoveBroadcastResponse>;
1691
+ cancel(id: string): Promise<CancelBroadcastResponse>;
1848
1692
  update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
1849
1693
  }
1850
1694
  //#endregion
@@ -1965,11 +1809,10 @@ declare class Emails {
1965
1809
  list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
1966
1810
  update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
1967
1811
  cancel(id: string): Promise<CancelEmailResponse>;
1968
- metrics(options?: GetEmailsMetricsOptions): Promise<GetEmailsMetricsResponse>;
1969
1812
  }
1970
1813
  //#endregion
1971
1814
  //#region src/events/events.d.ts
1972
- declare class Events$1 {
1815
+ declare class Events {
1973
1816
  private readonly resend;
1974
1817
  constructor(resend: Resend);
1975
1818
  send(payload: SendEventOptions): Promise<SendEventResponse>;
@@ -2006,60 +1849,6 @@ interface CreateSegmentResponseSuccess extends Pick<Segment, 'name' | 'id'> {
2006
1849
  }
2007
1850
  type CreateSegmentResponse = Response<CreateSegmentResponseSuccess>;
2008
1851
  //#endregion
2009
- //#region src/segments/interfaces/get-metrics.interface.d.ts
2010
- type SegmentMetric = 'all_contacts' | 'subscribers' | 'unsubscribers';
2011
- type SegmentMetricsDimension = 'segment';
2012
- type SegmentMetricsSortBy = 'date' | SegmentMetric;
2013
- type SegmentMetricsSortOrder = 'asc' | 'desc';
2014
- type GetSegmentsMetricsOptions = {
2015
- /**
2016
- * The metrics to include in the response. Defaults to all metrics.
2017
- *
2018
- * @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
2019
- */
2020
- metrics?: SegmentMetric[];
2021
- /**
2022
- * The dimensions to break `data` down by. Defaults to `[]`, which returns
2023
- * only `totals` with no `data`.
2024
- */
2025
- dimensions?: SegmentMetricsDimension[];
2026
- filter?: {
2027
- /**
2028
- * Restrict `totals` (and `data`, when requested) to these segment IDs,
2029
- * without double-counting contacts that belong to more than one.
2030
- */
2031
- segmentId?: string[];
2032
- };
2033
- /**
2034
- * What to sort the segment breakdown by: `date` (each segment's creation
2035
- * date), or a metric key to sort by that value instead. Only applies to
2036
- * `data` (when `dimensions` includes `segment`) — `totals` ignores sort
2037
- * params. Defaults to `date`.
2038
- *
2039
- * @link https://resend.com/docs/api-reference/segments/get-segment-metrics#query-parameters
2040
- */
2041
- sortBy?: SegmentMetricsSortBy;
2042
- /**
2043
- * The sort direction for `sortBy`. Defaults to `desc`.
2044
- */
2045
- sortOrder?: SegmentMetricsSortOrder;
2046
- };
2047
- type SegmentMetricsTotals = Partial<Record<SegmentMetric, number>>;
2048
- type SegmentMetricsDataRow = SegmentMetricsTotals & {
2049
- segment_id: string;
2050
- segment_name: string;
2051
- };
2052
- interface GetSegmentsMetricsResponseSuccess {
2053
- object: 'segments_metrics';
2054
- metrics: SegmentMetric[];
2055
- dimensions: SegmentMetricsDimension[];
2056
- sort_by: SegmentMetricsSortBy;
2057
- sort_order: SegmentMetricsSortOrder;
2058
- totals: SegmentMetricsTotals;
2059
- data?: SegmentMetricsDataRow[];
2060
- }
2061
- type GetSegmentsMetricsResponse = Response<GetSegmentsMetricsResponseSuccess>;
2062
- //#endregion
2063
1852
  //#region src/segments/interfaces/get-segment.interface.d.ts
2064
1853
  interface GetSegmentResponseSuccess extends Pick<Segment, 'id' | 'name' | 'created_at'> {
2065
1854
  object: 'segment';
@@ -2090,7 +1879,6 @@ declare class Segments {
2090
1879
  list(options?: ListSegmentsOptions): Promise<ListSegmentsResponse>;
2091
1880
  get(id: string): Promise<GetSegmentResponse>;
2092
1881
  remove(id: string): Promise<RemoveSegmentResponse>;
2093
- metrics(options?: GetSegmentsMetricsOptions): Promise<GetSegmentsMetricsResponse>;
2094
1882
  }
2095
1883
  //#endregion
2096
1884
  //#region src/suppressions/batch/interfaces/batch-add-suppressions.interface.d.ts
@@ -2365,86 +2153,6 @@ declare class Topics {
2365
2153
  remove(id: string): Promise<RemoveTopicResponse>;
2366
2154
  }
2367
2155
  //#endregion
2368
- //#region src/usage/interfaces/get-usage.interface.d.ts
2369
- type GetUsageResponseSuccess = {
2370
- object: 'usage';
2371
- generated_at: string;
2372
- emails: {
2373
- daily: {
2374
- used: number;
2375
- limit: number | null;
2376
- sent: number;
2377
- received: number;
2378
- resets_at: string;
2379
- };
2380
- monthly: {
2381
- used: number;
2382
- limit: number;
2383
- sent: number;
2384
- received: number;
2385
- resets_at: string;
2386
- };
2387
- };
2388
- contacts: {
2389
- used: number;
2390
- limit: number;
2391
- };
2392
- segments: {
2393
- used: number;
2394
- limit: number | null;
2395
- };
2396
- broadcasts: {
2397
- used: number;
2398
- limit: null;
2399
- };
2400
- ai_credits: {
2401
- used: number;
2402
- limit: number;
2403
- next_increase_at: string | null;
2404
- };
2405
- automation_runs: {
2406
- used: number;
2407
- limit: number;
2408
- resets_at: string;
2409
- };
2410
- domains: {
2411
- used: number;
2412
- limit: number | null;
2413
- };
2414
- rate_limit: {
2415
- limit: number;
2416
- duration: string;
2417
- };
2418
- };
2419
- type GetUsageResponse = Response<GetUsageResponseSuccess>;
2420
- //#endregion
2421
- //#region src/usage/usage.d.ts
2422
- declare class Usage {
2423
- private readonly resend;
2424
- constructor(resend: Resend);
2425
- get(): Promise<GetUsageResponse>;
2426
- }
2427
- //#endregion
2428
- //#region src/webhooks/interfaces/list-webhook-events.interface.d.ts
2429
- type WebhookEventLogStatus = 'success' | 'pending' | 'failed' | 'attempting';
2430
- interface WebhookEventLog {
2431
- id: string;
2432
- type: string;
2433
- created_at: string;
2434
- status: WebhookEventLogStatus;
2435
- }
2436
- type ListWebhookEventsOptions = {
2437
- webhookId: string;
2438
- limit?: number;
2439
- after?: string;
2440
- };
2441
- type ListWebhookEventsResponseSuccess = {
2442
- object: 'list';
2443
- has_more: boolean;
2444
- data: WebhookEventLog[];
2445
- };
2446
- type ListWebhookEventsResponse = Response<ListWebhookEventsResponseSuccess>;
2447
- //#endregion
2448
2156
  //#region src/webhooks/interfaces/webhook-event.interface.d.ts
2449
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';
2450
2158
  interface BaseEmailEventData {
@@ -2635,58 +2343,6 @@ interface SuppressionRemovedEvent {
2635
2343
  }
2636
2344
  type WebhookEventPayload = EmailSentEvent | EmailScheduledEvent | EmailDeliveredEvent | EmailDeliveryDelayedEvent | EmailComplainedEvent | EmailBouncedEvent | EmailOpenedEvent | EmailClickedEvent | EmailReceivedEvent | EmailFailedEvent | EmailSuppressedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | DomainCreatedEvent | DomainUpdatedEvent | DomainDeletedEvent | SuppressionAddedEvent | SuppressionRemovedEvent;
2637
2345
  //#endregion
2638
- //#region src/webhooks/interfaces/get-webhook-event.interface.d.ts
2639
- interface GetWebhookEventOptions {
2640
- webhookId: string;
2641
- eventId: string;
2642
- }
2643
- interface GetWebhookEventResponseSuccess {
2644
- object: 'webhook_event';
2645
- id: string;
2646
- type: WebhookEvent;
2647
- created_at: string;
2648
- status: WebhookEventLogStatus;
2649
- next_attempt_at: string | null;
2650
- payload: WebhookEventPayload;
2651
- }
2652
- type GetWebhookEventResponse = Response<GetWebhookEventResponseSuccess>;
2653
- //#endregion
2654
- //#region src/webhooks/interfaces/list-webhook-event-attempts.interface.d.ts
2655
- interface WebhookEventAttempt {
2656
- id: string;
2657
- http_status_code: number;
2658
- response: string;
2659
- sent_at: string;
2660
- }
2661
- type ListWebhookEventAttemptsOptions = {
2662
- webhookId: string;
2663
- eventId: string;
2664
- limit?: number;
2665
- after?: string;
2666
- };
2667
- type ListWebhookEventAttemptsResponseSuccess = {
2668
- object: 'list';
2669
- has_more: boolean;
2670
- data: WebhookEventAttempt[];
2671
- };
2672
- type ListWebhookEventAttemptsResponse = Response<ListWebhookEventAttemptsResponseSuccess>;
2673
- //#endregion
2674
- //#region src/webhooks/events/attempts/attempts.d.ts
2675
- declare class Attempts {
2676
- private readonly resend;
2677
- constructor(resend: Resend);
2678
- list(options: ListWebhookEventAttemptsOptions): Promise<ListWebhookEventAttemptsResponse>;
2679
- }
2680
- //#endregion
2681
- //#region src/webhooks/events/events.d.ts
2682
- declare class Events {
2683
- private readonly resend;
2684
- readonly attempts: Attempts;
2685
- constructor(resend: Resend);
2686
- list(options: ListWebhookEventsOptions): Promise<ListWebhookEventsResponse>;
2687
- get(options: GetWebhookEventOptions): Promise<GetWebhookEventResponse>;
2688
- }
2689
- //#endregion
2690
2346
  //#region src/webhooks/interfaces/create-webhook-options.interface.d.ts
2691
2347
  interface CreateWebhookOptions {
2692
2348
  endpoint: string;
@@ -2760,7 +2416,6 @@ interface VerifyWebhookOptions {
2760
2416
  }
2761
2417
  declare class Webhooks {
2762
2418
  private readonly resend;
2763
- readonly events: Events;
2764
2419
  constructor(resend: Resend);
2765
2420
  create(payload: CreateWebhookOptions, options?: CreateWebhookRequestOptions): Promise<CreateWebhookResponse>;
2766
2421
  get(id: string): Promise<GetWebhookResponse>;
@@ -2793,13 +2448,12 @@ declare class Resend {
2793
2448
  readonly contacts: Contacts;
2794
2449
  readonly domains: Domains;
2795
2450
  readonly emails: Emails;
2796
- readonly events: Events$1;
2451
+ readonly events: Events;
2797
2452
  readonly logs: Logs;
2798
2453
  readonly oauthGrants: OAuthGrants;
2799
2454
  readonly suppressions: Suppressions;
2800
2455
  readonly templates: Templates;
2801
2456
  readonly topics: Topics;
2802
- readonly usage: Usage;
2803
2457
  readonly webhooks: Webhooks;
2804
2458
  constructor(key?: string | undefined, options?: ResendOptions);
2805
2459
  private logError;
@@ -2811,4 +2465,4 @@ declare class Resend {
2811
2465
  delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
2812
2466
  }
2813
2467
  //#endregion
2814
- export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, BroadcastMetricCounter, BroadcastMetricsClickedLink, BroadcastRecipient, BroadcastRecipientBounceType, BroadcastRecipientClickedLink, BroadcastRecipientEventType, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailMetric, EmailMetricsDataRow, EmailMetricsDimension, EmailMetricsGranularity, EmailMetricsSortBy, EmailMetricsSortOrder, EmailMetricsTotals, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastMetricsResponse, GetBroadcastMetricsResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEmailsMetricsOptions, GetEmailsMetricsResponse, GetEmailsMetricsResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSegmentsMetricsOptions, GetSegmentsMetricsResponse, GetSegmentsMetricsResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetUsageResponse, GetUsageResponseSuccess, 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-preview-headless-dashboard.4";
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,16 +279,12 @@ 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
  }
285
+ async cancel(id) {
286
+ return await this.resend.post(`/broadcasts/${id}/cancel`);
287
+ }
292
288
  async update(id, payload) {
293
289
  const html = payload.react ? await render(payload.react) : payload.html;
294
290
  return await this.resend.patch(`/broadcasts/${id}`, {
@@ -305,14 +301,6 @@ var Broadcasts = class {
305
301
  });
306
302
  }
307
303
  };
308
- function buildRecipientsQuery(options) {
309
- const { type, email, bounceType, ...pagination } = options;
310
- const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
311
- searchParams.set("type", type);
312
- if (email !== void 0) searchParams.set("email", email);
313
- if (bounceType !== void 0) searchParams.set("bounce_type", bounceType);
314
- return searchParams.toString();
315
- }
316
304
  //#endregion
317
305
  //#region src/common/utils/parse-contact-properties-to-api-options.ts
318
306
  function parseContactPropertyFromApi(contactProperty) {
@@ -875,32 +863,10 @@ var Emails = class {
875
863
  async cancel(id) {
876
864
  return await this.resend.post(`/emails/${id}/cancel`);
877
865
  }
878
- async metrics(options = {}) {
879
- const queryString = buildMetricsQuery$1(options);
880
- const url = queryString ? `/emails/metrics?${queryString}` : "/emails/metrics";
881
- return await this.resend.get(url);
882
- }
883
866
  };
884
- function buildMetricsQuery$1(options) {
885
- const params = {
886
- start_date: options.startDate,
887
- end_date: options.endDate,
888
- timezone: options.timezone,
889
- granularity: options.granularity,
890
- metrics: options.metrics?.join(","),
891
- dimensions: options.dimensions?.join(","),
892
- domain_id: options.filter?.domainId?.join(","),
893
- email_id: options.filter?.emailId?.join(","),
894
- sort_by: options.sortBy,
895
- sort_order: options.sortOrder
896
- };
897
- const searchParams = new URLSearchParams();
898
- for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
899
- return searchParams.toString();
900
- }
901
867
  //#endregion
902
868
  //#region src/events/events.ts
903
- var Events$1 = class {
869
+ var Events = class {
904
870
  constructor(resend) {
905
871
  this.resend = resend;
906
872
  }
@@ -971,24 +937,7 @@ var Segments = class {
971
937
  async remove(id) {
972
938
  return await this.resend.delete(`/segments/${id}`);
973
939
  }
974
- async metrics(options = {}) {
975
- const queryString = buildMetricsQuery(options);
976
- const url = queryString ? `/segments/metrics?${queryString}` : "/segments/metrics";
977
- return await this.resend.get(url);
978
- }
979
940
  };
980
- function buildMetricsQuery(options) {
981
- const params = {
982
- metrics: options.metrics?.join(","),
983
- dimensions: options.dimensions?.join(","),
984
- segment_id: options.filter?.segmentId?.join(","),
985
- sort_by: options.sortBy,
986
- sort_order: options.sortOrder
987
- };
988
- const searchParams = new URLSearchParams();
989
- for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
990
- return searchParams.toString();
991
- }
992
941
  //#endregion
993
942
  //#region src/suppressions/batch/batch.ts
994
943
  var Batch = class {
@@ -1178,50 +1127,10 @@ var Topics = class {
1178
1127
  }
1179
1128
  };
1180
1129
  //#endregion
1181
- //#region src/usage/usage.ts
1182
- var Usage = class {
1183
- constructor(resend) {
1184
- this.resend = resend;
1185
- }
1186
- async get() {
1187
- return await this.resend.get("/usage");
1188
- }
1189
- };
1190
- //#endregion
1191
- //#region src/webhooks/events/attempts/attempts.ts
1192
- var Attempts = class {
1193
- constructor(resend) {
1194
- this.resend = resend;
1195
- }
1196
- async list(options) {
1197
- const { webhookId, eventId } = options;
1198
- const url = buildPaginationUrl(`/webhooks/${webhookId}/events/${eventId}/attempts`, options);
1199
- return await this.resend.get(url);
1200
- }
1201
- };
1202
- //#endregion
1203
- //#region src/webhooks/events/events.ts
1204
- var Events = class {
1205
- constructor(resend) {
1206
- this.resend = resend;
1207
- this.attempts = new Attempts(resend);
1208
- }
1209
- async list(options) {
1210
- const { webhookId } = options;
1211
- const url = buildPaginationUrl(`/webhooks/${webhookId}/events`, options);
1212
- return await this.resend.get(url);
1213
- }
1214
- async get(options) {
1215
- const { webhookId, eventId } = options;
1216
- return await this.resend.get(`/webhooks/${webhookId}/events/${eventId}`);
1217
- }
1218
- };
1219
- //#endregion
1220
1130
  //#region src/webhooks/webhooks.ts
1221
1131
  var Webhooks = class {
1222
1132
  constructor(resend) {
1223
1133
  this.resend = resend;
1224
- this.events = new Events(resend);
1225
1134
  }
1226
1135
  async create(payload, options = {}) {
1227
1136
  return await this.resend.post("/webhooks", payload, options);
@@ -1270,13 +1179,12 @@ var Resend = class {
1270
1179
  this.contacts = new Contacts(this);
1271
1180
  this.domains = new Domains(this);
1272
1181
  this.emails = new Emails(this);
1273
- this.events = new Events$1(this);
1182
+ this.events = new Events(this);
1274
1183
  this.logs = new Logs(this);
1275
1184
  this.oauthGrants = new OAuthGrants(this);
1276
1185
  this.suppressions = new Suppressions(this);
1277
1186
  this.templates = new Templates(this);
1278
1187
  this.topics = new Topics(this);
1279
- this.usage = new Usage(this);
1280
1188
  this.webhooks = new Webhooks(this);
1281
1189
  if (!key) {
1282
1190
  if (typeof process !== "undefined" && process.env) this.key = process.env.RESEND_API_KEY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "6.19.0-preview-headless-dashboard.4",
3
+ "version": "6.19.0",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -29,6 +29,19 @@
29
29
  }
30
30
  }
31
31
  },
32
+ "scripts": {
33
+ "build": "tsdown src/index.ts --format esm,cjs --dts",
34
+ "integration:nextjs": "cd ./e2e/nextjs && next build --turbopack",
35
+ "lint": "biome check .",
36
+ "lint:fix": "biome check . --write",
37
+ "prepublishOnly": "pnpm run build",
38
+ "test": "vitest run --exclude e2e",
39
+ "test:dev": "cross-env TEST_MODE=dev vitest run --exclude e2e",
40
+ "test:e2e": "vitest run e2e",
41
+ "test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run --exclude e2e",
42
+ "test:watch": "vitest --exclude e2e",
43
+ "typecheck": "tsc --noEmit"
44
+ },
32
45
  "repository": {
33
46
  "type": "git",
34
47
  "url": "git+https://github.com/resend/resend-node.git"
@@ -70,16 +83,5 @@
70
83
  "vitest": "4.1.10",
71
84
  "vitest-fetch-mock": "0.4.5"
72
85
  },
73
- "scripts": {
74
- "build": "tsdown src/index.ts --format esm,cjs --dts",
75
- "integration:nextjs": "cd ./e2e/nextjs && next build --turbopack",
76
- "lint": "biome check .",
77
- "lint:fix": "biome check . --write",
78
- "test": "vitest run --exclude e2e",
79
- "test:dev": "cross-env TEST_MODE=dev vitest run --exclude e2e",
80
- "test:e2e": "vitest run e2e",
81
- "test:record": "rimraf --glob \"**/__recordings__\" && cross-env TEST_MODE=record vitest run --exclude e2e",
82
- "test:watch": "vitest --exclude e2e",
83
- "typecheck": "tsc --noEmit"
84
- }
85
- }
86
+ "packageManager": "pnpm@11.12.0"
87
+ }