resend 6.8.0 → 6.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,8 @@
1
+ let mailparser = require("mailparser");
1
2
  let svix = require("svix");
2
3
 
3
4
  //#region package.json
4
- var version = "6.8.0";
5
+ var version = "6.9.1";
5
6
 
6
7
  //#endregion
7
8
  //#region src/common/utils/build-pagination-query.ts
@@ -73,13 +74,13 @@ function parseEmailToApiOptions(email) {
73
74
  //#endregion
74
75
  //#region src/render.ts
75
76
  async function render(node) {
76
- let render$1;
77
+ let render;
77
78
  try {
78
- ({render: render$1} = await import("@react-email/render"));
79
+ ({render} = await import("@react-email/render"));
79
80
  } catch {
80
81
  throw new Error("Failed to render React component. Make sure to install `@react-email/render` or `@react-email/components`.");
81
82
  }
82
- return render$1(node);
83
+ return render(node);
83
84
  }
84
85
 
85
86
  //#endregion
@@ -350,27 +351,40 @@ var Contacts = class {
350
351
  this.segments = new ContactSegments(this.resend);
351
352
  }
352
353
  async create(payload, options = {}) {
353
- if (!payload.audienceId) return await this.resend.post("/contacts", {
354
- unsubscribed: payload.unsubscribed,
355
- email: payload.email,
356
- first_name: payload.firstName,
357
- last_name: payload.lastName,
358
- properties: payload.properties
359
- }, options);
360
- return await this.resend.post(`/audiences/${payload.audienceId}/contacts`, {
354
+ if ("audienceId" in payload) {
355
+ if ("segments" in payload || "topics" in payload) return {
356
+ data: null,
357
+ headers: null,
358
+ error: {
359
+ message: "`audienceId` is deprecated, and cannot be used together with `segments` or `topics`. Use `segments` instead to add one or more segments to the new contact.",
360
+ statusCode: null,
361
+ name: "invalid_parameter"
362
+ }
363
+ };
364
+ return await this.resend.post(`/audiences/${payload.audienceId}/contacts`, {
365
+ unsubscribed: payload.unsubscribed,
366
+ email: payload.email,
367
+ first_name: payload.firstName,
368
+ last_name: payload.lastName,
369
+ properties: payload.properties
370
+ }, options);
371
+ }
372
+ return await this.resend.post("/contacts", {
361
373
  unsubscribed: payload.unsubscribed,
362
374
  email: payload.email,
363
375
  first_name: payload.firstName,
364
376
  last_name: payload.lastName,
365
- properties: payload.properties
377
+ properties: payload.properties,
378
+ segments: payload.segments,
379
+ topics: payload.topics
366
380
  }, options);
367
381
  }
368
382
  async list(options = {}) {
369
383
  const segmentId = options.segmentId ?? options.audienceId;
370
384
  if (!segmentId) {
371
- const queryString$1 = buildPaginationQuery(options);
372
- const url$1 = queryString$1 ? `/contacts?${queryString$1}` : "/contacts";
373
- return await this.resend.get(url$1);
385
+ const queryString = buildPaginationQuery(options);
386
+ const url = queryString ? `/contacts?${queryString}` : "/contacts";
387
+ return await this.resend.get(url);
374
388
  }
375
389
  const queryString = buildPaginationQuery(options);
376
390
  const url = queryString ? `/segments/${segmentId}/contacts?${queryString}` : `/segments/${segmentId}/contacts`;
@@ -527,6 +541,106 @@ var Receiving = class {
527
541
  const url = queryString ? `/emails/receiving?${queryString}` : "/emails/receiving";
528
542
  return await this.resend.get(url);
529
543
  }
544
+ async forward(options) {
545
+ const { emailId, to, from } = options;
546
+ const passthrough = options.passthrough !== false;
547
+ const emailResponse = await this.get(emailId);
548
+ if (emailResponse.error) return {
549
+ data: null,
550
+ error: emailResponse.error,
551
+ headers: emailResponse.headers
552
+ };
553
+ const email = emailResponse.data;
554
+ const originalSubject = email.subject || "(no subject)";
555
+ if (passthrough) return this.forwardPassthrough(email, {
556
+ to,
557
+ from,
558
+ subject: originalSubject
559
+ });
560
+ const forwardSubject = originalSubject.startsWith("Fwd:") ? originalSubject : `Fwd: ${originalSubject}`;
561
+ return this.forwardWrapped(email, {
562
+ to,
563
+ from,
564
+ subject: forwardSubject,
565
+ text: "text" in options ? options.text : void 0,
566
+ html: "html" in options ? options.html : void 0
567
+ });
568
+ }
569
+ async forwardPassthrough(email, options) {
570
+ const { to, from, subject } = options;
571
+ if (!email.raw?.download_url) return {
572
+ data: null,
573
+ error: {
574
+ name: "validation_error",
575
+ message: "Raw email content is not available for this email",
576
+ statusCode: 400
577
+ },
578
+ headers: null
579
+ };
580
+ const rawResponse = await fetch(email.raw.download_url);
581
+ if (!rawResponse.ok) return {
582
+ data: null,
583
+ error: {
584
+ name: "application_error",
585
+ message: "Failed to download raw email content",
586
+ statusCode: rawResponse.status
587
+ },
588
+ headers: null
589
+ };
590
+ const parsed = await (0, mailparser.simpleParser)(await rawResponse.text(), { skipImageLinks: true });
591
+ const attachments = parsed.attachments.map((attachment) => {
592
+ const contentId = attachment.contentId ? attachment.contentId.replace(/^<|>$/g, "") : void 0;
593
+ return {
594
+ filename: attachment.filename,
595
+ content: attachment.content.toString("base64"),
596
+ content_type: attachment.contentType,
597
+ content_id: contentId || void 0
598
+ };
599
+ });
600
+ return await this.resend.post("/emails", {
601
+ from,
602
+ to,
603
+ subject,
604
+ text: parsed.text || void 0,
605
+ html: parsed.html || void 0,
606
+ attachments: attachments.length > 0 ? attachments : void 0
607
+ });
608
+ }
609
+ async forwardWrapped(email, options) {
610
+ const { to, from, subject, text, html } = options;
611
+ if (!email.raw?.download_url) return {
612
+ data: null,
613
+ error: {
614
+ name: "validation_error",
615
+ message: "Raw email content is not available for this email",
616
+ statusCode: 400
617
+ },
618
+ headers: null
619
+ };
620
+ const rawResponse = await fetch(email.raw.download_url);
621
+ if (!rawResponse.ok) return {
622
+ data: null,
623
+ error: {
624
+ name: "application_error",
625
+ message: "Failed to download raw email content",
626
+ statusCode: rawResponse.status
627
+ },
628
+ headers: null
629
+ };
630
+ const rawEmailContent = await rawResponse.text();
631
+ return await this.resend.post("/emails", {
632
+ from,
633
+ to,
634
+ subject,
635
+ text,
636
+ html,
637
+ attachments: [{
638
+ filename: "forwarded_message.eml",
639
+ content: Buffer.from(rawEmailContent).toString("base64"),
640
+ content_type: "message/rfc822"
641
+ }]
642
+ });
643
+ }
530
644
  };
531
645
 
532
646
  //#endregion
package/dist/index.d.cts CHANGED
@@ -361,8 +361,7 @@ interface CreateBatchRequestOptions extends PostOptions, IdempotentRequest {
361
361
  }
362
362
  type CreateBatchSuccessResponse<Options extends CreateBatchRequestOptions = CreateBatchRequestOptions> = {
363
363
  data: {
364
- /** The ID of the newly created email. */
365
- id: string;
364
+ /** The ID of the newly created email. */id: string;
366
365
  }[];
367
366
  } & (Options['batchValidation'] extends 'permissive' ? {
368
367
  /**
@@ -575,6 +574,97 @@ type UpdateBroadcastOptions = {
575
574
  };
576
575
  type UpdateBroadcastResponse = Response<UpdateBroadcastResponseSuccess>;
577
576
  //#endregion
577
+ //#region src/contact-properties/interfaces/contact-property.d.ts
578
+ type StringBaseApiContactProperty = {
579
+ type: 'string';
580
+ fallback_value: string | null;
581
+ };
582
+ type NumberBaseApiContactProperty = {
583
+ type: 'number';
584
+ fallback_value: number | null;
585
+ };
586
+ type ApiContactProperty = {
587
+ id: string;
588
+ created_at: string;
589
+ key: string;
590
+ } & (StringBaseApiContactProperty | NumberBaseApiContactProperty);
591
+ type StringBaseContactProperty = {
592
+ type: 'string';
593
+ fallbackValue: string | null;
594
+ };
595
+ type NumberBaseContactProperty = {
596
+ type: 'number';
597
+ fallbackValue: number | null;
598
+ };
599
+ type ContactProperty = {
600
+ id: string;
601
+ createdAt: string;
602
+ key: string;
603
+ } & (StringBaseContactProperty | NumberBaseContactProperty);
604
+ //#endregion
605
+ //#region src/contact-properties/interfaces/create-contact-property-options.interface.d.ts
606
+ type StringBaseContactPropertyOptions = {
607
+ type: 'string';
608
+ fallbackValue?: string | null;
609
+ };
610
+ type NumberBaseContactPropertyOptions = {
611
+ type: 'number';
612
+ fallbackValue?: number | null;
613
+ };
614
+ type CreateContactPropertyOptions = {
615
+ key: string;
616
+ } & (StringBaseContactPropertyOptions | NumberBaseContactPropertyOptions);
617
+ interface CreateContactPropertyApiOptions {
618
+ key: string;
619
+ type: 'string' | 'number';
620
+ fallback_value?: string | number | null;
621
+ }
622
+ type CreateContactPropertyResponseSuccess = Pick<ContactProperty, 'id'> & {
623
+ object: 'contact_property';
624
+ };
625
+ type CreateContactPropertyResponse = Response<CreateContactPropertyResponseSuccess>;
626
+ //#endregion
627
+ //#region src/contact-properties/interfaces/delete-contact-property-options.interface.d.ts
628
+ type RemoveContactPropertyResponseSuccess = Pick<ContactProperty, 'id'> & {
629
+ object: 'contact_property';
630
+ deleted: boolean;
631
+ };
632
+ type RemoveContactPropertyResponse = Response<RemoveContactPropertyResponseSuccess>;
633
+ //#endregion
634
+ //#region src/contact-properties/interfaces/get-contact-property.interface.d.ts
635
+ type GetContactPropertyResponseSuccess = ApiContactProperty & {
636
+ object: 'contact_property';
637
+ };
638
+ type GetContactPropertyResponse = Response<ContactProperty & {
639
+ object: 'contact_property';
640
+ }>;
641
+ //#endregion
642
+ //#region src/contact-properties/interfaces/list-contact-properties-options.interface.d.ts
643
+ type ListContactPropertiesOptions = PaginationOptions;
644
+ type ListContactPropertiesResponseSuccess = {
645
+ object: 'list';
646
+ has_more: boolean;
647
+ data: ApiContactProperty[];
648
+ };
649
+ type ListContactPropertiesResponse = Response<{
650
+ object: 'list';
651
+ has_more: boolean;
652
+ data: ContactProperty[];
653
+ }>;
654
+ //#endregion
655
+ //#region src/contact-properties/interfaces/update-contact-property-options.interface.d.ts
656
+ type UpdateContactPropertyOptions = {
657
+ id: string;
658
+ fallbackValue?: string | number | null;
659
+ };
660
+ interface UpdateContactPropertyApiOptions {
661
+ fallback_value?: string | number | null;
662
+ }
663
+ type UpdateContactPropertyResponseSuccess = Pick<ContactProperty, 'id'> & {
664
+ object: 'contact_property';
665
+ };
666
+ type UpdateContactPropertyResponse = Response<UpdateContactPropertyResponseSuccess>;
667
+ //#endregion
578
668
  //#region src/contacts/interfaces/contact.d.ts
579
669
  interface Contact {
580
670
  created_at: string;
@@ -616,13 +706,36 @@ type SelectingField = {
616
706
  interface CreateContactPropertiesOptions {
617
707
  [key: string]: string | number | null;
618
708
  }
709
+ interface LegacyCreateContactOptions {
710
+ /**
711
+ * @deprecated Use `segments` instead to add one or more segments to the new contact
712
+ */
713
+ audienceId: string;
714
+ email: string;
715
+ unsubscribed?: boolean;
716
+ firstName?: string;
717
+ lastName?: string;
718
+ properties?: CreateContactPropertiesOptions;
719
+ segments?: never;
720
+ topics?: never;
721
+ }
619
722
  interface CreateContactOptions {
620
- audienceId?: string;
621
723
  email: string;
622
724
  unsubscribed?: boolean;
623
725
  firstName?: string;
624
726
  lastName?: string;
625
727
  properties?: CreateContactPropertiesOptions;
728
+ segments?: {
729
+ id: string;
730
+ }[];
731
+ topics?: {
732
+ id: string;
733
+ subscription: 'opt_in' | 'opt_out';
734
+ }[];
735
+ /**
736
+ * @deprecated Use `segments` instead to add one or more segments to the new contact
737
+ */
738
+ audienceId?: never;
626
739
  }
627
740
  interface CreateContactRequestOptions extends PostOptions {}
628
741
  interface CreateContactResponseSuccess extends Pick<Contact, 'id'> {
@@ -698,6 +811,79 @@ type UpdateContactResponseSuccess = Pick<Contact, 'id'> & {
698
811
  };
699
812
  type UpdateContactResponse = Response<UpdateContactResponseSuccess>;
700
813
  //#endregion
814
+ //#region src/contacts/segments/interfaces/contact-segments.interface.d.ts
815
+ type ContactSegmentsBaseOptions = {
816
+ contactId: string;
817
+ email?: never;
818
+ } | {
819
+ contactId?: never;
820
+ email: string;
821
+ };
822
+ //#endregion
823
+ //#region src/contacts/segments/interfaces/add-contact-segment.interface.d.ts
824
+ type AddContactSegmentOptions = ContactSegmentsBaseOptions & {
825
+ segmentId: string;
826
+ };
827
+ interface AddContactSegmentResponseSuccess {
828
+ id: string;
829
+ }
830
+ type AddContactSegmentResponse = Response<AddContactSegmentResponseSuccess>;
831
+ //#endregion
832
+ //#region src/segments/interfaces/segment.d.ts
833
+ interface Segment {
834
+ created_at: string;
835
+ id: string;
836
+ name: string;
837
+ }
838
+ //#endregion
839
+ //#region src/contacts/segments/interfaces/list-contact-segments.interface.d.ts
840
+ type ListContactSegmentsOptions = PaginationOptions & ContactSegmentsBaseOptions;
841
+ type ListContactSegmentsResponseSuccess = PaginatedData<Segment[]>;
842
+ type ListContactSegmentsResponse = Response<ListContactSegmentsResponseSuccess>;
843
+ //#endregion
844
+ //#region src/contacts/segments/interfaces/remove-contact-segment.interface.d.ts
845
+ type RemoveContactSegmentOptions = ContactSegmentsBaseOptions & {
846
+ segmentId: string;
847
+ };
848
+ interface RemoveContactSegmentResponseSuccess {
849
+ id: string;
850
+ deleted: boolean;
851
+ }
852
+ type RemoveContactSegmentResponse = Response<RemoveContactSegmentResponseSuccess>;
853
+ //#endregion
854
+ //#region src/contacts/topics/interfaces/list-contact-topics.interface.d.ts
855
+ interface ListContactTopicsBaseOptions {
856
+ id?: string;
857
+ email?: string;
858
+ }
859
+ type ListContactTopicsOptions = ListContactTopicsBaseOptions & PaginationOptions;
860
+ interface ListContactTopicsRequestOptions extends GetOptions {}
861
+ interface ContactTopic {
862
+ id: string;
863
+ name: string;
864
+ description: string | null;
865
+ subscription: 'opt_in' | 'opt_out';
866
+ }
867
+ type ListContactTopicsResponseSuccess = PaginatedData<ContactTopic[]>;
868
+ type ListContactTopicsResponse = Response<ListContactTopicsResponseSuccess>;
869
+ //#endregion
870
+ //#region src/contacts/topics/interfaces/update-contact-topics.interface.d.ts
871
+ interface UpdateContactTopicsBaseOptions {
872
+ id?: string;
873
+ email?: string;
874
+ }
875
+ interface UpdateContactTopicsOptions extends UpdateContactTopicsBaseOptions {
876
+ topics: {
877
+ id: string;
878
+ subscription: 'opt_in' | 'opt_out';
879
+ }[];
880
+ }
881
+ interface UpdateContactTopicsRequestOptions extends PatchOptions {}
882
+ interface UpdateContactTopicsResponseSuccess {
883
+ id: string;
884
+ }
885
+ type UpdateContactTopicsResponse = Response<UpdateContactTopicsResponseSuccess>;
886
+ //#endregion
701
887
  //#region src/domains/interfaces/create-domain-options.interface.d.ts
702
888
  interface CreateDomainOptions {
703
889
  name: string;
@@ -836,6 +1022,26 @@ interface UpdateEmailResponseSuccess {
836
1022
  }
837
1023
  type UpdateEmailResponse = Response<UpdateEmailResponseSuccess>;
838
1024
  //#endregion
1025
+ //#region src/emails/receiving/interfaces/forward-receiving-email.interface.d.ts
1026
+ interface ForwardReceivingEmailBodyOptions {
1027
+ text: string;
1028
+ html: string;
1029
+ }
1030
+ interface ForwardReceivingEmailBaseOptions {
1031
+ emailId: string;
1032
+ to: string | string[];
1033
+ from: string;
1034
+ }
1035
+ type ForwardReceivingEmailOptions = (ForwardReceivingEmailBaseOptions & {
1036
+ passthrough?: true;
1037
+ }) | (ForwardReceivingEmailBaseOptions & {
1038
+ passthrough: false;
1039
+ } & RequireAtLeastOne<ForwardReceivingEmailBodyOptions>);
1040
+ interface ForwardReceivingEmailResponseSuccess {
1041
+ id: string;
1042
+ }
1043
+ type ForwardReceivingEmailResponse = Response<ForwardReceivingEmailResponseSuccess>;
1044
+ //#endregion
839
1045
  //#region src/emails/receiving/interfaces/get-receiving-email.interface.d.ts
840
1046
  interface GetReceivingEmailResponseSuccess {
841
1047
  object: 'email';
@@ -851,6 +1057,10 @@ interface GetReceivingEmailResponseSuccess {
851
1057
  text: string | null;
852
1058
  headers: Record<string, string>;
853
1059
  message_id: string;
1060
+ raw: {
1061
+ download_url: string;
1062
+ expires_at: string;
1063
+ } | null;
854
1064
  attachments: Array<{
855
1065
  id: string;
856
1066
  filename: string;
@@ -864,7 +1074,7 @@ type GetReceivingEmailResponse = Response<GetReceivingEmailResponseSuccess>;
864
1074
  //#endregion
865
1075
  //#region src/emails/receiving/interfaces/list-receiving-emails.interface.d.ts
866
1076
  type ListReceivingEmailsOptions = PaginationOptions;
867
- type ListReceivingEmail = Omit<GetReceivingEmailResponseSuccess, 'html' | 'text' | 'headers' | 'object'>;
1077
+ type ListReceivingEmail = Omit<GetReceivingEmailResponseSuccess, 'html' | 'text' | 'headers' | 'raw' | 'object'>;
868
1078
  interface ListReceivingEmailsResponseSuccess {
869
1079
  object: 'list';
870
1080
  has_more: boolean;
@@ -907,68 +1117,6 @@ declare class Broadcasts {
907
1117
  update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
908
1118
  }
909
1119
  //#endregion
910
- //#region src/contact-properties/interfaces/contact-property.d.ts
911
- type StringBaseContactProperty = {
912
- type: 'string';
913
- fallbackValue: string | null;
914
- };
915
- type NumberBaseContactProperty = {
916
- type: 'number';
917
- fallbackValue: number | null;
918
- };
919
- type ContactProperty = {
920
- id: string;
921
- createdAt: string;
922
- key: string;
923
- } & (StringBaseContactProperty | NumberBaseContactProperty);
924
- //#endregion
925
- //#region src/contact-properties/interfaces/create-contact-property-options.interface.d.ts
926
- type StringBaseContactPropertyOptions = {
927
- type: 'string';
928
- fallbackValue?: string | null;
929
- };
930
- type NumberBaseContactPropertyOptions = {
931
- type: 'number';
932
- fallbackValue?: number | null;
933
- };
934
- type CreateContactPropertyOptions = {
935
- key: string;
936
- } & (StringBaseContactPropertyOptions | NumberBaseContactPropertyOptions);
937
- type CreateContactPropertyResponseSuccess = Pick<ContactProperty, 'id'> & {
938
- object: 'contact_property';
939
- };
940
- type CreateContactPropertyResponse = Response<CreateContactPropertyResponseSuccess>;
941
- //#endregion
942
- //#region src/contact-properties/interfaces/delete-contact-property-options.interface.d.ts
943
- type RemoveContactPropertyResponseSuccess = Pick<ContactProperty, 'id'> & {
944
- object: 'contact_property';
945
- deleted: boolean;
946
- };
947
- type RemoveContactPropertyResponse = Response<RemoveContactPropertyResponseSuccess>;
948
- //#endregion
949
- //#region src/contact-properties/interfaces/get-contact-property.interface.d.ts
950
- type GetContactPropertyResponse = Response<ContactProperty & {
951
- object: 'contact_property';
952
- }>;
953
- //#endregion
954
- //#region src/contact-properties/interfaces/list-contact-properties-options.interface.d.ts
955
- type ListContactPropertiesOptions = PaginationOptions;
956
- type ListContactPropertiesResponse = Response<{
957
- object: 'list';
958
- has_more: boolean;
959
- data: ContactProperty[];
960
- }>;
961
- //#endregion
962
- //#region src/contact-properties/interfaces/update-contact-property-options.interface.d.ts
963
- type UpdateContactPropertyOptions = {
964
- id: string;
965
- fallbackValue?: string | number | null;
966
- };
967
- type UpdateContactPropertyResponseSuccess = Pick<ContactProperty, 'id'> & {
968
- object: 'contact_property';
969
- };
970
- type UpdateContactPropertyResponse = Response<UpdateContactPropertyResponseSuccess>;
971
- //#endregion
972
1120
  //#region src/contact-properties/contact-properties.d.ts
973
1121
  declare class ContactProperties {
974
1122
  private readonly resend;
@@ -980,46 +1128,6 @@ declare class ContactProperties {
980
1128
  remove(id: string): Promise<RemoveContactPropertyResponse>;
981
1129
  }
982
1130
  //#endregion
983
- //#region src/contacts/segments/interfaces/contact-segments.interface.d.ts
984
- type ContactSegmentsBaseOptions = {
985
- contactId: string;
986
- email?: never;
987
- } | {
988
- contactId?: never;
989
- email: string;
990
- };
991
- //#endregion
992
- //#region src/contacts/segments/interfaces/add-contact-segment.interface.d.ts
993
- type AddContactSegmentOptions = ContactSegmentsBaseOptions & {
994
- segmentId: string;
995
- };
996
- interface AddContactSegmentResponseSuccess {
997
- id: string;
998
- }
999
- type AddContactSegmentResponse = Response<AddContactSegmentResponseSuccess>;
1000
- //#endregion
1001
- //#region src/segments/interfaces/segment.d.ts
1002
- interface Segment {
1003
- created_at: string;
1004
- id: string;
1005
- name: string;
1006
- }
1007
- //#endregion
1008
- //#region src/contacts/segments/interfaces/list-contact-segments.interface.d.ts
1009
- type ListContactSegmentsOptions = PaginationOptions & ContactSegmentsBaseOptions;
1010
- type ListContactSegmentsResponseSuccess = PaginatedData<Segment[]>;
1011
- type ListContactSegmentsResponse = Response<ListContactSegmentsResponseSuccess>;
1012
- //#endregion
1013
- //#region src/contacts/segments/interfaces/remove-contact-segment.interface.d.ts
1014
- type RemoveContactSegmentOptions = ContactSegmentsBaseOptions & {
1015
- segmentId: string;
1016
- };
1017
- interface RemoveContactSegmentResponseSuccess {
1018
- id: string;
1019
- deleted: boolean;
1020
- }
1021
- type RemoveContactSegmentResponse = Response<RemoveContactSegmentResponseSuccess>;
1022
- //#endregion
1023
1131
  //#region src/contacts/segments/contact-segments.d.ts
1024
1132
  declare class ContactSegments {
1025
1133
  private readonly resend;
@@ -1029,37 +1137,6 @@ declare class ContactSegments {
1029
1137
  remove(options: RemoveContactSegmentOptions): Promise<RemoveContactSegmentResponse>;
1030
1138
  }
1031
1139
  //#endregion
1032
- //#region src/contacts/topics/interfaces/list-contact-topics.interface.d.ts
1033
- interface ListContactTopicsBaseOptions {
1034
- id?: string;
1035
- email?: string;
1036
- }
1037
- type ListContactTopicsOptions = ListContactTopicsBaseOptions & PaginationOptions;
1038
- interface ContactTopic {
1039
- id: string;
1040
- name: string;
1041
- description: string | null;
1042
- subscription: 'opt_in' | 'opt_out';
1043
- }
1044
- type ListContactTopicsResponseSuccess = PaginatedData<ContactTopic[]>;
1045
- type ListContactTopicsResponse = Response<ListContactTopicsResponseSuccess>;
1046
- //#endregion
1047
- //#region src/contacts/topics/interfaces/update-contact-topics.interface.d.ts
1048
- interface UpdateContactTopicsBaseOptions {
1049
- id?: string;
1050
- email?: string;
1051
- }
1052
- interface UpdateContactTopicsOptions extends UpdateContactTopicsBaseOptions {
1053
- topics: {
1054
- id: string;
1055
- subscription: 'opt_in' | 'opt_out';
1056
- }[];
1057
- }
1058
- interface UpdateContactTopicsResponseSuccess {
1059
- id: string;
1060
- }
1061
- type UpdateContactTopicsResponse = Response<UpdateContactTopicsResponseSuccess>;
1062
- //#endregion
1063
1140
  //#region src/contacts/topics/contact-topics.d.ts
1064
1141
  declare class ContactTopics {
1065
1142
  private readonly resend;
@@ -1074,7 +1151,7 @@ declare class Contacts {
1074
1151
  readonly topics: ContactTopics;
1075
1152
  readonly segments: ContactSegments;
1076
1153
  constructor(resend: Resend);
1077
- create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1154
+ create(payload: CreateContactOptions | LegacyCreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
1078
1155
  list(options?: ListContactsOptions): Promise<ListContactsResponse>;
1079
1156
  get(options: GetContactOptions): Promise<GetContactResponse>;
1080
1157
  update(options: UpdateContactOptions): Promise<UpdateContactResponse>;
@@ -1126,6 +1203,9 @@ declare class Receiving {
1126
1203
  constructor(resend: Resend);
1127
1204
  get(id: string): Promise<GetReceivingEmailResponse>;
1128
1205
  list(options?: ListReceivingEmailsOptions): Promise<ListReceivingEmailsResponse>;
1206
+ forward(options: ForwardReceivingEmailOptions): Promise<ForwardReceivingEmailResponse>;
1207
+ private forwardPassthrough;
1208
+ private forwardWrapped;
1129
1209
  }
1130
1210
  //#endregion
1131
1211
  //#region src/emails/emails.d.ts
@@ -1227,6 +1307,7 @@ type TemplateOptionalFieldsForCreation = Partial<Pick<Template, 'subject' | 'tex
1227
1307
  variables?: TemplateVariableCreationOptions[];
1228
1308
  };
1229
1309
  type CreateTemplateOptions = Pick<Template, 'name'> & TemplateOptionalFieldsForCreation & TemplateContentCreationOptions;
1310
+ interface CreateTemplateRequestOptions extends PostOptions {}
1230
1311
  interface CreateTemplateResponseSuccess extends Pick<Template, 'id'> {
1231
1312
  object: 'template';
1232
1313
  }
@@ -1260,6 +1341,7 @@ interface GetTemplateResponseSuccess extends Template {
1260
1341
  type GetTemplateResponse = Response<GetTemplateResponseSuccess>;
1261
1342
  //#endregion
1262
1343
  //#region src/templates/interfaces/list-templates.interface.d.ts
1344
+ type ListTemplatesOptions = PaginationOptions;
1263
1345
  interface TemplateListItem extends Pick<Template, 'id' | 'name' | 'created_at' | 'updated_at' | 'status' | 'published_at' | 'alias'> {}
1264
1346
  interface ListTemplatesResponseSuccess {
1265
1347
  object: 'list';
@@ -1327,6 +1409,9 @@ type CreateTopicResponseSuccess = Pick<Topic, 'id'>;
1327
1409
  type CreateTopicResponse = Response<CreateTopicResponseSuccess>;
1328
1410
  //#endregion
1329
1411
  //#region src/topics/interfaces/get-contact.interface.d.ts
1412
+ interface GetTopicOptions {
1413
+ id: string;
1414
+ }
1330
1415
  type GetTopicResponseSuccess = Topic;
1331
1416
  type GetTopicResponse = Response<GetTopicResponseSuccess>;
1332
1417
  //#endregion
@@ -1644,4 +1729,4 @@ declare class Resend {
1644
1729
  delete<T>(path: string, query?: unknown): Promise<Response<T>>;
1645
1730
  }
1646
1731
  //#endregion
1647
- export { ApiKey, Attachment, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, Contact, ContactCreatedEvent, ContactDeletedEvent, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactOptions, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactOptions, GetContactResponse, GetContactResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsApiResponse, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type Response, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, Tag, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactResponse, UpdateContactResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, Webhook, WebhookEvent, WebhookEventPayload };
1732
+ export { AddContactSegmentOptions, AddContactSegmentResponse, AddContactSegmentResponseSuccess, ApiContactProperty, ApiKey, Attachment, Broadcast, CancelEmailResponse, CancelEmailResponseSuccess, Contact, ContactCreatedEvent, ContactDeletedEvent, ContactProperty, ContactSegmentsBaseOptions, ContactTopic, ContactUpdatedEvent, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactOptions, CreateContactPropertyApiOptions, CreateContactPropertyOptions, CreateContactPropertyResponse, CreateContactPropertyResponseSuccess, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, CreateSegmentOptions, CreateSegmentRequestOptions, CreateSegmentResponse, CreateSegmentResponseSuccess, CreateTemplateOptions, CreateTemplateRequestOptions, CreateTemplateResponse, CreateTemplateResponseSuccess, CreateTopicOptions, CreateTopicResponse, CreateTopicResponseSuccess, CreateWebhookOptions, CreateWebhookRequestOptions, CreateWebhookResponse, CreateWebhookResponseSuccess, Domain, DomainApiOptions, DomainCapabilities, DomainCapabilityStatus, DomainCreatedEvent, DomainDeletedEvent, DomainDkimRecord, DomainNameservers, DomainRecords, DomainRegion, DomainSpfRecord, DomainStatus, DomainUpdatedEvent, DuplicateTemplateResponse, DuplicateTemplateResponseSuccess, EmailApiAttachment, EmailApiOptions, EmailBouncedEvent, EmailClickedEvent, EmailComplainedEvent, EmailDeliveredEvent, EmailDeliveryDelayedEvent, EmailFailedEvent, EmailOpenedEvent, EmailReceivedEvent, EmailScheduledEvent, EmailSentEvent, EmailSuppressedEvent, type ErrorResponse, ForwardReceivingEmailOptions, ForwardReceivingEmailResponse, ForwardReceivingEmailResponseSuccess, GetAttachmentOptions, GetAttachmentResponse, GetAttachmentResponseSuccess, GetBroadcastResponse, GetBroadcastResponseSuccess, GetContactOptions, GetContactPropertyResponse, GetContactPropertyResponseSuccess, GetContactResponse, GetContactResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, GetOptions, GetReceivingEmailResponse, GetReceivingEmailResponseSuccess, GetSegmentResponse, GetSegmentResponseSuccess, GetTemplateResponse, GetTemplateResponseSuccess, GetTopicOptions, GetTopicResponse, GetTopicResponseSuccess, GetWebhookResponse, GetWebhookResponseSuccess, IdempotentRequest, LegacyCreateContactOptions, ListApiKeysOptions, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAttachmentsApiResponse, ListAttachmentsOptions, ListAttachmentsResponse, ListAttachmentsResponseSuccess, ListBroadcastsOptions, ListBroadcastsResponse, ListBroadcastsResponseSuccess, ListContactPropertiesOptions, ListContactPropertiesResponse, ListContactPropertiesResponseSuccess, ListContactSegmentsOptions, ListContactSegmentsResponse, ListContactSegmentsResponseSuccess, ListContactTopicsOptions, ListContactTopicsRequestOptions, ListContactTopicsResponse, ListContactTopicsResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsOptions, ListDomainsResponse, ListDomainsResponseSuccess, ListReceivingEmail, ListReceivingEmailsOptions, ListReceivingEmailsResponse, ListReceivingEmailsResponseSuccess, ListSegmentsOptions, ListSegmentsResponse, ListSegmentsResponseSuccess, ListTemplatesOptions, ListTemplatesResponse, ListTemplatesResponseSuccess, ListTopicsResponse, ListTopicsResponseSuccess, ListWebhooksOptions, ListWebhooksResponse, ListWebhooksResponseSuccess, PaginatedData, PaginationOptions, PatchOptions, PostOptions, PublishTemplateResponse, PublishTemplateResponseSuccess, PutOptions, ReceivingRecord, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveBroadcastResponse, RemoveBroadcastResponseSuccess, RemoveContactOptions, RemoveContactPropertyResponse, RemoveContactPropertyResponseSuccess, RemoveContactSegmentOptions, RemoveContactSegmentResponse, RemoveContactSegmentResponseSuccess, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, RemoveSegmentResponse, RemoveSegmentResponseSuccess, RemoveTemplateResponse, RemoveTemplateResponseSuccess, RemoveTopicResponse, RemoveTopicResponseSuccess, RemoveWebhookResponse, RemoveWebhookResponseSuccess, RequireAtLeastOne, Resend, type Response, Segment, SelectingField, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, Tag, Template, TemplateVariable, Topic, UpdateBroadcastOptions, UpdateBroadcastResponse, UpdateBroadcastResponseSuccess, UpdateContactOptions, UpdateContactPropertyApiOptions, UpdateContactPropertyOptions, UpdateContactPropertyResponse, UpdateContactPropertyResponseSuccess, UpdateContactResponse, UpdateContactResponseSuccess, UpdateContactTopicsOptions, UpdateContactTopicsRequestOptions, UpdateContactTopicsResponse, UpdateContactTopicsResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, UpdateEmailOptions, UpdateEmailResponse, UpdateEmailResponseSuccess, UpdateTemplateOptions, UpdateTemplateResponse, UpdateTemplateResponseSuccess, UpdateTopicOptions, UpdateTopicResponse, UpdateTopicResponseSuccess, UpdateWebhookOptions, UpdateWebhookResponse, UpdateWebhookResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess, Webhook, WebhookEvent, WebhookEventPayload };