resend 6.3.0 → 6.4.0-canary.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 +788 -199
- package/dist/index.d.ts +788 -199
- package/dist/index.js +582 -39
- package/dist/index.mjs +582 -39
- 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: {
|
|
@@ -50,9 +51,9 @@ interface EmailApiAttachment {
|
|
|
50
51
|
content_id?: string;
|
|
51
52
|
}
|
|
52
53
|
interface EmailApiOptions {
|
|
53
|
-
from
|
|
54
|
+
from?: string;
|
|
54
55
|
to: string | string[];
|
|
55
|
-
subject
|
|
56
|
+
subject?: string;
|
|
56
57
|
region?: string;
|
|
57
58
|
headers?: Record<string, string>;
|
|
58
59
|
html?: string;
|
|
@@ -60,9 +61,14 @@ interface EmailApiOptions {
|
|
|
60
61
|
bcc?: string | string[];
|
|
61
62
|
cc?: string | string[];
|
|
62
63
|
reply_to?: string | string[];
|
|
64
|
+
topic_id?: string | null;
|
|
63
65
|
scheduled_at?: string;
|
|
64
66
|
tags?: Tag$1[];
|
|
65
67
|
attachments?: EmailApiAttachment[];
|
|
68
|
+
template?: {
|
|
69
|
+
id: string;
|
|
70
|
+
variables?: Record<string, string | number | boolean>;
|
|
71
|
+
};
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
interface GetOptions {
|
|
@@ -79,11 +85,6 @@ interface IdempotentRequest {
|
|
|
79
85
|
idempotencyKey?: string;
|
|
80
86
|
}
|
|
81
87
|
|
|
82
|
-
interface List<T> {
|
|
83
|
-
readonly object: 'list';
|
|
84
|
-
data: T[];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
88
|
type PaginationOptions = {
|
|
88
89
|
/**
|
|
89
90
|
* Maximum number of items to return (1-100, default: 20)
|
|
@@ -102,6 +103,11 @@ type PaginationOptions = {
|
|
|
102
103
|
before?: string;
|
|
103
104
|
after?: never;
|
|
104
105
|
});
|
|
106
|
+
type PaginatedData<Data> = {
|
|
107
|
+
object: 'list';
|
|
108
|
+
data: Data;
|
|
109
|
+
has_more: boolean;
|
|
110
|
+
};
|
|
105
111
|
|
|
106
112
|
interface PatchOptions {
|
|
107
113
|
query?: {
|
|
@@ -170,65 +176,6 @@ type RemoveApiKeyResponse = {
|
|
|
170
176
|
error: ErrorResponse;
|
|
171
177
|
};
|
|
172
178
|
|
|
173
|
-
interface Audience {
|
|
174
|
-
created_at: string;
|
|
175
|
-
id: string;
|
|
176
|
-
name: string;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
interface CreateAudienceOptions {
|
|
180
|
-
name: string;
|
|
181
|
-
}
|
|
182
|
-
interface CreateAudienceRequestOptions extends PostOptions {
|
|
183
|
-
}
|
|
184
|
-
interface CreateAudienceResponseSuccess extends Pick<Audience, 'name' | 'id'> {
|
|
185
|
-
object: 'audience';
|
|
186
|
-
}
|
|
187
|
-
type CreateAudienceResponse = {
|
|
188
|
-
data: CreateAudienceResponseSuccess;
|
|
189
|
-
error: null;
|
|
190
|
-
} | {
|
|
191
|
-
data: null;
|
|
192
|
-
error: ErrorResponse;
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
interface GetAudienceResponseSuccess extends Pick<Audience, 'id' | 'name' | 'created_at'> {
|
|
196
|
-
object: 'audience';
|
|
197
|
-
}
|
|
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 = {
|
|
208
|
-
object: 'list';
|
|
209
|
-
data: Audience[];
|
|
210
|
-
has_more: boolean;
|
|
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;
|
|
223
|
-
}
|
|
224
|
-
type RemoveAudiencesResponse = {
|
|
225
|
-
data: RemoveAudiencesResponseSuccess;
|
|
226
|
-
error: null;
|
|
227
|
-
} | {
|
|
228
|
-
data: null;
|
|
229
|
-
error: ErrorResponse;
|
|
230
|
-
};
|
|
231
|
-
|
|
232
179
|
interface EmailRenderOptions$1 {
|
|
233
180
|
/**
|
|
234
181
|
* The React component used to write the message.
|
|
@@ -249,13 +196,23 @@ interface EmailRenderOptions$1 {
|
|
|
249
196
|
*/
|
|
250
197
|
text: string;
|
|
251
198
|
}
|
|
199
|
+
interface EmailTemplateOptions {
|
|
200
|
+
template: {
|
|
201
|
+
id: string;
|
|
202
|
+
variables?: Record<string, string | number | boolean>;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
interface CreateEmailBaseOptionsWithTemplate extends Omit<CreateEmailBaseOptions, 'from' | 'subject'> {
|
|
206
|
+
from?: string;
|
|
207
|
+
subject?: string;
|
|
208
|
+
}
|
|
252
209
|
interface CreateEmailBaseOptions {
|
|
253
210
|
/**
|
|
254
211
|
* Filename and content of attachments (max 40mb per email)
|
|
255
212
|
*
|
|
256
213
|
* @link https://resend.com/docs/api-reference/emails/send-email#body-parameters
|
|
257
214
|
*/
|
|
258
|
-
attachments?: Attachment[];
|
|
215
|
+
attachments?: Attachment$1[];
|
|
259
216
|
/**
|
|
260
217
|
* Blind carbon copy recipient email address. For multiple addresses, send as an array of strings.
|
|
261
218
|
*
|
|
@@ -304,6 +261,12 @@ interface CreateEmailBaseOptions {
|
|
|
304
261
|
* @link https://resend.com/docs/api-reference/emails/send-email#body-parameters
|
|
305
262
|
*/
|
|
306
263
|
to: string | string[];
|
|
264
|
+
/**
|
|
265
|
+
* The id of the topic you want to send to
|
|
266
|
+
*
|
|
267
|
+
* @link https://resend.com/docs/api-reference/emails/send-email#body-parameters
|
|
268
|
+
*/
|
|
269
|
+
topicId?: string | null;
|
|
307
270
|
/**
|
|
308
271
|
* Schedule email to be sent later.
|
|
309
272
|
* The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z).
|
|
@@ -312,7 +275,13 @@ interface CreateEmailBaseOptions {
|
|
|
312
275
|
*/
|
|
313
276
|
scheduledAt?: string;
|
|
314
277
|
}
|
|
315
|
-
type CreateEmailOptions = RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions
|
|
278
|
+
type CreateEmailOptions = ((RequireAtLeastOne<EmailRenderOptions$1> & CreateEmailBaseOptions) & {
|
|
279
|
+
template?: never;
|
|
280
|
+
}) | ((EmailTemplateOptions & CreateEmailBaseOptionsWithTemplate) & {
|
|
281
|
+
react?: never;
|
|
282
|
+
html?: never;
|
|
283
|
+
text?: never;
|
|
284
|
+
});
|
|
316
285
|
interface CreateEmailRequestOptions extends PostOptions, IdempotentRequest {
|
|
317
286
|
}
|
|
318
287
|
interface CreateEmailResponseSuccess {
|
|
@@ -326,7 +295,7 @@ type CreateEmailResponse = {
|
|
|
326
295
|
data: null;
|
|
327
296
|
error: ErrorResponse;
|
|
328
297
|
};
|
|
329
|
-
interface Attachment {
|
|
298
|
+
interface Attachment$1 {
|
|
330
299
|
/** Content of an attached file. */
|
|
331
300
|
content?: string | Buffer;
|
|
332
301
|
/** Name of attached file. */
|
|
@@ -390,6 +359,7 @@ type CreateBatchResponse<Options extends CreateBatchRequestOptions> = {
|
|
|
390
359
|
interface Broadcast {
|
|
391
360
|
id: string;
|
|
392
361
|
name: string;
|
|
362
|
+
segment_id: string | null;
|
|
393
363
|
audience_id: string | null;
|
|
394
364
|
from: string | null;
|
|
395
365
|
subject: string | null;
|
|
@@ -399,6 +369,7 @@ interface Broadcast {
|
|
|
399
369
|
created_at: string;
|
|
400
370
|
scheduled_at: string | null;
|
|
401
371
|
sent_at: string | null;
|
|
372
|
+
topic_id?: string | null;
|
|
402
373
|
html: string | null;
|
|
403
374
|
text: string | null;
|
|
404
375
|
}
|
|
@@ -423,19 +394,25 @@ interface EmailRenderOptions {
|
|
|
423
394
|
*/
|
|
424
395
|
text: string;
|
|
425
396
|
}
|
|
426
|
-
interface
|
|
397
|
+
interface SegmentOptions {
|
|
427
398
|
/**
|
|
428
|
-
* The
|
|
399
|
+
* The id of the segment you want to send to
|
|
429
400
|
*
|
|
430
401
|
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
431
402
|
*/
|
|
432
|
-
|
|
403
|
+
segmentId: string;
|
|
404
|
+
/**
|
|
405
|
+
* @deprecated Use segmentId instead
|
|
406
|
+
*/
|
|
407
|
+
audienceId: string;
|
|
408
|
+
}
|
|
409
|
+
interface CreateBroadcastBaseOptions {
|
|
433
410
|
/**
|
|
434
|
-
* The
|
|
411
|
+
* The name of the broadcast
|
|
435
412
|
*
|
|
436
413
|
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
437
414
|
*/
|
|
438
|
-
|
|
415
|
+
name?: string;
|
|
439
416
|
/**
|
|
440
417
|
* A short snippet of text displayed as a preview in recipients' inboxes, often shown below or beside the subject line.
|
|
441
418
|
*
|
|
@@ -460,8 +437,14 @@ interface CreateBroadcastBaseOptions {
|
|
|
460
437
|
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
461
438
|
*/
|
|
462
439
|
subject: string;
|
|
440
|
+
/**
|
|
441
|
+
* The id of the topic you want to send to
|
|
442
|
+
*
|
|
443
|
+
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
444
|
+
*/
|
|
445
|
+
topicId?: string | null;
|
|
463
446
|
}
|
|
464
|
-
type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> & CreateBroadcastBaseOptions;
|
|
447
|
+
type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> & RequireAtLeastOne<SegmentOptions> & CreateBroadcastBaseOptions;
|
|
465
448
|
interface CreateBroadcastRequestOptions extends PostOptions {
|
|
466
449
|
}
|
|
467
450
|
interface CreateBroadcastResponseSuccess {
|
|
@@ -491,7 +474,7 @@ type ListBroadcastsOptions = PaginationOptions;
|
|
|
491
474
|
type ListBroadcastsResponseSuccess = {
|
|
492
475
|
object: 'list';
|
|
493
476
|
has_more: boolean;
|
|
494
|
-
data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
|
|
477
|
+
data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'segment_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
|
|
495
478
|
};
|
|
496
479
|
type ListBroadcastsResponse = {
|
|
497
480
|
data: ListBroadcastsResponseSuccess;
|
|
@@ -543,6 +526,10 @@ interface UpdateBroadcastResponseSuccess {
|
|
|
543
526
|
}
|
|
544
527
|
type UpdateBroadcastOptions = {
|
|
545
528
|
name?: string;
|
|
529
|
+
segmentId?: string;
|
|
530
|
+
/**
|
|
531
|
+
* @deprecated Use segmentId instead
|
|
532
|
+
*/
|
|
546
533
|
audienceId?: string;
|
|
547
534
|
from?: string;
|
|
548
535
|
html?: string;
|
|
@@ -551,6 +538,7 @@ type UpdateBroadcastOptions = {
|
|
|
551
538
|
subject?: string;
|
|
552
539
|
replyTo?: string[];
|
|
553
540
|
previewText?: string;
|
|
541
|
+
topicId?: string | null;
|
|
554
542
|
};
|
|
555
543
|
type UpdateBroadcastResponse = {
|
|
556
544
|
data: UpdateBroadcastResponseSuccess;
|
|
@@ -597,7 +585,7 @@ type SelectingField = {
|
|
|
597
585
|
};
|
|
598
586
|
|
|
599
587
|
interface CreateContactOptions {
|
|
600
|
-
audienceId
|
|
588
|
+
audienceId?: string;
|
|
601
589
|
email: string;
|
|
602
590
|
unsubscribed?: boolean;
|
|
603
591
|
firstName?: string;
|
|
@@ -616,9 +604,9 @@ type CreateContactResponse = {
|
|
|
616
604
|
error: ErrorResponse;
|
|
617
605
|
};
|
|
618
606
|
|
|
619
|
-
type GetContactOptions = {
|
|
620
|
-
audienceId
|
|
621
|
-
} & SelectingField;
|
|
607
|
+
type GetContactOptions = string | ({
|
|
608
|
+
audienceId?: string;
|
|
609
|
+
} & SelectingField);
|
|
622
610
|
interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'email' | 'created_at' | 'first_name' | 'last_name' | 'unsubscribed'> {
|
|
623
611
|
object: 'contact';
|
|
624
612
|
}
|
|
@@ -630,9 +618,12 @@ type GetContactResponse = {
|
|
|
630
618
|
error: ErrorResponse;
|
|
631
619
|
};
|
|
632
620
|
|
|
633
|
-
type
|
|
621
|
+
type ListAudienceContactsOptions = {
|
|
634
622
|
audienceId: string;
|
|
635
623
|
} & PaginationOptions;
|
|
624
|
+
type ListContactsOptions = PaginationOptions & {
|
|
625
|
+
audienceId?: string;
|
|
626
|
+
};
|
|
636
627
|
interface ListContactsResponseSuccess {
|
|
637
628
|
object: 'list';
|
|
638
629
|
data: Contact[];
|
|
@@ -651,9 +642,9 @@ type RemoveContactsResponseSuccess = {
|
|
|
651
642
|
deleted: boolean;
|
|
652
643
|
contact: string;
|
|
653
644
|
};
|
|
654
|
-
type RemoveContactOptions = SelectingField & {
|
|
655
|
-
audienceId
|
|
656
|
-
};
|
|
645
|
+
type RemoveContactOptions = string | (SelectingField & {
|
|
646
|
+
audienceId?: string;
|
|
647
|
+
});
|
|
657
648
|
type RemoveContactsResponse = {
|
|
658
649
|
data: RemoveContactsResponseSuccess;
|
|
659
650
|
error: null;
|
|
@@ -663,7 +654,7 @@ type RemoveContactsResponse = {
|
|
|
663
654
|
};
|
|
664
655
|
|
|
665
656
|
type UpdateContactOptions = {
|
|
666
|
-
audienceId
|
|
657
|
+
audienceId?: string;
|
|
667
658
|
unsubscribed?: boolean;
|
|
668
659
|
firstName?: string;
|
|
669
660
|
lastName?: string;
|
|
@@ -682,7 +673,7 @@ type UpdateContactResponse = {
|
|
|
682
673
|
type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1';
|
|
683
674
|
type DomainNameservers = 'Amazon Route 53' | 'Cloudflare' | 'Digital Ocean' | 'GoDaddy' | 'Google Domains' | 'Namecheap' | 'Unidentified' | 'Vercel';
|
|
684
675
|
type DomainStatus = 'pending' | 'verified' | 'failed' | 'temporary_failure' | 'not_started';
|
|
685
|
-
type DomainRecords = DomainSpfRecord | DomainDkimRecord;
|
|
676
|
+
type DomainRecords = DomainSpfRecord | DomainDkimRecord | ReceivingRecord;
|
|
686
677
|
interface DomainSpfRecord {
|
|
687
678
|
record: 'SPF';
|
|
688
679
|
name: string;
|
|
@@ -705,22 +696,33 @@ interface DomainDkimRecord {
|
|
|
705
696
|
priority?: number;
|
|
706
697
|
proxy_status?: 'enable' | 'disable';
|
|
707
698
|
}
|
|
699
|
+
interface ReceivingRecord {
|
|
700
|
+
record: 'Receiving';
|
|
701
|
+
name: string;
|
|
702
|
+
value: string;
|
|
703
|
+
type: 'MX';
|
|
704
|
+
ttl: string;
|
|
705
|
+
status: DomainStatus;
|
|
706
|
+
priority: number;
|
|
707
|
+
}
|
|
708
708
|
interface Domain {
|
|
709
709
|
id: string;
|
|
710
710
|
name: string;
|
|
711
711
|
status: DomainStatus;
|
|
712
712
|
created_at: string;
|
|
713
713
|
region: DomainRegion;
|
|
714
|
+
capability: 'send' | 'receive' | 'send-and-receive';
|
|
714
715
|
}
|
|
715
716
|
|
|
716
717
|
interface CreateDomainOptions {
|
|
717
718
|
name: string;
|
|
718
719
|
region?: DomainRegion;
|
|
719
720
|
customReturnPath?: string;
|
|
721
|
+
capability?: 'send' | 'receive' | 'send-and-receive';
|
|
720
722
|
}
|
|
721
723
|
interface CreateDomainRequestOptions extends PostOptions {
|
|
722
724
|
}
|
|
723
|
-
interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> {
|
|
725
|
+
interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region' | 'capability'> {
|
|
724
726
|
records: DomainRecords[];
|
|
725
727
|
}
|
|
726
728
|
type CreateDomainResponse = {
|
|
@@ -731,7 +733,7 @@ type CreateDomainResponse = {
|
|
|
731
733
|
error: ErrorResponse;
|
|
732
734
|
};
|
|
733
735
|
|
|
734
|
-
interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> {
|
|
736
|
+
interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status' | 'capability'> {
|
|
735
737
|
object: 'domain';
|
|
736
738
|
records: DomainRecords[];
|
|
737
739
|
}
|
|
@@ -797,6 +799,53 @@ type VerifyDomainsResponse = {
|
|
|
797
799
|
error: ErrorResponse;
|
|
798
800
|
};
|
|
799
801
|
|
|
802
|
+
interface Attachment {
|
|
803
|
+
id: string;
|
|
804
|
+
filename?: string;
|
|
805
|
+
size: number;
|
|
806
|
+
content_type: string;
|
|
807
|
+
content_disposition: 'inline' | 'attachment';
|
|
808
|
+
content_id?: string;
|
|
809
|
+
download_url: string;
|
|
810
|
+
expires_at: string;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
interface GetAttachmentOptions {
|
|
814
|
+
emailId: string;
|
|
815
|
+
id: string;
|
|
816
|
+
}
|
|
817
|
+
type GetAttachmentResponseSuccess = {
|
|
818
|
+
object: 'attachment';
|
|
819
|
+
} & Attachment;
|
|
820
|
+
type GetAttachmentResponse = {
|
|
821
|
+
data: GetAttachmentResponseSuccess;
|
|
822
|
+
error: null;
|
|
823
|
+
} | {
|
|
824
|
+
data: null;
|
|
825
|
+
error: ErrorResponse;
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
type ListAttachmentsOptions = PaginationOptions & {
|
|
829
|
+
emailId: string;
|
|
830
|
+
};
|
|
831
|
+
interface ListAttachmentsApiResponse {
|
|
832
|
+
object: 'list';
|
|
833
|
+
has_more: boolean;
|
|
834
|
+
data: Attachment[];
|
|
835
|
+
}
|
|
836
|
+
interface ListAttachmentsResponseSuccess {
|
|
837
|
+
object: 'list';
|
|
838
|
+
has_more: boolean;
|
|
839
|
+
data: Attachment[];
|
|
840
|
+
}
|
|
841
|
+
type ListAttachmentsResponse = {
|
|
842
|
+
data: ListAttachmentsResponseSuccess;
|
|
843
|
+
error: null;
|
|
844
|
+
} | {
|
|
845
|
+
data: null;
|
|
846
|
+
error: ErrorResponse;
|
|
847
|
+
};
|
|
848
|
+
|
|
800
849
|
interface CancelEmailResponseSuccess {
|
|
801
850
|
object: 'email';
|
|
802
851
|
id: string;
|
|
@@ -825,6 +874,7 @@ interface GetEmailResponseSuccess {
|
|
|
825
874
|
value: string;
|
|
826
875
|
}[];
|
|
827
876
|
to: string[];
|
|
877
|
+
topic_id?: string | null;
|
|
828
878
|
scheduled_at: string | null;
|
|
829
879
|
object: 'email';
|
|
830
880
|
}
|
|
@@ -852,88 +902,46 @@ type UpdateEmailResponse = {
|
|
|
852
902
|
error: ErrorResponse;
|
|
853
903
|
};
|
|
854
904
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
interface CreateWebhookOptions {
|
|
858
|
-
endpoint: string;
|
|
859
|
-
events: WebhookEvent[];
|
|
860
|
-
}
|
|
861
|
-
interface CreateWebhookRequestOptions extends PostOptions {
|
|
862
|
-
}
|
|
863
|
-
interface CreateWebhookResponseSuccess {
|
|
864
|
-
object: 'webhook';
|
|
865
|
-
id: string;
|
|
866
|
-
signing_secret: string;
|
|
867
|
-
}
|
|
868
|
-
type CreateWebhookResponse = {
|
|
869
|
-
data: CreateWebhookResponseSuccess;
|
|
870
|
-
error: null;
|
|
871
|
-
} | {
|
|
872
|
-
data: null;
|
|
873
|
-
error: ErrorResponse;
|
|
874
|
-
};
|
|
875
|
-
|
|
876
|
-
interface GetWebhookResponseSuccess {
|
|
877
|
-
object: 'webhook';
|
|
905
|
+
interface GetReceivingEmailResponseSuccess {
|
|
906
|
+
object: 'email';
|
|
878
907
|
id: string;
|
|
908
|
+
to: string[];
|
|
909
|
+
from: string;
|
|
879
910
|
created_at: string;
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
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
|
+
}>;
|
|
884
927
|
}
|
|
885
|
-
type
|
|
886
|
-
data:
|
|
928
|
+
type GetReceivingEmailResponse = {
|
|
929
|
+
data: GetReceivingEmailResponseSuccess;
|
|
887
930
|
error: null;
|
|
888
931
|
} | {
|
|
889
932
|
data: null;
|
|
890
933
|
error: ErrorResponse;
|
|
891
934
|
};
|
|
892
935
|
|
|
893
|
-
type
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
endpoint: string;
|
|
897
|
-
created_at: string;
|
|
898
|
-
status: 'enabled' | 'disabled';
|
|
899
|
-
events: WebhookEvent[] | null;
|
|
900
|
-
}
|
|
901
|
-
type ListWebhooksResponseSuccess = {
|
|
936
|
+
type ListReceivingEmailsOptions = PaginationOptions;
|
|
937
|
+
type ListReceivingEmail = Omit<GetReceivingEmailResponseSuccess, 'html' | 'text' | 'headers' | 'object'>;
|
|
938
|
+
interface ListReceivingEmailsResponseSuccess {
|
|
902
939
|
object: 'list';
|
|
903
940
|
has_more: boolean;
|
|
904
|
-
data:
|
|
905
|
-
};
|
|
906
|
-
type ListWebhooksResponse = {
|
|
907
|
-
data: ListWebhooksResponseSuccess;
|
|
908
|
-
error: null;
|
|
909
|
-
} | {
|
|
910
|
-
data: null;
|
|
911
|
-
error: ErrorResponse;
|
|
912
|
-
};
|
|
913
|
-
|
|
914
|
-
type RemoveWebhookResponseSuccess = Pick<Webhook, 'id'> & {
|
|
915
|
-
object: 'webhook';
|
|
916
|
-
deleted: boolean;
|
|
917
|
-
};
|
|
918
|
-
type RemoveWebhookResponse = {
|
|
919
|
-
data: RemoveWebhookResponseSuccess;
|
|
920
|
-
error: null;
|
|
921
|
-
} | {
|
|
922
|
-
data: null;
|
|
923
|
-
error: ErrorResponse;
|
|
924
|
-
};
|
|
925
|
-
|
|
926
|
-
interface UpdateWebhookOptions {
|
|
927
|
-
endpoint?: string;
|
|
928
|
-
events?: WebhookEvent[];
|
|
929
|
-
status?: 'enabled' | 'disabled';
|
|
930
|
-
}
|
|
931
|
-
interface UpdateWebhookResponseSuccess {
|
|
932
|
-
object: 'webhook';
|
|
933
|
-
id: string;
|
|
941
|
+
data: ListReceivingEmail[];
|
|
934
942
|
}
|
|
935
|
-
type
|
|
936
|
-
data:
|
|
943
|
+
type ListReceivingEmailsResponse = {
|
|
944
|
+
data: ListReceivingEmailsResponseSuccess;
|
|
937
945
|
error: null;
|
|
938
946
|
} | {
|
|
939
947
|
data: null;
|
|
@@ -948,15 +956,6 @@ declare class ApiKeys {
|
|
|
948
956
|
remove(id: string): Promise<RemoveApiKeyResponse>;
|
|
949
957
|
}
|
|
950
958
|
|
|
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>;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
959
|
declare class Batch {
|
|
961
960
|
private readonly resend;
|
|
962
961
|
constructor(resend: Resend);
|
|
@@ -975,53 +974,636 @@ declare class Broadcasts {
|
|
|
975
974
|
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
976
975
|
}
|
|
977
976
|
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
977
|
+
type StringBaseContactProperty = {
|
|
978
|
+
type: 'string';
|
|
979
|
+
fallbackValue: string | null;
|
|
980
|
+
};
|
|
981
|
+
type NumberBaseContactProperty = {
|
|
982
|
+
type: 'number';
|
|
983
|
+
fallbackValue: number | null;
|
|
984
|
+
};
|
|
985
|
+
type ContactProperty = {
|
|
986
|
+
id: string;
|
|
987
|
+
object: 'contact_property';
|
|
988
|
+
createdAt: string;
|
|
989
|
+
key: string;
|
|
990
|
+
} & (StringBaseContactProperty | NumberBaseContactProperty);
|
|
991
|
+
|
|
992
|
+
type StringBaseContactPropertyOptions = {
|
|
993
|
+
type: 'string';
|
|
994
|
+
fallbackValue?: string | null;
|
|
995
|
+
};
|
|
996
|
+
type NumberBaseContactPropertyOptions = {
|
|
997
|
+
type: 'number';
|
|
998
|
+
fallbackValue?: number | null;
|
|
999
|
+
};
|
|
1000
|
+
type CreateContactPropertyOptions = {
|
|
1001
|
+
key: string;
|
|
1002
|
+
} & (StringBaseContactPropertyOptions | NumberBaseContactPropertyOptions);
|
|
1003
|
+
type CreateContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'>;
|
|
1004
|
+
interface CreateContactPropertyResponse {
|
|
1005
|
+
data: CreateContactPropertyResponseSuccess | null;
|
|
1006
|
+
error: ErrorResponse | null;
|
|
986
1007
|
}
|
|
987
1008
|
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
update(payload: UpdateDomainsOptions): Promise<UpdateDomainsResponse>;
|
|
995
|
-
remove(id: string): Promise<RemoveDomainsResponse>;
|
|
996
|
-
verify(id: string): Promise<VerifyDomainsResponse>;
|
|
1009
|
+
type RemoveContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'> & {
|
|
1010
|
+
deleted: boolean;
|
|
1011
|
+
};
|
|
1012
|
+
interface RemoveContactPropertyResponse {
|
|
1013
|
+
data: RemoveContactPropertyResponseSuccess | null;
|
|
1014
|
+
error: ErrorResponse | null;
|
|
997
1015
|
}
|
|
998
1016
|
|
|
999
|
-
type
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1017
|
+
type GetContactPropertyResponse = {
|
|
1018
|
+
data: ContactProperty;
|
|
1019
|
+
error: null;
|
|
1020
|
+
} | {
|
|
1021
|
+
data: null;
|
|
1022
|
+
error: ErrorResponse;
|
|
1005
1023
|
};
|
|
1006
|
-
|
|
1007
|
-
|
|
1024
|
+
|
|
1025
|
+
type ListContactPropertiesOptions = PaginationOptions;
|
|
1026
|
+
type ListContactPropertiesResponse = {
|
|
1027
|
+
data: {
|
|
1028
|
+
object: 'list';
|
|
1029
|
+
has_more: boolean;
|
|
1030
|
+
data: ContactProperty[];
|
|
1031
|
+
};
|
|
1008
1032
|
error: null;
|
|
1009
1033
|
} | {
|
|
1010
1034
|
data: null;
|
|
1011
1035
|
error: ErrorResponse;
|
|
1012
1036
|
};
|
|
1013
1037
|
|
|
1014
|
-
|
|
1038
|
+
type UpdateContactPropertyOptions = {
|
|
1039
|
+
id: string;
|
|
1040
|
+
fallbackValue?: string | number | null;
|
|
1041
|
+
};
|
|
1042
|
+
type UpdateContactPropertyResponseSuccess = Pick<ContactProperty, 'id' | 'object'>;
|
|
1043
|
+
interface UpdateContactPropertyResponse {
|
|
1044
|
+
data: UpdateContactPropertyResponseSuccess | null;
|
|
1045
|
+
error: ErrorResponse | null;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
declare class ContactProperties {
|
|
1015
1049
|
private readonly resend;
|
|
1016
1050
|
constructor(resend: Resend);
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
get(id: string): Promise<
|
|
1020
|
-
|
|
1051
|
+
create(options: CreateContactPropertyOptions): Promise<CreateContactPropertyResponse>;
|
|
1052
|
+
list(options?: ListContactPropertiesOptions): Promise<ListContactPropertiesResponse>;
|
|
1053
|
+
get(id: string): Promise<GetContactPropertyResponse>;
|
|
1054
|
+
update(payload: UpdateContactPropertyOptions): Promise<UpdateContactPropertyResponse>;
|
|
1055
|
+
remove(id: string): Promise<RemoveContactPropertyResponse>;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
type ContactSegmentsBaseOptions = {
|
|
1059
|
+
contactId: string;
|
|
1060
|
+
email?: never;
|
|
1061
|
+
} | {
|
|
1062
|
+
contactId?: never;
|
|
1063
|
+
email: string;
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
type AddContactSegmentOptions = ContactSegmentsBaseOptions & {
|
|
1067
|
+
segmentId: string;
|
|
1068
|
+
};
|
|
1069
|
+
interface AddContactSegmentResponseSuccess {
|
|
1070
|
+
id: string;
|
|
1071
|
+
}
|
|
1072
|
+
type AddContactSegmentResponse = {
|
|
1073
|
+
data: AddContactSegmentResponseSuccess;
|
|
1074
|
+
error: null;
|
|
1075
|
+
} | {
|
|
1076
|
+
data: null;
|
|
1077
|
+
error: ErrorResponse;
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
interface Segment {
|
|
1081
|
+
created_at: string;
|
|
1082
|
+
id: string;
|
|
1083
|
+
name: string;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
type ListContactSegmentsOptions = PaginationOptions & ContactSegmentsBaseOptions;
|
|
1087
|
+
type ListContactSegmentsResponseSuccess = PaginatedData<Segment[]>;
|
|
1088
|
+
type ListContactSegmentsResponse = {
|
|
1089
|
+
data: ListContactSegmentsResponseSuccess;
|
|
1090
|
+
error: null;
|
|
1091
|
+
} | {
|
|
1092
|
+
data: null;
|
|
1093
|
+
error: ErrorResponse;
|
|
1094
|
+
};
|
|
1095
|
+
|
|
1096
|
+
type RemoveContactSegmentOptions = ContactSegmentsBaseOptions & {
|
|
1097
|
+
segmentId: string;
|
|
1098
|
+
};
|
|
1099
|
+
interface RemoveContactSegmentResponseSuccess {
|
|
1100
|
+
id: string;
|
|
1101
|
+
deleted: boolean;
|
|
1102
|
+
}
|
|
1103
|
+
type RemoveContactSegmentResponse = {
|
|
1104
|
+
data: RemoveContactSegmentResponseSuccess;
|
|
1105
|
+
error: null;
|
|
1106
|
+
} | {
|
|
1107
|
+
data: null;
|
|
1108
|
+
error: ErrorResponse;
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1111
|
+
declare class ContactSegments {
|
|
1112
|
+
private readonly resend;
|
|
1113
|
+
constructor(resend: Resend);
|
|
1114
|
+
list(options: ListContactSegmentsOptions): Promise<ListContactSegmentsResponse>;
|
|
1115
|
+
add(options: AddContactSegmentOptions): Promise<AddContactSegmentResponse>;
|
|
1116
|
+
remove(options: RemoveContactSegmentOptions): Promise<RemoveContactSegmentResponse>;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
interface ListContactTopicsBaseOptions {
|
|
1120
|
+
id?: string;
|
|
1121
|
+
email?: string;
|
|
1122
|
+
}
|
|
1123
|
+
type ListContactTopicsOptions = ListContactTopicsBaseOptions & PaginationOptions;
|
|
1124
|
+
interface ContactTopic {
|
|
1125
|
+
id: string;
|
|
1126
|
+
name: string;
|
|
1127
|
+
description: string | null;
|
|
1128
|
+
subscription: 'opt_in' | 'opt_out';
|
|
1129
|
+
}
|
|
1130
|
+
type ListContactTopicsResponseSuccess = PaginatedData<ContactTopic[]>;
|
|
1131
|
+
type ListContactTopicsResponse = {
|
|
1132
|
+
data: ListContactTopicsResponseSuccess;
|
|
1133
|
+
error: null;
|
|
1134
|
+
} | {
|
|
1135
|
+
data: null;
|
|
1136
|
+
error: ErrorResponse;
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1139
|
+
interface UpdateContactTopicsBaseOptions {
|
|
1140
|
+
id?: string;
|
|
1141
|
+
email?: string;
|
|
1142
|
+
}
|
|
1143
|
+
interface UpdateContactTopicsOptions extends UpdateContactTopicsBaseOptions {
|
|
1144
|
+
topics: {
|
|
1145
|
+
id: string;
|
|
1146
|
+
subscription: 'opt_in' | 'opt_out';
|
|
1147
|
+
}[];
|
|
1148
|
+
}
|
|
1149
|
+
interface UpdateContactTopicsResponseSuccess {
|
|
1150
|
+
id: string;
|
|
1151
|
+
}
|
|
1152
|
+
interface UpdateContactTopicsResponse {
|
|
1153
|
+
data: UpdateContactTopicsResponseSuccess | null;
|
|
1154
|
+
error: ErrorResponse | null;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
declare class ContactTopics {
|
|
1158
|
+
private readonly resend;
|
|
1159
|
+
constructor(resend: Resend);
|
|
1160
|
+
update(payload: UpdateContactTopicsOptions): Promise<UpdateContactTopicsResponse>;
|
|
1161
|
+
list(options: ListContactTopicsOptions): Promise<ListContactTopicsResponse>;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
declare class Contacts {
|
|
1165
|
+
private readonly resend;
|
|
1166
|
+
readonly topics: ContactTopics;
|
|
1167
|
+
readonly segments: ContactSegments;
|
|
1168
|
+
constructor(resend: Resend);
|
|
1169
|
+
create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
|
|
1170
|
+
list(options?: ListContactsOptions | ListAudienceContactsOptions): Promise<ListContactsResponse>;
|
|
1171
|
+
get(options: GetContactOptions): Promise<GetContactResponse>;
|
|
1172
|
+
update(options: UpdateContactOptions): Promise<UpdateContactResponse>;
|
|
1173
|
+
remove(payload: RemoveContactOptions): Promise<RemoveContactsResponse>;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
declare class Domains {
|
|
1177
|
+
private readonly resend;
|
|
1178
|
+
constructor(resend: Resend);
|
|
1179
|
+
create(payload: CreateDomainOptions, options?: CreateDomainRequestOptions): Promise<CreateDomainResponse>;
|
|
1180
|
+
list(options?: ListDomainsOptions): Promise<ListDomainsResponse>;
|
|
1181
|
+
get(id: string): Promise<GetDomainResponse>;
|
|
1182
|
+
update(payload: UpdateDomainsOptions): Promise<UpdateDomainsResponse>;
|
|
1183
|
+
remove(id: string): Promise<RemoveDomainsResponse>;
|
|
1184
|
+
verify(id: string): Promise<VerifyDomainsResponse>;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
declare class Attachments$1 {
|
|
1188
|
+
private readonly resend;
|
|
1189
|
+
constructor(resend: Resend);
|
|
1190
|
+
get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>;
|
|
1191
|
+
list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
type ListEmailsOptions = PaginationOptions;
|
|
1195
|
+
type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
|
|
1196
|
+
type ListEmailsResponseSuccess = {
|
|
1197
|
+
object: 'list';
|
|
1198
|
+
has_more: boolean;
|
|
1199
|
+
data: ListEmail[];
|
|
1200
|
+
};
|
|
1201
|
+
type ListEmailsResponse = {
|
|
1202
|
+
data: ListEmailsResponseSuccess;
|
|
1203
|
+
error: null;
|
|
1204
|
+
} | {
|
|
1205
|
+
data: null;
|
|
1206
|
+
error: ErrorResponse;
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
declare class Attachments {
|
|
1210
|
+
private readonly resend;
|
|
1211
|
+
constructor(resend: Resend);
|
|
1212
|
+
get(options: GetAttachmentOptions): Promise<GetAttachmentResponse>;
|
|
1213
|
+
list(options: ListAttachmentsOptions): Promise<ListAttachmentsResponse>;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
declare class Receiving {
|
|
1217
|
+
private readonly resend;
|
|
1218
|
+
readonly attachments: Attachments;
|
|
1219
|
+
constructor(resend: Resend);
|
|
1220
|
+
get(id: string): Promise<GetReceivingEmailResponse>;
|
|
1221
|
+
list(options?: ListReceivingEmailsOptions): Promise<ListReceivingEmailsResponse>;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
declare class Emails {
|
|
1225
|
+
private readonly resend;
|
|
1226
|
+
readonly attachments: Attachments$1;
|
|
1227
|
+
readonly receiving: Receiving;
|
|
1228
|
+
constructor(resend: Resend);
|
|
1229
|
+
send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
1230
|
+
create(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
1231
|
+
get(id: string): Promise<GetEmailResponse>;
|
|
1232
|
+
list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
|
|
1021
1233
|
update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
|
|
1022
1234
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1023
1235
|
}
|
|
1024
1236
|
|
|
1237
|
+
interface CreateSegmentOptions {
|
|
1238
|
+
name: string;
|
|
1239
|
+
}
|
|
1240
|
+
interface CreateSegmentRequestOptions extends PostOptions {
|
|
1241
|
+
}
|
|
1242
|
+
interface CreateSegmentResponseSuccess extends Pick<Segment, 'name' | 'id'> {
|
|
1243
|
+
object: 'segment';
|
|
1244
|
+
}
|
|
1245
|
+
type CreateSegmentResponse = {
|
|
1246
|
+
data: CreateSegmentResponseSuccess;
|
|
1247
|
+
error: null;
|
|
1248
|
+
} | {
|
|
1249
|
+
data: null;
|
|
1250
|
+
error: ErrorResponse;
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
interface GetSegmentResponseSuccess extends Pick<Segment, 'id' | 'name' | 'created_at'> {
|
|
1254
|
+
object: 'segment';
|
|
1255
|
+
}
|
|
1256
|
+
type GetSegmentResponse = {
|
|
1257
|
+
data: GetSegmentResponseSuccess;
|
|
1258
|
+
error: null;
|
|
1259
|
+
} | {
|
|
1260
|
+
data: null;
|
|
1261
|
+
error: ErrorResponse;
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1264
|
+
type ListSegmentsOptions = PaginationOptions;
|
|
1265
|
+
type ListSegmentsResponseSuccess = {
|
|
1266
|
+
object: 'list';
|
|
1267
|
+
data: Segment[];
|
|
1268
|
+
has_more: boolean;
|
|
1269
|
+
};
|
|
1270
|
+
type ListSegmentsResponse = {
|
|
1271
|
+
data: ListSegmentsResponseSuccess;
|
|
1272
|
+
error: null;
|
|
1273
|
+
} | {
|
|
1274
|
+
data: null;
|
|
1275
|
+
error: ErrorResponse;
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
interface RemoveSegmentResponseSuccess extends Pick<Segment, 'id'> {
|
|
1279
|
+
object: 'segment';
|
|
1280
|
+
deleted: boolean;
|
|
1281
|
+
}
|
|
1282
|
+
type RemoveSegmentResponse = {
|
|
1283
|
+
data: RemoveSegmentResponseSuccess;
|
|
1284
|
+
error: null;
|
|
1285
|
+
} | {
|
|
1286
|
+
data: null;
|
|
1287
|
+
error: ErrorResponse;
|
|
1288
|
+
};
|
|
1289
|
+
|
|
1290
|
+
declare class Segments {
|
|
1291
|
+
private readonly resend;
|
|
1292
|
+
constructor(resend: Resend);
|
|
1293
|
+
create(payload: CreateSegmentOptions, options?: CreateSegmentRequestOptions): Promise<CreateSegmentResponse>;
|
|
1294
|
+
list(options?: ListSegmentsOptions): Promise<ListSegmentsResponse>;
|
|
1295
|
+
get(id: string): Promise<GetSegmentResponse>;
|
|
1296
|
+
remove(id: string): Promise<RemoveSegmentResponse>;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
interface Template {
|
|
1300
|
+
id: string;
|
|
1301
|
+
name: string;
|
|
1302
|
+
subject: string | null;
|
|
1303
|
+
html: string;
|
|
1304
|
+
text: string | null;
|
|
1305
|
+
status: 'draft' | 'published';
|
|
1306
|
+
variables: TemplateVariable[] | null;
|
|
1307
|
+
alias: string | null;
|
|
1308
|
+
from: string | null;
|
|
1309
|
+
reply_to: string[] | null;
|
|
1310
|
+
published_at: string | null;
|
|
1311
|
+
created_at: string;
|
|
1312
|
+
updated_at: string;
|
|
1313
|
+
has_unpublished_versions: boolean;
|
|
1314
|
+
current_version_id: string;
|
|
1315
|
+
}
|
|
1316
|
+
interface TemplateVariable {
|
|
1317
|
+
key: string;
|
|
1318
|
+
fallback_value: string | number | null;
|
|
1319
|
+
type: 'string' | 'number';
|
|
1320
|
+
created_at: string;
|
|
1321
|
+
updated_at: string;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
type TemplateContentCreationOptions = RequireAtLeastOne<{
|
|
1325
|
+
html: string;
|
|
1326
|
+
react: React.ReactNode;
|
|
1327
|
+
}>;
|
|
1328
|
+
type TemplateVariableCreationOptions = Pick<TemplateVariable, 'key' | 'type'> & ({
|
|
1329
|
+
type: 'string';
|
|
1330
|
+
fallbackValue?: string | null;
|
|
1331
|
+
} | {
|
|
1332
|
+
type: 'number';
|
|
1333
|
+
fallbackValue?: number | null;
|
|
1334
|
+
});
|
|
1335
|
+
type TemplateOptionalFieldsForCreation = Partial<Pick<Template, 'subject' | 'text' | 'alias' | 'from'>> & {
|
|
1336
|
+
replyTo?: string[] | string;
|
|
1337
|
+
variables?: TemplateVariableCreationOptions[];
|
|
1338
|
+
};
|
|
1339
|
+
type CreateTemplateOptions = Pick<Template, 'name'> & TemplateOptionalFieldsForCreation & TemplateContentCreationOptions;
|
|
1340
|
+
interface CreateTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1341
|
+
object: 'template';
|
|
1342
|
+
}
|
|
1343
|
+
type CreateTemplateResponse = {
|
|
1344
|
+
data: CreateTemplateResponseSuccess;
|
|
1345
|
+
error: null;
|
|
1346
|
+
} | {
|
|
1347
|
+
data: null;
|
|
1348
|
+
error: ErrorResponse;
|
|
1349
|
+
};
|
|
1350
|
+
|
|
1351
|
+
interface DuplicateTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1352
|
+
object: 'template';
|
|
1353
|
+
}
|
|
1354
|
+
type DuplicateTemplateResponse = {
|
|
1355
|
+
data: DuplicateTemplateResponseSuccess;
|
|
1356
|
+
error: null;
|
|
1357
|
+
} | {
|
|
1358
|
+
data: null;
|
|
1359
|
+
error: ErrorResponse;
|
|
1360
|
+
};
|
|
1361
|
+
|
|
1362
|
+
interface PublishTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1363
|
+
object: 'template';
|
|
1364
|
+
}
|
|
1365
|
+
type PublishTemplateResponse = {
|
|
1366
|
+
data: PublishTemplateResponseSuccess;
|
|
1367
|
+
error: null;
|
|
1368
|
+
} | {
|
|
1369
|
+
data: null;
|
|
1370
|
+
error: ErrorResponse;
|
|
1371
|
+
};
|
|
1372
|
+
|
|
1373
|
+
declare class ChainableTemplateResult<T extends CreateTemplateResponse | DuplicateTemplateResponse> implements PromiseLike<T> {
|
|
1374
|
+
private readonly promise;
|
|
1375
|
+
private readonly publishFn;
|
|
1376
|
+
constructor(promise: Promise<T>, publishFn: (id: string) => Promise<PublishTemplateResponse>);
|
|
1377
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
1378
|
+
publish(): Promise<PublishTemplateResponse>;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
interface GetTemplateResponseSuccess extends Template {
|
|
1382
|
+
object: 'template';
|
|
1383
|
+
}
|
|
1384
|
+
type GetTemplateResponse = {
|
|
1385
|
+
data: GetTemplateResponseSuccess;
|
|
1386
|
+
error: null;
|
|
1387
|
+
} | {
|
|
1388
|
+
data: null;
|
|
1389
|
+
error: ErrorResponse;
|
|
1390
|
+
};
|
|
1391
|
+
|
|
1392
|
+
interface TemplateListItem extends Pick<Template, 'id' | 'name' | 'created_at' | 'updated_at' | 'status' | 'published_at' | 'alias'> {
|
|
1393
|
+
}
|
|
1394
|
+
interface ListTemplatesResponseSuccess {
|
|
1395
|
+
object: 'list';
|
|
1396
|
+
data: TemplateListItem[];
|
|
1397
|
+
has_more: boolean;
|
|
1398
|
+
}
|
|
1399
|
+
type ListTemplatesResponse = {
|
|
1400
|
+
data: ListTemplatesResponseSuccess;
|
|
1401
|
+
error: null;
|
|
1402
|
+
} | {
|
|
1403
|
+
data: null;
|
|
1404
|
+
error: ErrorResponse;
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1407
|
+
interface RemoveTemplateResponseSuccess {
|
|
1408
|
+
object: 'template';
|
|
1409
|
+
id: string;
|
|
1410
|
+
deleted: boolean;
|
|
1411
|
+
}
|
|
1412
|
+
type RemoveTemplateResponse = {
|
|
1413
|
+
data: RemoveTemplateResponseSuccess;
|
|
1414
|
+
error: null;
|
|
1415
|
+
} | {
|
|
1416
|
+
data: null;
|
|
1417
|
+
error: ErrorResponse;
|
|
1418
|
+
};
|
|
1419
|
+
|
|
1420
|
+
type TemplateVariableUpdateOptions = Pick<TemplateVariable, 'key' | 'type'> & ({
|
|
1421
|
+
type: 'string';
|
|
1422
|
+
fallbackValue?: string | null;
|
|
1423
|
+
} | {
|
|
1424
|
+
type: 'number';
|
|
1425
|
+
fallbackValue?: number | null;
|
|
1426
|
+
});
|
|
1427
|
+
interface UpdateTemplateOptions extends Partial<Pick<Template, 'name' | 'subject' | 'html' | 'text' | 'from' | 'alias'>> {
|
|
1428
|
+
variables?: TemplateVariableUpdateOptions[];
|
|
1429
|
+
replyTo?: string[] | string;
|
|
1430
|
+
}
|
|
1431
|
+
interface UpdateTemplateResponseSuccess extends Pick<Template, 'id'> {
|
|
1432
|
+
object: 'template';
|
|
1433
|
+
}
|
|
1434
|
+
type UpdateTemplateResponse = {
|
|
1435
|
+
data: UpdateTemplateResponseSuccess;
|
|
1436
|
+
error: null;
|
|
1437
|
+
} | {
|
|
1438
|
+
data: null;
|
|
1439
|
+
error: ErrorResponse;
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
declare class Templates {
|
|
1443
|
+
private readonly resend;
|
|
1444
|
+
private renderAsync?;
|
|
1445
|
+
constructor(resend: Resend);
|
|
1446
|
+
create(payload: CreateTemplateOptions): ChainableTemplateResult<CreateTemplateResponse>;
|
|
1447
|
+
private performCreate;
|
|
1448
|
+
remove(identifier: string): Promise<RemoveTemplateResponse>;
|
|
1449
|
+
get(identifier: string): Promise<GetTemplateResponse>;
|
|
1450
|
+
list(options?: PaginationOptions): Promise<ListTemplatesResponse>;
|
|
1451
|
+
duplicate(identifier: string): ChainableTemplateResult<DuplicateTemplateResponse>;
|
|
1452
|
+
publish(identifier: string): Promise<PublishTemplateResponse>;
|
|
1453
|
+
update(identifier: string, payload: UpdateTemplateOptions): Promise<UpdateTemplateResponse>;
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
interface Topic {
|
|
1457
|
+
id: string;
|
|
1458
|
+
name: string;
|
|
1459
|
+
description?: string;
|
|
1460
|
+
defaultSubscription: 'opt_in' | 'opt_out';
|
|
1461
|
+
created_at: string;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
interface CreateTopicOptions {
|
|
1465
|
+
name: string;
|
|
1466
|
+
description?: string;
|
|
1467
|
+
defaultSubscription: 'opt_in' | 'opt_out';
|
|
1468
|
+
}
|
|
1469
|
+
type CreateTopicResponseSuccess = Pick<Topic, 'id'>;
|
|
1470
|
+
interface CreateTopicResponse {
|
|
1471
|
+
data: CreateTopicResponseSuccess | null;
|
|
1472
|
+
error: ErrorResponse | null;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
type GetTopicResponseSuccess = Topic;
|
|
1476
|
+
interface GetTopicResponse {
|
|
1477
|
+
data: GetTopicResponseSuccess | null;
|
|
1478
|
+
error: ErrorResponse | null;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
interface ListTopicsResponseSuccess {
|
|
1482
|
+
data: Topic[];
|
|
1483
|
+
}
|
|
1484
|
+
interface ListTopicsResponse {
|
|
1485
|
+
data: ListTopicsResponseSuccess | null;
|
|
1486
|
+
error: ErrorResponse | null;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
type RemoveTopicResponseSuccess = Pick<Topic, 'id'> & {
|
|
1490
|
+
object: 'topic';
|
|
1491
|
+
deleted: boolean;
|
|
1492
|
+
};
|
|
1493
|
+
interface RemoveTopicResponse {
|
|
1494
|
+
data: RemoveTopicResponseSuccess | null;
|
|
1495
|
+
error: ErrorResponse | null;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
interface UpdateTopicOptions {
|
|
1499
|
+
id: string;
|
|
1500
|
+
name?: string;
|
|
1501
|
+
description?: string;
|
|
1502
|
+
}
|
|
1503
|
+
type UpdateTopicResponseSuccess = Pick<Topic, 'id'>;
|
|
1504
|
+
interface UpdateTopicResponse {
|
|
1505
|
+
data: UpdateTopicResponseSuccess | null;
|
|
1506
|
+
error: ErrorResponse | null;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
declare class Topics {
|
|
1510
|
+
private readonly resend;
|
|
1511
|
+
constructor(resend: Resend);
|
|
1512
|
+
create(payload: CreateTopicOptions): Promise<CreateTopicResponse>;
|
|
1513
|
+
list(): Promise<ListTopicsResponse>;
|
|
1514
|
+
get(id: string): Promise<GetTopicResponse>;
|
|
1515
|
+
update(payload: UpdateTopicOptions): Promise<UpdateTopicResponse>;
|
|
1516
|
+
remove(id: string): Promise<RemoveTopicResponse>;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
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';
|
|
1520
|
+
|
|
1521
|
+
interface CreateWebhookOptions {
|
|
1522
|
+
endpoint: string;
|
|
1523
|
+
events: WebhookEvent[];
|
|
1524
|
+
}
|
|
1525
|
+
interface CreateWebhookRequestOptions extends PostOptions {
|
|
1526
|
+
}
|
|
1527
|
+
interface CreateWebhookResponseSuccess {
|
|
1528
|
+
object: 'webhook';
|
|
1529
|
+
id: string;
|
|
1530
|
+
signing_secret: string;
|
|
1531
|
+
}
|
|
1532
|
+
type CreateWebhookResponse = {
|
|
1533
|
+
data: CreateWebhookResponseSuccess;
|
|
1534
|
+
error: null;
|
|
1535
|
+
} | {
|
|
1536
|
+
data: null;
|
|
1537
|
+
error: ErrorResponse;
|
|
1538
|
+
};
|
|
1539
|
+
|
|
1540
|
+
interface GetWebhookResponseSuccess {
|
|
1541
|
+
object: 'webhook';
|
|
1542
|
+
id: string;
|
|
1543
|
+
created_at: string;
|
|
1544
|
+
status: 'enabled' | 'disabled';
|
|
1545
|
+
endpoint: string;
|
|
1546
|
+
events: WebhookEvent[] | null;
|
|
1547
|
+
signing_secret: string;
|
|
1548
|
+
}
|
|
1549
|
+
type GetWebhookResponse = {
|
|
1550
|
+
data: GetWebhookResponseSuccess;
|
|
1551
|
+
error: null;
|
|
1552
|
+
} | {
|
|
1553
|
+
data: null;
|
|
1554
|
+
error: ErrorResponse;
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
type ListWebhooksOptions = PaginationOptions;
|
|
1558
|
+
interface Webhook {
|
|
1559
|
+
id: string;
|
|
1560
|
+
endpoint: string;
|
|
1561
|
+
created_at: string;
|
|
1562
|
+
status: 'enabled' | 'disabled';
|
|
1563
|
+
events: WebhookEvent[] | null;
|
|
1564
|
+
}
|
|
1565
|
+
type ListWebhooksResponseSuccess = {
|
|
1566
|
+
object: 'list';
|
|
1567
|
+
has_more: boolean;
|
|
1568
|
+
data: Webhook[];
|
|
1569
|
+
};
|
|
1570
|
+
type ListWebhooksResponse = {
|
|
1571
|
+
data: ListWebhooksResponseSuccess;
|
|
1572
|
+
error: null;
|
|
1573
|
+
} | {
|
|
1574
|
+
data: null;
|
|
1575
|
+
error: ErrorResponse;
|
|
1576
|
+
};
|
|
1577
|
+
|
|
1578
|
+
type RemoveWebhookResponseSuccess = Pick<Webhook, 'id'> & {
|
|
1579
|
+
object: 'webhook';
|
|
1580
|
+
deleted: boolean;
|
|
1581
|
+
};
|
|
1582
|
+
type RemoveWebhookResponse = {
|
|
1583
|
+
data: RemoveWebhookResponseSuccess;
|
|
1584
|
+
error: null;
|
|
1585
|
+
} | {
|
|
1586
|
+
data: null;
|
|
1587
|
+
error: ErrorResponse;
|
|
1588
|
+
};
|
|
1589
|
+
|
|
1590
|
+
interface UpdateWebhookOptions {
|
|
1591
|
+
endpoint?: string;
|
|
1592
|
+
events?: WebhookEvent[];
|
|
1593
|
+
status?: 'enabled' | 'disabled';
|
|
1594
|
+
}
|
|
1595
|
+
interface UpdateWebhookResponseSuccess {
|
|
1596
|
+
object: 'webhook';
|
|
1597
|
+
id: string;
|
|
1598
|
+
}
|
|
1599
|
+
type UpdateWebhookResponse = {
|
|
1600
|
+
data: UpdateWebhookResponseSuccess;
|
|
1601
|
+
error: null;
|
|
1602
|
+
} | {
|
|
1603
|
+
data: null;
|
|
1604
|
+
error: ErrorResponse;
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1025
1607
|
interface Headers {
|
|
1026
1608
|
id: string;
|
|
1027
1609
|
timestamp: string;
|
|
@@ -1047,13 +1629,20 @@ declare class Resend {
|
|
|
1047
1629
|
readonly key?: string | undefined;
|
|
1048
1630
|
private readonly headers;
|
|
1049
1631
|
readonly apiKeys: ApiKeys;
|
|
1050
|
-
readonly
|
|
1632
|
+
readonly segments: Segments;
|
|
1633
|
+
/**
|
|
1634
|
+
* @deprecated Use segments instead
|
|
1635
|
+
*/
|
|
1636
|
+
readonly audiences: Segments;
|
|
1051
1637
|
readonly batch: Batch;
|
|
1052
1638
|
readonly broadcasts: Broadcasts;
|
|
1053
1639
|
readonly contacts: Contacts;
|
|
1640
|
+
readonly contactProperties: ContactProperties;
|
|
1054
1641
|
readonly domains: Domains;
|
|
1055
1642
|
readonly emails: Emails;
|
|
1056
1643
|
readonly webhooks: Webhooks;
|
|
1644
|
+
readonly templates: Templates;
|
|
1645
|
+
readonly topics: Topics;
|
|
1057
1646
|
constructor(key?: string | undefined);
|
|
1058
1647
|
fetchRequest<T>(path: string, options?: {}): Promise<{
|
|
1059
1648
|
data: T;
|
|
@@ -1099,4 +1688,4 @@ declare class Resend {
|
|
|
1099
1688
|
}>;
|
|
1100
1689
|
}
|
|
1101
1690
|
|
|
1102
|
-
export { type ApiKey, type Attachment
|
|
1691
|
+
export { type ApiKey, type Attachment$1 as 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 CreateSegmentOptions, type CreateSegmentRequestOptions, type CreateSegmentResponse, type CreateSegmentResponseSuccess, 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 GetAttachmentOptions, type GetAttachmentResponse, type GetAttachmentResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetOptions, type GetReceivingEmailResponse, type GetReceivingEmailResponseSuccess, type GetSegmentResponse, type GetSegmentResponseSuccess, type GetWebhookResponse, type GetWebhookResponseSuccess, type IdempotentRequest, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAttachmentsApiResponse, type ListAttachmentsOptions, type ListAttachmentsResponse, type ListAttachmentsResponseSuccess, type ListAudienceContactsOptions, type ListBroadcastsOptions, type ListBroadcastsResponse, type ListBroadcastsResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsOptions, type ListDomainsResponse, type ListDomainsResponseSuccess, type ListReceivingEmail, type ListReceivingEmailsOptions, type ListReceivingEmailsResponse, type ListReceivingEmailsResponseSuccess, type ListSegmentsOptions, type ListSegmentsResponse, type ListSegmentsResponseSuccess, type ListWebhooksOptions, type ListWebhooksResponse, type ListWebhooksResponseSuccess, type PaginatedData, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type ReceivingRecord, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveBroadcastResponse, type RemoveBroadcastResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, type RemoveSegmentResponse, type RemoveSegmentResponseSuccess, type RemoveWebhookResponse, type RemoveWebhookResponseSuccess, type RequireAtLeastOne, Resend, type Segment, 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 };
|