resend 6.3.0-canary.4 → 6.3.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 +140 -734
- package/dist/index.d.ts +140 -734
- package/dist/index.js +21 -571
- package/dist/index.mjs +21 -571
- package/package.json +10 -19
- package/readme.md +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -10,7 +10,6 @@ interface DomainApiOptions {
|
|
|
10
10
|
name: string;
|
|
11
11
|
region?: string;
|
|
12
12
|
custom_return_path?: string;
|
|
13
|
-
capability?: 'send' | 'receive' | 'send-and-receive';
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
declare const RESEND_ERROR_CODES_BY_KEY: {
|
|
@@ -51,9 +50,9 @@ interface EmailApiAttachment {
|
|
|
51
50
|
content_id?: string;
|
|
52
51
|
}
|
|
53
52
|
interface EmailApiOptions {
|
|
54
|
-
from
|
|
53
|
+
from: string;
|
|
55
54
|
to: string | string[];
|
|
56
|
-
subject
|
|
55
|
+
subject: string;
|
|
57
56
|
region?: string;
|
|
58
57
|
headers?: Record<string, string>;
|
|
59
58
|
html?: string;
|
|
@@ -61,14 +60,9 @@ interface EmailApiOptions {
|
|
|
61
60
|
bcc?: string | string[];
|
|
62
61
|
cc?: string | string[];
|
|
63
62
|
reply_to?: string | string[];
|
|
64
|
-
topic_id?: string | null;
|
|
65
63
|
scheduled_at?: string;
|
|
66
64
|
tags?: Tag$1[];
|
|
67
65
|
attachments?: EmailApiAttachment[];
|
|
68
|
-
template?: {
|
|
69
|
-
id: string;
|
|
70
|
-
variables?: Record<string, string | number | boolean>;
|
|
71
|
-
};
|
|
72
66
|
}
|
|
73
67
|
|
|
74
68
|
interface GetOptions {
|
|
@@ -85,6 +79,11 @@ interface IdempotentRequest {
|
|
|
85
79
|
idempotencyKey?: string;
|
|
86
80
|
}
|
|
87
81
|
|
|
82
|
+
interface List<T> {
|
|
83
|
+
readonly object: 'list';
|
|
84
|
+
data: T[];
|
|
85
|
+
}
|
|
86
|
+
|
|
88
87
|
type PaginationOptions = {
|
|
89
88
|
/**
|
|
90
89
|
* Maximum number of items to return (1-100, default: 20)
|
|
@@ -103,11 +102,6 @@ type PaginationOptions = {
|
|
|
103
102
|
before?: string;
|
|
104
103
|
after?: never;
|
|
105
104
|
});
|
|
106
|
-
type PaginatedData<Data> = {
|
|
107
|
-
object: 'list';
|
|
108
|
-
data: Data;
|
|
109
|
-
has_more: boolean;
|
|
110
|
-
};
|
|
111
105
|
|
|
112
106
|
interface PatchOptions {
|
|
113
107
|
query?: {
|
|
@@ -176,47 +170,59 @@ type RemoveApiKeyResponse = {
|
|
|
176
170
|
error: ErrorResponse;
|
|
177
171
|
};
|
|
178
172
|
|
|
179
|
-
interface
|
|
173
|
+
interface Audience {
|
|
174
|
+
created_at: string;
|
|
180
175
|
id: string;
|
|
181
|
-
|
|
182
|
-
size: number;
|
|
183
|
-
content_type: string;
|
|
184
|
-
content_disposition: 'inline' | 'attachment';
|
|
185
|
-
content_id?: string;
|
|
186
|
-
download_url: string;
|
|
187
|
-
expires_at: string;
|
|
176
|
+
name: string;
|
|
188
177
|
}
|
|
189
178
|
|
|
190
|
-
interface
|
|
191
|
-
|
|
192
|
-
id: string;
|
|
179
|
+
interface CreateAudienceOptions {
|
|
180
|
+
name: string;
|
|
193
181
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
182
|
+
interface CreateAudienceRequestOptions extends PostOptions {
|
|
183
|
+
}
|
|
184
|
+
interface CreateAudienceResponseSuccess extends Pick<Audience, 'name' | 'id'> {
|
|
185
|
+
object: 'audience';
|
|
186
|
+
}
|
|
187
|
+
type CreateAudienceResponse = {
|
|
188
|
+
data: CreateAudienceResponseSuccess;
|
|
199
189
|
error: null;
|
|
200
190
|
} | {
|
|
201
191
|
data: null;
|
|
202
192
|
error: ErrorResponse;
|
|
203
193
|
};
|
|
204
194
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
};
|
|
208
|
-
interface ListAttachmentsApiResponse {
|
|
209
|
-
object: 'list';
|
|
210
|
-
has_more: boolean;
|
|
211
|
-
data: Attachment$1[];
|
|
195
|
+
interface GetAudienceResponseSuccess extends Pick<Audience, 'id' | 'name' | 'created_at'> {
|
|
196
|
+
object: 'audience';
|
|
212
197
|
}
|
|
213
|
-
|
|
198
|
+
type GetAudienceResponse = {
|
|
199
|
+
data: GetAudienceResponseSuccess;
|
|
200
|
+
error: null;
|
|
201
|
+
} | {
|
|
202
|
+
data: null;
|
|
203
|
+
error: ErrorResponse;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
type ListAudiencesOptions = PaginationOptions;
|
|
207
|
+
type ListAudiencesResponseSuccess = {
|
|
214
208
|
object: 'list';
|
|
209
|
+
data: Audience[];
|
|
215
210
|
has_more: boolean;
|
|
216
|
-
|
|
211
|
+
};
|
|
212
|
+
type ListAudiencesResponse = {
|
|
213
|
+
data: ListAudiencesResponseSuccess;
|
|
214
|
+
error: null;
|
|
215
|
+
} | {
|
|
216
|
+
data: null;
|
|
217
|
+
error: ErrorResponse;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
interface RemoveAudiencesResponseSuccess extends Pick<Audience, 'id'> {
|
|
221
|
+
object: 'audience';
|
|
222
|
+
deleted: boolean;
|
|
217
223
|
}
|
|
218
|
-
type
|
|
219
|
-
data:
|
|
224
|
+
type RemoveAudiencesResponse = {
|
|
225
|
+
data: RemoveAudiencesResponseSuccess;
|
|
220
226
|
error: null;
|
|
221
227
|
} | {
|
|
222
228
|
data: null;
|
|
@@ -243,16 +249,6 @@ interface EmailRenderOptions$1 {
|
|
|
243
249
|
*/
|
|
244
250
|
text: string;
|
|
245
251
|
}
|
|
246
|
-
interface EmailTemplateOptions {
|
|
247
|
-
template: {
|
|
248
|
-
id: string;
|
|
249
|
-
variables?: Record<string, string | number | boolean>;
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
interface CreateEmailBaseOptionsWithTemplate extends Omit<CreateEmailBaseOptions, 'from' | 'subject'> {
|
|
253
|
-
from?: string;
|
|
254
|
-
subject?: string;
|
|
255
|
-
}
|
|
256
252
|
interface CreateEmailBaseOptions {
|
|
257
253
|
/**
|
|
258
254
|
* Filename and content of attachments (max 40mb per email)
|
|
@@ -308,12 +304,6 @@ interface CreateEmailBaseOptions {
|
|
|
308
304
|
* @link https://resend.com/docs/api-reference/emails/send-email#body-parameters
|
|
309
305
|
*/
|
|
310
306
|
to: string | string[];
|
|
311
|
-
/**
|
|
312
|
-
* The id of the topic you want to send to
|
|
313
|
-
*
|
|
314
|
-
* @link https://resend.com/docs/api-reference/emails/send-email#body-parameters
|
|
315
|
-
*/
|
|
316
|
-
topicId?: string | null;
|
|
317
307
|
/**
|
|
318
308
|
* Schedule email to be sent later.
|
|
319
309
|
* The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z).
|
|
@@ -322,13 +312,7 @@ interface CreateEmailBaseOptions {
|
|
|
322
312
|
*/
|
|
323
313
|
scheduledAt?: string;
|
|
324
314
|
}
|
|
325
|
-
type CreateEmailOptions =
|
|
326
|
-
template?: never;
|
|
327
|
-
}) | ((EmailTemplateOptions & CreateEmailBaseOptionsWithTemplate) & {
|
|
328
|
-
react?: never;
|
|
329
|
-
html?: never;
|
|
330
|
-
text?: never;
|
|
331
|
-
});
|
|
315
|
+
type CreateEmailOptions = RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions;
|
|
332
316
|
interface CreateEmailRequestOptions extends PostOptions, IdempotentRequest {
|
|
333
317
|
}
|
|
334
318
|
interface CreateEmailResponseSuccess {
|
|
@@ -406,7 +390,6 @@ type CreateBatchResponse<Options extends CreateBatchRequestOptions> = {
|
|
|
406
390
|
interface Broadcast {
|
|
407
391
|
id: string;
|
|
408
392
|
name: string;
|
|
409
|
-
segment_id: string | null;
|
|
410
393
|
audience_id: string | null;
|
|
411
394
|
from: string | null;
|
|
412
395
|
subject: string | null;
|
|
@@ -416,7 +399,6 @@ interface Broadcast {
|
|
|
416
399
|
created_at: string;
|
|
417
400
|
scheduled_at: string | null;
|
|
418
401
|
sent_at: string | null;
|
|
419
|
-
topic_id?: string | null;
|
|
420
402
|
html: string | null;
|
|
421
403
|
text: string | null;
|
|
422
404
|
}
|
|
@@ -441,25 +423,19 @@ interface EmailRenderOptions {
|
|
|
441
423
|
*/
|
|
442
424
|
text: string;
|
|
443
425
|
}
|
|
444
|
-
interface
|
|
426
|
+
interface CreateBroadcastBaseOptions {
|
|
445
427
|
/**
|
|
446
|
-
* The
|
|
428
|
+
* The name of the broadcast
|
|
447
429
|
*
|
|
448
430
|
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
449
431
|
*/
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* @deprecated Use segmentId instead
|
|
453
|
-
*/
|
|
454
|
-
audienceId: string;
|
|
455
|
-
}
|
|
456
|
-
interface CreateBroadcastBaseOptions {
|
|
432
|
+
name?: string;
|
|
457
433
|
/**
|
|
458
|
-
* The
|
|
434
|
+
* The id of the audience you want to send to
|
|
459
435
|
*
|
|
460
436
|
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
461
437
|
*/
|
|
462
|
-
|
|
438
|
+
audienceId: string;
|
|
463
439
|
/**
|
|
464
440
|
* A short snippet of text displayed as a preview in recipients' inboxes, often shown below or beside the subject line.
|
|
465
441
|
*
|
|
@@ -484,14 +460,8 @@ interface CreateBroadcastBaseOptions {
|
|
|
484
460
|
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
485
461
|
*/
|
|
486
462
|
subject: string;
|
|
487
|
-
/**
|
|
488
|
-
* The id of the topic you want to send to
|
|
489
|
-
*
|
|
490
|
-
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
491
|
-
*/
|
|
492
|
-
topicId?: string | null;
|
|
493
463
|
}
|
|
494
|
-
type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> &
|
|
464
|
+
type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> & CreateBroadcastBaseOptions;
|
|
495
465
|
interface CreateBroadcastRequestOptions extends PostOptions {
|
|
496
466
|
}
|
|
497
467
|
interface CreateBroadcastResponseSuccess {
|
|
@@ -521,7 +491,7 @@ type ListBroadcastsOptions = PaginationOptions;
|
|
|
521
491
|
type ListBroadcastsResponseSuccess = {
|
|
522
492
|
object: 'list';
|
|
523
493
|
has_more: boolean;
|
|
524
|
-
data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | '
|
|
494
|
+
data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
|
|
525
495
|
};
|
|
526
496
|
type ListBroadcastsResponse = {
|
|
527
497
|
data: ListBroadcastsResponseSuccess;
|
|
@@ -573,10 +543,6 @@ interface UpdateBroadcastResponseSuccess {
|
|
|
573
543
|
}
|
|
574
544
|
type UpdateBroadcastOptions = {
|
|
575
545
|
name?: string;
|
|
576
|
-
segmentId?: string;
|
|
577
|
-
/**
|
|
578
|
-
* @deprecated Use segmentId instead
|
|
579
|
-
*/
|
|
580
546
|
audienceId?: string;
|
|
581
547
|
from?: string;
|
|
582
548
|
html?: string;
|
|
@@ -585,7 +551,6 @@ type UpdateBroadcastOptions = {
|
|
|
585
551
|
subject?: string;
|
|
586
552
|
replyTo?: string[];
|
|
587
553
|
previewText?: string;
|
|
588
|
-
topicId?: string | null;
|
|
589
554
|
};
|
|
590
555
|
type UpdateBroadcastResponse = {
|
|
591
556
|
data: UpdateBroadcastResponseSuccess;
|
|
@@ -632,7 +597,7 @@ type SelectingField = {
|
|
|
632
597
|
};
|
|
633
598
|
|
|
634
599
|
interface CreateContactOptions {
|
|
635
|
-
audienceId
|
|
600
|
+
audienceId: string;
|
|
636
601
|
email: string;
|
|
637
602
|
unsubscribed?: boolean;
|
|
638
603
|
firstName?: string;
|
|
@@ -651,9 +616,9 @@ type CreateContactResponse = {
|
|
|
651
616
|
error: ErrorResponse;
|
|
652
617
|
};
|
|
653
618
|
|
|
654
|
-
type GetContactOptions =
|
|
655
|
-
audienceId
|
|
656
|
-
} & SelectingField
|
|
619
|
+
type GetContactOptions = {
|
|
620
|
+
audienceId: string;
|
|
621
|
+
} & SelectingField;
|
|
657
622
|
interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'email' | 'created_at' | 'first_name' | 'last_name' | 'unsubscribed'> {
|
|
658
623
|
object: 'contact';
|
|
659
624
|
}
|
|
@@ -665,12 +630,9 @@ type GetContactResponse = {
|
|
|
665
630
|
error: ErrorResponse;
|
|
666
631
|
};
|
|
667
632
|
|
|
668
|
-
type
|
|
633
|
+
type ListContactsOptions = {
|
|
669
634
|
audienceId: string;
|
|
670
635
|
} & PaginationOptions;
|
|
671
|
-
type ListContactsOptions = PaginationOptions & {
|
|
672
|
-
audienceId?: string;
|
|
673
|
-
};
|
|
674
636
|
interface ListContactsResponseSuccess {
|
|
675
637
|
object: 'list';
|
|
676
638
|
data: Contact[];
|
|
@@ -689,9 +651,9 @@ type RemoveContactsResponseSuccess = {
|
|
|
689
651
|
deleted: boolean;
|
|
690
652
|
contact: string;
|
|
691
653
|
};
|
|
692
|
-
type RemoveContactOptions =
|
|
693
|
-
audienceId
|
|
694
|
-
}
|
|
654
|
+
type RemoveContactOptions = SelectingField & {
|
|
655
|
+
audienceId: string;
|
|
656
|
+
};
|
|
695
657
|
type RemoveContactsResponse = {
|
|
696
658
|
data: RemoveContactsResponseSuccess;
|
|
697
659
|
error: null;
|
|
@@ -701,7 +663,7 @@ type RemoveContactsResponse = {
|
|
|
701
663
|
};
|
|
702
664
|
|
|
703
665
|
type UpdateContactOptions = {
|
|
704
|
-
audienceId
|
|
666
|
+
audienceId: string;
|
|
705
667
|
unsubscribed?: boolean;
|
|
706
668
|
firstName?: string;
|
|
707
669
|
lastName?: string;
|
|
@@ -720,7 +682,7 @@ type UpdateContactResponse = {
|
|
|
720
682
|
type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1';
|
|
721
683
|
type DomainNameservers = 'Amazon Route 53' | 'Cloudflare' | 'Digital Ocean' | 'GoDaddy' | 'Google Domains' | 'Namecheap' | 'Unidentified' | 'Vercel';
|
|
722
684
|
type DomainStatus = 'pending' | 'verified' | 'failed' | 'temporary_failure' | 'not_started';
|
|
723
|
-
type DomainRecords = DomainSpfRecord | DomainDkimRecord
|
|
685
|
+
type DomainRecords = DomainSpfRecord | DomainDkimRecord;
|
|
724
686
|
interface DomainSpfRecord {
|
|
725
687
|
record: 'SPF';
|
|
726
688
|
name: string;
|
|
@@ -743,33 +705,22 @@ interface DomainDkimRecord {
|
|
|
743
705
|
priority?: number;
|
|
744
706
|
proxy_status?: 'enable' | 'disable';
|
|
745
707
|
}
|
|
746
|
-
interface ReceivingRecord {
|
|
747
|
-
record: 'Receiving';
|
|
748
|
-
name: string;
|
|
749
|
-
value: string;
|
|
750
|
-
type: 'MX';
|
|
751
|
-
ttl: string;
|
|
752
|
-
status: DomainStatus;
|
|
753
|
-
priority: number;
|
|
754
|
-
}
|
|
755
708
|
interface Domain {
|
|
756
709
|
id: string;
|
|
757
710
|
name: string;
|
|
758
711
|
status: DomainStatus;
|
|
759
712
|
created_at: string;
|
|
760
713
|
region: DomainRegion;
|
|
761
|
-
capability: 'send' | 'receive' | 'send-and-receive';
|
|
762
714
|
}
|
|
763
715
|
|
|
764
716
|
interface CreateDomainOptions {
|
|
765
717
|
name: string;
|
|
766
718
|
region?: DomainRegion;
|
|
767
719
|
customReturnPath?: string;
|
|
768
|
-
capability?: 'send' | 'receive' | 'send-and-receive';
|
|
769
720
|
}
|
|
770
721
|
interface CreateDomainRequestOptions extends PostOptions {
|
|
771
722
|
}
|
|
772
|
-
interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'
|
|
723
|
+
interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> {
|
|
773
724
|
records: DomainRecords[];
|
|
774
725
|
}
|
|
775
726
|
type CreateDomainResponse = {
|
|
@@ -780,7 +731,7 @@ type CreateDomainResponse = {
|
|
|
780
731
|
error: ErrorResponse;
|
|
781
732
|
};
|
|
782
733
|
|
|
783
|
-
interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'
|
|
734
|
+
interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> {
|
|
784
735
|
object: 'domain';
|
|
785
736
|
records: DomainRecords[];
|
|
786
737
|
}
|
|
@@ -874,7 +825,6 @@ interface GetEmailResponseSuccess {
|
|
|
874
825
|
value: string;
|
|
875
826
|
}[];
|
|
876
827
|
to: string[];
|
|
877
|
-
topic_id?: string | null;
|
|
878
828
|
scheduled_at: string | null;
|
|
879
829
|
object: 'email';
|
|
880
830
|
}
|
|
@@ -902,292 +852,134 @@ type UpdateEmailResponse = {
|
|
|
902
852
|
error: ErrorResponse;
|
|
903
853
|
};
|
|
904
854
|
|
|
905
|
-
|
|
906
|
-
object: 'inbound';
|
|
907
|
-
id: string;
|
|
908
|
-
to: string[];
|
|
909
|
-
from: string;
|
|
910
|
-
created_at: string;
|
|
911
|
-
subject: string;
|
|
912
|
-
bcc: string[] | null;
|
|
913
|
-
cc: string[] | null;
|
|
914
|
-
reply_to: string[] | null;
|
|
915
|
-
html: string | null;
|
|
916
|
-
text: string | null;
|
|
917
|
-
headers: Record<string, string>;
|
|
918
|
-
message_id: string;
|
|
919
|
-
attachments: Array<{
|
|
920
|
-
id: string;
|
|
921
|
-
filename: string;
|
|
922
|
-
size: number;
|
|
923
|
-
content_type: string;
|
|
924
|
-
content_id: string;
|
|
925
|
-
content_disposition: string;
|
|
926
|
-
}>;
|
|
927
|
-
}
|
|
928
|
-
type GetInboundEmailResponse = {
|
|
929
|
-
data: GetInboundEmailResponseSuccess;
|
|
930
|
-
error: null;
|
|
931
|
-
} | {
|
|
932
|
-
data: null;
|
|
933
|
-
error: ErrorResponse;
|
|
934
|
-
};
|
|
935
|
-
|
|
936
|
-
type ListInboundEmailsOptions = PaginationOptions;
|
|
937
|
-
type ListInboundEmail = Omit<GetInboundEmailResponseSuccess, 'html' | 'text' | 'headers' | 'object'>;
|
|
938
|
-
interface ListInboundEmailsResponseSuccess {
|
|
939
|
-
object: 'list';
|
|
940
|
-
has_more: boolean;
|
|
941
|
-
data: ListInboundEmail[];
|
|
942
|
-
}
|
|
943
|
-
type ListInboundEmailsResponse = {
|
|
944
|
-
data: ListInboundEmailsResponseSuccess;
|
|
945
|
-
error: null;
|
|
946
|
-
} | {
|
|
947
|
-
data: null;
|
|
948
|
-
error: ErrorResponse;
|
|
949
|
-
};
|
|
950
|
-
|
|
951
|
-
declare class ApiKeys {
|
|
952
|
-
private readonly resend;
|
|
953
|
-
constructor(resend: Resend);
|
|
954
|
-
create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>;
|
|
955
|
-
list(options?: ListApiKeysOptions): Promise<ListApiKeysResponse>;
|
|
956
|
-
remove(id: string): Promise<RemoveApiKeyResponse>;
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
declare class Receiving$1 {
|
|
960
|
-
private readonly resend;
|
|
961
|
-
constructor(resend: Resend);
|
|
962
|
-
get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>;
|
|
963
|
-
list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
declare class Sending {
|
|
967
|
-
private readonly resend;
|
|
968
|
-
constructor(resend: Resend);
|
|
969
|
-
get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>;
|
|
970
|
-
list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
declare class Attachments {
|
|
974
|
-
readonly receiving: Receiving$1;
|
|
975
|
-
readonly sending: Sending;
|
|
976
|
-
constructor(resend: Resend);
|
|
977
|
-
}
|
|
855
|
+
type WebhookEvent = 'email.sent' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'domain.created' | 'domain.updated' | 'domain.deleted';
|
|
978
856
|
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
send<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>;
|
|
983
|
-
create<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>;
|
|
857
|
+
interface CreateWebhookOptions {
|
|
858
|
+
endpoint: string;
|
|
859
|
+
events: WebhookEvent[];
|
|
984
860
|
}
|
|
985
|
-
|
|
986
|
-
declare class Broadcasts {
|
|
987
|
-
private readonly resend;
|
|
988
|
-
constructor(resend: Resend);
|
|
989
|
-
create(payload: CreateBroadcastOptions, options?: CreateBroadcastRequestOptions): Promise<SendBroadcastResponse>;
|
|
990
|
-
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
991
|
-
list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
|
|
992
|
-
get(id: string): Promise<GetBroadcastResponse>;
|
|
993
|
-
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
994
|
-
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
861
|
+
interface CreateWebhookRequestOptions extends PostOptions {
|
|
995
862
|
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
type: 'string';
|
|
999
|
-
fallbackValue: string | null;
|
|
1000
|
-
};
|
|
1001
|
-
type NumberBaseContactProperty = {
|
|
1002
|
-
type: 'number';
|
|
1003
|
-
fallbackValue: number | null;
|
|
1004
|
-
};
|
|
1005
|
-
type ContactProperty = {
|
|
863
|
+
interface CreateWebhookResponseSuccess {
|
|
864
|
+
object: 'webhook';
|
|
1006
865
|
id: string;
|
|
1007
|
-
|
|
1008
|
-
createdAt: string;
|
|
1009
|
-
key: string;
|
|
1010
|
-
} & (StringBaseContactProperty | NumberBaseContactProperty);
|
|
1011
|
-
|
|
1012
|
-
type StringBaseContactPropertyOptions = {
|
|
1013
|
-
type: 'string';
|
|
1014
|
-
fallbackValue?: string | null;
|
|
1015
|
-
};
|
|
1016
|
-
type NumberBaseContactPropertyOptions = {
|
|
1017
|
-
type: 'number';
|
|
1018
|
-
fallbackValue?: number | null;
|
|
1019
|
-
};
|
|
1020
|
-
type CreateContactPropertyOptions = {
|
|
1021
|
-
key: string;
|
|
1022
|
-
} & (StringBaseContactPropertyOptions | NumberBaseContactPropertyOptions);
|
|
1023
|
-
type CreateContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'>;
|
|
1024
|
-
interface CreateContactPropertyResponse {
|
|
1025
|
-
data: CreateContactPropertyResponseSuccess | null;
|
|
1026
|
-
error: ErrorResponse | null;
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
type RemoveContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'> & {
|
|
1030
|
-
deleted: boolean;
|
|
1031
|
-
};
|
|
1032
|
-
interface RemoveContactPropertyResponse {
|
|
1033
|
-
data: RemoveContactPropertyResponseSuccess | null;
|
|
1034
|
-
error: ErrorResponse | null;
|
|
866
|
+
signing_secret: string;
|
|
1035
867
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
data: ContactProperty;
|
|
868
|
+
type CreateWebhookResponse = {
|
|
869
|
+
data: CreateWebhookResponseSuccess;
|
|
1039
870
|
error: null;
|
|
1040
871
|
} | {
|
|
1041
872
|
data: null;
|
|
1042
873
|
error: ErrorResponse;
|
|
1043
874
|
};
|
|
1044
875
|
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
876
|
+
interface GetWebhookResponseSuccess {
|
|
877
|
+
object: 'webhook';
|
|
878
|
+
id: string;
|
|
879
|
+
created_at: string;
|
|
880
|
+
status: 'enabled' | 'disabled';
|
|
881
|
+
endpoint: string;
|
|
882
|
+
events: WebhookEvent[] | null;
|
|
883
|
+
signing_secret: string;
|
|
884
|
+
}
|
|
885
|
+
type GetWebhookResponse = {
|
|
886
|
+
data: GetWebhookResponseSuccess;
|
|
1052
887
|
error: null;
|
|
1053
888
|
} | {
|
|
1054
889
|
data: null;
|
|
1055
890
|
error: ErrorResponse;
|
|
1056
891
|
};
|
|
1057
892
|
|
|
1058
|
-
type
|
|
893
|
+
type ListWebhooksOptions = PaginationOptions;
|
|
894
|
+
interface Webhook {
|
|
1059
895
|
id: string;
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
data: UpdateContactPropertyResponseSuccess | null;
|
|
1065
|
-
error: ErrorResponse | null;
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
declare class ContactProperties {
|
|
1069
|
-
private readonly resend;
|
|
1070
|
-
constructor(resend: Resend);
|
|
1071
|
-
create(options: CreateContactPropertyOptions): Promise<CreateContactPropertyResponse>;
|
|
1072
|
-
list(options?: ListContactPropertiesOptions): Promise<ListContactPropertiesResponse>;
|
|
1073
|
-
get(id: string): Promise<GetContactPropertyResponse>;
|
|
1074
|
-
update(payload: UpdateContactPropertyOptions): Promise<UpdateContactPropertyResponse>;
|
|
1075
|
-
remove(id: string): Promise<RemoveContactPropertyResponse>;
|
|
896
|
+
endpoint: string;
|
|
897
|
+
created_at: string;
|
|
898
|
+
status: 'enabled' | 'disabled';
|
|
899
|
+
events: WebhookEvent[] | null;
|
|
1076
900
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
} | {
|
|
1082
|
-
contactId?: never;
|
|
1083
|
-
email: string;
|
|
1084
|
-
};
|
|
1085
|
-
|
|
1086
|
-
type AddContactSegmentOptions = ContactSegmentsBaseOptions & {
|
|
1087
|
-
segmentId: string;
|
|
901
|
+
type ListWebhooksResponseSuccess = {
|
|
902
|
+
object: 'list';
|
|
903
|
+
has_more: boolean;
|
|
904
|
+
data: Webhook[];
|
|
1088
905
|
};
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
}
|
|
1092
|
-
type AddContactSegmentResponse = {
|
|
1093
|
-
data: AddContactSegmentResponseSuccess;
|
|
906
|
+
type ListWebhooksResponse = {
|
|
907
|
+
data: ListWebhooksResponseSuccess;
|
|
1094
908
|
error: null;
|
|
1095
909
|
} | {
|
|
1096
910
|
data: null;
|
|
1097
911
|
error: ErrorResponse;
|
|
1098
912
|
};
|
|
1099
913
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
type ListContactSegmentsOptions = PaginationOptions & ContactSegmentsBaseOptions;
|
|
1107
|
-
type ListContactSegmentsResponseSuccess = PaginatedData<Segment[]>;
|
|
1108
|
-
type ListContactSegmentsResponse = {
|
|
1109
|
-
data: ListContactSegmentsResponseSuccess;
|
|
914
|
+
type RemoveWebhookResponseSuccess = Pick<Webhook, 'id'> & {
|
|
915
|
+
object: 'webhook';
|
|
916
|
+
deleted: boolean;
|
|
917
|
+
};
|
|
918
|
+
type RemoveWebhookResponse = {
|
|
919
|
+
data: RemoveWebhookResponseSuccess;
|
|
1110
920
|
error: null;
|
|
1111
921
|
} | {
|
|
1112
922
|
data: null;
|
|
1113
923
|
error: ErrorResponse;
|
|
1114
924
|
};
|
|
1115
925
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
926
|
+
interface UpdateWebhookOptions {
|
|
927
|
+
endpoint?: string;
|
|
928
|
+
events?: WebhookEvent[];
|
|
929
|
+
status?: 'enabled' | 'disabled';
|
|
930
|
+
}
|
|
931
|
+
interface UpdateWebhookResponseSuccess {
|
|
932
|
+
object: 'webhook';
|
|
1120
933
|
id: string;
|
|
1121
|
-
deleted: boolean;
|
|
1122
934
|
}
|
|
1123
|
-
type
|
|
1124
|
-
data:
|
|
935
|
+
type UpdateWebhookResponse = {
|
|
936
|
+
data: UpdateWebhookResponseSuccess;
|
|
1125
937
|
error: null;
|
|
1126
938
|
} | {
|
|
1127
939
|
data: null;
|
|
1128
940
|
error: ErrorResponse;
|
|
1129
941
|
};
|
|
1130
942
|
|
|
1131
|
-
declare class
|
|
943
|
+
declare class ApiKeys {
|
|
1132
944
|
private readonly resend;
|
|
1133
945
|
constructor(resend: Resend);
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
remove(
|
|
946
|
+
create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>;
|
|
947
|
+
list(options?: ListApiKeysOptions): Promise<ListApiKeysResponse>;
|
|
948
|
+
remove(id: string): Promise<RemoveApiKeyResponse>;
|
|
1137
949
|
}
|
|
1138
950
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
id: string
|
|
1146
|
-
name: string;
|
|
1147
|
-
description: string | null;
|
|
1148
|
-
subscription: 'opt_in' | 'opt_out';
|
|
951
|
+
declare class Audiences {
|
|
952
|
+
private readonly resend;
|
|
953
|
+
constructor(resend: Resend);
|
|
954
|
+
create(payload: CreateAudienceOptions, options?: CreateAudienceRequestOptions): Promise<CreateAudienceResponse>;
|
|
955
|
+
list(options?: ListAudiencesOptions): Promise<ListAudiencesResponse>;
|
|
956
|
+
get(id: string): Promise<GetAudienceResponse>;
|
|
957
|
+
remove(id: string): Promise<RemoveAudiencesResponse>;
|
|
1149
958
|
}
|
|
1150
|
-
type ListContactTopicsResponseSuccess = PaginatedData<ContactTopic[]>;
|
|
1151
|
-
type ListContactTopicsResponse = {
|
|
1152
|
-
data: ListContactTopicsResponseSuccess;
|
|
1153
|
-
error: null;
|
|
1154
|
-
} | {
|
|
1155
|
-
data: null;
|
|
1156
|
-
error: ErrorResponse;
|
|
1157
|
-
};
|
|
1158
959
|
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
topics: {
|
|
1165
|
-
id: string;
|
|
1166
|
-
subscription: 'opt_in' | 'opt_out';
|
|
1167
|
-
}[];
|
|
1168
|
-
}
|
|
1169
|
-
interface UpdateContactTopicsResponseSuccess {
|
|
1170
|
-
id: string;
|
|
1171
|
-
}
|
|
1172
|
-
interface UpdateContactTopicsResponse {
|
|
1173
|
-
data: UpdateContactTopicsResponseSuccess | null;
|
|
1174
|
-
error: ErrorResponse | null;
|
|
960
|
+
declare class Batch {
|
|
961
|
+
private readonly resend;
|
|
962
|
+
constructor(resend: Resend);
|
|
963
|
+
send<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>;
|
|
964
|
+
create<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>;
|
|
1175
965
|
}
|
|
1176
966
|
|
|
1177
|
-
declare class
|
|
967
|
+
declare class Broadcasts {
|
|
1178
968
|
private readonly resend;
|
|
1179
969
|
constructor(resend: Resend);
|
|
1180
|
-
|
|
1181
|
-
|
|
970
|
+
create(payload: CreateBroadcastOptions, options?: CreateBroadcastRequestOptions): Promise<SendBroadcastResponse>;
|
|
971
|
+
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
972
|
+
list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
|
|
973
|
+
get(id: string): Promise<GetBroadcastResponse>;
|
|
974
|
+
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
975
|
+
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
1182
976
|
}
|
|
1183
977
|
|
|
1184
978
|
declare class Contacts {
|
|
1185
979
|
private readonly resend;
|
|
1186
|
-
readonly topics: ContactTopics;
|
|
1187
|
-
readonly segments: ContactSegments;
|
|
1188
980
|
constructor(resend: Resend);
|
|
1189
981
|
create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
|
|
1190
|
-
list(options
|
|
982
|
+
list(options: ListContactsOptions): Promise<ListContactsResponse>;
|
|
1191
983
|
get(options: GetContactOptions): Promise<GetContactResponse>;
|
|
1192
984
|
update(options: UpdateContactOptions): Promise<UpdateContactResponse>;
|
|
1193
985
|
remove(payload: RemoveContactOptions): Promise<RemoveContactsResponse>;
|
|
@@ -1219,16 +1011,8 @@ type ListEmailsResponse = {
|
|
|
1219
1011
|
error: ErrorResponse;
|
|
1220
1012
|
};
|
|
1221
1013
|
|
|
1222
|
-
declare class Receiving {
|
|
1223
|
-
private readonly resend;
|
|
1224
|
-
constructor(resend: Resend);
|
|
1225
|
-
get(id: string): Promise<GetInboundEmailResponse>;
|
|
1226
|
-
list(options?: ListInboundEmailsOptions): Promise<ListInboundEmailsResponse>;
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
1014
|
declare class Emails {
|
|
1230
1015
|
private readonly resend;
|
|
1231
|
-
readonly receiving: Receiving;
|
|
1232
1016
|
constructor(resend: Resend);
|
|
1233
1017
|
send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
1234
1018
|
create(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
@@ -1238,376 +1022,6 @@ declare class Emails {
|
|
|
1238
1022
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1239
1023
|
}
|
|
1240
1024
|
|
|
1241
|
-
interface CreateSegmentOptions {
|
|
1242
|
-
name: string;
|
|
1243
|
-
}
|
|
1244
|
-
interface CreateSegmentRequestOptions extends PostOptions {
|
|
1245
|
-
}
|
|
1246
|
-
interface CreateSegmentResponseSuccess extends Pick<Segment, 'name' | 'id'> {
|
|
1247
|
-
object: 'segment';
|
|
1248
|
-
}
|
|
1249
|
-
type CreateSegmentResponse = {
|
|
1250
|
-
data: CreateSegmentResponseSuccess;
|
|
1251
|
-
error: null;
|
|
1252
|
-
} | {
|
|
1253
|
-
data: null;
|
|
1254
|
-
error: ErrorResponse;
|
|
1255
|
-
};
|
|
1256
|
-
|
|
1257
|
-
interface GetSegmentResponseSuccess extends Pick<Segment, 'id' | 'name' | 'created_at'> {
|
|
1258
|
-
object: 'segment';
|
|
1259
|
-
}
|
|
1260
|
-
type GetSegmentResponse = {
|
|
1261
|
-
data: GetSegmentResponseSuccess;
|
|
1262
|
-
error: null;
|
|
1263
|
-
} | {
|
|
1264
|
-
data: null;
|
|
1265
|
-
error: ErrorResponse;
|
|
1266
|
-
};
|
|
1267
|
-
|
|
1268
|
-
type ListSegmentsOptions = PaginationOptions;
|
|
1269
|
-
type ListSegmentsResponseSuccess = {
|
|
1270
|
-
object: 'list';
|
|
1271
|
-
data: Segment[];
|
|
1272
|
-
has_more: boolean;
|
|
1273
|
-
};
|
|
1274
|
-
type ListSegmentsResponse = {
|
|
1275
|
-
data: ListSegmentsResponseSuccess;
|
|
1276
|
-
error: null;
|
|
1277
|
-
} | {
|
|
1278
|
-
data: null;
|
|
1279
|
-
error: ErrorResponse;
|
|
1280
|
-
};
|
|
1281
|
-
|
|
1282
|
-
interface RemoveSegmentResponseSuccess extends Pick<Segment, 'id'> {
|
|
1283
|
-
object: 'segment';
|
|
1284
|
-
deleted: boolean;
|
|
1285
|
-
}
|
|
1286
|
-
type RemoveSegmentResponse = {
|
|
1287
|
-
data: RemoveSegmentResponseSuccess;
|
|
1288
|
-
error: null;
|
|
1289
|
-
} | {
|
|
1290
|
-
data: null;
|
|
1291
|
-
error: ErrorResponse;
|
|
1292
|
-
};
|
|
1293
|
-
|
|
1294
|
-
declare class Segments {
|
|
1295
|
-
private readonly resend;
|
|
1296
|
-
constructor(resend: Resend);
|
|
1297
|
-
create(payload: CreateSegmentOptions, options?: CreateSegmentRequestOptions): Promise<CreateSegmentResponse>;
|
|
1298
|
-
list(options?: ListSegmentsOptions): Promise<ListSegmentsResponse>;
|
|
1299
|
-
get(id: string): Promise<GetSegmentResponse>;
|
|
1300
|
-
remove(id: string): Promise<RemoveSegmentResponse>;
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
interface Template {
|
|
1304
|
-
id: string;
|
|
1305
|
-
name: string;
|
|
1306
|
-
subject: string | null;
|
|
1307
|
-
html: string;
|
|
1308
|
-
text: string | null;
|
|
1309
|
-
status: 'draft' | 'published';
|
|
1310
|
-
variables: TemplateVariable[] | null;
|
|
1311
|
-
alias: string | null;
|
|
1312
|
-
from: string | null;
|
|
1313
|
-
reply_to: string[] | null;
|
|
1314
|
-
published_at: string | null;
|
|
1315
|
-
created_at: string;
|
|
1316
|
-
updated_at: string;
|
|
1317
|
-
has_unpublished_versions: boolean;
|
|
1318
|
-
current_version_id: string;
|
|
1319
|
-
}
|
|
1320
|
-
interface TemplateVariable {
|
|
1321
|
-
key: string;
|
|
1322
|
-
fallback_value: string | number | null;
|
|
1323
|
-
type: 'string' | 'number';
|
|
1324
|
-
created_at: string;
|
|
1325
|
-
updated_at: string;
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
type TemplateContentCreationOptions = RequireAtLeastOne<{
|
|
1329
|
-
html: string;
|
|
1330
|
-
react: React.ReactNode;
|
|
1331
|
-
}>;
|
|
1332
|
-
type TemplateVariableCreationOptions = Pick<TemplateVariable, 'key' | 'type'> & ({
|
|
1333
|
-
type: 'string';
|
|
1334
|
-
fallbackValue?: string | null;
|
|
1335
|
-
} | {
|
|
1336
|
-
type: 'number';
|
|
1337
|
-
fallbackValue?: number | null;
|
|
1338
|
-
});
|
|
1339
|
-
type TemplateOptionalFieldsForCreation = Partial<Pick<Template, 'subject' | 'text' | 'alias' | 'from'>> & {
|
|
1340
|
-
replyTo?: string[] | string;
|
|
1341
|
-
variables?: TemplateVariableCreationOptions[];
|
|
1342
|
-
};
|
|
1343
|
-
type CreateTemplateOptions = Pick<Template, 'name'> & TemplateOptionalFieldsForCreation & TemplateContentCreationOptions;
|
|
1344
|
-
interface CreateTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1345
|
-
object: 'template';
|
|
1346
|
-
}
|
|
1347
|
-
type CreateTemplateResponse = {
|
|
1348
|
-
data: CreateTemplateResponseSuccess;
|
|
1349
|
-
error: null;
|
|
1350
|
-
} | {
|
|
1351
|
-
data: null;
|
|
1352
|
-
error: ErrorResponse;
|
|
1353
|
-
};
|
|
1354
|
-
|
|
1355
|
-
interface DuplicateTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1356
|
-
object: 'template';
|
|
1357
|
-
}
|
|
1358
|
-
type DuplicateTemplateResponse = {
|
|
1359
|
-
data: DuplicateTemplateResponseSuccess;
|
|
1360
|
-
error: null;
|
|
1361
|
-
} | {
|
|
1362
|
-
data: null;
|
|
1363
|
-
error: ErrorResponse;
|
|
1364
|
-
};
|
|
1365
|
-
|
|
1366
|
-
interface PublishTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1367
|
-
object: 'template';
|
|
1368
|
-
}
|
|
1369
|
-
type PublishTemplateResponse = {
|
|
1370
|
-
data: PublishTemplateResponseSuccess;
|
|
1371
|
-
error: null;
|
|
1372
|
-
} | {
|
|
1373
|
-
data: null;
|
|
1374
|
-
error: ErrorResponse;
|
|
1375
|
-
};
|
|
1376
|
-
|
|
1377
|
-
declare class ChainableTemplateResult<T extends CreateTemplateResponse | DuplicateTemplateResponse> implements PromiseLike<T> {
|
|
1378
|
-
private readonly promise;
|
|
1379
|
-
private readonly publishFn;
|
|
1380
|
-
constructor(promise: Promise<T>, publishFn: (id: string) => Promise<PublishTemplateResponse>);
|
|
1381
|
-
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
1382
|
-
publish(): Promise<PublishTemplateResponse>;
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
interface GetTemplateResponseSuccess extends Template {
|
|
1386
|
-
object: 'template';
|
|
1387
|
-
}
|
|
1388
|
-
type GetTemplateResponse = {
|
|
1389
|
-
data: GetTemplateResponseSuccess;
|
|
1390
|
-
error: null;
|
|
1391
|
-
} | {
|
|
1392
|
-
data: null;
|
|
1393
|
-
error: ErrorResponse;
|
|
1394
|
-
};
|
|
1395
|
-
|
|
1396
|
-
interface TemplateListItem extends Pick<Template, 'id' | 'name' | 'created_at' | 'updated_at' | 'status' | 'published_at' | 'alias'> {
|
|
1397
|
-
}
|
|
1398
|
-
interface ListTemplatesResponseSuccess {
|
|
1399
|
-
object: 'list';
|
|
1400
|
-
data: TemplateListItem[];
|
|
1401
|
-
has_more: boolean;
|
|
1402
|
-
}
|
|
1403
|
-
type ListTemplatesResponse = {
|
|
1404
|
-
data: ListTemplatesResponseSuccess;
|
|
1405
|
-
error: null;
|
|
1406
|
-
} | {
|
|
1407
|
-
data: null;
|
|
1408
|
-
error: ErrorResponse;
|
|
1409
|
-
};
|
|
1410
|
-
|
|
1411
|
-
interface RemoveTemplateResponseSuccess {
|
|
1412
|
-
object: 'template';
|
|
1413
|
-
id: string;
|
|
1414
|
-
deleted: boolean;
|
|
1415
|
-
}
|
|
1416
|
-
type RemoveTemplateResponse = {
|
|
1417
|
-
data: RemoveTemplateResponseSuccess;
|
|
1418
|
-
error: null;
|
|
1419
|
-
} | {
|
|
1420
|
-
data: null;
|
|
1421
|
-
error: ErrorResponse;
|
|
1422
|
-
};
|
|
1423
|
-
|
|
1424
|
-
type TemplateVariableUpdateOptions = Pick<TemplateVariable, 'key' | 'type'> & ({
|
|
1425
|
-
type: 'string';
|
|
1426
|
-
fallbackValue?: string | null;
|
|
1427
|
-
} | {
|
|
1428
|
-
type: 'number';
|
|
1429
|
-
fallbackValue?: number | null;
|
|
1430
|
-
});
|
|
1431
|
-
interface UpdateTemplateOptions extends Partial<Pick<Template, 'name' | 'subject' | 'html' | 'text' | 'from' | 'alias'>> {
|
|
1432
|
-
variables?: TemplateVariableUpdateOptions[];
|
|
1433
|
-
replyTo?: string[] | string;
|
|
1434
|
-
}
|
|
1435
|
-
interface UpdateTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1436
|
-
object: 'template';
|
|
1437
|
-
}
|
|
1438
|
-
type UpdateTemplateResponse = {
|
|
1439
|
-
data: UpdateTemplateResponseSuccess;
|
|
1440
|
-
error: null;
|
|
1441
|
-
} | {
|
|
1442
|
-
data: null;
|
|
1443
|
-
error: ErrorResponse;
|
|
1444
|
-
};
|
|
1445
|
-
|
|
1446
|
-
declare class Templates {
|
|
1447
|
-
private readonly resend;
|
|
1448
|
-
private renderAsync?;
|
|
1449
|
-
constructor(resend: Resend);
|
|
1450
|
-
create(payload: CreateTemplateOptions): ChainableTemplateResult<CreateTemplateResponse>;
|
|
1451
|
-
private performCreate;
|
|
1452
|
-
remove(identifier: string): Promise<RemoveTemplateResponse>;
|
|
1453
|
-
get(identifier: string): Promise<GetTemplateResponse>;
|
|
1454
|
-
list(options?: PaginationOptions): Promise<ListTemplatesResponse>;
|
|
1455
|
-
duplicate(identifier: string): ChainableTemplateResult<DuplicateTemplateResponse>;
|
|
1456
|
-
publish(identifier: string): Promise<PublishTemplateResponse>;
|
|
1457
|
-
update(identifier: string, payload: UpdateTemplateOptions): Promise<UpdateTemplateResponse>;
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
interface Topic {
|
|
1461
|
-
id: string;
|
|
1462
|
-
name: string;
|
|
1463
|
-
description?: string;
|
|
1464
|
-
defaultSubscription: 'opt_in' | 'opt_out';
|
|
1465
|
-
created_at: string;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
interface CreateTopicOptions {
|
|
1469
|
-
name: string;
|
|
1470
|
-
description?: string;
|
|
1471
|
-
defaultSubscription: 'opt_in' | 'opt_out';
|
|
1472
|
-
}
|
|
1473
|
-
type CreateTopicResponseSuccess = Pick<Topic, 'id'>;
|
|
1474
|
-
interface CreateTopicResponse {
|
|
1475
|
-
data: CreateTopicResponseSuccess | null;
|
|
1476
|
-
error: ErrorResponse | null;
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
type GetTopicResponseSuccess = Topic;
|
|
1480
|
-
interface GetTopicResponse {
|
|
1481
|
-
data: GetTopicResponseSuccess | null;
|
|
1482
|
-
error: ErrorResponse | null;
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
interface ListTopicsResponseSuccess {
|
|
1486
|
-
data: Topic[];
|
|
1487
|
-
}
|
|
1488
|
-
interface ListTopicsResponse {
|
|
1489
|
-
data: ListTopicsResponseSuccess | null;
|
|
1490
|
-
error: ErrorResponse | null;
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1493
|
-
type RemoveTopicResponseSuccess = Pick<Topic, 'id'> & {
|
|
1494
|
-
object: 'topic';
|
|
1495
|
-
deleted: boolean;
|
|
1496
|
-
};
|
|
1497
|
-
interface RemoveTopicResponse {
|
|
1498
|
-
data: RemoveTopicResponseSuccess | null;
|
|
1499
|
-
error: ErrorResponse | null;
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
|
-
interface UpdateTopicOptions {
|
|
1503
|
-
id: string;
|
|
1504
|
-
name?: string;
|
|
1505
|
-
description?: string;
|
|
1506
|
-
}
|
|
1507
|
-
type UpdateTopicResponseSuccess = Pick<Topic, 'id'>;
|
|
1508
|
-
interface UpdateTopicResponse {
|
|
1509
|
-
data: UpdateTopicResponseSuccess | null;
|
|
1510
|
-
error: ErrorResponse | null;
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
declare class Topics {
|
|
1514
|
-
private readonly resend;
|
|
1515
|
-
constructor(resend: Resend);
|
|
1516
|
-
create(payload: CreateTopicOptions): Promise<CreateTopicResponse>;
|
|
1517
|
-
list(): Promise<ListTopicsResponse>;
|
|
1518
|
-
get(id: string): Promise<GetTopicResponse>;
|
|
1519
|
-
update(payload: UpdateTopicOptions): Promise<UpdateTopicResponse>;
|
|
1520
|
-
remove(id: string): Promise<RemoveTopicResponse>;
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
type WebhookEvent = 'email.sent' | 'email.delivered' | 'email.delivery_delayed' | 'email.complained' | 'email.bounced' | 'email.opened' | 'email.clicked' | 'email.received' | 'email.failed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'domain.created' | 'domain.updated' | 'domain.deleted';
|
|
1524
|
-
|
|
1525
|
-
interface CreateWebhookOptions {
|
|
1526
|
-
endpoint: string;
|
|
1527
|
-
events: WebhookEvent[];
|
|
1528
|
-
}
|
|
1529
|
-
interface CreateWebhookRequestOptions extends PostOptions {
|
|
1530
|
-
}
|
|
1531
|
-
interface CreateWebhookResponseSuccess {
|
|
1532
|
-
object: 'webhook';
|
|
1533
|
-
id: string;
|
|
1534
|
-
signing_secret: string;
|
|
1535
|
-
}
|
|
1536
|
-
type CreateWebhookResponse = {
|
|
1537
|
-
data: CreateWebhookResponseSuccess;
|
|
1538
|
-
error: null;
|
|
1539
|
-
} | {
|
|
1540
|
-
data: null;
|
|
1541
|
-
error: ErrorResponse;
|
|
1542
|
-
};
|
|
1543
|
-
|
|
1544
|
-
interface GetWebhookResponseSuccess {
|
|
1545
|
-
object: 'webhook';
|
|
1546
|
-
id: string;
|
|
1547
|
-
created_at: string;
|
|
1548
|
-
status: 'enabled' | 'disabled';
|
|
1549
|
-
endpoint: string;
|
|
1550
|
-
events: WebhookEvent[] | null;
|
|
1551
|
-
signing_secret: string;
|
|
1552
|
-
}
|
|
1553
|
-
type GetWebhookResponse = {
|
|
1554
|
-
data: GetWebhookResponseSuccess;
|
|
1555
|
-
error: null;
|
|
1556
|
-
} | {
|
|
1557
|
-
data: null;
|
|
1558
|
-
error: ErrorResponse;
|
|
1559
|
-
};
|
|
1560
|
-
|
|
1561
|
-
type ListWebhooksOptions = PaginationOptions;
|
|
1562
|
-
interface Webhook {
|
|
1563
|
-
id: string;
|
|
1564
|
-
endpoint: string;
|
|
1565
|
-
created_at: string;
|
|
1566
|
-
status: 'enabled' | 'disabled';
|
|
1567
|
-
events: WebhookEvent[] | null;
|
|
1568
|
-
}
|
|
1569
|
-
type ListWebhooksResponseSuccess = {
|
|
1570
|
-
object: 'list';
|
|
1571
|
-
has_more: boolean;
|
|
1572
|
-
data: Webhook[];
|
|
1573
|
-
};
|
|
1574
|
-
type ListWebhooksResponse = {
|
|
1575
|
-
data: ListWebhooksResponseSuccess;
|
|
1576
|
-
error: null;
|
|
1577
|
-
} | {
|
|
1578
|
-
data: null;
|
|
1579
|
-
error: ErrorResponse;
|
|
1580
|
-
};
|
|
1581
|
-
|
|
1582
|
-
type RemoveWebhookResponseSuccess = Pick<Webhook, 'id'> & {
|
|
1583
|
-
object: 'webhook';
|
|
1584
|
-
deleted: boolean;
|
|
1585
|
-
};
|
|
1586
|
-
type RemoveWebhookResponse = {
|
|
1587
|
-
data: RemoveWebhookResponseSuccess;
|
|
1588
|
-
error: null;
|
|
1589
|
-
} | {
|
|
1590
|
-
data: null;
|
|
1591
|
-
error: ErrorResponse;
|
|
1592
|
-
};
|
|
1593
|
-
|
|
1594
|
-
interface UpdateWebhookOptions {
|
|
1595
|
-
endpoint?: string;
|
|
1596
|
-
events?: WebhookEvent[];
|
|
1597
|
-
status?: 'enabled' | 'disabled';
|
|
1598
|
-
}
|
|
1599
|
-
interface UpdateWebhookResponseSuccess {
|
|
1600
|
-
object: 'webhook';
|
|
1601
|
-
id: string;
|
|
1602
|
-
}
|
|
1603
|
-
type UpdateWebhookResponse = {
|
|
1604
|
-
data: UpdateWebhookResponseSuccess;
|
|
1605
|
-
error: null;
|
|
1606
|
-
} | {
|
|
1607
|
-
data: null;
|
|
1608
|
-
error: ErrorResponse;
|
|
1609
|
-
};
|
|
1610
|
-
|
|
1611
1025
|
interface Headers {
|
|
1612
1026
|
id: string;
|
|
1613
1027
|
timestamp: string;
|
|
@@ -1633,21 +1047,13 @@ declare class Resend {
|
|
|
1633
1047
|
readonly key?: string | undefined;
|
|
1634
1048
|
private readonly headers;
|
|
1635
1049
|
readonly apiKeys: ApiKeys;
|
|
1636
|
-
readonly
|
|
1637
|
-
readonly segments: Segments;
|
|
1638
|
-
/**
|
|
1639
|
-
* @deprecated Use segments instead
|
|
1640
|
-
*/
|
|
1641
|
-
readonly audiences: Segments;
|
|
1050
|
+
readonly audiences: Audiences;
|
|
1642
1051
|
readonly batch: Batch;
|
|
1643
1052
|
readonly broadcasts: Broadcasts;
|
|
1644
1053
|
readonly contacts: Contacts;
|
|
1645
|
-
readonly contactProperties: ContactProperties;
|
|
1646
1054
|
readonly domains: Domains;
|
|
1647
1055
|
readonly emails: Emails;
|
|
1648
1056
|
readonly webhooks: Webhooks;
|
|
1649
|
-
readonly templates: Templates;
|
|
1650
|
-
readonly topics: Topics;
|
|
1651
1057
|
constructor(key?: string | undefined);
|
|
1652
1058
|
fetchRequest<T>(path: string, options?: {}): Promise<{
|
|
1653
1059
|
data: T;
|
|
@@ -1693,4 +1099,4 @@ declare class Resend {
|
|
|
1693
1099
|
}>;
|
|
1694
1100
|
}
|
|
1695
1101
|
|
|
1696
|
-
export { type ApiKey, type Attachment, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, 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
|
|
1102
|
+
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 CreateWebhookOptions, type CreateWebhookRequestOptions, type CreateWebhookResponse, type CreateWebhookResponseSuccess, 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 GetWebhookResponse, type GetWebhookResponseSuccess, type IdempotentRequest, type List, 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 ListWebhooksOptions, type ListWebhooksResponse, type ListWebhooksResponseSuccess, 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 RemoveWebhookResponse, type RemoveWebhookResponseSuccess, 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 UpdateWebhookOptions, type UpdateWebhookResponse, type UpdateWebhookResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess, type Webhook, type WebhookEvent };
|