resend 4.7.0-preview-topics.2 → 4.8.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 +238 -254
- package/dist/index.d.ts +238 -254
- package/dist/index.js +14 -128
- package/dist/index.mjs +14 -128
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -51,10 +51,13 @@ interface CreateApiKeyResponseSuccess {
|
|
|
51
51
|
token: string;
|
|
52
52
|
id: string;
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
data: CreateApiKeyResponseSuccess
|
|
56
|
-
error:
|
|
57
|
-
}
|
|
54
|
+
type CreateApiKeyResponse = {
|
|
55
|
+
data: CreateApiKeyResponseSuccess;
|
|
56
|
+
error: null;
|
|
57
|
+
} | {
|
|
58
|
+
data: null;
|
|
59
|
+
error: ErrorResponse;
|
|
60
|
+
};
|
|
58
61
|
|
|
59
62
|
interface ApiKey {
|
|
60
63
|
created_at: string;
|
|
@@ -63,16 +66,22 @@ interface ApiKey {
|
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
type ListApiKeysResponseSuccess = Pick<ApiKey, 'name' | 'id' | 'created_at'>[];
|
|
66
|
-
|
|
67
|
-
data: ListApiKeysResponseSuccess
|
|
68
|
-
error:
|
|
69
|
-
}
|
|
69
|
+
type ListApiKeysResponse = {
|
|
70
|
+
data: ListApiKeysResponseSuccess;
|
|
71
|
+
error: null;
|
|
72
|
+
} | {
|
|
73
|
+
data: null;
|
|
74
|
+
error: ErrorResponse;
|
|
75
|
+
};
|
|
70
76
|
|
|
71
77
|
type RemoveApiKeyResponseSuccess = {};
|
|
72
|
-
|
|
73
|
-
data: RemoveApiKeyResponseSuccess
|
|
74
|
-
error:
|
|
75
|
-
}
|
|
78
|
+
type RemoveApiKeyResponse = {
|
|
79
|
+
data: RemoveApiKeyResponseSuccess;
|
|
80
|
+
error: null;
|
|
81
|
+
} | {
|
|
82
|
+
data: null;
|
|
83
|
+
error: ErrorResponse;
|
|
84
|
+
};
|
|
76
85
|
|
|
77
86
|
declare class ApiKeys {
|
|
78
87
|
private readonly resend;
|
|
@@ -96,36 +105,48 @@ interface CreateAudienceRequestOptions extends PostOptions {
|
|
|
96
105
|
interface CreateAudienceResponseSuccess extends Pick<Audience, 'name' | 'id'> {
|
|
97
106
|
object: 'audience';
|
|
98
107
|
}
|
|
99
|
-
|
|
100
|
-
data: CreateAudienceResponseSuccess
|
|
101
|
-
error:
|
|
102
|
-
}
|
|
108
|
+
type CreateAudienceResponse = {
|
|
109
|
+
data: CreateAudienceResponseSuccess;
|
|
110
|
+
error: null;
|
|
111
|
+
} | {
|
|
112
|
+
data: null;
|
|
113
|
+
error: ErrorResponse;
|
|
114
|
+
};
|
|
103
115
|
|
|
104
116
|
interface GetAudienceResponseSuccess extends Pick<Audience, 'id' | 'name' | 'created_at'> {
|
|
105
117
|
object: 'audience';
|
|
106
118
|
}
|
|
107
|
-
|
|
108
|
-
data: GetAudienceResponseSuccess
|
|
109
|
-
error:
|
|
110
|
-
}
|
|
119
|
+
type GetAudienceResponse = {
|
|
120
|
+
data: GetAudienceResponseSuccess;
|
|
121
|
+
error: null;
|
|
122
|
+
} | {
|
|
123
|
+
data: null;
|
|
124
|
+
error: ErrorResponse;
|
|
125
|
+
};
|
|
111
126
|
|
|
112
127
|
type ListAudiencesResponseSuccess = {
|
|
113
128
|
object: 'list';
|
|
114
129
|
data: Audience[];
|
|
115
130
|
};
|
|
116
|
-
|
|
117
|
-
data: ListAudiencesResponseSuccess
|
|
118
|
-
error:
|
|
119
|
-
}
|
|
131
|
+
type ListAudiencesResponse = {
|
|
132
|
+
data: ListAudiencesResponseSuccess;
|
|
133
|
+
error: null;
|
|
134
|
+
} | {
|
|
135
|
+
data: null;
|
|
136
|
+
error: ErrorResponse;
|
|
137
|
+
};
|
|
120
138
|
|
|
121
139
|
interface RemoveAudiencesResponseSuccess extends Pick<Audience, 'id'> {
|
|
122
140
|
object: 'audience';
|
|
123
141
|
deleted: boolean;
|
|
124
142
|
}
|
|
125
|
-
|
|
126
|
-
data: RemoveAudiencesResponseSuccess
|
|
127
|
-
error:
|
|
128
|
-
}
|
|
143
|
+
type RemoveAudiencesResponse = {
|
|
144
|
+
data: RemoveAudiencesResponseSuccess;
|
|
145
|
+
error: null;
|
|
146
|
+
} | {
|
|
147
|
+
data: null;
|
|
148
|
+
error: ErrorResponse;
|
|
149
|
+
};
|
|
129
150
|
|
|
130
151
|
declare class Audiences {
|
|
131
152
|
private readonly resend;
|
|
@@ -224,12 +245,6 @@ interface CreateEmailBaseOptions {
|
|
|
224
245
|
* @link https://resend.com/docs/api-reference/emails/send-email#body-parameters
|
|
225
246
|
*/
|
|
226
247
|
to: string | string[];
|
|
227
|
-
/**
|
|
228
|
-
* The id of the topic you want to send to
|
|
229
|
-
*
|
|
230
|
-
* @link https://resend.com/docs/api-reference/emails/send-email#body-parameters
|
|
231
|
-
*/
|
|
232
|
-
topicId?: string | null;
|
|
233
248
|
/**
|
|
234
249
|
* Schedule email to be sent later.
|
|
235
250
|
* The date should be in ISO 8601 format (e.g: 2024-08-05T11:52:01.858Z).
|
|
@@ -245,10 +260,13 @@ interface CreateEmailResponseSuccess {
|
|
|
245
260
|
/** The ID of the newly created email. */
|
|
246
261
|
id: string;
|
|
247
262
|
}
|
|
248
|
-
|
|
249
|
-
data: CreateEmailResponseSuccess
|
|
250
|
-
error:
|
|
251
|
-
}
|
|
263
|
+
type CreateEmailResponse = {
|
|
264
|
+
data: CreateEmailResponseSuccess;
|
|
265
|
+
error: null;
|
|
266
|
+
} | {
|
|
267
|
+
data: null;
|
|
268
|
+
error: ErrorResponse;
|
|
269
|
+
};
|
|
252
270
|
interface Attachment {
|
|
253
271
|
/** Content of an attached file. */
|
|
254
272
|
content?: string | Buffer;
|
|
@@ -258,6 +276,11 @@ interface Attachment {
|
|
|
258
276
|
path?: string;
|
|
259
277
|
/** Optional content type for the attachment, if not set will be derived from the filename property */
|
|
260
278
|
contentType?: string;
|
|
279
|
+
/**
|
|
280
|
+
* Optional content ID for the attachment, to be used as a reference in the HTML content.
|
|
281
|
+
* If set, this attachment will be sent as an inline attachment and you can reference it in the HTML content using the `cid:` prefix.
|
|
282
|
+
*/
|
|
283
|
+
inlineContentId?: string;
|
|
261
284
|
}
|
|
262
285
|
type Tag = {
|
|
263
286
|
/**
|
|
@@ -279,10 +302,13 @@ interface CreateBatchSuccessResponse {
|
|
|
279
302
|
id: string;
|
|
280
303
|
}[];
|
|
281
304
|
}
|
|
282
|
-
|
|
283
|
-
data: CreateBatchSuccessResponse
|
|
284
|
-
error:
|
|
285
|
-
}
|
|
305
|
+
type CreateBatchResponse = {
|
|
306
|
+
data: CreateBatchSuccessResponse;
|
|
307
|
+
error: null;
|
|
308
|
+
} | {
|
|
309
|
+
data: null;
|
|
310
|
+
error: ErrorResponse;
|
|
311
|
+
};
|
|
286
312
|
|
|
287
313
|
declare class Batch {
|
|
288
314
|
private readonly resend;
|
|
@@ -349,12 +375,6 @@ interface CreateBroadcastBaseOptions {
|
|
|
349
375
|
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
350
376
|
*/
|
|
351
377
|
subject: string;
|
|
352
|
-
/**
|
|
353
|
-
* The id of the topic you want to send to
|
|
354
|
-
*
|
|
355
|
-
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
356
|
-
*/
|
|
357
|
-
topicId?: string | null;
|
|
358
378
|
}
|
|
359
379
|
type CreateBroadcastOptions = RequireAtLeastOne<EmailRenderOptions> & CreateBroadcastBaseOptions;
|
|
360
380
|
interface CreateBroadcastRequestOptions extends PostOptions {
|
|
@@ -363,10 +383,13 @@ interface CreateBroadcastResponseSuccess {
|
|
|
363
383
|
/** The ID of the newly sent broadcasts. */
|
|
364
384
|
id: string;
|
|
365
385
|
}
|
|
366
|
-
|
|
367
|
-
data: CreateBroadcastResponseSuccess
|
|
368
|
-
error:
|
|
369
|
-
}
|
|
386
|
+
type CreateBroadcastResponse = {
|
|
387
|
+
data: CreateBroadcastResponseSuccess;
|
|
388
|
+
error: null;
|
|
389
|
+
} | {
|
|
390
|
+
data: null;
|
|
391
|
+
error: ErrorResponse;
|
|
392
|
+
};
|
|
370
393
|
|
|
371
394
|
interface Broadcast {
|
|
372
395
|
id: string;
|
|
@@ -380,34 +403,42 @@ interface Broadcast {
|
|
|
380
403
|
created_at: string;
|
|
381
404
|
scheduled_at: string | null;
|
|
382
405
|
sent_at: string | null;
|
|
383
|
-
topic_id?: string | null;
|
|
384
406
|
}
|
|
385
407
|
|
|
386
408
|
interface GetBroadcastResponseSuccess extends Broadcast {
|
|
387
409
|
object: 'broadcast';
|
|
388
410
|
}
|
|
389
|
-
|
|
390
|
-
data: GetBroadcastResponseSuccess
|
|
391
|
-
error:
|
|
392
|
-
}
|
|
411
|
+
type GetBroadcastResponse = {
|
|
412
|
+
data: GetBroadcastResponseSuccess;
|
|
413
|
+
error: null;
|
|
414
|
+
} | {
|
|
415
|
+
data: null;
|
|
416
|
+
error: ErrorResponse;
|
|
417
|
+
};
|
|
393
418
|
|
|
394
419
|
type ListBroadcastsResponseSuccess = {
|
|
395
420
|
object: 'list';
|
|
396
421
|
data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
|
|
397
422
|
};
|
|
398
|
-
|
|
399
|
-
data: ListBroadcastsResponseSuccess
|
|
400
|
-
error:
|
|
401
|
-
}
|
|
423
|
+
type ListBroadcastsResponse = {
|
|
424
|
+
data: ListBroadcastsResponseSuccess;
|
|
425
|
+
error: null;
|
|
426
|
+
} | {
|
|
427
|
+
data: null;
|
|
428
|
+
error: ErrorResponse;
|
|
429
|
+
};
|
|
402
430
|
|
|
403
431
|
interface RemoveBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
|
|
404
432
|
object: 'broadcast';
|
|
405
433
|
deleted: boolean;
|
|
406
434
|
}
|
|
407
|
-
|
|
408
|
-
data: RemoveBroadcastResponseSuccess
|
|
409
|
-
error:
|
|
410
|
-
}
|
|
435
|
+
type RemoveBroadcastResponse = {
|
|
436
|
+
data: RemoveBroadcastResponseSuccess;
|
|
437
|
+
error: null;
|
|
438
|
+
} | {
|
|
439
|
+
data: null;
|
|
440
|
+
error: ErrorResponse;
|
|
441
|
+
};
|
|
411
442
|
|
|
412
443
|
interface SendBroadcastBaseOptions {
|
|
413
444
|
/**
|
|
@@ -426,10 +457,13 @@ interface SendBroadcastResponseSuccess {
|
|
|
426
457
|
/** The ID of the sent broadcast. */
|
|
427
458
|
id: string;
|
|
428
459
|
}
|
|
429
|
-
|
|
430
|
-
data: SendBroadcastResponseSuccess
|
|
431
|
-
error:
|
|
432
|
-
}
|
|
460
|
+
type SendBroadcastResponse = {
|
|
461
|
+
data: SendBroadcastResponseSuccess;
|
|
462
|
+
error: null;
|
|
463
|
+
} | {
|
|
464
|
+
data: null;
|
|
465
|
+
error: ErrorResponse;
|
|
466
|
+
};
|
|
433
467
|
|
|
434
468
|
interface UpdateBroadcastResponseSuccess {
|
|
435
469
|
id: string;
|
|
@@ -443,12 +477,14 @@ interface UpdateBroadcastOptions {
|
|
|
443
477
|
subject?: string;
|
|
444
478
|
replyTo?: string[];
|
|
445
479
|
previewText?: string;
|
|
446
|
-
topicId?: string | null;
|
|
447
|
-
}
|
|
448
|
-
interface UpdateBroadcastResponse {
|
|
449
|
-
data: UpdateBroadcastResponseSuccess | null;
|
|
450
|
-
error: ErrorResponse | null;
|
|
451
480
|
}
|
|
481
|
+
type UpdateBroadcastResponse = {
|
|
482
|
+
data: UpdateBroadcastResponseSuccess;
|
|
483
|
+
error: null;
|
|
484
|
+
} | {
|
|
485
|
+
data: null;
|
|
486
|
+
error: ErrorResponse;
|
|
487
|
+
};
|
|
452
488
|
|
|
453
489
|
declare class Broadcasts {
|
|
454
490
|
private readonly resend;
|
|
@@ -489,10 +525,13 @@ interface CreateContactRequestOptions extends PostOptions {
|
|
|
489
525
|
interface CreateContactResponseSuccess extends Pick<Contact, 'id'> {
|
|
490
526
|
object: 'contact';
|
|
491
527
|
}
|
|
492
|
-
|
|
493
|
-
data: CreateContactResponseSuccess
|
|
494
|
-
error:
|
|
495
|
-
}
|
|
528
|
+
type CreateContactResponse = {
|
|
529
|
+
data: CreateContactResponseSuccess;
|
|
530
|
+
error: null;
|
|
531
|
+
} | {
|
|
532
|
+
data: null;
|
|
533
|
+
error: ErrorResponse;
|
|
534
|
+
};
|
|
496
535
|
|
|
497
536
|
interface GetContactOptions {
|
|
498
537
|
audienceId: string;
|
|
@@ -502,10 +541,13 @@ interface GetContactOptions {
|
|
|
502
541
|
interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'email' | 'created_at' | 'first_name' | 'last_name' | 'unsubscribed'> {
|
|
503
542
|
object: 'contact';
|
|
504
543
|
}
|
|
505
|
-
|
|
506
|
-
data: GetContactResponseSuccess
|
|
507
|
-
error:
|
|
508
|
-
}
|
|
544
|
+
type GetContactResponse = {
|
|
545
|
+
data: GetContactResponseSuccess;
|
|
546
|
+
error: null;
|
|
547
|
+
} | {
|
|
548
|
+
data: null;
|
|
549
|
+
error: ErrorResponse;
|
|
550
|
+
};
|
|
509
551
|
|
|
510
552
|
interface ListContactsOptions {
|
|
511
553
|
audienceId: string;
|
|
@@ -514,10 +556,13 @@ interface ListContactsResponseSuccess {
|
|
|
514
556
|
object: 'list';
|
|
515
557
|
data: Contact[];
|
|
516
558
|
}
|
|
517
|
-
|
|
518
|
-
data: ListContactsResponseSuccess
|
|
519
|
-
error:
|
|
520
|
-
}
|
|
559
|
+
type ListContactsResponse = {
|
|
560
|
+
data: ListContactsResponseSuccess;
|
|
561
|
+
error: null;
|
|
562
|
+
} | {
|
|
563
|
+
data: null;
|
|
564
|
+
error: ErrorResponse;
|
|
565
|
+
};
|
|
521
566
|
|
|
522
567
|
type RemoveContactsResponseSuccess = {
|
|
523
568
|
object: 'contact';
|
|
@@ -541,10 +586,13 @@ interface RemoveByOptions {
|
|
|
541
586
|
interface RemoveContactOptions extends RemoveByOptions {
|
|
542
587
|
audienceId: string;
|
|
543
588
|
}
|
|
544
|
-
|
|
545
|
-
data: RemoveContactsResponseSuccess
|
|
546
|
-
error:
|
|
547
|
-
}
|
|
589
|
+
type RemoveContactsResponse = {
|
|
590
|
+
data: RemoveContactsResponseSuccess;
|
|
591
|
+
error: null;
|
|
592
|
+
} | {
|
|
593
|
+
data: null;
|
|
594
|
+
error: ErrorResponse;
|
|
595
|
+
};
|
|
548
596
|
|
|
549
597
|
interface UpdateContactBaseOptions {
|
|
550
598
|
id?: string;
|
|
@@ -559,60 +607,16 @@ interface UpdateContactOptions extends UpdateContactBaseOptions {
|
|
|
559
607
|
type UpdateContactResponseSuccess = Pick<Contact, 'id'> & {
|
|
560
608
|
object: 'contact';
|
|
561
609
|
};
|
|
562
|
-
|
|
563
|
-
data: UpdateContactResponseSuccess
|
|
564
|
-
error:
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
email?: string;
|
|
570
|
-
}
|
|
571
|
-
interface GetContactTopicsOptions extends GetContactTopicsBaseOptions {
|
|
572
|
-
}
|
|
573
|
-
interface ContactTopic {
|
|
574
|
-
id: string;
|
|
575
|
-
name: string;
|
|
576
|
-
description: string | null;
|
|
577
|
-
subscription: 'opt_in' | 'opt_out';
|
|
578
|
-
}
|
|
579
|
-
interface GetContactTopicsResponseSuccess {
|
|
580
|
-
email: string;
|
|
581
|
-
topics: ContactTopic[];
|
|
582
|
-
}
|
|
583
|
-
interface GetContactTopicsResponse {
|
|
584
|
-
data: GetContactTopicsResponseSuccess | null;
|
|
585
|
-
error: ErrorResponse | null;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
interface UpdateContactTopicsBaseOptions {
|
|
589
|
-
id?: string;
|
|
590
|
-
email?: string;
|
|
591
|
-
}
|
|
592
|
-
interface UpdateContactTopicsOptions extends UpdateContactTopicsBaseOptions {
|
|
593
|
-
topics: {
|
|
594
|
-
id: string;
|
|
595
|
-
subscription: 'opt_in' | 'opt_out';
|
|
596
|
-
}[];
|
|
597
|
-
}
|
|
598
|
-
interface UpdateContactTopicsResponseSuccess {
|
|
599
|
-
id: string;
|
|
600
|
-
}
|
|
601
|
-
interface UpdateContactTopicsResponse {
|
|
602
|
-
data: UpdateContactTopicsResponseSuccess | null;
|
|
603
|
-
error: ErrorResponse | null;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
declare class ContactTopics {
|
|
607
|
-
private readonly resend;
|
|
608
|
-
constructor(resend: Resend);
|
|
609
|
-
update(payload: UpdateContactTopicsOptions): Promise<UpdateContactTopicsResponse>;
|
|
610
|
-
get(options: GetContactTopicsOptions): Promise<GetContactTopicsResponse>;
|
|
611
|
-
}
|
|
610
|
+
type UpdateContactResponse = {
|
|
611
|
+
data: UpdateContactResponseSuccess;
|
|
612
|
+
error: null;
|
|
613
|
+
} | {
|
|
614
|
+
data: null;
|
|
615
|
+
error: ErrorResponse;
|
|
616
|
+
};
|
|
612
617
|
|
|
613
618
|
declare class Contacts {
|
|
614
619
|
private readonly resend;
|
|
615
|
-
readonly topics: ContactTopics;
|
|
616
620
|
constructor(resend: Resend);
|
|
617
621
|
create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
|
|
618
622
|
list(options: ListContactsOptions): Promise<ListContactsResponse>;
|
|
@@ -664,36 +668,48 @@ interface CreateDomainRequestOptions extends PostOptions {
|
|
|
664
668
|
interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> {
|
|
665
669
|
records: DomainRecords[];
|
|
666
670
|
}
|
|
667
|
-
|
|
668
|
-
data: CreateDomainResponseSuccess
|
|
669
|
-
error:
|
|
670
|
-
}
|
|
671
|
+
type CreateDomainResponse = {
|
|
672
|
+
data: CreateDomainResponseSuccess;
|
|
673
|
+
error: null;
|
|
674
|
+
} | {
|
|
675
|
+
data: null;
|
|
676
|
+
error: ErrorResponse;
|
|
677
|
+
};
|
|
671
678
|
|
|
672
679
|
interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> {
|
|
673
680
|
object: 'domain';
|
|
674
681
|
records: DomainRecords[];
|
|
675
682
|
}
|
|
676
|
-
|
|
677
|
-
data: GetDomainResponseSuccess
|
|
678
|
-
error:
|
|
679
|
-
}
|
|
683
|
+
type GetDomainResponse = {
|
|
684
|
+
data: GetDomainResponseSuccess;
|
|
685
|
+
error: null;
|
|
686
|
+
} | {
|
|
687
|
+
data: null;
|
|
688
|
+
error: ErrorResponse;
|
|
689
|
+
};
|
|
680
690
|
|
|
681
691
|
type ListDomainsResponseSuccess = {
|
|
682
692
|
data: Domain[];
|
|
683
693
|
};
|
|
684
|
-
|
|
685
|
-
data: ListDomainsResponseSuccess
|
|
686
|
-
error:
|
|
687
|
-
}
|
|
694
|
+
type ListDomainsResponse = {
|
|
695
|
+
data: ListDomainsResponseSuccess;
|
|
696
|
+
error: null;
|
|
697
|
+
} | {
|
|
698
|
+
data: null;
|
|
699
|
+
error: ErrorResponse;
|
|
700
|
+
};
|
|
688
701
|
|
|
689
702
|
type RemoveDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
690
703
|
object: 'domain';
|
|
691
704
|
deleted: boolean;
|
|
692
705
|
};
|
|
693
|
-
|
|
694
|
-
data: RemoveDomainsResponseSuccess
|
|
695
|
-
error:
|
|
696
|
-
}
|
|
706
|
+
type RemoveDomainsResponse = {
|
|
707
|
+
data: RemoveDomainsResponseSuccess;
|
|
708
|
+
error: null;
|
|
709
|
+
} | {
|
|
710
|
+
data: null;
|
|
711
|
+
error: ErrorResponse;
|
|
712
|
+
};
|
|
697
713
|
|
|
698
714
|
interface UpdateDomainsOptions {
|
|
699
715
|
id: string;
|
|
@@ -704,18 +720,24 @@ interface UpdateDomainsOptions {
|
|
|
704
720
|
type UpdateDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
705
721
|
object: 'domain';
|
|
706
722
|
};
|
|
707
|
-
|
|
708
|
-
data: UpdateDomainsResponseSuccess
|
|
709
|
-
error:
|
|
710
|
-
}
|
|
723
|
+
type UpdateDomainsResponse = {
|
|
724
|
+
data: UpdateDomainsResponseSuccess;
|
|
725
|
+
error: null;
|
|
726
|
+
} | {
|
|
727
|
+
data: null;
|
|
728
|
+
error: ErrorResponse;
|
|
729
|
+
};
|
|
711
730
|
|
|
712
731
|
type VerifyDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
713
732
|
object: 'domain';
|
|
714
733
|
};
|
|
715
|
-
|
|
716
|
-
data: VerifyDomainsResponseSuccess
|
|
717
|
-
error:
|
|
718
|
-
}
|
|
734
|
+
type VerifyDomainsResponse = {
|
|
735
|
+
data: VerifyDomainsResponseSuccess;
|
|
736
|
+
error: null;
|
|
737
|
+
} | {
|
|
738
|
+
data: null;
|
|
739
|
+
error: ErrorResponse;
|
|
740
|
+
};
|
|
719
741
|
|
|
720
742
|
declare class Domains {
|
|
721
743
|
private readonly resend;
|
|
@@ -728,14 +750,17 @@ declare class Domains {
|
|
|
728
750
|
verify(id: string): Promise<VerifyDomainsResponse>;
|
|
729
751
|
}
|
|
730
752
|
|
|
731
|
-
interface CancelEmailResponse {
|
|
732
|
-
data: CancelEmailResponseSuccess | null;
|
|
733
|
-
error: ErrorResponse | null;
|
|
734
|
-
}
|
|
735
753
|
interface CancelEmailResponseSuccess {
|
|
736
754
|
object: 'email';
|
|
737
755
|
id: string;
|
|
738
756
|
}
|
|
757
|
+
type CancelEmailResponse = {
|
|
758
|
+
data: CancelEmailResponseSuccess;
|
|
759
|
+
error: null;
|
|
760
|
+
} | {
|
|
761
|
+
data: null;
|
|
762
|
+
error: ErrorResponse;
|
|
763
|
+
};
|
|
739
764
|
|
|
740
765
|
interface GetEmailResponseSuccess {
|
|
741
766
|
bcc: string[] | null;
|
|
@@ -749,14 +774,16 @@ interface GetEmailResponseSuccess {
|
|
|
749
774
|
subject: string;
|
|
750
775
|
text: string | null;
|
|
751
776
|
to: string[];
|
|
752
|
-
topic_id?: string | null;
|
|
753
777
|
scheduled_at: string | null;
|
|
754
778
|
object: 'email';
|
|
755
779
|
}
|
|
756
|
-
|
|
757
|
-
data: GetEmailResponseSuccess
|
|
758
|
-
error:
|
|
759
|
-
}
|
|
780
|
+
type GetEmailResponse = {
|
|
781
|
+
data: GetEmailResponseSuccess;
|
|
782
|
+
error: null;
|
|
783
|
+
} | {
|
|
784
|
+
data: null;
|
|
785
|
+
error: ErrorResponse;
|
|
786
|
+
};
|
|
760
787
|
|
|
761
788
|
interface UpdateEmailOptions {
|
|
762
789
|
id: string;
|
|
@@ -766,10 +793,13 @@ interface UpdateEmailResponseSuccess {
|
|
|
766
793
|
id: string;
|
|
767
794
|
object: 'email';
|
|
768
795
|
}
|
|
769
|
-
|
|
770
|
-
data: UpdateEmailResponseSuccess
|
|
771
|
-
error:
|
|
772
|
-
}
|
|
796
|
+
type UpdateEmailResponse = {
|
|
797
|
+
data: UpdateEmailResponseSuccess;
|
|
798
|
+
error: null;
|
|
799
|
+
} | {
|
|
800
|
+
data: null;
|
|
801
|
+
error: ErrorResponse;
|
|
802
|
+
};
|
|
773
803
|
|
|
774
804
|
declare class Emails {
|
|
775
805
|
private readonly resend;
|
|
@@ -782,69 +812,6 @@ declare class Emails {
|
|
|
782
812
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
783
813
|
}
|
|
784
814
|
|
|
785
|
-
interface Topic {
|
|
786
|
-
id: string;
|
|
787
|
-
name: string;
|
|
788
|
-
description?: string;
|
|
789
|
-
default_subscription: 'opt_in' | 'opt_out';
|
|
790
|
-
created_at: string;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
interface CreateTopicOptions {
|
|
794
|
-
name: string;
|
|
795
|
-
description?: string;
|
|
796
|
-
default_subscription: 'opt_in' | 'opt_out';
|
|
797
|
-
}
|
|
798
|
-
type CreateTopicResponseSuccess = Pick<Topic, 'id'>;
|
|
799
|
-
interface CreateTopicResponse {
|
|
800
|
-
data: CreateTopicResponseSuccess | null;
|
|
801
|
-
error: ErrorResponse | null;
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
type GetTopicResponseSuccess = Topic;
|
|
805
|
-
interface GetTopicResponse {
|
|
806
|
-
data: GetTopicResponseSuccess | null;
|
|
807
|
-
error: ErrorResponse | null;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
interface ListTopicsResponseSuccess {
|
|
811
|
-
data: Topic[];
|
|
812
|
-
}
|
|
813
|
-
interface ListTopicsResponse {
|
|
814
|
-
data: ListTopicsResponseSuccess | null;
|
|
815
|
-
error: ErrorResponse | null;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
type RemoveTopicResponseSuccess = Pick<Topic, 'id'> & {
|
|
819
|
-
object: 'topic';
|
|
820
|
-
deleted: boolean;
|
|
821
|
-
};
|
|
822
|
-
interface RemoveTopicResponse {
|
|
823
|
-
data: RemoveTopicResponseSuccess | null;
|
|
824
|
-
error: ErrorResponse | null;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
interface UpdateTopicOptions {
|
|
828
|
-
id: string;
|
|
829
|
-
name?: string;
|
|
830
|
-
description?: string;
|
|
831
|
-
}
|
|
832
|
-
type UpdateTopicResponseSuccess = Pick<Topic, 'id'>;
|
|
833
|
-
interface UpdateTopicResponse {
|
|
834
|
-
data: UpdateTopicResponseSuccess | null;
|
|
835
|
-
error: ErrorResponse | null;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
declare class Topics {
|
|
839
|
-
private readonly resend;
|
|
840
|
-
constructor(resend: Resend);
|
|
841
|
-
create(payload: CreateTopicOptions): Promise<CreateTopicResponse>;
|
|
842
|
-
list(): Promise<ListTopicsResponse>;
|
|
843
|
-
get(id: string): Promise<GetTopicResponse>;
|
|
844
|
-
update(payload: UpdateTopicOptions): Promise<UpdateTopicResponse>;
|
|
845
|
-
remove(id: string): Promise<RemoveTopicResponse>;
|
|
846
|
-
}
|
|
847
|
-
|
|
848
815
|
declare class Resend {
|
|
849
816
|
readonly key?: string | undefined;
|
|
850
817
|
private readonly headers;
|
|
@@ -855,31 +822,48 @@ declare class Resend {
|
|
|
855
822
|
readonly contacts: Contacts;
|
|
856
823
|
readonly domains: Domains;
|
|
857
824
|
readonly emails: Emails;
|
|
858
|
-
readonly topics: Topics;
|
|
859
825
|
constructor(key?: string | undefined);
|
|
860
826
|
fetchRequest<T>(path: string, options?: {}): Promise<{
|
|
861
|
-
data: T
|
|
862
|
-
error:
|
|
827
|
+
data: T;
|
|
828
|
+
error: null;
|
|
829
|
+
} | {
|
|
830
|
+
data: null;
|
|
831
|
+
error: ErrorResponse;
|
|
863
832
|
}>;
|
|
864
833
|
post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<{
|
|
865
|
-
data:
|
|
866
|
-
error: ErrorResponse
|
|
834
|
+
data: null;
|
|
835
|
+
error: ErrorResponse;
|
|
836
|
+
} | {
|
|
837
|
+
data: T;
|
|
838
|
+
error: null;
|
|
867
839
|
}>;
|
|
868
840
|
get<T>(path: string, options?: GetOptions): Promise<{
|
|
869
|
-
data:
|
|
870
|
-
error: ErrorResponse
|
|
841
|
+
data: null;
|
|
842
|
+
error: ErrorResponse;
|
|
843
|
+
} | {
|
|
844
|
+
data: T;
|
|
845
|
+
error: null;
|
|
871
846
|
}>;
|
|
872
847
|
put<T>(path: string, entity: unknown, options?: PutOptions): Promise<{
|
|
873
|
-
data:
|
|
874
|
-
error: ErrorResponse
|
|
848
|
+
data: null;
|
|
849
|
+
error: ErrorResponse;
|
|
850
|
+
} | {
|
|
851
|
+
data: T;
|
|
852
|
+
error: null;
|
|
875
853
|
}>;
|
|
876
854
|
patch<T>(path: string, entity: unknown, options?: PatchOptions): Promise<{
|
|
877
|
-
data:
|
|
878
|
-
error: ErrorResponse
|
|
855
|
+
data: null;
|
|
856
|
+
error: ErrorResponse;
|
|
857
|
+
} | {
|
|
858
|
+
data: T;
|
|
859
|
+
error: null;
|
|
879
860
|
}>;
|
|
880
861
|
delete<T>(path: string, query?: unknown): Promise<{
|
|
881
|
-
data:
|
|
882
|
-
error: ErrorResponse
|
|
862
|
+
data: null;
|
|
863
|
+
error: ErrorResponse;
|
|
864
|
+
} | {
|
|
865
|
+
data: T;
|
|
866
|
+
error: null;
|
|
883
867
|
}>;
|
|
884
868
|
}
|
|
885
869
|
|