resend 6.1.0 → 6.1.2-preview-templates.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,10 +1,86 @@
1
1
  import * as React$1 from 'react';
2
2
 
3
+ interface ApiKey {
4
+ created_at: string;
5
+ id: string;
6
+ name: string;
7
+ }
8
+
9
+ interface DomainApiOptions {
10
+ name: string;
11
+ region?: string;
12
+ custom_return_path?: string;
13
+ }
14
+
15
+ declare const RESEND_ERROR_CODES_BY_KEY: {
16
+ readonly missing_required_field: 422;
17
+ readonly invalid_idempotency_key: 400;
18
+ readonly invalid_idempotent_request: 409;
19
+ readonly concurrent_idempotent_requests: 409;
20
+ readonly invalid_access: 422;
21
+ readonly invalid_parameter: 422;
22
+ readonly invalid_region: 422;
23
+ readonly rate_limit_exceeded: 429;
24
+ readonly missing_api_key: 401;
25
+ readonly invalid_api_key: 403;
26
+ readonly invalid_from_address: 403;
27
+ readonly validation_error: 403;
28
+ readonly not_found: 404;
29
+ readonly method_not_allowed: 405;
30
+ readonly application_error: 500;
31
+ readonly internal_server_error: 500;
32
+ };
33
+ type RESEND_ERROR_CODE_KEY = keyof typeof RESEND_ERROR_CODES_BY_KEY;
34
+ interface ErrorResponse {
35
+ message: string;
36
+ name: RESEND_ERROR_CODE_KEY;
37
+ }
38
+ type Tag$1 = {
39
+ name: string;
40
+ value: string;
41
+ };
42
+
43
+ interface EmailApiAttachment {
44
+ content?: string | Buffer;
45
+ filename?: string | false | undefined;
46
+ path?: string;
47
+ content_type?: string;
48
+ content_id?: string;
49
+ }
50
+ interface EmailApiOptions {
51
+ from?: string;
52
+ to: string | string[];
53
+ subject?: string;
54
+ region?: string;
55
+ headers?: Record<string, string>;
56
+ html?: string;
57
+ text?: string;
58
+ bcc?: string | string[];
59
+ cc?: string | string[];
60
+ reply_to?: string | string[];
61
+ scheduled_at?: string;
62
+ tags?: Tag$1[];
63
+ attachments?: EmailApiAttachment[];
64
+ template?: {
65
+ id: string;
66
+ variables?: Record<string, string | number | boolean>;
67
+ };
68
+ }
69
+
3
70
  interface GetOptions {
4
71
  query?: Record<string, unknown>;
5
72
  headers?: HeadersInit;
6
73
  }
7
74
 
75
+ interface IdempotentRequest {
76
+ /**
77
+ * Unique key that ensures the same operation is not processed multiple times.
78
+ * Allows for safe retries without duplicating operations.
79
+ * If provided, will be sent as the `Idempotency-Key` header.
80
+ */
81
+ idempotencyKey?: string;
82
+ }
83
+
8
84
  type PaginationOptions = {
9
85
  /**
10
86
  * Maximum number of items to return (1-100, default: 20)
@@ -24,6 +100,13 @@ type PaginationOptions = {
24
100
  after?: never;
25
101
  });
26
102
 
103
+ interface PatchOptions {
104
+ query?: {
105
+ [key: string]: unknown;
106
+ };
107
+ headers?: HeadersInit;
108
+ }
109
+
27
110
  interface PostOptions {
28
111
  query?: {
29
112
  [key: string]: unknown;
@@ -38,29 +121,9 @@ interface PutOptions {
38
121
  headers?: HeadersInit;
39
122
  }
40
123
 
41
- declare const RESEND_ERROR_CODES_BY_KEY: {
42
- readonly missing_required_field: 422;
43
- readonly invalid_idempotency_key: 400;
44
- readonly invalid_idempotent_request: 409;
45
- readonly concurrent_idempotent_requests: 409;
46
- readonly invalid_access: 422;
47
- readonly invalid_parameter: 422;
48
- readonly invalid_region: 422;
49
- readonly rate_limit_exceeded: 429;
50
- readonly missing_api_key: 401;
51
- readonly invalid_api_key: 403;
52
- readonly invalid_from_address: 403;
53
- readonly validation_error: 403;
54
- readonly not_found: 404;
55
- readonly method_not_allowed: 405;
56
- readonly application_error: 500;
57
- readonly internal_server_error: 500;
58
- };
59
- type RESEND_ERROR_CODE_KEY = keyof typeof RESEND_ERROR_CODES_BY_KEY;
60
- interface ErrorResponse {
61
- message: string;
62
- name: RESEND_ERROR_CODE_KEY;
63
- }
124
+ type RequireAtLeastOne<T> = {
125
+ [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
126
+ }[keyof T];
64
127
 
65
128
  interface CreateApiKeyOptions {
66
129
  name: string;
@@ -81,12 +144,6 @@ type CreateApiKeyResponse = {
81
144
  error: ErrorResponse;
82
145
  };
83
146
 
84
- interface ApiKey {
85
- created_at: string;
86
- id: string;
87
- name: string;
88
- }
89
-
90
147
  type ListApiKeysOptions = PaginationOptions;
91
148
  type ListApiKeysResponseSuccess = {
92
149
  object: 'list';
@@ -169,19 +226,6 @@ type RemoveAudiencesResponse = {
169
226
  error: ErrorResponse;
170
227
  };
171
228
 
172
- interface IdempotentRequest {
173
- /**
174
- * Unique key that ensures the same operation is not processed multiple times.
175
- * Allows for safe retries without duplicating operations.
176
- * If provided, will be sent as the `Idempotency-Key` header.
177
- */
178
- idempotencyKey?: string;
179
- }
180
-
181
- type RequireAtLeastOne<T> = {
182
- [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
183
- }[keyof T];
184
-
185
229
  interface EmailRenderOptions$1 {
186
230
  /**
187
231
  * The React component used to write the message.
@@ -202,6 +246,16 @@ interface EmailRenderOptions$1 {
202
246
  */
203
247
  text: string;
204
248
  }
249
+ interface EmailTemplateOptions {
250
+ template: {
251
+ id: string;
252
+ variables?: Record<string, string | number | boolean>;
253
+ };
254
+ }
255
+ interface CreateEmailBaseOptionsWithTemplate extends Omit<CreateEmailBaseOptions, 'from' | 'subject'> {
256
+ from?: string;
257
+ subject?: string;
258
+ }
205
259
  interface CreateEmailBaseOptions {
206
260
  /**
207
261
  * Filename and content of attachments (max 40mb per email)
@@ -265,7 +319,13 @@ interface CreateEmailBaseOptions {
265
319
  */
266
320
  scheduledAt?: string;
267
321
  }
268
- type CreateEmailOptions = RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions;
322
+ type CreateEmailOptions = ((RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions) & {
323
+ template?: never;
324
+ }) | ((EmailTemplateOptions & CreateEmailBaseOptionsWithTemplate) & {
325
+ react?: never;
326
+ html?: never;
327
+ text?: never;
328
+ });
269
329
  interface CreateEmailRequestOptions extends PostOptions, IdempotentRequest {
270
330
  }
271
331
  interface CreateEmailResponseSuccess {
@@ -340,6 +400,20 @@ type CreateBatchResponse<Options extends CreateBatchRequestOptions> = {
340
400
  error: ErrorResponse;
341
401
  };
342
402
 
403
+ interface Broadcast {
404
+ id: string;
405
+ name: string;
406
+ audience_id: string | null;
407
+ from: string | null;
408
+ subject: string | null;
409
+ reply_to: string[] | null;
410
+ preview_text: string | null;
411
+ status: 'draft' | 'sent' | 'queued';
412
+ created_at: string;
413
+ scheduled_at: string | null;
414
+ sent_at: string | null;
415
+ }
416
+
343
417
  interface EmailRenderOptions {
344
418
  /**
345
419
  * The React component used to write the message.
@@ -413,6 +487,43 @@ type CreateBroadcastResponse = {
413
487
  error: ErrorResponse;
414
488
  };
415
489
 
490
+ interface GetBroadcastResponseSuccess extends Broadcast {
491
+ object: 'broadcast';
492
+ }
493
+ type GetBroadcastResponse = {
494
+ data: GetBroadcastResponseSuccess;
495
+ error: null;
496
+ } | {
497
+ data: null;
498
+ error: ErrorResponse;
499
+ };
500
+
501
+ type ListBroadcastsOptions = PaginationOptions;
502
+ type ListBroadcastsResponseSuccess = {
503
+ object: 'list';
504
+ has_more: boolean;
505
+ data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
506
+ };
507
+ type ListBroadcastsResponse = {
508
+ data: ListBroadcastsResponseSuccess;
509
+ error: null;
510
+ } | {
511
+ data: null;
512
+ error: ErrorResponse;
513
+ };
514
+
515
+ interface RemoveBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
516
+ object: 'broadcast';
517
+ deleted: boolean;
518
+ }
519
+ type RemoveBroadcastResponse = {
520
+ data: RemoveBroadcastResponseSuccess;
521
+ error: null;
522
+ } | {
523
+ data: null;
524
+ error: ErrorResponse;
525
+ };
526
+
416
527
  interface SendBroadcastBaseOptions {
417
528
  /**
418
529
  * Schedule email to be sent later.
@@ -438,6 +549,28 @@ type SendBroadcastResponse = {
438
549
  error: ErrorResponse;
439
550
  };
440
551
 
552
+ interface UpdateBroadcastResponseSuccess {
553
+ id: string;
554
+ }
555
+ type UpdateBroadcastOptions = {
556
+ name?: string;
557
+ audienceId?: string;
558
+ from?: string;
559
+ html?: string;
560
+ react?: React.ReactNode;
561
+ text?: string;
562
+ subject?: string;
563
+ replyTo?: string[];
564
+ previewText?: string;
565
+ };
566
+ type UpdateBroadcastResponse = {
567
+ data: UpdateBroadcastResponseSuccess;
568
+ error: null;
569
+ } | {
570
+ data: null;
571
+ error: ErrorResponse;
572
+ };
573
+
441
574
  interface Contact {
442
575
  created_at: string;
443
576
  id: string;
@@ -558,6 +691,7 @@ type UpdateContactResponse = {
558
691
  };
559
692
 
560
693
  type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1';
694
+ type DomainNameservers = 'Amazon Route 53' | 'Cloudflare' | 'Digital Ocean' | 'GoDaddy' | 'Google Domains' | 'Namecheap' | 'Unidentified' | 'Vercel';
561
695
  type DomainStatus = 'pending' | 'verified' | 'failed' | 'temporary_failure' | 'not_started';
562
696
  type DomainRecords = DomainSpfRecord | DomainDkimRecord;
563
697
  interface DomainSpfRecord {
@@ -674,6 +808,18 @@ type VerifyDomainsResponse = {
674
808
  error: ErrorResponse;
675
809
  };
676
810
 
811
+ interface CancelEmailResponseSuccess {
812
+ object: 'email';
813
+ id: string;
814
+ }
815
+ type CancelEmailResponse = {
816
+ data: CancelEmailResponseSuccess;
817
+ error: null;
818
+ } | {
819
+ data: null;
820
+ error: ErrorResponse;
821
+ };
822
+
677
823
  interface GetEmailResponseSuccess {
678
824
  bcc: string[] | null;
679
825
  cc: string[] | null;
@@ -701,6 +847,22 @@ type GetEmailResponse = {
701
847
  error: ErrorResponse;
702
848
  };
703
849
 
850
+ interface UpdateEmailOptions {
851
+ id: string;
852
+ scheduledAt: string;
853
+ }
854
+ interface UpdateEmailResponseSuccess {
855
+ id: string;
856
+ object: 'email';
857
+ }
858
+ type UpdateEmailResponse = {
859
+ data: UpdateEmailResponseSuccess;
860
+ error: null;
861
+ } | {
862
+ data: null;
863
+ error: ErrorResponse;
864
+ };
865
+
704
866
  declare class ApiKeys {
705
867
  private readonly resend;
706
868
  constructor(resend: Resend);
@@ -725,79 +887,6 @@ declare class Batch {
725
887
  create<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>;
726
888
  }
727
889
 
728
- interface Broadcast {
729
- id: string;
730
- name: string;
731
- audience_id: string | null;
732
- from: string | null;
733
- subject: string | null;
734
- reply_to: string[] | null;
735
- preview_text: string | null;
736
- status: 'draft' | 'sent' | 'queued';
737
- created_at: string;
738
- scheduled_at: string | null;
739
- sent_at: string | null;
740
- }
741
-
742
- interface GetBroadcastResponseSuccess extends Broadcast {
743
- object: 'broadcast';
744
- }
745
- type GetBroadcastResponse = {
746
- data: GetBroadcastResponseSuccess;
747
- error: null;
748
- } | {
749
- data: null;
750
- error: ErrorResponse;
751
- };
752
-
753
- type ListBroadcastsOptions = PaginationOptions;
754
- type ListBroadcastsResponseSuccess = {
755
- object: 'list';
756
- has_more: boolean;
757
- data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
758
- };
759
- type ListBroadcastsResponse = {
760
- data: ListBroadcastsResponseSuccess;
761
- error: null;
762
- } | {
763
- data: null;
764
- error: ErrorResponse;
765
- };
766
-
767
- interface RemoveBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
768
- object: 'broadcast';
769
- deleted: boolean;
770
- }
771
- type RemoveBroadcastResponse = {
772
- data: RemoveBroadcastResponseSuccess;
773
- error: null;
774
- } | {
775
- data: null;
776
- error: ErrorResponse;
777
- };
778
-
779
- interface UpdateBroadcastResponseSuccess {
780
- id: string;
781
- }
782
- type UpdateBroadcastOptions = {
783
- name?: string;
784
- audienceId?: string;
785
- from?: string;
786
- html?: string;
787
- react?: React.ReactNode;
788
- text?: string;
789
- subject?: string;
790
- replyTo?: string[];
791
- previewText?: string;
792
- };
793
- type UpdateBroadcastResponse = {
794
- data: UpdateBroadcastResponseSuccess;
795
- error: null;
796
- } | {
797
- data: null;
798
- error: ErrorResponse;
799
- };
800
-
801
890
  declare class Broadcasts {
802
891
  private readonly resend;
803
892
  constructor(resend: Resend);
@@ -809,13 +898,6 @@ declare class Broadcasts {
809
898
  update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
810
899
  }
811
900
 
812
- interface PatchOptions {
813
- query?: {
814
- [key: string]: unknown;
815
- };
816
- headers?: HeadersInit;
817
- }
818
-
819
901
  declare class Contacts {
820
902
  private readonly resend;
821
903
  constructor(resend: Resend);
@@ -837,18 +919,6 @@ declare class Domains {
837
919
  verify(id: string): Promise<VerifyDomainsResponse>;
838
920
  }
839
921
 
840
- interface CancelEmailResponseSuccess {
841
- object: 'email';
842
- id: string;
843
- }
844
- type CancelEmailResponse = {
845
- data: CancelEmailResponseSuccess;
846
- error: null;
847
- } | {
848
- data: null;
849
- error: ErrorResponse;
850
- };
851
-
852
922
  type ListEmailsOptions = PaginationOptions;
853
923
  type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
854
924
  type ListEmailsResponseSuccess = {
@@ -864,31 +934,189 @@ type ListEmailsResponse = {
864
934
  error: ErrorResponse;
865
935
  };
866
936
 
867
- interface UpdateEmailOptions {
937
+ declare class Emails {
938
+ private readonly resend;
939
+ constructor(resend: Resend);
940
+ send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
941
+ create(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
942
+ get(id: string): Promise<GetEmailResponse>;
943
+ list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
944
+ update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
945
+ cancel(id: string): Promise<CancelEmailResponse>;
946
+ }
947
+
948
+ interface Template {
868
949
  id: string;
869
- scheduledAt: string;
950
+ name: string;
951
+ subject: string | null;
952
+ html: string;
953
+ text: string | null;
954
+ status: 'draft' | 'published';
955
+ variables: TemplateVariable[] | null;
956
+ alias: string | null;
957
+ from: string | null;
958
+ reply_to: string[] | null;
959
+ published_at: string | null;
960
+ created_at: string;
961
+ updated_at: string;
870
962
  }
871
- interface UpdateEmailResponseSuccess {
963
+ type TemplateVariableListFallbackType = string[] | number[] | boolean[] | Record<string, unknown>[];
964
+ interface TemplateVariable {
965
+ key: string;
966
+ fallback_value: string | number | boolean | Record<string, unknown> | TemplateVariableListFallbackType | null;
967
+ type: 'string' | 'number' | 'boolean' | 'object' | 'list';
968
+ created_at: string;
969
+ updated_at: string;
970
+ }
971
+
972
+ type TemplateContentCreationOptions = RequireAtLeastOne<{
973
+ html: string;
974
+ react: React.ReactNode;
975
+ }>;
976
+ type TemplateVariableCreationOptions = Pick<TemplateVariable, 'key' | 'type'> & ({
977
+ type: 'string';
978
+ fallbackValue?: string | null;
979
+ } | {
980
+ type: 'number';
981
+ fallbackValue?: number | null;
982
+ } | {
983
+ type: 'boolean';
984
+ fallbackValue?: boolean | null;
985
+ } | {
986
+ type: 'object';
987
+ fallbackValue: Record<string, unknown>;
988
+ } | {
989
+ type: 'list';
990
+ fallbackValue: TemplateVariableListFallbackType;
991
+ });
992
+ type TemplateOptionalFieldsForCreation = Partial<Pick<Template, 'subject' | 'text' | 'alias' | 'from'>> & {
993
+ replyTo?: string[] | string;
994
+ variables?: TemplateVariableCreationOptions[];
995
+ };
996
+ type CreateTemplateOptions = Pick<Template, 'name'> & TemplateOptionalFieldsForCreation & TemplateContentCreationOptions;
997
+ interface CreateTemplateResponseSuccess extends Pick<Template, 'id'> {
998
+ object: 'template';
999
+ }
1000
+ type CreateTemplateResponse = {
1001
+ data: CreateTemplateResponseSuccess;
1002
+ error: null;
1003
+ } | {
1004
+ data: null;
1005
+ error: ErrorResponse;
1006
+ };
1007
+
1008
+ interface DuplicateTemplateResponseSuccess extends Pick<Template, 'id'> {
1009
+ object: 'template';
1010
+ }
1011
+ type DuplicateTemplateResponse = {
1012
+ data: DuplicateTemplateResponseSuccess;
1013
+ error: null;
1014
+ } | {
1015
+ data: null;
1016
+ error: ErrorResponse;
1017
+ };
1018
+
1019
+ interface PublishTemplateResponseSuccess extends Pick<Template, 'id'> {
1020
+ object: 'template';
1021
+ }
1022
+ type PublishTemplateResponse = {
1023
+ data: PublishTemplateResponseSuccess;
1024
+ error: null;
1025
+ } | {
1026
+ data: null;
1027
+ error: ErrorResponse;
1028
+ };
1029
+
1030
+ declare class ChainableTemplateResult<T extends CreateTemplateResponse | DuplicateTemplateResponse> implements PromiseLike<T> {
1031
+ private readonly promise;
1032
+ private readonly publishFn;
1033
+ constructor(promise: Promise<T>, publishFn: (id: string) => Promise<PublishTemplateResponse>);
1034
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
1035
+ publish(): Promise<PublishTemplateResponse>;
1036
+ }
1037
+
1038
+ interface GetTemplateResponseSuccess extends Template {
1039
+ object: 'template';
1040
+ }
1041
+ type GetTemplateResponse = {
1042
+ data: GetTemplateResponseSuccess;
1043
+ error: null;
1044
+ } | {
1045
+ data: null;
1046
+ error: ErrorResponse;
1047
+ };
1048
+
1049
+ interface TemplateListItem extends Pick<Template, 'id' | 'name' | 'created_at' | 'updated_at' | 'status' | 'published_at' | 'alias'> {
1050
+ }
1051
+ interface ListTemplatesResponseSuccess {
1052
+ object: 'list';
1053
+ data: TemplateListItem[];
1054
+ has_more: boolean;
1055
+ }
1056
+ type ListTemplatesResponse = {
1057
+ data: ListTemplatesResponseSuccess;
1058
+ error: null;
1059
+ } | {
1060
+ data: null;
1061
+ error: ErrorResponse;
1062
+ };
1063
+
1064
+ interface RemoveTemplateResponseSuccess {
1065
+ object: 'template';
872
1066
  id: string;
873
- object: 'email';
1067
+ deleted: boolean;
874
1068
  }
875
- type UpdateEmailResponse = {
876
- data: UpdateEmailResponseSuccess;
1069
+ type RemoveTemplateResponse = {
1070
+ data: RemoveTemplateResponseSuccess;
877
1071
  error: null;
878
1072
  } | {
879
1073
  data: null;
880
1074
  error: ErrorResponse;
881
1075
  };
882
1076
 
883
- declare class Emails {
1077
+ type TemplateVariableUpdateOptions = Pick<TemplateVariable, 'key' | 'type'> & ({
1078
+ type: 'string';
1079
+ fallbackValue?: string | null;
1080
+ } | {
1081
+ type: 'number';
1082
+ fallbackValue?: number | null;
1083
+ } | {
1084
+ type: 'boolean';
1085
+ fallbackValue?: boolean | null;
1086
+ } | {
1087
+ type: 'object';
1088
+ fallbackValue: Record<string, unknown>;
1089
+ } | {
1090
+ type: 'list';
1091
+ fallbackValue: TemplateVariableListFallbackType;
1092
+ });
1093
+ interface UpdateTemplateOptions extends Partial<Pick<Template, 'name' | 'subject' | 'html' | 'text' | 'from' | 'alias'>> {
1094
+ variables?: TemplateVariableUpdateOptions[];
1095
+ replyTo?: string[] | string;
1096
+ }
1097
+ interface UpdateTemplateResponseSuccess extends Pick<Template, 'id'> {
1098
+ object: 'template';
1099
+ }
1100
+ type UpdateTemplateResponse = {
1101
+ data: UpdateTemplateResponseSuccess;
1102
+ error: null;
1103
+ } | {
1104
+ data: null;
1105
+ error: ErrorResponse;
1106
+ };
1107
+
1108
+ declare class Templates {
884
1109
  private readonly resend;
1110
+ private renderAsync?;
885
1111
  constructor(resend: Resend);
886
- send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
887
- create(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
888
- get(id: string): Promise<GetEmailResponse>;
889
- list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
890
- update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
891
- cancel(id: string): Promise<CancelEmailResponse>;
1112
+ create(payload: CreateTemplateOptions): ChainableTemplateResult<CreateTemplateResponse>;
1113
+ private performCreate;
1114
+ remove(identifier: string): Promise<RemoveTemplateResponse>;
1115
+ get(identifier: string): Promise<GetTemplateResponse>;
1116
+ list(options?: PaginationOptions): Promise<ListTemplatesResponse>;
1117
+ duplicate(identifier: string): ChainableTemplateResult<DuplicateTemplateResponse>;
1118
+ publish(identifier: string): Promise<PublishTemplateResponse>;
1119
+ update(identifier: string, payload: UpdateTemplateOptions): Promise<UpdateTemplateResponse>;
892
1120
  }
893
1121
 
894
1122
  declare class Resend {
@@ -901,6 +1129,7 @@ declare class Resend {
901
1129
  readonly contacts: Contacts;
902
1130
  readonly domains: Domains;
903
1131
  readonly emails: Emails;
1132
+ readonly templates: Templates;
904
1133
  constructor(key?: string | undefined);
905
1134
  fetchRequest<T>(path: string, options?: {}): Promise<{
906
1135
  data: T;
@@ -946,4 +1175,4 @@ declare class Resend {
946
1175
  }>;
947
1176
  }
948
1177
 
949
- export { type Attachment, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, type CreateAudienceOptions, type CreateAudienceRequestOptions, type CreateAudienceResponse, type CreateAudienceResponseSuccess, type CreateBatchOptions, type CreateBatchRequestOptions, type CreateBatchResponse, type CreateBatchSuccessResponse, type CreateBroadcastOptions, type CreateBroadcastRequestOptions, type CreateBroadcastResponse, type CreateBroadcastResponseSuccess, type CreateContactOptions, type CreateContactRequestOptions, type CreateContactResponse, type CreateContactResponseSuccess, type CreateDomainOptions, type CreateDomainRequestOptions, type CreateDomainResponse, type CreateDomainResponseSuccess, type CreateEmailOptions, type CreateEmailRequestOptions, type CreateEmailResponse, type CreateEmailResponseSuccess, type ErrorResponse, type GetAudienceResponse, type GetAudienceResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAudiencesOptions, type ListAudiencesResponse, type ListAudiencesResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsOptions, type ListDomainsResponse, type ListDomainsResponseSuccess, type PaginationOptions, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveAudiencesResponse, type RemoveAudiencesResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, Resend, type SendBroadcastOptions, type SendBroadcastRequestOptions, type SendBroadcastResponse, type SendBroadcastResponseSuccess, type Tag, type UpdateContactOptions, type UpdateContactResponse, type UpdateContactResponseSuccess, type UpdateDomainsOptions, type UpdateDomainsResponse, type UpdateDomainsResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess };
1178
+ export { type ApiKey, type Attachment, type Audience, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, type CreateAudienceOptions, type CreateAudienceRequestOptions, type CreateAudienceResponse, type CreateAudienceResponseSuccess, type CreateBatchOptions, type CreateBatchRequestOptions, type CreateBatchResponse, type CreateBatchSuccessResponse, type CreateBroadcastOptions, type CreateBroadcastRequestOptions, type CreateBroadcastResponse, type CreateBroadcastResponseSuccess, type CreateContactOptions, type CreateContactRequestOptions, type CreateContactResponse, type CreateContactResponseSuccess, type CreateDomainOptions, type CreateDomainRequestOptions, type CreateDomainResponse, type CreateDomainResponseSuccess, type CreateEmailOptions, type CreateEmailRequestOptions, type CreateEmailResponse, type CreateEmailResponseSuccess, type Domain, type DomainApiOptions, type DomainDkimRecord, type DomainNameservers, type DomainRecords, type DomainRegion, type DomainSpfRecord, type DomainStatus, type EmailApiAttachment, type EmailApiOptions, type ErrorResponse, type GetAudienceResponse, type GetAudienceResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetOptions, type IdempotentRequest, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAudiencesOptions, type ListAudiencesResponse, type ListAudiencesResponseSuccess, type ListBroadcastsOptions, type ListBroadcastsResponse, type ListBroadcastsResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsOptions, type ListDomainsResponse, type ListDomainsResponseSuccess, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveAudiencesResponse, type RemoveAudiencesResponseSuccess, type RemoveBroadcastResponse, type RemoveBroadcastResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, type RequireAtLeastOne, Resend, type SelectingField, type SendBroadcastOptions, type SendBroadcastRequestOptions, type SendBroadcastResponse, type SendBroadcastResponseSuccess, type Tag, type UpdateBroadcastOptions, type UpdateBroadcastResponse, type UpdateBroadcastResponseSuccess, type UpdateContactOptions, type UpdateContactResponse, type UpdateContactResponseSuccess, type UpdateDomainsOptions, type UpdateDomainsResponse, type UpdateDomainsResponseSuccess, type UpdateEmailOptions, type UpdateEmailResponse, type UpdateEmailResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess };