@depup/resend 6.18.1-depup.0 → 6.22.0-depup.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/README.md CHANGED
@@ -13,10 +13,16 @@ npm install @depup/resend
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [resend](https://www.npmjs.com/package/resend) @ 6.18.1 |
17
- | Processed | 2026-08-02 |
16
+ | Original | [resend](https://www.npmjs.com/package/resend) @ 6.22.0 |
17
+ | Processed | 2026-08-23 |
18
18
  | Smoke test | passed |
19
- | Deps updated | 0 |
19
+ | Deps updated | 1 |
20
+
21
+ ## Dependency Changes
22
+
23
+ | Dependency | From | To |
24
+ |------------|------|-----|
25
+ | postal-mime | 2.7.5 | ^3.0.0 |
20
26
 
21
27
  ---
22
28
 
package/changes.json CHANGED
@@ -1,5 +1,10 @@
1
1
  {
2
- "bumped": {},
3
- "timestamp": "2026-08-02T00:59:27.599Z",
4
- "totalUpdated": 0
2
+ "bumped": {
3
+ "postal-mime": {
4
+ "from": "2.7.5",
5
+ "to": "^3.0.0"
6
+ }
7
+ },
8
+ "timestamp": "2026-08-23T00:28:26.655Z",
9
+ "totalUpdated": 1
5
10
  }
package/dist/index.cjs CHANGED
@@ -25,9 +25,13 @@ 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.18.1";
28
+ var version = "6.22.0";
29
29
  //#endregion
30
30
  //#region src/common/utils/build-pagination-query.ts
31
+ function buildPaginationUrl(base, options) {
32
+ const queryString = buildPaginationQuery(options);
33
+ return queryString ? `${base}?${queryString}` : base;
34
+ }
31
35
  /**
32
36
  * Builds a query string from pagination options
33
37
  * @param options - Pagination options containing limit and either after or before (but not both)
@@ -50,10 +54,12 @@ var ApiKeys = class {
50
54
  return await this.resend.post("/api-keys", payload, options);
51
55
  }
52
56
  async list(options = {}) {
53
- const queryString = buildPaginationQuery(options);
54
- const url = queryString ? `/api-keys?${queryString}` : "/api-keys";
57
+ const url = buildPaginationUrl("/api-keys", options);
55
58
  return await this.resend.get(url);
56
59
  }
60
+ async update(id, payload) {
61
+ return await this.resend.patch(`/api-keys/${id}`, payload);
62
+ }
57
63
  async remove(id) {
58
64
  return await this.resend.delete(`/api-keys/${id}`);
59
65
  }
@@ -193,6 +199,9 @@ var Automations = class {
193
199
  if (payload.connections !== void 0) apiPayload.connections = payload.connections.map(parseConnection);
194
200
  return await this.resend.patch(`/automations/${id}`, apiPayload);
195
201
  }
202
+ async duplicate(id) {
203
+ return await this.resend.post(`/automations/${id}/duplicate`);
204
+ }
196
205
  async stop(id) {
197
206
  return await this.resend.post(`/automations/${id}/stop`);
198
207
  }
@@ -294,16 +303,26 @@ var Broadcasts = class {
294
303
  return await this.resend.post(`/broadcasts/${id}/send`, { scheduled_at: payload?.scheduledAt });
295
304
  }
296
305
  async list(options = {}) {
297
- const queryString = buildPaginationQuery(options);
298
- const url = queryString ? `/broadcasts?${queryString}` : "/broadcasts";
306
+ const url = buildPaginationUrl("/broadcasts", options);
299
307
  return await this.resend.get(url);
300
308
  }
301
309
  async get(id) {
302
310
  return await this.resend.get(`/broadcasts/${id}`);
303
311
  }
312
+ async recipients(id, options) {
313
+ const url = `/broadcasts/${id}/recipients?${buildRecipientsQuery(options)}`;
314
+ return await this.resend.get(url);
315
+ }
316
+ async clickedLinks(id, options = {}) {
317
+ const url = buildPaginationUrl(`/broadcasts/${id}/clicked-links`, options);
318
+ return await this.resend.get(url);
319
+ }
304
320
  async remove(id) {
305
321
  return await this.resend.delete(`/broadcasts/${id}`);
306
322
  }
323
+ async cancel(id) {
324
+ return await this.resend.post(`/broadcasts/${id}/cancel`);
325
+ }
307
326
  async update(id, payload) {
308
327
  const html = payload.react ? await render(payload.react) : payload.html;
309
328
  return await this.resend.patch(`/broadcasts/${id}`, {
@@ -320,6 +339,14 @@ var Broadcasts = class {
320
339
  });
321
340
  }
322
341
  };
342
+ function buildRecipientsQuery(options) {
343
+ const { type, email, bounceType, ...pagination } = options;
344
+ const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
345
+ searchParams.set("type", type);
346
+ if (email !== void 0) searchParams.set("email", email);
347
+ if (bounceType !== void 0) searchParams.set("bounce_type", bounceType);
348
+ return searchParams.toString();
349
+ }
323
350
  //#endregion
324
351
  //#region src/common/utils/parse-contact-properties-to-api-options.ts
325
352
  function parseContactPropertyFromApi(contactProperty) {
@@ -350,8 +377,7 @@ var ContactProperties = class {
350
377
  return await this.resend.post("/contact-properties", apiOptions);
351
378
  }
352
379
  async list(options = {}) {
353
- const queryString = buildPaginationQuery(options);
354
- const url = queryString ? `/contact-properties?${queryString}` : "/contact-properties";
380
+ const url = buildPaginationUrl("/contact-properties", options);
355
381
  const response = await this.resend.get(url);
356
382
  if (response.data) return {
357
383
  data: {
@@ -470,9 +496,7 @@ var ContactSegments = class {
470
496
  name: "missing_required_field"
471
497
  }
472
498
  };
473
- const identifier = options.email ? options.email : options.contactId;
474
- const queryString = buildPaginationQuery(options);
475
- const url = queryString ? `/contacts/${identifier}/segments?${queryString}` : `/contacts/${identifier}/segments`;
499
+ const url = buildPaginationUrl(`/contacts/${options.email ? options.email : options.contactId}/segments`, options);
476
500
  return await this.resend.get(url);
477
501
  }
478
502
  async add(options) {
@@ -531,9 +555,7 @@ var ContactTopics = class {
531
555
  name: "missing_required_field"
532
556
  }
533
557
  };
534
- const identifier = options.email ? options.email : options.id;
535
- const queryString = buildPaginationQuery(options);
536
- const url = queryString ? `/contacts/${identifier}/topics?${queryString}` : `/contacts/${identifier}/topics`;
558
+ const url = buildPaginationUrl(`/contacts/${options.email ? options.email : options.id}/topics`, options);
537
559
  return this.resend.get(url);
538
560
  }
539
561
  };
@@ -578,12 +600,10 @@ var Contacts = class {
578
600
  async list(options = {}) {
579
601
  const segmentId = options.segmentId ?? options.audienceId;
580
602
  if (!segmentId) {
581
- const queryString = buildPaginationQuery(options);
582
- const url = queryString ? `/contacts?${queryString}` : "/contacts";
603
+ const url = buildPaginationUrl("/contacts", options);
583
604
  return await this.resend.get(url);
584
605
  }
585
- const queryString = buildPaginationQuery(options);
586
- const url = queryString ? `/segments/${segmentId}/contacts?${queryString}` : `/segments/${segmentId}/contacts`;
606
+ const url = buildPaginationUrl(`/segments/${segmentId}/contacts`, options);
587
607
  return await this.resend.get(url);
588
608
  }
589
609
  async get(options) {
@@ -686,8 +706,7 @@ var Domains = class {
686
706
  return await this.resend.post("/domains", parseDomainToApiOptions(payload), options);
687
707
  }
688
708
  async list(options = {}) {
689
- const queryString = buildPaginationQuery(options);
690
- const url = queryString ? `/domains?${queryString}` : "/domains";
709
+ const url = buildPaginationUrl("/domains", options);
691
710
  return await this.resend.get(url);
692
711
  }
693
712
  async get(id) {
@@ -721,8 +740,7 @@ var Attachments$1 = class {
721
740
  }
722
741
  async list(options) {
723
742
  const { emailId } = options;
724
- const queryString = buildPaginationQuery(options);
725
- const url = queryString ? `/emails/${emailId}/attachments?${queryString}` : `/emails/${emailId}/attachments`;
743
+ const url = buildPaginationUrl(`/emails/${emailId}/attachments`, options);
726
744
  return await this.resend.get(url);
727
745
  }
728
746
  };
@@ -738,8 +756,7 @@ var Attachments = class {
738
756
  }
739
757
  async list(options) {
740
758
  const { emailId } = options;
741
- const queryString = buildPaginationQuery(options);
742
- const url = queryString ? `/emails/receiving/${emailId}/attachments?${queryString}` : `/emails/receiving/${emailId}/attachments`;
759
+ const url = buildPaginationUrl(`/emails/receiving/${emailId}/attachments`, options);
743
760
  return await this.resend.get(url);
744
761
  }
745
762
  };
@@ -758,8 +775,7 @@ var Receiving = class {
758
775
  return await this.resend.get(path);
759
776
  }
760
777
  async list(options = {}) {
761
- const queryString = buildPaginationQuery(options);
762
- const url = queryString ? `/emails/receiving?${queryString}` : "/emails/receiving";
778
+ const url = buildPaginationUrl("/emails/receiving", options);
763
779
  return await this.resend.get(url);
764
780
  }
765
781
  async forward(options, requestOptions = {}) {
@@ -884,8 +900,7 @@ var Emails = class {
884
900
  return await this.resend.get(`/emails/${id}`);
885
901
  }
886
902
  async list(options = {}) {
887
- const queryString = buildPaginationQuery(options);
888
- const url = queryString ? `/emails?${queryString}` : "/emails";
903
+ const url = buildPaginationUrl("/emails", options);
889
904
  return await this.resend.get(url);
890
905
  }
891
906
  async update(payload) {
@@ -894,7 +909,31 @@ var Emails = class {
894
909
  async cancel(id) {
895
910
  return await this.resend.post(`/emails/${id}/cancel`);
896
911
  }
912
+ async share(id, payload) {
913
+ return await this.resend.post(`/emails/${id}/share`, { expires_in: payload?.expiresIn });
914
+ }
915
+ async metrics(options = {}) {
916
+ const queryString = buildMetricsQuery(options);
917
+ const url = queryString ? `/emails/metrics?${queryString}` : "/emails/metrics";
918
+ return await this.resend.get(url);
919
+ }
897
920
  };
921
+ function buildMetricsQuery(options) {
922
+ const params = {
923
+ start_date: options.startDate,
924
+ end_date: options.endDate,
925
+ timezone: options.timezone,
926
+ granularity: options.granularity,
927
+ metrics: options.metrics?.join(","),
928
+ dimensions: options.dimensions?.join(","),
929
+ domain_id: options.domainId?.join(","),
930
+ email_id: options.emailId?.join(","),
931
+ broadcast_id: options.broadcastId?.join(",")
932
+ };
933
+ const searchParams = new URLSearchParams();
934
+ for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
935
+ return searchParams.toString();
936
+ }
898
937
  //#endregion
899
938
  //#region src/events/events.ts
900
939
  var Events = class {
@@ -911,8 +950,7 @@ var Events = class {
911
950
  return await this.resend.get(`/events/${encodeURIComponent(identifier)}`);
912
951
  }
913
952
  async list(options = {}) {
914
- const queryString = buildPaginationQuery(options);
915
- const url = queryString ? `/events?${queryString}` : "/events";
953
+ const url = buildPaginationUrl("/events", options);
916
954
  return await this.resend.get(url);
917
955
  }
918
956
  async update(identifier, payload) {
@@ -929,8 +967,7 @@ var Logs = class {
929
967
  this.resend = resend;
930
968
  }
931
969
  async list(options = {}) {
932
- const queryString = buildPaginationQuery(options);
933
- const url = queryString ? `/logs?${queryString}` : "/logs";
970
+ const url = buildPaginationUrl("/logs", options);
934
971
  return await this.resend.get(url);
935
972
  }
936
973
  async get(id) {
@@ -944,8 +981,7 @@ var OAuthGrants = class {
944
981
  this.resend = resend;
945
982
  }
946
983
  async list(options = {}) {
947
- const queryString = buildPaginationQuery(options);
948
- const url = queryString ? `/oauth/grants?${queryString}` : "/oauth/grants";
984
+ const url = buildPaginationUrl("/oauth/grants", options);
949
985
  return await this.resend.get(url);
950
986
  }
951
987
  async revoke(id) {
@@ -962,8 +998,7 @@ var Segments = class {
962
998
  return await this.resend.post("/segments", payload, options);
963
999
  }
964
1000
  async list(options = {}) {
965
- const queryString = buildPaginationQuery(options);
966
- const url = queryString ? `/segments?${queryString}` : "/segments";
1001
+ const url = buildPaginationUrl("/segments", options);
967
1002
  return await this.resend.get(url);
968
1003
  }
969
1004
  async get(id) {
@@ -1174,8 +1209,7 @@ var Webhooks = class {
1174
1209
  return await this.resend.get(`/webhooks/${id}`);
1175
1210
  }
1176
1211
  async list(options = {}) {
1177
- const queryString = buildPaginationQuery(options);
1178
- const url = queryString ? `/webhooks?${queryString}` : "/webhooks";
1212
+ const url = buildPaginationUrl("/webhooks", options);
1179
1213
  return await this.resend.get(url);
1180
1214
  }
1181
1215
  async update(id, payload) {
package/dist/index.d.cts CHANGED
@@ -264,6 +264,16 @@ type RemoveApiKeyResponseSuccess = Pick<ApiKey, 'id'> & {
264
264
  };
265
265
  type RemoveApiKeyResponse = Response<RemoveApiKeyResponseSuccess>;
266
266
  //#endregion
267
+ //#region src/api-keys/interfaces/update-api-key-options.interface.d.ts
268
+ interface UpdateApiKeyOptions {
269
+ name: string;
270
+ }
271
+ interface UpdateApiKeyResponseSuccess {
272
+ object: 'api_key';
273
+ id: string;
274
+ }
275
+ type UpdateApiKeyResponse = Response<UpdateApiKeyResponseSuccess>;
276
+ //#endregion
267
277
  //#region src/automations/interfaces/automation-step.interface.d.ts
268
278
  type ConditionRule = {
269
279
  type: 'rule';
@@ -447,6 +457,12 @@ interface CreateAutomationResponseSuccess {
447
457
  }
448
458
  type CreateAutomationResponse = Response<CreateAutomationResponseSuccess>;
449
459
  //#endregion
460
+ //#region src/automations/interfaces/duplicate-automation.interface.d.ts
461
+ interface DuplicateAutomationResponseSuccess extends Pick<Automation, 'id'> {
462
+ object: 'automation';
463
+ }
464
+ type DuplicateAutomationResponse = Response<DuplicateAutomationResponseSuccess>;
465
+ //#endregion
450
466
  //#region src/automations/interfaces/get-automation.interface.d.ts
451
467
  interface GetAutomationResponseSuccess extends Automation {
452
468
  object: 'automation';
@@ -629,13 +645,19 @@ type Tag = {
629
645
  };
630
646
  //#endregion
631
647
  //#region src/batch/interfaces/create-batch-options.interface.d.ts
648
+ /**
649
+ * Distributes over union members, unlike the built-in `Omit`, which would
650
+ * collapse `CreateEmailOptions` into a single object type and lose the
651
+ * mutual exclusivity between its `react`/`html`/`text` and `template` variants.
652
+ */
653
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
632
654
  /**
633
655
  * Email options for batch sending. Same as CreateEmailOptions but without attachments,
634
656
  * as these are not supported in the batch API.
635
657
  *
636
658
  * @link https://resend.com/docs/dashboard/emails/batch-sending#limitations
637
659
  */
638
- type CreateBatchEmailOptions = Omit<CreateEmailOptions, 'attachments'>;
660
+ type CreateBatchEmailOptions = DistributiveOmit<CreateEmailOptions, 'attachments'>;
639
661
  type CreateBatchOptions = CreateBatchEmailOptions[];
640
662
  interface CreateBatchRequestOptions extends PostOptions, IdempotentRequest {
641
663
  /**
@@ -683,6 +705,12 @@ interface Broadcast {
683
705
  text: string | null;
684
706
  }
685
707
  //#endregion
708
+ //#region src/broadcasts/interfaces/cancel-broadcast.interface.d.ts
709
+ interface CancelBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
710
+ object: 'broadcast';
711
+ }
712
+ type CancelBroadcastResponse = Response<CancelBroadcastResponseSuccess>;
713
+ //#endregion
686
714
  //#region src/broadcasts/interfaces/create-broadcast-options.interface.d.ts
687
715
  interface EmailRenderOptions {
688
716
  /**
@@ -801,6 +829,65 @@ interface GetBroadcastResponseSuccess extends Broadcast {
801
829
  }
802
830
  type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;
803
831
  //#endregion
832
+ //#region src/broadcasts/interfaces/list-broadcast-clicked-links.interface.d.ts
833
+ type ListBroadcastClickedLinksOptions = PaginationOptions;
834
+ type BroadcastClickedLink = {
835
+ /**
836
+ * `id` is an opaque cursor for this row, used only for pagination.
837
+ * It does not identify any entity in Resend.
838
+ */
839
+ id: string;
840
+ url: string;
841
+ clicks: number;
842
+ unique_clicks: number;
843
+ };
844
+ type ListBroadcastClickedLinksResponseSuccess = PaginatedData<BroadcastClickedLink[]>;
845
+ type ListBroadcastClickedLinksResponse = Response<ListBroadcastClickedLinksResponseSuccess>;
846
+ //#endregion
847
+ //#region src/broadcasts/interfaces/list-broadcast-recipients.interface.d.ts
848
+ type BroadcastRecipientEventType = 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
849
+ type BroadcastRecipientBounceType = 'permanent' | 'transient' | 'undetermined';
850
+ type ListBroadcastRecipientsOptions<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginationOptions & {
851
+ type: T;
852
+ email?: string;
853
+ bounceType?: T extends 'bounced' ? BroadcastRecipientBounceType : never;
854
+ };
855
+ interface BroadcastRecipientClickedLink {
856
+ url: string;
857
+ clicks: number;
858
+ }
859
+ type BroadcastRecipientBase = {
860
+ id: string;
861
+ contact_id: string | null;
862
+ email: string;
863
+ };
864
+ type BroadcastRecipientLoose = BroadcastRecipientBase & {
865
+ count?: number;
866
+ clicked_links?: BroadcastRecipientClickedLink[];
867
+ bounce_type?: BroadcastRecipientBounceType;
868
+ };
869
+ type IsUnion<T, B = T> = T extends B ? ([B] extends [T] ? false : true) : never;
870
+ type BroadcastRecipientFieldsByType = {
871
+ sent: unknown;
872
+ delivered: unknown;
873
+ opened: {
874
+ count: number;
875
+ };
876
+ clicked: {
877
+ count: number;
878
+ clicked_links: BroadcastRecipientClickedLink[];
879
+ };
880
+ bounced: {
881
+ bounce_type: BroadcastRecipientBounceType;
882
+ };
883
+ complained: unknown;
884
+ unsubscribed: unknown;
885
+ suppressed: unknown;
886
+ };
887
+ type BroadcastRecipient<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = IsUnion<T> extends true ? BroadcastRecipientLoose : BroadcastRecipientBase & BroadcastRecipientFieldsByType[T];
888
+ type ListBroadcastRecipientsResponseSuccess<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginatedData<BroadcastRecipient<T>[]>;
889
+ type ListBroadcastRecipientsResponse<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = Response<ListBroadcastRecipientsResponseSuccess<T>>;
890
+ //#endregion
804
891
  //#region src/broadcasts/interfaces/list-broadcasts.interface.d.ts
805
892
  type ListBroadcastsOptions = PaginationOptions;
806
893
  type ListBroadcastsResponseSuccess = {
@@ -1391,6 +1478,92 @@ interface GetEmailResponseSuccess {
1391
1478
  }
1392
1479
  type GetEmailResponse = Response<GetEmailResponseSuccess>;
1393
1480
  //#endregion
1481
+ //#region src/emails/interfaces/get-metrics.interface.d.ts
1482
+ type EmailMetric = 'received' | 'delivered' | 'complained' | 'suppressed' | 'bounced' | 'bounced_transient' | 'bounced_permanent' | 'bounced_undetermined' | 'opened' | 'clicked' | 'unsubscribed' | 'delivery_delayed' | 'failed' | 'sent' | 'unique_opened' | 'unique_clicked' | 'delivery_rate' | 'open_rate' | 'click_rate' | 'bounce_rate' | 'complaint_rate' | 'unsubscribe_rate';
1483
+ type EmailMetricsDimension = 'period' | 'domain' | 'email' | 'broadcast';
1484
+ type EmailMetricsGranularity = 'hourly' | 'daily' | 'weekly' | 'monthly';
1485
+ type EmailMetricsCommonOptions = {
1486
+ /**
1487
+ * The start of the date range, as an ISO 8601 date or datetime.
1488
+ * Defaults to 6 days before `endDate`.
1489
+ *
1490
+ * @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
1491
+ */
1492
+ startDate?: string;
1493
+ /**
1494
+ * The end of the date range, as an ISO 8601 date or datetime.
1495
+ * Defaults to now.
1496
+ *
1497
+ * @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
1498
+ */
1499
+ endDate?: string;
1500
+ /**
1501
+ * The IANA timezone used to bucket periods when `period` is in `dimensions`.
1502
+ * Defaults to `UTC`.
1503
+ */
1504
+ timezone?: string;
1505
+ /**
1506
+ * The bucket size used when `period` is in `dimensions`.
1507
+ * Defaults to `daily`.
1508
+ */
1509
+ granularity?: EmailMetricsGranularity;
1510
+ /**
1511
+ * The metrics to include in the response. Defaults to all metrics.
1512
+ */
1513
+ metrics?: EmailMetric[];
1514
+ /**
1515
+ * Restrict the response to these sending domain IDs.
1516
+ */
1517
+ domainId?: string[];
1518
+ };
1519
+ type GetEmailsMetricsOptions = EmailMetricsCommonOptions & ({
1520
+ /**
1521
+ * The dimensions to break the response down by. Defaults to `[]`,
1522
+ * which returns a single `totals` row for the whole range, with no
1523
+ * `data`. Cannot combine `broadcast` with `email`/`emailId`.
1524
+ */
1525
+ dimensions?: Exclude<EmailMetricsDimension, 'broadcast'>[];
1526
+ /**
1527
+ * Restrict the response to these email IDs. Cannot be combined with
1528
+ * the `broadcast` dimension or `broadcastId`.
1529
+ */
1530
+ emailId?: string[];
1531
+ broadcastId?: never;
1532
+ } | {
1533
+ /**
1534
+ * The dimensions to break the response down by. Defaults to `[]`,
1535
+ * which returns a single `totals` row for the whole range, with no
1536
+ * `data`. Cannot combine `email` with `broadcast`/`broadcastId`.
1537
+ */
1538
+ dimensions?: Exclude<EmailMetricsDimension, 'email'>[];
1539
+ emailId?: never;
1540
+ /**
1541
+ * Restrict the response to these broadcast IDs. Cannot be combined
1542
+ * with the `email` dimension or `emailId`.
1543
+ */
1544
+ broadcastId?: string[];
1545
+ });
1546
+ type EmailMetricsTotals = Partial<Record<EmailMetric, number>>;
1547
+ type EmailMetricsDataRow = EmailMetricsTotals & {
1548
+ period?: string;
1549
+ domain_id?: string;
1550
+ domain_name?: string;
1551
+ email_id?: string;
1552
+ broadcast_id?: string;
1553
+ broadcast_name?: string;
1554
+ };
1555
+ interface GetEmailsMetricsResponseSuccess {
1556
+ object: 'metrics';
1557
+ start_date: string;
1558
+ end_date: string;
1559
+ metrics: EmailMetric[];
1560
+ dimensions: EmailMetricsDimension[];
1561
+ granularity: EmailMetricsGranularity;
1562
+ totals: EmailMetricsTotals;
1563
+ data?: EmailMetricsDataRow[];
1564
+ }
1565
+ type GetEmailsMetricsResponse = Response<GetEmailsMetricsResponseSuccess>;
1566
+ //#endregion
1394
1567
  //#region src/emails/interfaces/list-emails-options.interface.d.ts
1395
1568
  type ListEmailsOptions = PaginationOptions;
1396
1569
  type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
@@ -1401,6 +1574,17 @@ type ListEmailsResponseSuccess = {
1401
1574
  };
1402
1575
  type ListEmailsResponse = Response<ListEmailsResponseSuccess>;
1403
1576
  //#endregion
1577
+ //#region src/emails/interfaces/share-email-options.interface.d.ts
1578
+ interface ShareEmailOptions {
1579
+ expiresIn?: string;
1580
+ }
1581
+ interface ShareEmailResponseSuccess {
1582
+ object: 'email';
1583
+ id: string;
1584
+ url: string;
1585
+ }
1586
+ type ShareEmailResponse = Response<ShareEmailResponseSuccess>;
1587
+ //#endregion
1404
1588
  //#region src/emails/interfaces/update-email-options.interface.d.ts
1405
1589
  interface UpdateEmailOptions {
1406
1590
  id: string;
@@ -1635,6 +1819,7 @@ declare class ApiKeys {
1635
1819
  constructor(resend: Resend);
1636
1820
  create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>;
1637
1821
  list(options?: ListApiKeysOptions): Promise<ListApiKeysResponse>;
1822
+ update(id: string, payload: UpdateApiKeyOptions): Promise<UpdateApiKeyResponse>;
1638
1823
  remove(id: string): Promise<RemoveApiKeyResponse>;
1639
1824
  }
1640
1825
  //#endregion
@@ -1656,6 +1841,7 @@ declare class Automations {
1656
1841
  get(id: string): Promise<GetAutomationResponse>;
1657
1842
  remove(id: string): Promise<RemoveAutomationResponse>;
1658
1843
  update(id: string, payload: UpdateAutomationOptions): Promise<UpdateAutomationResponse>;
1844
+ duplicate(id: string): Promise<DuplicateAutomationResponse>;
1659
1845
  stop(id: string): Promise<StopAutomationResponse>;
1660
1846
  }
1661
1847
  //#endregion
@@ -1675,7 +1861,10 @@ declare class Broadcasts {
1675
1861
  send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
1676
1862
  list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
1677
1863
  get(id: string): Promise<GetBroadcastResponse>;
1864
+ recipients<T extends BroadcastRecipientEventType>(id: string, options: ListBroadcastRecipientsOptions<T>): Promise<ListBroadcastRecipientsResponse<T>>;
1865
+ clickedLinks(id: string, options?: ListBroadcastClickedLinksOptions): Promise<ListBroadcastClickedLinksResponse>;
1678
1866
  remove(id: string): Promise<RemoveBroadcastResponse>;
1867
+ cancel(id: string): Promise<CancelBroadcastResponse>;
1679
1868
  update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
1680
1869
  }
1681
1870
  //#endregion
@@ -1796,6 +1985,8 @@ declare class Emails {
1796
1985
  list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
1797
1986
  update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
1798
1987
  cancel(id: string): Promise<CancelEmailResponse>;
1988
+ share(id: string, payload?: ShareEmailOptions): Promise<ShareEmailResponse>;
1989
+ metrics(options?: GetEmailsMetricsOptions): Promise<GetEmailsMetricsResponse>;
1799
1990
  }
1800
1991
  //#endregion
1801
1992
  //#region src/events/events.d.ts
@@ -2146,6 +2337,7 @@ interface BaseEmailEventData {
2146
2337
  broadcast_id?: string;
2147
2338
  created_at: string;
2148
2339
  email_id: string;
2340
+ message_id: string;
2149
2341
  from: string;
2150
2342
  to: string[];
2151
2343
  subject: string;
@@ -2451,4 +2643,4 @@ declare class Resend {
2451
2643
  delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
2452
2644
  }
2453
2645
  //#endregion
2454
- export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, 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 };
2646
+ export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, BroadcastClickedLink, BroadcastRecipient, BroadcastRecipientBounceType, BroadcastRecipientClickedLink, BroadcastRecipientEventType, CancelBroadcastResponse, CancelBroadcastResponseSuccess, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateAutomationResponse, DuplicateAutomationResponseSuccess, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailMetric, EmailMetricsDataRow, EmailMetricsDimension, EmailMetricsGranularity, EmailMetricsTotals, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEmailsMetricsOptions, GetEmailsMetricsResponse, GetEmailsMetricsResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, ListBroadcastClickedLinksOptions, ListBroadcastClickedLinksResponse, ListBroadcastClickedLinksResponseSuccess, ListBroadcastRecipientsOptions, ListBroadcastRecipientsResponse, ListBroadcastRecipientsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactImportsOptions, ListContactImportsResponse, ListContactImportsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListEventsOptions, ListEventsResponse, ListEventsResponseSuccess, ListLogsOptions, ListLogsResponse, ListLogsResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListSuppressionsOptions, ListSuppressionsResponse, ListSuppressionsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, OAuthGrant, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveAutomationResponse, RemoveAutomationResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveEventResponse, RemoveEventResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveSuppressionResponse, RemoveSuppressionResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type ResendOptions, type Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, ShareEmailOptions, ShareEmailResponse, ShareEmailResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Suppression, SuppressionAddedEvent, SuppressionListEntry, SuppressionOrigin, SuppressionRemovedEvent, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, UpdateApiKeyOptions, UpdateApiKeyResponse, UpdateApiKeyResponseSuccess, UpdateAutomationOptions, UpdateAutomationResponse, UpdateAutomationResponseSuccess, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateEventOptions, UpdateEventResponse, UpdateEventResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainClaimResponse, VerifyDomainClaimResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
package/dist/index.d.mts CHANGED
@@ -264,6 +264,16 @@ type RemoveApiKeyResponseSuccess = Pick<ApiKey, 'id'> & {
264
264
  };
265
265
  type RemoveApiKeyResponse = Response<RemoveApiKeyResponseSuccess>;
266
266
  //#endregion
267
+ //#region src/api-keys/interfaces/update-api-key-options.interface.d.ts
268
+ interface UpdateApiKeyOptions {
269
+ name: string;
270
+ }
271
+ interface UpdateApiKeyResponseSuccess {
272
+ object: 'api_key';
273
+ id: string;
274
+ }
275
+ type UpdateApiKeyResponse = Response<UpdateApiKeyResponseSuccess>;
276
+ //#endregion
267
277
  //#region src/automations/interfaces/automation-step.interface.d.ts
268
278
  type ConditionRule = {
269
279
  type: 'rule';
@@ -447,6 +457,12 @@ interface CreateAutomationResponseSuccess {
447
457
  }
448
458
  type CreateAutomationResponse = Response<CreateAutomationResponseSuccess>;
449
459
  //#endregion
460
+ //#region src/automations/interfaces/duplicate-automation.interface.d.ts
461
+ interface DuplicateAutomationResponseSuccess extends Pick<Automation, 'id'> {
462
+ object: 'automation';
463
+ }
464
+ type DuplicateAutomationResponse = Response<DuplicateAutomationResponseSuccess>;
465
+ //#endregion
450
466
  //#region src/automations/interfaces/get-automation.interface.d.ts
451
467
  interface GetAutomationResponseSuccess extends Automation {
452
468
  object: 'automation';
@@ -629,13 +645,19 @@ type Tag = {
629
645
  };
630
646
  //#endregion
631
647
  //#region src/batch/interfaces/create-batch-options.interface.d.ts
648
+ /**
649
+ * Distributes over union members, unlike the built-in `Omit`, which would
650
+ * collapse `CreateEmailOptions` into a single object type and lose the
651
+ * mutual exclusivity between its `react`/`html`/`text` and `template` variants.
652
+ */
653
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
632
654
  /**
633
655
  * Email options for batch sending. Same as CreateEmailOptions but without attachments,
634
656
  * as these are not supported in the batch API.
635
657
  *
636
658
  * @link https://resend.com/docs/dashboard/emails/batch-sending#limitations
637
659
  */
638
- type CreateBatchEmailOptions = Omit<CreateEmailOptions, 'attachments'>;
660
+ type CreateBatchEmailOptions = DistributiveOmit<CreateEmailOptions, 'attachments'>;
639
661
  type CreateBatchOptions = CreateBatchEmailOptions[];
640
662
  interface CreateBatchRequestOptions extends PostOptions, IdempotentRequest {
641
663
  /**
@@ -683,6 +705,12 @@ interface Broadcast {
683
705
  text: string | null;
684
706
  }
685
707
  //#endregion
708
+ //#region src/broadcasts/interfaces/cancel-broadcast.interface.d.ts
709
+ interface CancelBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
710
+ object: 'broadcast';
711
+ }
712
+ type CancelBroadcastResponse = Response<CancelBroadcastResponseSuccess>;
713
+ //#endregion
686
714
  //#region src/broadcasts/interfaces/create-broadcast-options.interface.d.ts
687
715
  interface EmailRenderOptions {
688
716
  /**
@@ -801,6 +829,65 @@ interface GetBroadcastResponseSuccess extends Broadcast {
801
829
  }
802
830
  type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;
803
831
  //#endregion
832
+ //#region src/broadcasts/interfaces/list-broadcast-clicked-links.interface.d.ts
833
+ type ListBroadcastClickedLinksOptions = PaginationOptions;
834
+ type BroadcastClickedLink = {
835
+ /**
836
+ * `id` is an opaque cursor for this row, used only for pagination.
837
+ * It does not identify any entity in Resend.
838
+ */
839
+ id: string;
840
+ url: string;
841
+ clicks: number;
842
+ unique_clicks: number;
843
+ };
844
+ type ListBroadcastClickedLinksResponseSuccess = PaginatedData<BroadcastClickedLink[]>;
845
+ type ListBroadcastClickedLinksResponse = Response<ListBroadcastClickedLinksResponseSuccess>;
846
+ //#endregion
847
+ //#region src/broadcasts/interfaces/list-broadcast-recipients.interface.d.ts
848
+ type BroadcastRecipientEventType = 'sent' | 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
849
+ type BroadcastRecipientBounceType = 'permanent' | 'transient' | 'undetermined';
850
+ type ListBroadcastRecipientsOptions<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginationOptions & {
851
+ type: T;
852
+ email?: string;
853
+ bounceType?: T extends 'bounced' ? BroadcastRecipientBounceType : never;
854
+ };
855
+ interface BroadcastRecipientClickedLink {
856
+ url: string;
857
+ clicks: number;
858
+ }
859
+ type BroadcastRecipientBase = {
860
+ id: string;
861
+ contact_id: string | null;
862
+ email: string;
863
+ };
864
+ type BroadcastRecipientLoose = BroadcastRecipientBase & {
865
+ count?: number;
866
+ clicked_links?: BroadcastRecipientClickedLink[];
867
+ bounce_type?: BroadcastRecipientBounceType;
868
+ };
869
+ type IsUnion<T, B = T> = T extends B ? ([B] extends [T] ? false : true) : never;
870
+ type BroadcastRecipientFieldsByType = {
871
+ sent: unknown;
872
+ delivered: unknown;
873
+ opened: {
874
+ count: number;
875
+ };
876
+ clicked: {
877
+ count: number;
878
+ clicked_links: BroadcastRecipientClickedLink[];
879
+ };
880
+ bounced: {
881
+ bounce_type: BroadcastRecipientBounceType;
882
+ };
883
+ complained: unknown;
884
+ unsubscribed: unknown;
885
+ suppressed: unknown;
886
+ };
887
+ type BroadcastRecipient<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = IsUnion<T> extends true ? BroadcastRecipientLoose : BroadcastRecipientBase & BroadcastRecipientFieldsByType[T];
888
+ type ListBroadcastRecipientsResponseSuccess<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = PaginatedData<BroadcastRecipient<T>[]>;
889
+ type ListBroadcastRecipientsResponse<T extends BroadcastRecipientEventType = BroadcastRecipientEventType> = Response<ListBroadcastRecipientsResponseSuccess<T>>;
890
+ //#endregion
804
891
  //#region src/broadcasts/interfaces/list-broadcasts.interface.d.ts
805
892
  type ListBroadcastsOptions = PaginationOptions;
806
893
  type ListBroadcastsResponseSuccess = {
@@ -1391,6 +1478,92 @@ interface GetEmailResponseSuccess {
1391
1478
  }
1392
1479
  type GetEmailResponse = Response<GetEmailResponseSuccess>;
1393
1480
  //#endregion
1481
+ //#region src/emails/interfaces/get-metrics.interface.d.ts
1482
+ type EmailMetric = 'received' | 'delivered' | 'complained' | 'suppressed' | 'bounced' | 'bounced_transient' | 'bounced_permanent' | 'bounced_undetermined' | 'opened' | 'clicked' | 'unsubscribed' | 'delivery_delayed' | 'failed' | 'sent' | 'unique_opened' | 'unique_clicked' | 'delivery_rate' | 'open_rate' | 'click_rate' | 'bounce_rate' | 'complaint_rate' | 'unsubscribe_rate';
1483
+ type EmailMetricsDimension = 'period' | 'domain' | 'email' | 'broadcast';
1484
+ type EmailMetricsGranularity = 'hourly' | 'daily' | 'weekly' | 'monthly';
1485
+ type EmailMetricsCommonOptions = {
1486
+ /**
1487
+ * The start of the date range, as an ISO 8601 date or datetime.
1488
+ * Defaults to 6 days before `endDate`.
1489
+ *
1490
+ * @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
1491
+ */
1492
+ startDate?: string;
1493
+ /**
1494
+ * The end of the date range, as an ISO 8601 date or datetime.
1495
+ * Defaults to now.
1496
+ *
1497
+ * @link https://resend.com/docs/api-reference/emails/get-metrics#query-parameters
1498
+ */
1499
+ endDate?: string;
1500
+ /**
1501
+ * The IANA timezone used to bucket periods when `period` is in `dimensions`.
1502
+ * Defaults to `UTC`.
1503
+ */
1504
+ timezone?: string;
1505
+ /**
1506
+ * The bucket size used when `period` is in `dimensions`.
1507
+ * Defaults to `daily`.
1508
+ */
1509
+ granularity?: EmailMetricsGranularity;
1510
+ /**
1511
+ * The metrics to include in the response. Defaults to all metrics.
1512
+ */
1513
+ metrics?: EmailMetric[];
1514
+ /**
1515
+ * Restrict the response to these sending domain IDs.
1516
+ */
1517
+ domainId?: string[];
1518
+ };
1519
+ type GetEmailsMetricsOptions = EmailMetricsCommonOptions & ({
1520
+ /**
1521
+ * The dimensions to break the response down by. Defaults to `[]`,
1522
+ * which returns a single `totals` row for the whole range, with no
1523
+ * `data`. Cannot combine `broadcast` with `email`/`emailId`.
1524
+ */
1525
+ dimensions?: Exclude<EmailMetricsDimension, 'broadcast'>[];
1526
+ /**
1527
+ * Restrict the response to these email IDs. Cannot be combined with
1528
+ * the `broadcast` dimension or `broadcastId`.
1529
+ */
1530
+ emailId?: string[];
1531
+ broadcastId?: never;
1532
+ } | {
1533
+ /**
1534
+ * The dimensions to break the response down by. Defaults to `[]`,
1535
+ * which returns a single `totals` row for the whole range, with no
1536
+ * `data`. Cannot combine `email` with `broadcast`/`broadcastId`.
1537
+ */
1538
+ dimensions?: Exclude<EmailMetricsDimension, 'email'>[];
1539
+ emailId?: never;
1540
+ /**
1541
+ * Restrict the response to these broadcast IDs. Cannot be combined
1542
+ * with the `email` dimension or `emailId`.
1543
+ */
1544
+ broadcastId?: string[];
1545
+ });
1546
+ type EmailMetricsTotals = Partial<Record<EmailMetric, number>>;
1547
+ type EmailMetricsDataRow = EmailMetricsTotals & {
1548
+ period?: string;
1549
+ domain_id?: string;
1550
+ domain_name?: string;
1551
+ email_id?: string;
1552
+ broadcast_id?: string;
1553
+ broadcast_name?: string;
1554
+ };
1555
+ interface GetEmailsMetricsResponseSuccess {
1556
+ object: 'metrics';
1557
+ start_date: string;
1558
+ end_date: string;
1559
+ metrics: EmailMetric[];
1560
+ dimensions: EmailMetricsDimension[];
1561
+ granularity: EmailMetricsGranularity;
1562
+ totals: EmailMetricsTotals;
1563
+ data?: EmailMetricsDataRow[];
1564
+ }
1565
+ type GetEmailsMetricsResponse = Response<GetEmailsMetricsResponseSuccess>;
1566
+ //#endregion
1394
1567
  //#region src/emails/interfaces/list-emails-options.interface.d.ts
1395
1568
  type ListEmailsOptions = PaginationOptions;
1396
1569
  type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
@@ -1401,6 +1574,17 @@ type ListEmailsResponseSuccess = {
1401
1574
  };
1402
1575
  type ListEmailsResponse = Response<ListEmailsResponseSuccess>;
1403
1576
  //#endregion
1577
+ //#region src/emails/interfaces/share-email-options.interface.d.ts
1578
+ interface ShareEmailOptions {
1579
+ expiresIn?: string;
1580
+ }
1581
+ interface ShareEmailResponseSuccess {
1582
+ object: 'email';
1583
+ id: string;
1584
+ url: string;
1585
+ }
1586
+ type ShareEmailResponse = Response<ShareEmailResponseSuccess>;
1587
+ //#endregion
1404
1588
  //#region src/emails/interfaces/update-email-options.interface.d.ts
1405
1589
  interface UpdateEmailOptions {
1406
1590
  id: string;
@@ -1635,6 +1819,7 @@ declare class ApiKeys {
1635
1819
  constructor(resend: Resend);
1636
1820
  create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>;
1637
1821
  list(options?: ListApiKeysOptions): Promise<ListApiKeysResponse>;
1822
+ update(id: string, payload: UpdateApiKeyOptions): Promise<UpdateApiKeyResponse>;
1638
1823
  remove(id: string): Promise<RemoveApiKeyResponse>;
1639
1824
  }
1640
1825
  //#endregion
@@ -1656,6 +1841,7 @@ declare class Automations {
1656
1841
  get(id: string): Promise<GetAutomationResponse>;
1657
1842
  remove(id: string): Promise<RemoveAutomationResponse>;
1658
1843
  update(id: string, payload: UpdateAutomationOptions): Promise<UpdateAutomationResponse>;
1844
+ duplicate(id: string): Promise<DuplicateAutomationResponse>;
1659
1845
  stop(id: string): Promise<StopAutomationResponse>;
1660
1846
  }
1661
1847
  //#endregion
@@ -1675,7 +1861,10 @@ declare class Broadcasts {
1675
1861
  send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
1676
1862
  list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
1677
1863
  get(id: string): Promise<GetBroadcastResponse>;
1864
+ recipients<T extends BroadcastRecipientEventType>(id: string, options: ListBroadcastRecipientsOptions<T>): Promise<ListBroadcastRecipientsResponse<T>>;
1865
+ clickedLinks(id: string, options?: ListBroadcastClickedLinksOptions): Promise<ListBroadcastClickedLinksResponse>;
1678
1866
  remove(id: string): Promise<RemoveBroadcastResponse>;
1867
+ cancel(id: string): Promise<CancelBroadcastResponse>;
1679
1868
  update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
1680
1869
  }
1681
1870
  //#endregion
@@ -1796,6 +1985,8 @@ declare class Emails {
1796
1985
  list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
1797
1986
  update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
1798
1987
  cancel(id: string): Promise<CancelEmailResponse>;
1988
+ share(id: string, payload?: ShareEmailOptions): Promise<ShareEmailResponse>;
1989
+ metrics(options?: GetEmailsMetricsOptions): Promise<GetEmailsMetricsResponse>;
1799
1990
  }
1800
1991
  //#endregion
1801
1992
  //#region src/events/events.d.ts
@@ -2146,6 +2337,7 @@ interface BaseEmailEventData {
2146
2337
  broadcast_id?: string;
2147
2338
  created_at: string;
2148
2339
  email_id: string;
2340
+ message_id: string;
2149
2341
  from: string;
2150
2342
  to: string[];
2151
2343
  subject: string;
@@ -2451,4 +2643,4 @@ declare class Resend {
2451
2643
  delete<T>(path: string, query?: unknown, options?: DeleteOptions): Promise<Response<T>>;
2452
2644
  }
2453
2645
  //#endregion
2454
- export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, 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 };
2646
+ export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, AddSuppressionOptions, AddSuppressionResponse, AddSuppressionResponseSuccess, AddToSegmentStepConfig, ApiContactProperty, ApiKey, Attachment, AttachmentData, Automation, AutomationConnection, AutomationConnectionType, AutomationResponseConnection, AutomationResponseStep, AutomationRun, AutomationRunItem, AutomationRunStatus, AutomationRunStep, AutomationRunStepStatus, AutomationStatus, AutomationStep, AutomationStepType, BatchAddSuppressionsOptions, BatchAddSuppressionsResponse, BatchAddSuppressionsResponseSuccess, BatchRemoveSuppressionsOptions, BatchRemoveSuppressionsResponse, BatchRemoveSuppressionsResponseSuccess, Broadcast, BroadcastClickedLink, BroadcastRecipient, BroadcastRecipientBounceType, BroadcastRecipientClickedLink, BroadcastRecipientEventType, CancelBroadcastResponse, CancelBroadcastResponseSuccess, CancelEmailResponse, CancelEmailResponseSuccess, ClaimDomainOptions, ClaimDomainRequestOptions, ClaimDomainResponse, ClaimDomainResponseSuccess, ConditionRule, ConditionStepConfig, Contact, ContactCreatedEvent, ContactDeleteStepConfig, ContactDeletedEvent, ContactImport, ContactImportColumnMap, ContactImportCounts, ContactImportOnConflict, ContactImportPropertyMapping, ContactImportPropertyType, ContactImportSegment, ContactImportStatus, ContactImportTopic, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdateStepConfig, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAutomationOptions, CreateAutomationResponse, CreateAutomationResponseSuccess, CreateBatchEmailOptions, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactImportOptions, CreateContactImportRequestOptions, CreateContactImportResponse, CreateContactImportResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateEventOptions, CreateEventResponse, CreateEventResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, DelayStepConfig, DeleteOptions, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainClaim, DomainClaimBlockedReason, DomainClaimRecord, DomainClaimStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecordStatus, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateAutomationResponse, DuplicateAutomationResponseSuccess, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailMetric, EmailMetricsDataRow, EmailMetricsDimension, EmailMetricsGranularity, EmailMetricsTotals, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, Event, EventSchemaMap, EventSchemaType, ForwardReceivingEmailOptions, ForwardReceivingEmailRequestOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetAutomationResponse, GetAutomationResponseSuccess, GetAutomationRunOptions, GetAutomationRunResponse, GetAutomationRunResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactImportResponse, GetContactImportResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainClaimResponse, GetDomainClaimResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetEmailsMetricsOptions, GetEmailsMetricsResponse, GetEmailsMetricsResponseSuccess, GetEventResponse, GetEventResponseSuccess, GetLogResponse, GetLogResponseSuccess, GetOptions, GetReceivingEmailOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetSuppressionResponse, GetSuppressionResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, InboundAttachment, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListAutomationRunsOptions, ListAutomationRunsResponse, ListAutomationRunsResponseSuccess, ListAutomationsOptions, ListAutomationsResponse, ListAutomationsResponseSuccess, ListBroadcastClickedLinksOptions, ListBroadcastClickedLinksResponse, ListBroadcastClickedLinksResponseSuccess, ListBroadcastRecipientsOptions, ListBroadcastRecipientsResponse, ListBroadcastRecipientsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactImportsOptions, ListContactImportsResponse, ListContactImportsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListEmail, ListEmailsOptions, ListEmailsResponse, ListEmailsResponseSuccess, ListEventsOptions, ListEventsResponse, ListEventsResponseSuccess, ListLogsOptions, ListLogsResponse, ListLogsResponseSuccess, ListOAuthGrantsOptions, ListOAuthGrantsResponse, ListOAuthGrantsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListSuppressionsOptions, ListSuppressionsResponse, ListSuppressionsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, Log, OAuthGrant, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveAutomationResponse, RemoveAutomationResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveEventResponse, RemoveEventResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveSuppressionResponse, RemoveSuppressionResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type ResendOptions, type Response, RevokeOAuthGrantResponse, RevokeOAuthGrantResponseSuccess, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, SendEmailStepConfig, SendEventOptions, SendEventResponse, SendEventResponseSuccess, ShareEmailOptions, ShareEmailResponse, ShareEmailResponseSuccess, StopAutomationResponse, StopAutomationResponseSuccess, Suppression, SuppressionAddedEvent, SuppressionListEntry, SuppressionOrigin, SuppressionRemovedEvent, Tag, Template, TemplateVariable, TemplateVariableValue, Topic, TrackingCaaRecord, TrackingRecord, TriggerStepConfig, UpdateApiKeyOptions, UpdateApiKeyResponse, UpdateApiKeyResponseSuccess, UpdateAutomationOptions, UpdateAutomationResponse, UpdateAutomationResponseSuccess, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateEventOptions, UpdateEventResponse, UpdateEventResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainClaimResponse, VerifyDomainClaimResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, WaitForEventStepConfig, Webhook, WebhookEvent, WebhookEventPayload };
package/dist/index.mjs CHANGED
@@ -1,9 +1,13 @@
1
1
  import PostalMime from "postal-mime";
2
2
  import { Webhook } from "standardwebhooks";
3
3
  //#region package.json
4
- var version = "6.18.1";
4
+ var version = "6.22.0";
5
5
  //#endregion
6
6
  //#region src/common/utils/build-pagination-query.ts
7
+ function buildPaginationUrl(base, options) {
8
+ const queryString = buildPaginationQuery(options);
9
+ return queryString ? `${base}?${queryString}` : base;
10
+ }
7
11
  /**
8
12
  * Builds a query string from pagination options
9
13
  * @param options - Pagination options containing limit and either after or before (but not both)
@@ -26,10 +30,12 @@ var ApiKeys = class {
26
30
  return await this.resend.post("/api-keys", payload, options);
27
31
  }
28
32
  async list(options = {}) {
29
- const queryString = buildPaginationQuery(options);
30
- const url = queryString ? `/api-keys?${queryString}` : "/api-keys";
33
+ const url = buildPaginationUrl("/api-keys", options);
31
34
  return await this.resend.get(url);
32
35
  }
36
+ async update(id, payload) {
37
+ return await this.resend.patch(`/api-keys/${id}`, payload);
38
+ }
33
39
  async remove(id) {
34
40
  return await this.resend.delete(`/api-keys/${id}`);
35
41
  }
@@ -169,6 +175,9 @@ var Automations = class {
169
175
  if (payload.connections !== void 0) apiPayload.connections = payload.connections.map(parseConnection);
170
176
  return await this.resend.patch(`/automations/${id}`, apiPayload);
171
177
  }
178
+ async duplicate(id) {
179
+ return await this.resend.post(`/automations/${id}/duplicate`);
180
+ }
172
181
  async stop(id) {
173
182
  return await this.resend.post(`/automations/${id}/stop`);
174
183
  }
@@ -270,16 +279,26 @@ var Broadcasts = class {
270
279
  return await this.resend.post(`/broadcasts/${id}/send`, { scheduled_at: payload?.scheduledAt });
271
280
  }
272
281
  async list(options = {}) {
273
- const queryString = buildPaginationQuery(options);
274
- const url = queryString ? `/broadcasts?${queryString}` : "/broadcasts";
282
+ const url = buildPaginationUrl("/broadcasts", options);
275
283
  return await this.resend.get(url);
276
284
  }
277
285
  async get(id) {
278
286
  return await this.resend.get(`/broadcasts/${id}`);
279
287
  }
288
+ async recipients(id, options) {
289
+ const url = `/broadcasts/${id}/recipients?${buildRecipientsQuery(options)}`;
290
+ return await this.resend.get(url);
291
+ }
292
+ async clickedLinks(id, options = {}) {
293
+ const url = buildPaginationUrl(`/broadcasts/${id}/clicked-links`, options);
294
+ return await this.resend.get(url);
295
+ }
280
296
  async remove(id) {
281
297
  return await this.resend.delete(`/broadcasts/${id}`);
282
298
  }
299
+ async cancel(id) {
300
+ return await this.resend.post(`/broadcasts/${id}/cancel`);
301
+ }
283
302
  async update(id, payload) {
284
303
  const html = payload.react ? await render(payload.react) : payload.html;
285
304
  return await this.resend.patch(`/broadcasts/${id}`, {
@@ -296,6 +315,14 @@ var Broadcasts = class {
296
315
  });
297
316
  }
298
317
  };
318
+ function buildRecipientsQuery(options) {
319
+ const { type, email, bounceType, ...pagination } = options;
320
+ const searchParams = new URLSearchParams(buildPaginationQuery(pagination));
321
+ searchParams.set("type", type);
322
+ if (email !== void 0) searchParams.set("email", email);
323
+ if (bounceType !== void 0) searchParams.set("bounce_type", bounceType);
324
+ return searchParams.toString();
325
+ }
299
326
  //#endregion
300
327
  //#region src/common/utils/parse-contact-properties-to-api-options.ts
301
328
  function parseContactPropertyFromApi(contactProperty) {
@@ -326,8 +353,7 @@ var ContactProperties = class {
326
353
  return await this.resend.post("/contact-properties", apiOptions);
327
354
  }
328
355
  async list(options = {}) {
329
- const queryString = buildPaginationQuery(options);
330
- const url = queryString ? `/contact-properties?${queryString}` : "/contact-properties";
356
+ const url = buildPaginationUrl("/contact-properties", options);
331
357
  const response = await this.resend.get(url);
332
358
  if (response.data) return {
333
359
  data: {
@@ -446,9 +472,7 @@ var ContactSegments = class {
446
472
  name: "missing_required_field"
447
473
  }
448
474
  };
449
- const identifier = options.email ? options.email : options.contactId;
450
- const queryString = buildPaginationQuery(options);
451
- const url = queryString ? `/contacts/${identifier}/segments?${queryString}` : `/contacts/${identifier}/segments`;
475
+ const url = buildPaginationUrl(`/contacts/${options.email ? options.email : options.contactId}/segments`, options);
452
476
  return await this.resend.get(url);
453
477
  }
454
478
  async add(options) {
@@ -507,9 +531,7 @@ var ContactTopics = class {
507
531
  name: "missing_required_field"
508
532
  }
509
533
  };
510
- const identifier = options.email ? options.email : options.id;
511
- const queryString = buildPaginationQuery(options);
512
- const url = queryString ? `/contacts/${identifier}/topics?${queryString}` : `/contacts/${identifier}/topics`;
534
+ const url = buildPaginationUrl(`/contacts/${options.email ? options.email : options.id}/topics`, options);
513
535
  return this.resend.get(url);
514
536
  }
515
537
  };
@@ -554,12 +576,10 @@ var Contacts = class {
554
576
  async list(options = {}) {
555
577
  const segmentId = options.segmentId ?? options.audienceId;
556
578
  if (!segmentId) {
557
- const queryString = buildPaginationQuery(options);
558
- const url = queryString ? `/contacts?${queryString}` : "/contacts";
579
+ const url = buildPaginationUrl("/contacts", options);
559
580
  return await this.resend.get(url);
560
581
  }
561
- const queryString = buildPaginationQuery(options);
562
- const url = queryString ? `/segments/${segmentId}/contacts?${queryString}` : `/segments/${segmentId}/contacts`;
582
+ const url = buildPaginationUrl(`/segments/${segmentId}/contacts`, options);
563
583
  return await this.resend.get(url);
564
584
  }
565
585
  async get(options) {
@@ -662,8 +682,7 @@ var Domains = class {
662
682
  return await this.resend.post("/domains", parseDomainToApiOptions(payload), options);
663
683
  }
664
684
  async list(options = {}) {
665
- const queryString = buildPaginationQuery(options);
666
- const url = queryString ? `/domains?${queryString}` : "/domains";
685
+ const url = buildPaginationUrl("/domains", options);
667
686
  return await this.resend.get(url);
668
687
  }
669
688
  async get(id) {
@@ -697,8 +716,7 @@ var Attachments$1 = class {
697
716
  }
698
717
  async list(options) {
699
718
  const { emailId } = options;
700
- const queryString = buildPaginationQuery(options);
701
- const url = queryString ? `/emails/${emailId}/attachments?${queryString}` : `/emails/${emailId}/attachments`;
719
+ const url = buildPaginationUrl(`/emails/${emailId}/attachments`, options);
702
720
  return await this.resend.get(url);
703
721
  }
704
722
  };
@@ -714,8 +732,7 @@ var Attachments = class {
714
732
  }
715
733
  async list(options) {
716
734
  const { emailId } = options;
717
- const queryString = buildPaginationQuery(options);
718
- const url = queryString ? `/emails/receiving/${emailId}/attachments?${queryString}` : `/emails/receiving/${emailId}/attachments`;
735
+ const url = buildPaginationUrl(`/emails/receiving/${emailId}/attachments`, options);
719
736
  return await this.resend.get(url);
720
737
  }
721
738
  };
@@ -734,8 +751,7 @@ var Receiving = class {
734
751
  return await this.resend.get(path);
735
752
  }
736
753
  async list(options = {}) {
737
- const queryString = buildPaginationQuery(options);
738
- const url = queryString ? `/emails/receiving?${queryString}` : "/emails/receiving";
754
+ const url = buildPaginationUrl("/emails/receiving", options);
739
755
  return await this.resend.get(url);
740
756
  }
741
757
  async forward(options, requestOptions = {}) {
@@ -860,8 +876,7 @@ var Emails = class {
860
876
  return await this.resend.get(`/emails/${id}`);
861
877
  }
862
878
  async list(options = {}) {
863
- const queryString = buildPaginationQuery(options);
864
- const url = queryString ? `/emails?${queryString}` : "/emails";
879
+ const url = buildPaginationUrl("/emails", options);
865
880
  return await this.resend.get(url);
866
881
  }
867
882
  async update(payload) {
@@ -870,7 +885,31 @@ var Emails = class {
870
885
  async cancel(id) {
871
886
  return await this.resend.post(`/emails/${id}/cancel`);
872
887
  }
888
+ async share(id, payload) {
889
+ return await this.resend.post(`/emails/${id}/share`, { expires_in: payload?.expiresIn });
890
+ }
891
+ async metrics(options = {}) {
892
+ const queryString = buildMetricsQuery(options);
893
+ const url = queryString ? `/emails/metrics?${queryString}` : "/emails/metrics";
894
+ return await this.resend.get(url);
895
+ }
873
896
  };
897
+ function buildMetricsQuery(options) {
898
+ const params = {
899
+ start_date: options.startDate,
900
+ end_date: options.endDate,
901
+ timezone: options.timezone,
902
+ granularity: options.granularity,
903
+ metrics: options.metrics?.join(","),
904
+ dimensions: options.dimensions?.join(","),
905
+ domain_id: options.domainId?.join(","),
906
+ email_id: options.emailId?.join(","),
907
+ broadcast_id: options.broadcastId?.join(",")
908
+ };
909
+ const searchParams = new URLSearchParams();
910
+ for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== "") searchParams.set(key, value);
911
+ return searchParams.toString();
912
+ }
874
913
  //#endregion
875
914
  //#region src/events/events.ts
876
915
  var Events = class {
@@ -887,8 +926,7 @@ var Events = class {
887
926
  return await this.resend.get(`/events/${encodeURIComponent(identifier)}`);
888
927
  }
889
928
  async list(options = {}) {
890
- const queryString = buildPaginationQuery(options);
891
- const url = queryString ? `/events?${queryString}` : "/events";
929
+ const url = buildPaginationUrl("/events", options);
892
930
  return await this.resend.get(url);
893
931
  }
894
932
  async update(identifier, payload) {
@@ -905,8 +943,7 @@ var Logs = class {
905
943
  this.resend = resend;
906
944
  }
907
945
  async list(options = {}) {
908
- const queryString = buildPaginationQuery(options);
909
- const url = queryString ? `/logs?${queryString}` : "/logs";
946
+ const url = buildPaginationUrl("/logs", options);
910
947
  return await this.resend.get(url);
911
948
  }
912
949
  async get(id) {
@@ -920,8 +957,7 @@ var OAuthGrants = class {
920
957
  this.resend = resend;
921
958
  }
922
959
  async list(options = {}) {
923
- const queryString = buildPaginationQuery(options);
924
- const url = queryString ? `/oauth/grants?${queryString}` : "/oauth/grants";
960
+ const url = buildPaginationUrl("/oauth/grants", options);
925
961
  return await this.resend.get(url);
926
962
  }
927
963
  async revoke(id) {
@@ -938,8 +974,7 @@ var Segments = class {
938
974
  return await this.resend.post("/segments", payload, options);
939
975
  }
940
976
  async list(options = {}) {
941
- const queryString = buildPaginationQuery(options);
942
- const url = queryString ? `/segments?${queryString}` : "/segments";
977
+ const url = buildPaginationUrl("/segments", options);
943
978
  return await this.resend.get(url);
944
979
  }
945
980
  async get(id) {
@@ -1150,8 +1185,7 @@ var Webhooks = class {
1150
1185
  return await this.resend.get(`/webhooks/${id}`);
1151
1186
  }
1152
1187
  async list(options = {}) {
1153
- const queryString = buildPaginationQuery(options);
1154
- const url = queryString ? `/webhooks?${queryString}` : "/webhooks";
1188
+ const url = buildPaginationUrl("/webhooks", options);
1155
1189
  return await this.resend.get(url);
1156
1190
  }
1157
1191
  async update(id, payload) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depup/resend",
3
- "version": "6.18.1-depup.0",
3
+ "version": "6.22.0-depup.0",
4
4
  "description": "Node.js library for the Resend API (with updated dependencies)",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "homepage": "https://github.com/resend/resend-node#readme",
56
56
  "dependencies": {
57
- "postal-mime": "2.7.5",
57
+ "postal-mime": "^3.0.0",
58
58
  "standardwebhooks": "1.0.0"
59
59
  },
60
60
  "peerDependencies": {
@@ -94,11 +94,16 @@
94
94
  "patched"
95
95
  ],
96
96
  "depup": {
97
- "changes": {},
98
- "depsUpdated": 0,
97
+ "changes": {
98
+ "postal-mime": {
99
+ "from": "2.7.5",
100
+ "to": "^3.0.0"
101
+ }
102
+ },
103
+ "depsUpdated": 1,
99
104
  "originalPackage": "resend",
100
- "originalVersion": "6.18.1",
101
- "processedAt": "2026-08-02T00:59:34.207Z",
105
+ "originalVersion": "6.22.0",
106
+ "processedAt": "2026-08-23T00:28:33.045Z",
102
107
  "smokeTest": "passed"
103
108
  }
104
109
  }