resend 4.7.0-preview-topics.0 → 4.7.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 +233 -235
- package/dist/index.d.ts +233 -235
- package/dist/index.js +1 -124
- package/dist/index.mjs +1 -124
- 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;
|
|
@@ -239,10 +260,13 @@ interface CreateEmailResponseSuccess {
|
|
|
239
260
|
/** The ID of the newly created email. */
|
|
240
261
|
id: string;
|
|
241
262
|
}
|
|
242
|
-
|
|
243
|
-
data: CreateEmailResponseSuccess
|
|
244
|
-
error:
|
|
245
|
-
}
|
|
263
|
+
type CreateEmailResponse = {
|
|
264
|
+
data: CreateEmailResponseSuccess;
|
|
265
|
+
error: null;
|
|
266
|
+
} | {
|
|
267
|
+
data: null;
|
|
268
|
+
error: ErrorResponse;
|
|
269
|
+
};
|
|
246
270
|
interface Attachment {
|
|
247
271
|
/** Content of an attached file. */
|
|
248
272
|
content?: string | Buffer;
|
|
@@ -273,10 +297,13 @@ interface CreateBatchSuccessResponse {
|
|
|
273
297
|
id: string;
|
|
274
298
|
}[];
|
|
275
299
|
}
|
|
276
|
-
|
|
277
|
-
data: CreateBatchSuccessResponse
|
|
278
|
-
error:
|
|
279
|
-
}
|
|
300
|
+
type CreateBatchResponse = {
|
|
301
|
+
data: CreateBatchSuccessResponse;
|
|
302
|
+
error: null;
|
|
303
|
+
} | {
|
|
304
|
+
data: null;
|
|
305
|
+
error: ErrorResponse;
|
|
306
|
+
};
|
|
280
307
|
|
|
281
308
|
declare class Batch {
|
|
282
309
|
private readonly resend;
|
|
@@ -351,10 +378,13 @@ interface CreateBroadcastResponseSuccess {
|
|
|
351
378
|
/** The ID of the newly sent broadcasts. */
|
|
352
379
|
id: string;
|
|
353
380
|
}
|
|
354
|
-
|
|
355
|
-
data: CreateBroadcastResponseSuccess
|
|
356
|
-
error:
|
|
357
|
-
}
|
|
381
|
+
type CreateBroadcastResponse = {
|
|
382
|
+
data: CreateBroadcastResponseSuccess;
|
|
383
|
+
error: null;
|
|
384
|
+
} | {
|
|
385
|
+
data: null;
|
|
386
|
+
error: ErrorResponse;
|
|
387
|
+
};
|
|
358
388
|
|
|
359
389
|
interface Broadcast {
|
|
360
390
|
id: string;
|
|
@@ -373,28 +403,37 @@ interface Broadcast {
|
|
|
373
403
|
interface GetBroadcastResponseSuccess extends Broadcast {
|
|
374
404
|
object: 'broadcast';
|
|
375
405
|
}
|
|
376
|
-
|
|
377
|
-
data: GetBroadcastResponseSuccess
|
|
378
|
-
error:
|
|
379
|
-
}
|
|
406
|
+
type GetBroadcastResponse = {
|
|
407
|
+
data: GetBroadcastResponseSuccess;
|
|
408
|
+
error: null;
|
|
409
|
+
} | {
|
|
410
|
+
data: null;
|
|
411
|
+
error: ErrorResponse;
|
|
412
|
+
};
|
|
380
413
|
|
|
381
414
|
type ListBroadcastsResponseSuccess = {
|
|
382
415
|
object: 'list';
|
|
383
416
|
data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
|
|
384
417
|
};
|
|
385
|
-
|
|
386
|
-
data: ListBroadcastsResponseSuccess
|
|
387
|
-
error:
|
|
388
|
-
}
|
|
418
|
+
type ListBroadcastsResponse = {
|
|
419
|
+
data: ListBroadcastsResponseSuccess;
|
|
420
|
+
error: null;
|
|
421
|
+
} | {
|
|
422
|
+
data: null;
|
|
423
|
+
error: ErrorResponse;
|
|
424
|
+
};
|
|
389
425
|
|
|
390
426
|
interface RemoveBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
|
|
391
427
|
object: 'broadcast';
|
|
392
428
|
deleted: boolean;
|
|
393
429
|
}
|
|
394
|
-
|
|
395
|
-
data: RemoveBroadcastResponseSuccess
|
|
396
|
-
error:
|
|
397
|
-
}
|
|
430
|
+
type RemoveBroadcastResponse = {
|
|
431
|
+
data: RemoveBroadcastResponseSuccess;
|
|
432
|
+
error: null;
|
|
433
|
+
} | {
|
|
434
|
+
data: null;
|
|
435
|
+
error: ErrorResponse;
|
|
436
|
+
};
|
|
398
437
|
|
|
399
438
|
interface SendBroadcastBaseOptions {
|
|
400
439
|
/**
|
|
@@ -413,10 +452,13 @@ interface SendBroadcastResponseSuccess {
|
|
|
413
452
|
/** The ID of the sent broadcast. */
|
|
414
453
|
id: string;
|
|
415
454
|
}
|
|
416
|
-
|
|
417
|
-
data: SendBroadcastResponseSuccess
|
|
418
|
-
error:
|
|
419
|
-
}
|
|
455
|
+
type SendBroadcastResponse = {
|
|
456
|
+
data: SendBroadcastResponseSuccess;
|
|
457
|
+
error: null;
|
|
458
|
+
} | {
|
|
459
|
+
data: null;
|
|
460
|
+
error: ErrorResponse;
|
|
461
|
+
};
|
|
420
462
|
|
|
421
463
|
interface UpdateBroadcastResponseSuccess {
|
|
422
464
|
id: string;
|
|
@@ -431,10 +473,13 @@ interface UpdateBroadcastOptions {
|
|
|
431
473
|
replyTo?: string[];
|
|
432
474
|
previewText?: string;
|
|
433
475
|
}
|
|
434
|
-
|
|
435
|
-
data: UpdateBroadcastResponseSuccess
|
|
436
|
-
error:
|
|
437
|
-
}
|
|
476
|
+
type UpdateBroadcastResponse = {
|
|
477
|
+
data: UpdateBroadcastResponseSuccess;
|
|
478
|
+
error: null;
|
|
479
|
+
} | {
|
|
480
|
+
data: null;
|
|
481
|
+
error: ErrorResponse;
|
|
482
|
+
};
|
|
438
483
|
|
|
439
484
|
declare class Broadcasts {
|
|
440
485
|
private readonly resend;
|
|
@@ -475,10 +520,13 @@ interface CreateContactRequestOptions extends PostOptions {
|
|
|
475
520
|
interface CreateContactResponseSuccess extends Pick<Contact, 'id'> {
|
|
476
521
|
object: 'contact';
|
|
477
522
|
}
|
|
478
|
-
|
|
479
|
-
data: CreateContactResponseSuccess
|
|
480
|
-
error:
|
|
481
|
-
}
|
|
523
|
+
type CreateContactResponse = {
|
|
524
|
+
data: CreateContactResponseSuccess;
|
|
525
|
+
error: null;
|
|
526
|
+
} | {
|
|
527
|
+
data: null;
|
|
528
|
+
error: ErrorResponse;
|
|
529
|
+
};
|
|
482
530
|
|
|
483
531
|
interface GetContactOptions {
|
|
484
532
|
audienceId: string;
|
|
@@ -488,10 +536,13 @@ interface GetContactOptions {
|
|
|
488
536
|
interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'email' | 'created_at' | 'first_name' | 'last_name' | 'unsubscribed'> {
|
|
489
537
|
object: 'contact';
|
|
490
538
|
}
|
|
491
|
-
|
|
492
|
-
data: GetContactResponseSuccess
|
|
493
|
-
error:
|
|
494
|
-
}
|
|
539
|
+
type GetContactResponse = {
|
|
540
|
+
data: GetContactResponseSuccess;
|
|
541
|
+
error: null;
|
|
542
|
+
} | {
|
|
543
|
+
data: null;
|
|
544
|
+
error: ErrorResponse;
|
|
545
|
+
};
|
|
495
546
|
|
|
496
547
|
interface ListContactsOptions {
|
|
497
548
|
audienceId: string;
|
|
@@ -500,10 +551,13 @@ interface ListContactsResponseSuccess {
|
|
|
500
551
|
object: 'list';
|
|
501
552
|
data: Contact[];
|
|
502
553
|
}
|
|
503
|
-
|
|
504
|
-
data: ListContactsResponseSuccess
|
|
505
|
-
error:
|
|
506
|
-
}
|
|
554
|
+
type ListContactsResponse = {
|
|
555
|
+
data: ListContactsResponseSuccess;
|
|
556
|
+
error: null;
|
|
557
|
+
} | {
|
|
558
|
+
data: null;
|
|
559
|
+
error: ErrorResponse;
|
|
560
|
+
};
|
|
507
561
|
|
|
508
562
|
type RemoveContactsResponseSuccess = {
|
|
509
563
|
object: 'contact';
|
|
@@ -527,10 +581,13 @@ interface RemoveByOptions {
|
|
|
527
581
|
interface RemoveContactOptions extends RemoveByOptions {
|
|
528
582
|
audienceId: string;
|
|
529
583
|
}
|
|
530
|
-
|
|
531
|
-
data: RemoveContactsResponseSuccess
|
|
532
|
-
error:
|
|
533
|
-
}
|
|
584
|
+
type RemoveContactsResponse = {
|
|
585
|
+
data: RemoveContactsResponseSuccess;
|
|
586
|
+
error: null;
|
|
587
|
+
} | {
|
|
588
|
+
data: null;
|
|
589
|
+
error: ErrorResponse;
|
|
590
|
+
};
|
|
534
591
|
|
|
535
592
|
interface UpdateContactBaseOptions {
|
|
536
593
|
id?: string;
|
|
@@ -545,56 +602,16 @@ interface UpdateContactOptions extends UpdateContactBaseOptions {
|
|
|
545
602
|
type UpdateContactResponseSuccess = Pick<Contact, 'id'> & {
|
|
546
603
|
object: 'contact';
|
|
547
604
|
};
|
|
548
|
-
|
|
549
|
-
data: UpdateContactResponseSuccess
|
|
550
|
-
error:
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
email?: string;
|
|
556
|
-
}
|
|
557
|
-
interface GetContactTopicsOptions extends GetContactTopicsBaseOptions {
|
|
558
|
-
}
|
|
559
|
-
interface ContactTopic {
|
|
560
|
-
id: string;
|
|
561
|
-
subscription: 'opt_in' | 'opt_out';
|
|
562
|
-
}
|
|
563
|
-
interface GetContactTopicsResponseSuccess {
|
|
564
|
-
email: string;
|
|
565
|
-
topics: ContactTopic[];
|
|
566
|
-
}
|
|
567
|
-
interface GetContactTopicsResponse {
|
|
568
|
-
data: GetContactTopicsResponseSuccess | null;
|
|
569
|
-
error: ErrorResponse | null;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
interface UpdateContactTopicsBaseOptions {
|
|
573
|
-
id?: string;
|
|
574
|
-
email?: string;
|
|
575
|
-
}
|
|
576
|
-
interface UpdateContactTopicsOptions extends UpdateContactTopicsBaseOptions {
|
|
577
|
-
opt_in?: string | string[];
|
|
578
|
-
opt_out?: string | string[];
|
|
579
|
-
}
|
|
580
|
-
interface UpdateContactTopicsResponseSuccess {
|
|
581
|
-
id: string;
|
|
582
|
-
}
|
|
583
|
-
interface UpdateContactTopicsResponse {
|
|
584
|
-
data: UpdateContactTopicsResponseSuccess | null;
|
|
585
|
-
error: ErrorResponse | null;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
declare class ContactTopics {
|
|
589
|
-
private readonly resend;
|
|
590
|
-
constructor(resend: Resend);
|
|
591
|
-
update(payload: UpdateContactTopicsOptions): Promise<UpdateContactTopicsResponse>;
|
|
592
|
-
get(options: GetContactTopicsOptions): Promise<GetContactTopicsResponse>;
|
|
593
|
-
}
|
|
605
|
+
type UpdateContactResponse = {
|
|
606
|
+
data: UpdateContactResponseSuccess;
|
|
607
|
+
error: null;
|
|
608
|
+
} | {
|
|
609
|
+
data: null;
|
|
610
|
+
error: ErrorResponse;
|
|
611
|
+
};
|
|
594
612
|
|
|
595
613
|
declare class Contacts {
|
|
596
614
|
private readonly resend;
|
|
597
|
-
readonly topics: ContactTopics;
|
|
598
615
|
constructor(resend: Resend);
|
|
599
616
|
create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
|
|
600
617
|
list(options: ListContactsOptions): Promise<ListContactsResponse>;
|
|
@@ -646,36 +663,48 @@ interface CreateDomainRequestOptions extends PostOptions {
|
|
|
646
663
|
interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> {
|
|
647
664
|
records: DomainRecords[];
|
|
648
665
|
}
|
|
649
|
-
|
|
650
|
-
data: CreateDomainResponseSuccess
|
|
651
|
-
error:
|
|
652
|
-
}
|
|
666
|
+
type CreateDomainResponse = {
|
|
667
|
+
data: CreateDomainResponseSuccess;
|
|
668
|
+
error: null;
|
|
669
|
+
} | {
|
|
670
|
+
data: null;
|
|
671
|
+
error: ErrorResponse;
|
|
672
|
+
};
|
|
653
673
|
|
|
654
674
|
interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> {
|
|
655
675
|
object: 'domain';
|
|
656
676
|
records: DomainRecords[];
|
|
657
677
|
}
|
|
658
|
-
|
|
659
|
-
data: GetDomainResponseSuccess
|
|
660
|
-
error:
|
|
661
|
-
}
|
|
678
|
+
type GetDomainResponse = {
|
|
679
|
+
data: GetDomainResponseSuccess;
|
|
680
|
+
error: null;
|
|
681
|
+
} | {
|
|
682
|
+
data: null;
|
|
683
|
+
error: ErrorResponse;
|
|
684
|
+
};
|
|
662
685
|
|
|
663
686
|
type ListDomainsResponseSuccess = {
|
|
664
687
|
data: Domain[];
|
|
665
688
|
};
|
|
666
|
-
|
|
667
|
-
data: ListDomainsResponseSuccess
|
|
668
|
-
error:
|
|
669
|
-
}
|
|
689
|
+
type ListDomainsResponse = {
|
|
690
|
+
data: ListDomainsResponseSuccess;
|
|
691
|
+
error: null;
|
|
692
|
+
} | {
|
|
693
|
+
data: null;
|
|
694
|
+
error: ErrorResponse;
|
|
695
|
+
};
|
|
670
696
|
|
|
671
697
|
type RemoveDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
672
698
|
object: 'domain';
|
|
673
699
|
deleted: boolean;
|
|
674
700
|
};
|
|
675
|
-
|
|
676
|
-
data: RemoveDomainsResponseSuccess
|
|
677
|
-
error:
|
|
678
|
-
}
|
|
701
|
+
type RemoveDomainsResponse = {
|
|
702
|
+
data: RemoveDomainsResponseSuccess;
|
|
703
|
+
error: null;
|
|
704
|
+
} | {
|
|
705
|
+
data: null;
|
|
706
|
+
error: ErrorResponse;
|
|
707
|
+
};
|
|
679
708
|
|
|
680
709
|
interface UpdateDomainsOptions {
|
|
681
710
|
id: string;
|
|
@@ -686,18 +715,24 @@ interface UpdateDomainsOptions {
|
|
|
686
715
|
type UpdateDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
687
716
|
object: 'domain';
|
|
688
717
|
};
|
|
689
|
-
|
|
690
|
-
data: UpdateDomainsResponseSuccess
|
|
691
|
-
error:
|
|
692
|
-
}
|
|
718
|
+
type UpdateDomainsResponse = {
|
|
719
|
+
data: UpdateDomainsResponseSuccess;
|
|
720
|
+
error: null;
|
|
721
|
+
} | {
|
|
722
|
+
data: null;
|
|
723
|
+
error: ErrorResponse;
|
|
724
|
+
};
|
|
693
725
|
|
|
694
726
|
type VerifyDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
695
727
|
object: 'domain';
|
|
696
728
|
};
|
|
697
|
-
|
|
698
|
-
data: VerifyDomainsResponseSuccess
|
|
699
|
-
error:
|
|
700
|
-
}
|
|
729
|
+
type VerifyDomainsResponse = {
|
|
730
|
+
data: VerifyDomainsResponseSuccess;
|
|
731
|
+
error: null;
|
|
732
|
+
} | {
|
|
733
|
+
data: null;
|
|
734
|
+
error: ErrorResponse;
|
|
735
|
+
};
|
|
701
736
|
|
|
702
737
|
declare class Domains {
|
|
703
738
|
private readonly resend;
|
|
@@ -710,14 +745,17 @@ declare class Domains {
|
|
|
710
745
|
verify(id: string): Promise<VerifyDomainsResponse>;
|
|
711
746
|
}
|
|
712
747
|
|
|
713
|
-
interface CancelEmailResponse {
|
|
714
|
-
data: CancelEmailResponseSuccess | null;
|
|
715
|
-
error: ErrorResponse | null;
|
|
716
|
-
}
|
|
717
748
|
interface CancelEmailResponseSuccess {
|
|
718
749
|
object: 'email';
|
|
719
750
|
id: string;
|
|
720
751
|
}
|
|
752
|
+
type CancelEmailResponse = {
|
|
753
|
+
data: CancelEmailResponseSuccess;
|
|
754
|
+
error: null;
|
|
755
|
+
} | {
|
|
756
|
+
data: null;
|
|
757
|
+
error: ErrorResponse;
|
|
758
|
+
};
|
|
721
759
|
|
|
722
760
|
interface GetEmailResponseSuccess {
|
|
723
761
|
bcc: string[] | null;
|
|
@@ -734,10 +772,13 @@ interface GetEmailResponseSuccess {
|
|
|
734
772
|
scheduled_at: string | null;
|
|
735
773
|
object: 'email';
|
|
736
774
|
}
|
|
737
|
-
|
|
738
|
-
data: GetEmailResponseSuccess
|
|
739
|
-
error:
|
|
740
|
-
}
|
|
775
|
+
type GetEmailResponse = {
|
|
776
|
+
data: GetEmailResponseSuccess;
|
|
777
|
+
error: null;
|
|
778
|
+
} | {
|
|
779
|
+
data: null;
|
|
780
|
+
error: ErrorResponse;
|
|
781
|
+
};
|
|
741
782
|
|
|
742
783
|
interface UpdateEmailOptions {
|
|
743
784
|
id: string;
|
|
@@ -747,10 +788,13 @@ interface UpdateEmailResponseSuccess {
|
|
|
747
788
|
id: string;
|
|
748
789
|
object: 'email';
|
|
749
790
|
}
|
|
750
|
-
|
|
751
|
-
data: UpdateEmailResponseSuccess
|
|
752
|
-
error:
|
|
753
|
-
}
|
|
791
|
+
type UpdateEmailResponse = {
|
|
792
|
+
data: UpdateEmailResponseSuccess;
|
|
793
|
+
error: null;
|
|
794
|
+
} | {
|
|
795
|
+
data: null;
|
|
796
|
+
error: ErrorResponse;
|
|
797
|
+
};
|
|
754
798
|
|
|
755
799
|
declare class Emails {
|
|
756
800
|
private readonly resend;
|
|
@@ -763,69 +807,6 @@ declare class Emails {
|
|
|
763
807
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
764
808
|
}
|
|
765
809
|
|
|
766
|
-
interface Topic {
|
|
767
|
-
id: string;
|
|
768
|
-
name: string;
|
|
769
|
-
description?: string;
|
|
770
|
-
default_subscription: 'opt_in' | 'opt_out';
|
|
771
|
-
created_at: string;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
interface CreateTopicOptions {
|
|
775
|
-
name: string;
|
|
776
|
-
description?: string;
|
|
777
|
-
default_subscription: 'opt_in' | 'opt_out';
|
|
778
|
-
}
|
|
779
|
-
type CreateTopicResponseSuccess = Pick<Topic, 'id'>;
|
|
780
|
-
interface CreateTopicResponse {
|
|
781
|
-
data: CreateTopicResponseSuccess | null;
|
|
782
|
-
error: ErrorResponse | null;
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
type GetTopicResponseSuccess = Topic;
|
|
786
|
-
interface GetTopicResponse {
|
|
787
|
-
data: GetTopicResponseSuccess | null;
|
|
788
|
-
error: ErrorResponse | null;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
interface ListTopicsResponseSuccess {
|
|
792
|
-
data: Topic[];
|
|
793
|
-
}
|
|
794
|
-
interface ListTopicsResponse {
|
|
795
|
-
data: ListTopicsResponseSuccess | null;
|
|
796
|
-
error: ErrorResponse | null;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
type RemoveTopicResponseSuccess = Pick<Topic, 'id'> & {
|
|
800
|
-
object: 'topic';
|
|
801
|
-
deleted: boolean;
|
|
802
|
-
};
|
|
803
|
-
interface RemoveTopicResponse {
|
|
804
|
-
data: RemoveTopicResponseSuccess | null;
|
|
805
|
-
error: ErrorResponse | null;
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
interface UpdateTopicOptions {
|
|
809
|
-
id: string;
|
|
810
|
-
name?: string;
|
|
811
|
-
description?: string;
|
|
812
|
-
}
|
|
813
|
-
type UpdateTopicResponseSuccess = Pick<Topic, 'id'>;
|
|
814
|
-
interface UpdateTopicResponse {
|
|
815
|
-
data: UpdateTopicResponseSuccess | null;
|
|
816
|
-
error: ErrorResponse | null;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
declare class Topics {
|
|
820
|
-
private readonly resend;
|
|
821
|
-
constructor(resend: Resend);
|
|
822
|
-
create(payload: CreateTopicOptions): Promise<CreateTopicResponse>;
|
|
823
|
-
list(): Promise<ListTopicsResponse>;
|
|
824
|
-
get(id: string): Promise<GetTopicResponse>;
|
|
825
|
-
update(payload: UpdateTopicOptions): Promise<UpdateTopicResponse>;
|
|
826
|
-
remove(id: string): Promise<RemoveTopicResponse>;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
810
|
declare class Resend {
|
|
830
811
|
readonly key?: string | undefined;
|
|
831
812
|
private readonly headers;
|
|
@@ -836,31 +817,48 @@ declare class Resend {
|
|
|
836
817
|
readonly contacts: Contacts;
|
|
837
818
|
readonly domains: Domains;
|
|
838
819
|
readonly emails: Emails;
|
|
839
|
-
readonly topics: Topics;
|
|
840
820
|
constructor(key?: string | undefined);
|
|
841
821
|
fetchRequest<T>(path: string, options?: {}): Promise<{
|
|
842
|
-
data: T
|
|
843
|
-
error:
|
|
822
|
+
data: T;
|
|
823
|
+
error: null;
|
|
824
|
+
} | {
|
|
825
|
+
data: null;
|
|
826
|
+
error: ErrorResponse;
|
|
844
827
|
}>;
|
|
845
828
|
post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<{
|
|
846
|
-
data:
|
|
847
|
-
error: ErrorResponse
|
|
829
|
+
data: null;
|
|
830
|
+
error: ErrorResponse;
|
|
831
|
+
} | {
|
|
832
|
+
data: T;
|
|
833
|
+
error: null;
|
|
848
834
|
}>;
|
|
849
835
|
get<T>(path: string, options?: GetOptions): Promise<{
|
|
850
|
-
data:
|
|
851
|
-
error: ErrorResponse
|
|
836
|
+
data: null;
|
|
837
|
+
error: ErrorResponse;
|
|
838
|
+
} | {
|
|
839
|
+
data: T;
|
|
840
|
+
error: null;
|
|
852
841
|
}>;
|
|
853
842
|
put<T>(path: string, entity: unknown, options?: PutOptions): Promise<{
|
|
854
|
-
data:
|
|
855
|
-
error: ErrorResponse
|
|
843
|
+
data: null;
|
|
844
|
+
error: ErrorResponse;
|
|
845
|
+
} | {
|
|
846
|
+
data: T;
|
|
847
|
+
error: null;
|
|
856
848
|
}>;
|
|
857
849
|
patch<T>(path: string, entity: unknown, options?: PatchOptions): Promise<{
|
|
858
|
-
data:
|
|
859
|
-
error: ErrorResponse
|
|
850
|
+
data: null;
|
|
851
|
+
error: ErrorResponse;
|
|
852
|
+
} | {
|
|
853
|
+
data: T;
|
|
854
|
+
error: null;
|
|
860
855
|
}>;
|
|
861
856
|
delete<T>(path: string, query?: unknown): Promise<{
|
|
862
|
-
data:
|
|
863
|
-
error: ErrorResponse
|
|
857
|
+
data: null;
|
|
858
|
+
error: ErrorResponse;
|
|
859
|
+
} | {
|
|
860
|
+
data: T;
|
|
861
|
+
error: null;
|
|
864
862
|
}>;
|
|
865
863
|
}
|
|
866
864
|
|