resend 6.2.0 → 6.3.0-canary.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.d.mts +525 -22
- package/dist/index.d.ts +525 -22
- package/dist/index.js +450 -6
- package/dist/index.mjs +450 -6
- package/package.json +19 -10
- package/readme.md +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,7 @@ interface DomainApiOptions {
|
|
|
10
10
|
name: string;
|
|
11
11
|
region?: string;
|
|
12
12
|
custom_return_path?: string;
|
|
13
|
+
capability?: 'send' | 'receive' | 'send-and-receive';
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
declare const RESEND_ERROR_CODES_BY_KEY: {
|
|
@@ -49,9 +50,9 @@ interface EmailApiAttachment {
|
|
|
49
50
|
content_id?: string;
|
|
50
51
|
}
|
|
51
52
|
interface EmailApiOptions {
|
|
52
|
-
from
|
|
53
|
+
from?: string;
|
|
53
54
|
to: string | string[];
|
|
54
|
-
subject
|
|
55
|
+
subject?: string;
|
|
55
56
|
region?: string;
|
|
56
57
|
headers?: Record<string, string>;
|
|
57
58
|
html?: string;
|
|
@@ -59,9 +60,14 @@ interface EmailApiOptions {
|
|
|
59
60
|
bcc?: string | string[];
|
|
60
61
|
cc?: string | string[];
|
|
61
62
|
reply_to?: string | string[];
|
|
63
|
+
topic_id?: string | null;
|
|
62
64
|
scheduled_at?: string;
|
|
63
65
|
tags?: Tag$1[];
|
|
64
66
|
attachments?: EmailApiAttachment[];
|
|
67
|
+
template?: {
|
|
68
|
+
id: string;
|
|
69
|
+
variables?: Record<string, string | number | boolean>;
|
|
70
|
+
};
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
interface GetOptions {
|
|
@@ -78,11 +84,6 @@ interface IdempotentRequest {
|
|
|
78
84
|
idempotencyKey?: string;
|
|
79
85
|
}
|
|
80
86
|
|
|
81
|
-
interface List<T> {
|
|
82
|
-
readonly object: 'list';
|
|
83
|
-
data: T[];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
87
|
type PaginationOptions = {
|
|
87
88
|
/**
|
|
88
89
|
* Maximum number of items to return (1-100, default: 20)
|
|
@@ -101,6 +102,11 @@ type PaginationOptions = {
|
|
|
101
102
|
before?: string;
|
|
102
103
|
after?: never;
|
|
103
104
|
});
|
|
105
|
+
type PaginatedData<Data> = {
|
|
106
|
+
object: 'list';
|
|
107
|
+
data: Data;
|
|
108
|
+
has_more: boolean;
|
|
109
|
+
};
|
|
104
110
|
|
|
105
111
|
interface PatchOptions {
|
|
106
112
|
query?: {
|
|
@@ -169,6 +175,48 @@ type RemoveApiKeyResponse = {
|
|
|
169
175
|
error: ErrorResponse;
|
|
170
176
|
};
|
|
171
177
|
|
|
178
|
+
interface InboundAttachment {
|
|
179
|
+
id: string;
|
|
180
|
+
filename?: string;
|
|
181
|
+
content_type: string;
|
|
182
|
+
content_disposition: 'inline' | 'attachment';
|
|
183
|
+
content_id?: string;
|
|
184
|
+
download_url: string;
|
|
185
|
+
expires_at: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
interface GetAttachmentOptions {
|
|
189
|
+
emailId: string;
|
|
190
|
+
id: string;
|
|
191
|
+
}
|
|
192
|
+
interface GetAttachmentResponseSuccess {
|
|
193
|
+
object: 'attachment';
|
|
194
|
+
data: InboundAttachment;
|
|
195
|
+
}
|
|
196
|
+
type GetAttachmentResponse = {
|
|
197
|
+
data: GetAttachmentResponseSuccess;
|
|
198
|
+
error: null;
|
|
199
|
+
} | {
|
|
200
|
+
data: null;
|
|
201
|
+
error: ErrorResponse;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
type ListAttachmentsOptions = PaginationOptions & {
|
|
205
|
+
emailId: string;
|
|
206
|
+
};
|
|
207
|
+
interface ListAttachmentsResponseSuccess {
|
|
208
|
+
object: 'list';
|
|
209
|
+
has_more: boolean;
|
|
210
|
+
data: InboundAttachment[];
|
|
211
|
+
}
|
|
212
|
+
type ListAttachmentsResponse = {
|
|
213
|
+
data: ListAttachmentsResponseSuccess;
|
|
214
|
+
error: null;
|
|
215
|
+
} | {
|
|
216
|
+
data: null;
|
|
217
|
+
error: ErrorResponse;
|
|
218
|
+
};
|
|
219
|
+
|
|
172
220
|
interface Audience {
|
|
173
221
|
created_at: string;
|
|
174
222
|
id: string;
|
|
@@ -248,6 +296,16 @@ interface EmailRenderOptions$1 {
|
|
|
248
296
|
*/
|
|
249
297
|
text: string;
|
|
250
298
|
}
|
|
299
|
+
interface EmailTemplateOptions {
|
|
300
|
+
template: {
|
|
301
|
+
id: string;
|
|
302
|
+
variables?: Record<string, string | number | boolean>;
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
interface CreateEmailBaseOptionsWithTemplate extends Omit<CreateEmailBaseOptions, 'from' | 'subject'> {
|
|
306
|
+
from?: string;
|
|
307
|
+
subject?: string;
|
|
308
|
+
}
|
|
251
309
|
interface CreateEmailBaseOptions {
|
|
252
310
|
/**
|
|
253
311
|
* Filename and content of attachments (max 40mb per email)
|
|
@@ -303,6 +361,12 @@ interface CreateEmailBaseOptions {
|
|
|
303
361
|
* @link https://resend.com/docs/api-reference/emails/send-email#body-parameters
|
|
304
362
|
*/
|
|
305
363
|
to: string | string[];
|
|
364
|
+
/**
|
|
365
|
+
* The id of the topic you want to send to
|
|
366
|
+
*
|
|
367
|
+
* @link https://resend.com/docs/api-reference/emails/send-email#body-parameters
|
|
368
|
+
*/
|
|
369
|
+
topicId?: string | null;
|
|
306
370
|
/**
|
|
307
371
|
* Schedule email to be sent later.
|
|
308
372
|
* The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z).
|
|
@@ -311,7 +375,13 @@ interface CreateEmailBaseOptions {
|
|
|
311
375
|
*/
|
|
312
376
|
scheduledAt?: string;
|
|
313
377
|
}
|
|
314
|
-
type CreateEmailOptions = RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions
|
|
378
|
+
type CreateEmailOptions = ((RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions) & {
|
|
379
|
+
template?: never;
|
|
380
|
+
}) | ((EmailTemplateOptions & CreateEmailBaseOptionsWithTemplate) & {
|
|
381
|
+
react?: never;
|
|
382
|
+
html?: never;
|
|
383
|
+
text?: never;
|
|
384
|
+
});
|
|
315
385
|
interface CreateEmailRequestOptions extends PostOptions, IdempotentRequest {
|
|
316
386
|
}
|
|
317
387
|
interface CreateEmailResponseSuccess {
|
|
@@ -398,6 +468,7 @@ interface Broadcast {
|
|
|
398
468
|
created_at: string;
|
|
399
469
|
scheduled_at: string | null;
|
|
400
470
|
sent_at: string | null;
|
|
471
|
+
topic_id?: string | null;
|
|
401
472
|
html: string | null;
|
|
402
473
|
text: string | null;
|
|
403
474
|
}
|
|
@@ -459,6 +530,12 @@ interface CreateBroadcastBaseOptions {
|
|
|
459
530
|
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
460
531
|
*/
|
|
461
532
|
subject: string;
|
|
533
|
+
/**
|
|
534
|
+
* The id of the topic you want to send to
|
|
535
|
+
*
|
|
536
|
+
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
537
|
+
*/
|
|
538
|
+
topicId?: string | null;
|
|
462
539
|
}
|
|
463
540
|
type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> & CreateBroadcastBaseOptions;
|
|
464
541
|
interface CreateBroadcastRequestOptions extends PostOptions {
|
|
@@ -550,6 +627,7 @@ type UpdateBroadcastOptions = {
|
|
|
550
627
|
subject?: string;
|
|
551
628
|
replyTo?: string[];
|
|
552
629
|
previewText?: string;
|
|
630
|
+
topicId?: string | null;
|
|
553
631
|
};
|
|
554
632
|
type UpdateBroadcastResponse = {
|
|
555
633
|
data: UpdateBroadcastResponseSuccess;
|
|
@@ -596,7 +674,7 @@ type SelectingField = {
|
|
|
596
674
|
};
|
|
597
675
|
|
|
598
676
|
interface CreateContactOptions {
|
|
599
|
-
audienceId
|
|
677
|
+
audienceId?: string;
|
|
600
678
|
email: string;
|
|
601
679
|
unsubscribed?: boolean;
|
|
602
680
|
firstName?: string;
|
|
@@ -615,9 +693,9 @@ type CreateContactResponse = {
|
|
|
615
693
|
error: ErrorResponse;
|
|
616
694
|
};
|
|
617
695
|
|
|
618
|
-
type GetContactOptions = {
|
|
619
|
-
audienceId
|
|
620
|
-
} & SelectingField;
|
|
696
|
+
type GetContactOptions = string | ({
|
|
697
|
+
audienceId?: string;
|
|
698
|
+
} & SelectingField);
|
|
621
699
|
interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'email' | 'created_at' | 'first_name' | 'last_name' | 'unsubscribed'> {
|
|
622
700
|
object: 'contact';
|
|
623
701
|
}
|
|
@@ -629,9 +707,12 @@ type GetContactResponse = {
|
|
|
629
707
|
error: ErrorResponse;
|
|
630
708
|
};
|
|
631
709
|
|
|
632
|
-
type
|
|
710
|
+
type ListAudienceContactsOptions = {
|
|
633
711
|
audienceId: string;
|
|
634
712
|
} & PaginationOptions;
|
|
713
|
+
type ListContactsOptions = PaginationOptions & {
|
|
714
|
+
audienceId?: string;
|
|
715
|
+
};
|
|
635
716
|
interface ListContactsResponseSuccess {
|
|
636
717
|
object: 'list';
|
|
637
718
|
data: Contact[];
|
|
@@ -650,9 +731,9 @@ type RemoveContactsResponseSuccess = {
|
|
|
650
731
|
deleted: boolean;
|
|
651
732
|
contact: string;
|
|
652
733
|
};
|
|
653
|
-
type RemoveContactOptions = SelectingField & {
|
|
654
|
-
audienceId
|
|
655
|
-
};
|
|
734
|
+
type RemoveContactOptions = string | (SelectingField & {
|
|
735
|
+
audienceId?: string;
|
|
736
|
+
});
|
|
656
737
|
type RemoveContactsResponse = {
|
|
657
738
|
data: RemoveContactsResponseSuccess;
|
|
658
739
|
error: null;
|
|
@@ -662,7 +743,7 @@ type RemoveContactsResponse = {
|
|
|
662
743
|
};
|
|
663
744
|
|
|
664
745
|
type UpdateContactOptions = {
|
|
665
|
-
audienceId
|
|
746
|
+
audienceId?: string;
|
|
666
747
|
unsubscribed?: boolean;
|
|
667
748
|
firstName?: string;
|
|
668
749
|
lastName?: string;
|
|
@@ -681,7 +762,7 @@ type UpdateContactResponse = {
|
|
|
681
762
|
type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1';
|
|
682
763
|
type DomainNameservers = 'Amazon Route 53' | 'Cloudflare' | 'Digital Ocean' | 'GoDaddy' | 'Google Domains' | 'Namecheap' | 'Unidentified' | 'Vercel';
|
|
683
764
|
type DomainStatus = 'pending' | 'verified' | 'failed' | 'temporary_failure' | 'not_started';
|
|
684
|
-
type DomainRecords = DomainSpfRecord | DomainDkimRecord;
|
|
765
|
+
type DomainRecords = DomainSpfRecord | DomainDkimRecord | ReceivingRecord;
|
|
685
766
|
interface DomainSpfRecord {
|
|
686
767
|
record: 'SPF';
|
|
687
768
|
name: string;
|
|
@@ -704,22 +785,33 @@ interface DomainDkimRecord {
|
|
|
704
785
|
priority?: number;
|
|
705
786
|
proxy_status?: 'enable' | 'disable';
|
|
706
787
|
}
|
|
788
|
+
interface ReceivingRecord {
|
|
789
|
+
record: 'Receiving';
|
|
790
|
+
name: string;
|
|
791
|
+
value: string;
|
|
792
|
+
type: 'MX';
|
|
793
|
+
ttl: string;
|
|
794
|
+
status: DomainStatus;
|
|
795
|
+
priority: number;
|
|
796
|
+
}
|
|
707
797
|
interface Domain {
|
|
708
798
|
id: string;
|
|
709
799
|
name: string;
|
|
710
800
|
status: DomainStatus;
|
|
711
801
|
created_at: string;
|
|
712
802
|
region: DomainRegion;
|
|
803
|
+
capability: 'send' | 'receive' | 'send-and-receive';
|
|
713
804
|
}
|
|
714
805
|
|
|
715
806
|
interface CreateDomainOptions {
|
|
716
807
|
name: string;
|
|
717
808
|
region?: DomainRegion;
|
|
718
809
|
customReturnPath?: string;
|
|
810
|
+
capability?: 'send' | 'receive' | 'send-and-receive';
|
|
719
811
|
}
|
|
720
812
|
interface CreateDomainRequestOptions extends PostOptions {
|
|
721
813
|
}
|
|
722
|
-
interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> {
|
|
814
|
+
interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region' | 'capability'> {
|
|
723
815
|
records: DomainRecords[];
|
|
724
816
|
}
|
|
725
817
|
type CreateDomainResponse = {
|
|
@@ -730,7 +822,7 @@ type CreateDomainResponse = {
|
|
|
730
822
|
error: ErrorResponse;
|
|
731
823
|
};
|
|
732
824
|
|
|
733
|
-
interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> {
|
|
825
|
+
interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status' | 'capability'> {
|
|
734
826
|
object: 'domain';
|
|
735
827
|
records: DomainRecords[];
|
|
736
828
|
}
|
|
@@ -824,6 +916,7 @@ interface GetEmailResponseSuccess {
|
|
|
824
916
|
value: string;
|
|
825
917
|
}[];
|
|
826
918
|
to: string[];
|
|
919
|
+
topic_id?: string | null;
|
|
827
920
|
scheduled_at: string | null;
|
|
828
921
|
object: 'email';
|
|
829
922
|
}
|
|
@@ -851,6 +944,50 @@ type UpdateEmailResponse = {
|
|
|
851
944
|
error: ErrorResponse;
|
|
852
945
|
};
|
|
853
946
|
|
|
947
|
+
interface GetInboundEmailResponseSuccess {
|
|
948
|
+
object: 'inbound';
|
|
949
|
+
id: string;
|
|
950
|
+
to: string[];
|
|
951
|
+
from: string;
|
|
952
|
+
created_at: string;
|
|
953
|
+
subject: string;
|
|
954
|
+
bcc: string[] | null;
|
|
955
|
+
cc: string[] | null;
|
|
956
|
+
reply_to: string[] | null;
|
|
957
|
+
html: string | null;
|
|
958
|
+
text: string | null;
|
|
959
|
+
headers: Record<string, string>;
|
|
960
|
+
attachments: Array<{
|
|
961
|
+
id: string;
|
|
962
|
+
filename: string;
|
|
963
|
+
content_type: string;
|
|
964
|
+
content_id: string;
|
|
965
|
+
content_disposition: string;
|
|
966
|
+
}>;
|
|
967
|
+
}
|
|
968
|
+
type GetInboundEmailResponse = {
|
|
969
|
+
data: GetInboundEmailResponseSuccess;
|
|
970
|
+
error: null;
|
|
971
|
+
} | {
|
|
972
|
+
data: null;
|
|
973
|
+
error: ErrorResponse;
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
type ListInboundEmailsOptions = PaginationOptions;
|
|
977
|
+
type ListInboundEmail = Omit<GetInboundEmailResponseSuccess, 'html' | 'text' | 'headers' | 'object'>;
|
|
978
|
+
interface ListInboundEmailsResponseSuccess {
|
|
979
|
+
object: 'list';
|
|
980
|
+
has_more: boolean;
|
|
981
|
+
data: ListInboundEmail[];
|
|
982
|
+
}
|
|
983
|
+
type ListInboundEmailsResponse = {
|
|
984
|
+
data: ListInboundEmailsResponseSuccess;
|
|
985
|
+
error: null;
|
|
986
|
+
} | {
|
|
987
|
+
data: null;
|
|
988
|
+
error: ErrorResponse;
|
|
989
|
+
};
|
|
990
|
+
|
|
854
991
|
declare class ApiKeys {
|
|
855
992
|
private readonly resend;
|
|
856
993
|
constructor(resend: Resend);
|
|
@@ -859,6 +996,18 @@ declare class ApiKeys {
|
|
|
859
996
|
remove(id: string): Promise<RemoveApiKeyResponse>;
|
|
860
997
|
}
|
|
861
998
|
|
|
999
|
+
declare class Receiving$1 {
|
|
1000
|
+
private readonly resend;
|
|
1001
|
+
constructor(resend: Resend);
|
|
1002
|
+
get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>;
|
|
1003
|
+
list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
declare class Attachments {
|
|
1007
|
+
readonly receiving: Receiving$1;
|
|
1008
|
+
constructor(resend: Resend);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
862
1011
|
declare class Audiences {
|
|
863
1012
|
private readonly resend;
|
|
864
1013
|
constructor(resend: Resend);
|
|
@@ -886,11 +1035,115 @@ declare class Broadcasts {
|
|
|
886
1035
|
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
887
1036
|
}
|
|
888
1037
|
|
|
1038
|
+
type ContactAudiencesBaseOptions = {
|
|
1039
|
+
contactId: string;
|
|
1040
|
+
email?: never;
|
|
1041
|
+
} | {
|
|
1042
|
+
contactId?: never;
|
|
1043
|
+
email: string;
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
type AddContactAudiencesOptions = ContactAudiencesBaseOptions & {
|
|
1047
|
+
audienceId: string;
|
|
1048
|
+
};
|
|
1049
|
+
interface AddContactAudiencesResponseSuccess {
|
|
1050
|
+
id: string;
|
|
1051
|
+
}
|
|
1052
|
+
type AddContactAudiencesResponse = {
|
|
1053
|
+
data: AddContactAudiencesResponseSuccess;
|
|
1054
|
+
error: null;
|
|
1055
|
+
} | {
|
|
1056
|
+
data: null;
|
|
1057
|
+
error: ErrorResponse;
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1060
|
+
type ListContactAudiencesOptions = PaginationOptions & ContactAudiencesBaseOptions;
|
|
1061
|
+
type ListContactAudiencesResponseSuccess = PaginatedData<Audience[]>;
|
|
1062
|
+
type ListContactAudiencesResponse = {
|
|
1063
|
+
data: ListContactAudiencesResponseSuccess;
|
|
1064
|
+
error: null;
|
|
1065
|
+
} | {
|
|
1066
|
+
data: null;
|
|
1067
|
+
error: ErrorResponse;
|
|
1068
|
+
};
|
|
1069
|
+
|
|
1070
|
+
type RemoveContactAudiencesOptions = ContactAudiencesBaseOptions & {
|
|
1071
|
+
audienceId: string;
|
|
1072
|
+
};
|
|
1073
|
+
interface RemoveContactAudiencesResponseSuccess {
|
|
1074
|
+
id: string;
|
|
1075
|
+
deleted: boolean;
|
|
1076
|
+
}
|
|
1077
|
+
type RemoveContactAudiencesResponse = {
|
|
1078
|
+
data: RemoveContactAudiencesResponseSuccess;
|
|
1079
|
+
error: null;
|
|
1080
|
+
} | {
|
|
1081
|
+
data: null;
|
|
1082
|
+
error: ErrorResponse;
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
declare class ContactAudiences {
|
|
1086
|
+
private readonly resend;
|
|
1087
|
+
constructor(resend: Resend);
|
|
1088
|
+
list(options: ListContactAudiencesOptions): Promise<ListContactAudiencesResponse>;
|
|
1089
|
+
add(options: AddContactAudiencesOptions): Promise<AddContactAudiencesResponse>;
|
|
1090
|
+
remove(options: RemoveContactAudiencesOptions): Promise<RemoveContactAudiencesResponse>;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
interface GetContactTopicsBaseOptions {
|
|
1094
|
+
id?: string;
|
|
1095
|
+
email?: string;
|
|
1096
|
+
}
|
|
1097
|
+
type GetContactTopicsOptions = GetContactTopicsBaseOptions & PaginationOptions;
|
|
1098
|
+
interface ContactTopic {
|
|
1099
|
+
id: string;
|
|
1100
|
+
name: string;
|
|
1101
|
+
description: string | null;
|
|
1102
|
+
subscription: 'opt_in' | 'opt_out';
|
|
1103
|
+
}
|
|
1104
|
+
type GetContactTopicsResponse = {
|
|
1105
|
+
data: PaginatedData<{
|
|
1106
|
+
email: string;
|
|
1107
|
+
topics: ContactTopic[];
|
|
1108
|
+
}>;
|
|
1109
|
+
error: null;
|
|
1110
|
+
} | {
|
|
1111
|
+
data: null;
|
|
1112
|
+
error: ErrorResponse;
|
|
1113
|
+
};
|
|
1114
|
+
|
|
1115
|
+
interface UpdateContactTopicsBaseOptions {
|
|
1116
|
+
id?: string;
|
|
1117
|
+
email?: string;
|
|
1118
|
+
}
|
|
1119
|
+
interface UpdateContactTopicsOptions extends UpdateContactTopicsBaseOptions {
|
|
1120
|
+
topics: {
|
|
1121
|
+
id: string;
|
|
1122
|
+
subscription: 'opt_in' | 'opt_out';
|
|
1123
|
+
}[];
|
|
1124
|
+
}
|
|
1125
|
+
interface UpdateContactTopicsResponseSuccess {
|
|
1126
|
+
id: string;
|
|
1127
|
+
}
|
|
1128
|
+
interface UpdateContactTopicsResponse {
|
|
1129
|
+
data: UpdateContactTopicsResponseSuccess | null;
|
|
1130
|
+
error: ErrorResponse | null;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
declare class ContactTopics {
|
|
1134
|
+
private readonly resend;
|
|
1135
|
+
constructor(resend: Resend);
|
|
1136
|
+
update(payload: UpdateContactTopicsOptions): Promise<UpdateContactTopicsResponse>;
|
|
1137
|
+
get(options: GetContactTopicsOptions): Promise<GetContactTopicsResponse>;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
889
1140
|
declare class Contacts {
|
|
890
1141
|
private readonly resend;
|
|
1142
|
+
readonly topics: ContactTopics;
|
|
1143
|
+
readonly audiences: ContactAudiences;
|
|
891
1144
|
constructor(resend: Resend);
|
|
892
1145
|
create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
|
|
893
|
-
list(options
|
|
1146
|
+
list(options?: ListContactsOptions | ListAudienceContactsOptions): Promise<ListContactsResponse>;
|
|
894
1147
|
get(options: GetContactOptions): Promise<GetContactResponse>;
|
|
895
1148
|
update(options: UpdateContactOptions): Promise<UpdateContactResponse>;
|
|
896
1149
|
remove(payload: RemoveContactOptions): Promise<RemoveContactsResponse>;
|
|
@@ -922,8 +1175,16 @@ type ListEmailsResponse = {
|
|
|
922
1175
|
error: ErrorResponse;
|
|
923
1176
|
};
|
|
924
1177
|
|
|
1178
|
+
declare class Receiving {
|
|
1179
|
+
private readonly resend;
|
|
1180
|
+
constructor(resend: Resend);
|
|
1181
|
+
get(id: string): Promise<GetInboundEmailResponse>;
|
|
1182
|
+
list(options?: ListInboundEmailsOptions): Promise<ListInboundEmailsResponse>;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
925
1185
|
declare class Emails {
|
|
926
1186
|
private readonly resend;
|
|
1187
|
+
readonly receiving: Receiving;
|
|
927
1188
|
constructor(resend: Resend);
|
|
928
1189
|
send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
929
1190
|
create(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
@@ -933,6 +1194,245 @@ declare class Emails {
|
|
|
933
1194
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
934
1195
|
}
|
|
935
1196
|
|
|
1197
|
+
interface Template {
|
|
1198
|
+
id: string;
|
|
1199
|
+
name: string;
|
|
1200
|
+
subject: string | null;
|
|
1201
|
+
html: string;
|
|
1202
|
+
text: string | null;
|
|
1203
|
+
status: 'draft' | 'published';
|
|
1204
|
+
variables: TemplateVariable[] | null;
|
|
1205
|
+
alias: string | null;
|
|
1206
|
+
from: string | null;
|
|
1207
|
+
reply_to: string[] | null;
|
|
1208
|
+
published_at: string | null;
|
|
1209
|
+
created_at: string;
|
|
1210
|
+
updated_at: string;
|
|
1211
|
+
has_unpublished_versions: boolean;
|
|
1212
|
+
current_version_id: string;
|
|
1213
|
+
}
|
|
1214
|
+
type TemplateVariableListFallbackType = string[] | number[] | boolean[] | Record<string, unknown>[];
|
|
1215
|
+
interface TemplateVariable {
|
|
1216
|
+
key: string;
|
|
1217
|
+
fallback_value: string | number | boolean | Record<string, unknown> | TemplateVariableListFallbackType | null;
|
|
1218
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'list';
|
|
1219
|
+
created_at: string;
|
|
1220
|
+
updated_at: string;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
type TemplateContentCreationOptions = RequireAtLeastOne<{
|
|
1224
|
+
html: string;
|
|
1225
|
+
react: React.ReactNode;
|
|
1226
|
+
}>;
|
|
1227
|
+
type TemplateVariableCreationOptions = Pick<TemplateVariable, 'key' | 'type'> & ({
|
|
1228
|
+
type: 'string';
|
|
1229
|
+
fallbackValue?: string | null;
|
|
1230
|
+
} | {
|
|
1231
|
+
type: 'number';
|
|
1232
|
+
fallbackValue?: number | null;
|
|
1233
|
+
} | {
|
|
1234
|
+
type: 'boolean';
|
|
1235
|
+
fallbackValue?: boolean | null;
|
|
1236
|
+
} | {
|
|
1237
|
+
type: 'object';
|
|
1238
|
+
fallbackValue: Record<string, unknown>;
|
|
1239
|
+
} | {
|
|
1240
|
+
type: 'list';
|
|
1241
|
+
fallbackValue: TemplateVariableListFallbackType;
|
|
1242
|
+
});
|
|
1243
|
+
type TemplateOptionalFieldsForCreation = Partial<Pick<Template, 'subject' | 'text' | 'alias' | 'from'>> & {
|
|
1244
|
+
replyTo?: string[] | string;
|
|
1245
|
+
variables?: TemplateVariableCreationOptions[];
|
|
1246
|
+
};
|
|
1247
|
+
type CreateTemplateOptions = Pick<Template, 'name'> & TemplateOptionalFieldsForCreation & TemplateContentCreationOptions;
|
|
1248
|
+
interface CreateTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1249
|
+
object: 'template';
|
|
1250
|
+
}
|
|
1251
|
+
type CreateTemplateResponse = {
|
|
1252
|
+
data: CreateTemplateResponseSuccess;
|
|
1253
|
+
error: null;
|
|
1254
|
+
} | {
|
|
1255
|
+
data: null;
|
|
1256
|
+
error: ErrorResponse;
|
|
1257
|
+
};
|
|
1258
|
+
|
|
1259
|
+
interface DuplicateTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1260
|
+
object: 'template';
|
|
1261
|
+
}
|
|
1262
|
+
type DuplicateTemplateResponse = {
|
|
1263
|
+
data: DuplicateTemplateResponseSuccess;
|
|
1264
|
+
error: null;
|
|
1265
|
+
} | {
|
|
1266
|
+
data: null;
|
|
1267
|
+
error: ErrorResponse;
|
|
1268
|
+
};
|
|
1269
|
+
|
|
1270
|
+
interface PublishTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1271
|
+
object: 'template';
|
|
1272
|
+
}
|
|
1273
|
+
type PublishTemplateResponse = {
|
|
1274
|
+
data: PublishTemplateResponseSuccess;
|
|
1275
|
+
error: null;
|
|
1276
|
+
} | {
|
|
1277
|
+
data: null;
|
|
1278
|
+
error: ErrorResponse;
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
declare class ChainableTemplateResult<T extends CreateTemplateResponse | DuplicateTemplateResponse> implements PromiseLike<T> {
|
|
1282
|
+
private readonly promise;
|
|
1283
|
+
private readonly publishFn;
|
|
1284
|
+
constructor(promise: Promise<T>, publishFn: (id: string) => Promise<PublishTemplateResponse>);
|
|
1285
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
1286
|
+
publish(): Promise<PublishTemplateResponse>;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
interface GetTemplateResponseSuccess extends Template {
|
|
1290
|
+
object: 'template';
|
|
1291
|
+
}
|
|
1292
|
+
type GetTemplateResponse = {
|
|
1293
|
+
data: GetTemplateResponseSuccess;
|
|
1294
|
+
error: null;
|
|
1295
|
+
} | {
|
|
1296
|
+
data: null;
|
|
1297
|
+
error: ErrorResponse;
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
interface TemplateListItem extends Pick<Template, 'id' | 'name' | 'created_at' | 'updated_at' | 'status' | 'published_at' | 'alias'> {
|
|
1301
|
+
}
|
|
1302
|
+
interface ListTemplatesResponseSuccess {
|
|
1303
|
+
object: 'list';
|
|
1304
|
+
data: TemplateListItem[];
|
|
1305
|
+
has_more: boolean;
|
|
1306
|
+
}
|
|
1307
|
+
type ListTemplatesResponse = {
|
|
1308
|
+
data: ListTemplatesResponseSuccess;
|
|
1309
|
+
error: null;
|
|
1310
|
+
} | {
|
|
1311
|
+
data: null;
|
|
1312
|
+
error: ErrorResponse;
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1315
|
+
interface RemoveTemplateResponseSuccess {
|
|
1316
|
+
object: 'template';
|
|
1317
|
+
id: string;
|
|
1318
|
+
deleted: boolean;
|
|
1319
|
+
}
|
|
1320
|
+
type RemoveTemplateResponse = {
|
|
1321
|
+
data: RemoveTemplateResponseSuccess;
|
|
1322
|
+
error: null;
|
|
1323
|
+
} | {
|
|
1324
|
+
data: null;
|
|
1325
|
+
error: ErrorResponse;
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
type TemplateVariableUpdateOptions = Pick<TemplateVariable, 'key' | 'type'> & ({
|
|
1329
|
+
type: 'string';
|
|
1330
|
+
fallbackValue?: string | null;
|
|
1331
|
+
} | {
|
|
1332
|
+
type: 'number';
|
|
1333
|
+
fallbackValue?: number | null;
|
|
1334
|
+
} | {
|
|
1335
|
+
type: 'boolean';
|
|
1336
|
+
fallbackValue?: boolean | null;
|
|
1337
|
+
} | {
|
|
1338
|
+
type: 'object';
|
|
1339
|
+
fallbackValue: Record<string, unknown>;
|
|
1340
|
+
} | {
|
|
1341
|
+
type: 'list';
|
|
1342
|
+
fallbackValue: TemplateVariableListFallbackType;
|
|
1343
|
+
});
|
|
1344
|
+
interface UpdateTemplateOptions extends Partial<Pick<Template, 'name' | 'subject' | 'html' | 'text' | 'from' | 'alias'>> {
|
|
1345
|
+
variables?: TemplateVariableUpdateOptions[];
|
|
1346
|
+
replyTo?: string[] | string;
|
|
1347
|
+
}
|
|
1348
|
+
interface UpdateTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1349
|
+
object: 'template';
|
|
1350
|
+
}
|
|
1351
|
+
type UpdateTemplateResponse = {
|
|
1352
|
+
data: UpdateTemplateResponseSuccess;
|
|
1353
|
+
error: null;
|
|
1354
|
+
} | {
|
|
1355
|
+
data: null;
|
|
1356
|
+
error: ErrorResponse;
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1359
|
+
declare class Templates {
|
|
1360
|
+
private readonly resend;
|
|
1361
|
+
private renderAsync?;
|
|
1362
|
+
constructor(resend: Resend);
|
|
1363
|
+
create(payload: CreateTemplateOptions): ChainableTemplateResult<CreateTemplateResponse>;
|
|
1364
|
+
private performCreate;
|
|
1365
|
+
remove(identifier: string): Promise<RemoveTemplateResponse>;
|
|
1366
|
+
get(identifier: string): Promise<GetTemplateResponse>;
|
|
1367
|
+
list(options?: PaginationOptions): Promise<ListTemplatesResponse>;
|
|
1368
|
+
duplicate(identifier: string): ChainableTemplateResult<DuplicateTemplateResponse>;
|
|
1369
|
+
publish(identifier: string): Promise<PublishTemplateResponse>;
|
|
1370
|
+
update(identifier: string, payload: UpdateTemplateOptions): Promise<UpdateTemplateResponse>;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
interface Topic {
|
|
1374
|
+
id: string;
|
|
1375
|
+
name: string;
|
|
1376
|
+
description?: string;
|
|
1377
|
+
defaultSubscription: 'opt_in' | 'opt_out';
|
|
1378
|
+
created_at: string;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
interface CreateTopicOptions {
|
|
1382
|
+
name: string;
|
|
1383
|
+
description?: string;
|
|
1384
|
+
defaultSubscription: 'opt_in' | 'opt_out';
|
|
1385
|
+
}
|
|
1386
|
+
type CreateTopicResponseSuccess = Pick<Topic, 'id'>;
|
|
1387
|
+
interface CreateTopicResponse {
|
|
1388
|
+
data: CreateTopicResponseSuccess | null;
|
|
1389
|
+
error: ErrorResponse | null;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
type GetTopicResponseSuccess = Topic;
|
|
1393
|
+
interface GetTopicResponse {
|
|
1394
|
+
data: GetTopicResponseSuccess | null;
|
|
1395
|
+
error: ErrorResponse | null;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
interface ListTopicsResponseSuccess {
|
|
1399
|
+
data: Topic[];
|
|
1400
|
+
}
|
|
1401
|
+
interface ListTopicsResponse {
|
|
1402
|
+
data: ListTopicsResponseSuccess | null;
|
|
1403
|
+
error: ErrorResponse | null;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
type RemoveTopicResponseSuccess = Pick<Topic, 'id'> & {
|
|
1407
|
+
object: 'topic';
|
|
1408
|
+
deleted: boolean;
|
|
1409
|
+
};
|
|
1410
|
+
interface RemoveTopicResponse {
|
|
1411
|
+
data: RemoveTopicResponseSuccess | null;
|
|
1412
|
+
error: ErrorResponse | null;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
interface UpdateTopicOptions {
|
|
1416
|
+
id: string;
|
|
1417
|
+
name?: string;
|
|
1418
|
+
description?: string;
|
|
1419
|
+
}
|
|
1420
|
+
type UpdateTopicResponseSuccess = Pick<Topic, 'id'>;
|
|
1421
|
+
interface UpdateTopicResponse {
|
|
1422
|
+
data: UpdateTopicResponseSuccess | null;
|
|
1423
|
+
error: ErrorResponse | null;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
declare class Topics {
|
|
1427
|
+
private readonly resend;
|
|
1428
|
+
constructor(resend: Resend);
|
|
1429
|
+
create(payload: CreateTopicOptions): Promise<CreateTopicResponse>;
|
|
1430
|
+
list(): Promise<ListTopicsResponse>;
|
|
1431
|
+
get(id: string): Promise<GetTopicResponse>;
|
|
1432
|
+
update(payload: UpdateTopicOptions): Promise<UpdateTopicResponse>;
|
|
1433
|
+
remove(id: string): Promise<RemoveTopicResponse>;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
936
1436
|
interface Headers {
|
|
937
1437
|
id: string;
|
|
938
1438
|
timestamp: string;
|
|
@@ -951,12 +1451,15 @@ declare class Resend {
|
|
|
951
1451
|
readonly key?: string | undefined;
|
|
952
1452
|
private readonly headers;
|
|
953
1453
|
readonly apiKeys: ApiKeys;
|
|
1454
|
+
readonly attachments: Attachments;
|
|
954
1455
|
readonly audiences: Audiences;
|
|
955
1456
|
readonly batch: Batch;
|
|
956
1457
|
readonly broadcasts: Broadcasts;
|
|
957
1458
|
readonly contacts: Contacts;
|
|
958
1459
|
readonly domains: Domains;
|
|
959
1460
|
readonly emails: Emails;
|
|
1461
|
+
readonly templates: Templates;
|
|
1462
|
+
readonly topics: Topics;
|
|
960
1463
|
readonly webhooks: Webhooks;
|
|
961
1464
|
constructor(key?: string | undefined);
|
|
962
1465
|
fetchRequest<T>(path: string, options?: {}): Promise<{
|
|
@@ -1003,4 +1506,4 @@ declare class Resend {
|
|
|
1003
1506
|
}>;
|
|
1004
1507
|
}
|
|
1005
1508
|
|
|
1006
|
-
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
|
|
1509
|
+
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 GetAttachmentOptions, type GetAttachmentResponse, type GetAttachmentResponseSuccess, type GetAudienceResponse, type GetAudienceResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetInboundEmailResponse, type GetInboundEmailResponseSuccess, type GetOptions, type IdempotentRequest, type InboundAttachment, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAttachmentsOptions, type ListAttachmentsResponse, type ListAudienceContactsOptions, 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 ListInboundEmail, type ListInboundEmailsOptions, type ListInboundEmailsResponse, type ListInboundEmailsResponseSuccess, type PaginatedData, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type ReceivingRecord, 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 };
|