resend 4.6.0 → 4.7.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 CHANGED
@@ -51,10 +51,13 @@ interface CreateApiKeyResponseSuccess {
51
51
  token: string;
52
52
  id: string;
53
53
  }
54
- interface CreateApiKeyResponse {
55
- data: CreateApiKeyResponseSuccess | null;
56
- error: ErrorResponse | null;
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
- interface ListApiKeysResponse {
67
- data: ListApiKeysResponseSuccess | null;
68
- error: ErrorResponse | null;
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
- interface RemoveApiKeyResponse {
73
- data: RemoveApiKeyResponseSuccess | null;
74
- error: ErrorResponse | null;
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
- interface CreateAudienceResponse {
100
- data: CreateAudienceResponseSuccess | null;
101
- error: ErrorResponse | null;
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
- interface GetAudienceResponse {
108
- data: GetAudienceResponseSuccess | null;
109
- error: ErrorResponse | null;
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
- interface ListAudiencesResponse {
117
- data: ListAudiencesResponseSuccess | null;
118
- error: ErrorResponse | null;
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
- interface RemoveAudiencesResponse {
126
- data: RemoveAudiencesResponseSuccess | null;
127
- error: ErrorResponse | null;
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
- interface CreateEmailResponse {
243
- data: CreateEmailResponseSuccess | null;
244
- error: ErrorResponse | null;
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
- interface CreateBatchResponse {
277
- data: CreateBatchSuccessResponse | null;
278
- error: ErrorResponse | null;
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
- interface CreateBroadcastResponse {
355
- data: CreateBroadcastResponseSuccess | null;
356
- error: ErrorResponse | null;
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
- interface GetBroadcastResponse {
377
- data: GetBroadcastResponseSuccess | null;
378
- error: ErrorResponse | null;
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
- interface ListBroadcastsResponse {
386
- data: ListBroadcastsResponseSuccess | null;
387
- error: ErrorResponse | null;
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
- interface RemoveBroadcastResponse {
395
- data: RemoveBroadcastResponseSuccess | null;
396
- error: ErrorResponse | null;
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
- interface SendBroadcastResponse {
417
- data: SendBroadcastResponseSuccess | null;
418
- error: ErrorResponse | null;
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
- interface UpdateBroadcastResponse {
435
- data: UpdateBroadcastResponseSuccess | null;
436
- error: ErrorResponse | null;
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
- interface CreateContactResponse {
479
- data: CreateContactResponseSuccess | null;
480
- error: ErrorResponse | null;
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
- interface GetContactResponse {
492
- data: GetContactResponseSuccess | null;
493
- error: ErrorResponse | null;
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
- interface ListContactsResponse {
504
- data: ListContactsResponseSuccess | null;
505
- error: ErrorResponse | null;
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
- interface RemoveContactsResponse {
531
- data: RemoveContactsResponseSuccess | null;
532
- error: ErrorResponse | null;
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,10 +602,13 @@ interface UpdateContactOptions extends UpdateContactBaseOptions {
545
602
  type UpdateContactResponseSuccess = Pick<Contact, 'id'> & {
546
603
  object: 'contact';
547
604
  };
548
- interface UpdateContactResponse {
549
- data: UpdateContactResponseSuccess | null;
550
- error: ErrorResponse | null;
551
- }
605
+ type UpdateContactResponse = {
606
+ data: UpdateContactResponseSuccess;
607
+ error: null;
608
+ } | {
609
+ data: null;
610
+ error: ErrorResponse;
611
+ };
552
612
 
553
613
  declare class Contacts {
554
614
  private readonly resend;
@@ -603,36 +663,48 @@ interface CreateDomainRequestOptions extends PostOptions {
603
663
  interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> {
604
664
  records: DomainRecords[];
605
665
  }
606
- interface CreateDomainResponse {
607
- data: CreateDomainResponseSuccess | null;
608
- error: ErrorResponse | null;
609
- }
666
+ type CreateDomainResponse = {
667
+ data: CreateDomainResponseSuccess;
668
+ error: null;
669
+ } | {
670
+ data: null;
671
+ error: ErrorResponse;
672
+ };
610
673
 
611
674
  interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> {
612
675
  object: 'domain';
613
676
  records: DomainRecords[];
614
677
  }
615
- interface GetDomainResponse {
616
- data: GetDomainResponseSuccess | null;
617
- error: ErrorResponse | null;
618
- }
678
+ type GetDomainResponse = {
679
+ data: GetDomainResponseSuccess;
680
+ error: null;
681
+ } | {
682
+ data: null;
683
+ error: ErrorResponse;
684
+ };
619
685
 
620
686
  type ListDomainsResponseSuccess = {
621
687
  data: Domain[];
622
688
  };
623
- interface ListDomainsResponse {
624
- data: ListDomainsResponseSuccess | null;
625
- error: ErrorResponse | null;
626
- }
689
+ type ListDomainsResponse = {
690
+ data: ListDomainsResponseSuccess;
691
+ error: null;
692
+ } | {
693
+ data: null;
694
+ error: ErrorResponse;
695
+ };
627
696
 
628
697
  type RemoveDomainsResponseSuccess = Pick<Domain, 'id'> & {
629
698
  object: 'domain';
630
699
  deleted: boolean;
631
700
  };
632
- interface RemoveDomainsResponse {
633
- data: RemoveDomainsResponseSuccess | null;
634
- error: ErrorResponse | null;
635
- }
701
+ type RemoveDomainsResponse = {
702
+ data: RemoveDomainsResponseSuccess;
703
+ error: null;
704
+ } | {
705
+ data: null;
706
+ error: ErrorResponse;
707
+ };
636
708
 
637
709
  interface UpdateDomainsOptions {
638
710
  id: string;
@@ -643,18 +715,24 @@ interface UpdateDomainsOptions {
643
715
  type UpdateDomainsResponseSuccess = Pick<Domain, 'id'> & {
644
716
  object: 'domain';
645
717
  };
646
- interface UpdateDomainsResponse {
647
- data: UpdateDomainsResponseSuccess | null;
648
- error: ErrorResponse | null;
649
- }
718
+ type UpdateDomainsResponse = {
719
+ data: UpdateDomainsResponseSuccess;
720
+ error: null;
721
+ } | {
722
+ data: null;
723
+ error: ErrorResponse;
724
+ };
650
725
 
651
726
  type VerifyDomainsResponseSuccess = Pick<Domain, 'id'> & {
652
727
  object: 'domain';
653
728
  };
654
- interface VerifyDomainsResponse {
655
- data: VerifyDomainsResponseSuccess | null;
656
- error: ErrorResponse | null;
657
- }
729
+ type VerifyDomainsResponse = {
730
+ data: VerifyDomainsResponseSuccess;
731
+ error: null;
732
+ } | {
733
+ data: null;
734
+ error: ErrorResponse;
735
+ };
658
736
 
659
737
  declare class Domains {
660
738
  private readonly resend;
@@ -667,14 +745,17 @@ declare class Domains {
667
745
  verify(id: string): Promise<VerifyDomainsResponse>;
668
746
  }
669
747
 
670
- interface CancelEmailResponse {
671
- data: CancelEmailResponseSuccess | null;
672
- error: ErrorResponse | null;
673
- }
674
748
  interface CancelEmailResponseSuccess {
675
749
  object: 'email';
676
750
  id: string;
677
751
  }
752
+ type CancelEmailResponse = {
753
+ data: CancelEmailResponseSuccess;
754
+ error: null;
755
+ } | {
756
+ data: null;
757
+ error: ErrorResponse;
758
+ };
678
759
 
679
760
  interface GetEmailResponseSuccess {
680
761
  bcc: string[] | null;
@@ -691,10 +772,13 @@ interface GetEmailResponseSuccess {
691
772
  scheduled_at: string | null;
692
773
  object: 'email';
693
774
  }
694
- interface GetEmailResponse {
695
- data: GetEmailResponseSuccess | null;
696
- error: ErrorResponse | null;
697
- }
775
+ type GetEmailResponse = {
776
+ data: GetEmailResponseSuccess;
777
+ error: null;
778
+ } | {
779
+ data: null;
780
+ error: ErrorResponse;
781
+ };
698
782
 
699
783
  interface UpdateEmailOptions {
700
784
  id: string;
@@ -704,10 +788,13 @@ interface UpdateEmailResponseSuccess {
704
788
  id: string;
705
789
  object: 'email';
706
790
  }
707
- interface UpdateEmailResponse {
708
- data: UpdateEmailResponseSuccess | null;
709
- error: ErrorResponse | null;
710
- }
791
+ type UpdateEmailResponse = {
792
+ data: UpdateEmailResponseSuccess;
793
+ error: null;
794
+ } | {
795
+ data: null;
796
+ error: ErrorResponse;
797
+ };
711
798
 
712
799
  declare class Emails {
713
800
  private readonly resend;
@@ -732,28 +819,46 @@ declare class Resend {
732
819
  readonly emails: Emails;
733
820
  constructor(key?: string | undefined);
734
821
  fetchRequest<T>(path: string, options?: {}): Promise<{
735
- data: T | null;
736
- error: ErrorResponse | null;
822
+ data: T;
823
+ error: null;
824
+ } | {
825
+ data: null;
826
+ error: ErrorResponse;
737
827
  }>;
738
828
  post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<{
739
- data: T | null;
740
- error: ErrorResponse | null;
829
+ data: null;
830
+ error: ErrorResponse;
831
+ } | {
832
+ data: T;
833
+ error: null;
741
834
  }>;
742
835
  get<T>(path: string, options?: GetOptions): Promise<{
743
- data: T | null;
744
- error: ErrorResponse | null;
836
+ data: null;
837
+ error: ErrorResponse;
838
+ } | {
839
+ data: T;
840
+ error: null;
745
841
  }>;
746
842
  put<T>(path: string, entity: unknown, options?: PutOptions): Promise<{
747
- data: T | null;
748
- error: ErrorResponse | null;
843
+ data: null;
844
+ error: ErrorResponse;
845
+ } | {
846
+ data: T;
847
+ error: null;
749
848
  }>;
750
849
  patch<T>(path: string, entity: unknown, options?: PatchOptions): Promise<{
751
- data: T | null;
752
- error: ErrorResponse | null;
850
+ data: null;
851
+ error: ErrorResponse;
852
+ } | {
853
+ data: T;
854
+ error: null;
753
855
  }>;
754
856
  delete<T>(path: string, query?: unknown): Promise<{
755
- data: T | null;
756
- error: ErrorResponse | null;
857
+ data: null;
858
+ error: ErrorResponse;
859
+ } | {
860
+ data: T;
861
+ error: null;
757
862
  }>;
758
863
  }
759
864
 
package/dist/index.d.ts CHANGED
@@ -51,10 +51,13 @@ interface CreateApiKeyResponseSuccess {
51
51
  token: string;
52
52
  id: string;
53
53
  }
54
- interface CreateApiKeyResponse {
55
- data: CreateApiKeyResponseSuccess | null;
56
- error: ErrorResponse | null;
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
- interface ListApiKeysResponse {
67
- data: ListApiKeysResponseSuccess | null;
68
- error: ErrorResponse | null;
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
- interface RemoveApiKeyResponse {
73
- data: RemoveApiKeyResponseSuccess | null;
74
- error: ErrorResponse | null;
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
- interface CreateAudienceResponse {
100
- data: CreateAudienceResponseSuccess | null;
101
- error: ErrorResponse | null;
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
- interface GetAudienceResponse {
108
- data: GetAudienceResponseSuccess | null;
109
- error: ErrorResponse | null;
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
- interface ListAudiencesResponse {
117
- data: ListAudiencesResponseSuccess | null;
118
- error: ErrorResponse | null;
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
- interface RemoveAudiencesResponse {
126
- data: RemoveAudiencesResponseSuccess | null;
127
- error: ErrorResponse | null;
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
- interface CreateEmailResponse {
243
- data: CreateEmailResponseSuccess | null;
244
- error: ErrorResponse | null;
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
- interface CreateBatchResponse {
277
- data: CreateBatchSuccessResponse | null;
278
- error: ErrorResponse | null;
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
- interface CreateBroadcastResponse {
355
- data: CreateBroadcastResponseSuccess | null;
356
- error: ErrorResponse | null;
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
- interface GetBroadcastResponse {
377
- data: GetBroadcastResponseSuccess | null;
378
- error: ErrorResponse | null;
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
- interface ListBroadcastsResponse {
386
- data: ListBroadcastsResponseSuccess | null;
387
- error: ErrorResponse | null;
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
- interface RemoveBroadcastResponse {
395
- data: RemoveBroadcastResponseSuccess | null;
396
- error: ErrorResponse | null;
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
- interface SendBroadcastResponse {
417
- data: SendBroadcastResponseSuccess | null;
418
- error: ErrorResponse | null;
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
- interface UpdateBroadcastResponse {
435
- data: UpdateBroadcastResponseSuccess | null;
436
- error: ErrorResponse | null;
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
- interface CreateContactResponse {
479
- data: CreateContactResponseSuccess | null;
480
- error: ErrorResponse | null;
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
- interface GetContactResponse {
492
- data: GetContactResponseSuccess | null;
493
- error: ErrorResponse | null;
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
- interface ListContactsResponse {
504
- data: ListContactsResponseSuccess | null;
505
- error: ErrorResponse | null;
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
- interface RemoveContactsResponse {
531
- data: RemoveContactsResponseSuccess | null;
532
- error: ErrorResponse | null;
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,10 +602,13 @@ interface UpdateContactOptions extends UpdateContactBaseOptions {
545
602
  type UpdateContactResponseSuccess = Pick<Contact, 'id'> & {
546
603
  object: 'contact';
547
604
  };
548
- interface UpdateContactResponse {
549
- data: UpdateContactResponseSuccess | null;
550
- error: ErrorResponse | null;
551
- }
605
+ type UpdateContactResponse = {
606
+ data: UpdateContactResponseSuccess;
607
+ error: null;
608
+ } | {
609
+ data: null;
610
+ error: ErrorResponse;
611
+ };
552
612
 
553
613
  declare class Contacts {
554
614
  private readonly resend;
@@ -603,36 +663,48 @@ interface CreateDomainRequestOptions extends PostOptions {
603
663
  interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> {
604
664
  records: DomainRecords[];
605
665
  }
606
- interface CreateDomainResponse {
607
- data: CreateDomainResponseSuccess | null;
608
- error: ErrorResponse | null;
609
- }
666
+ type CreateDomainResponse = {
667
+ data: CreateDomainResponseSuccess;
668
+ error: null;
669
+ } | {
670
+ data: null;
671
+ error: ErrorResponse;
672
+ };
610
673
 
611
674
  interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> {
612
675
  object: 'domain';
613
676
  records: DomainRecords[];
614
677
  }
615
- interface GetDomainResponse {
616
- data: GetDomainResponseSuccess | null;
617
- error: ErrorResponse | null;
618
- }
678
+ type GetDomainResponse = {
679
+ data: GetDomainResponseSuccess;
680
+ error: null;
681
+ } | {
682
+ data: null;
683
+ error: ErrorResponse;
684
+ };
619
685
 
620
686
  type ListDomainsResponseSuccess = {
621
687
  data: Domain[];
622
688
  };
623
- interface ListDomainsResponse {
624
- data: ListDomainsResponseSuccess | null;
625
- error: ErrorResponse | null;
626
- }
689
+ type ListDomainsResponse = {
690
+ data: ListDomainsResponseSuccess;
691
+ error: null;
692
+ } | {
693
+ data: null;
694
+ error: ErrorResponse;
695
+ };
627
696
 
628
697
  type RemoveDomainsResponseSuccess = Pick<Domain, 'id'> & {
629
698
  object: 'domain';
630
699
  deleted: boolean;
631
700
  };
632
- interface RemoveDomainsResponse {
633
- data: RemoveDomainsResponseSuccess | null;
634
- error: ErrorResponse | null;
635
- }
701
+ type RemoveDomainsResponse = {
702
+ data: RemoveDomainsResponseSuccess;
703
+ error: null;
704
+ } | {
705
+ data: null;
706
+ error: ErrorResponse;
707
+ };
636
708
 
637
709
  interface UpdateDomainsOptions {
638
710
  id: string;
@@ -643,18 +715,24 @@ interface UpdateDomainsOptions {
643
715
  type UpdateDomainsResponseSuccess = Pick<Domain, 'id'> & {
644
716
  object: 'domain';
645
717
  };
646
- interface UpdateDomainsResponse {
647
- data: UpdateDomainsResponseSuccess | null;
648
- error: ErrorResponse | null;
649
- }
718
+ type UpdateDomainsResponse = {
719
+ data: UpdateDomainsResponseSuccess;
720
+ error: null;
721
+ } | {
722
+ data: null;
723
+ error: ErrorResponse;
724
+ };
650
725
 
651
726
  type VerifyDomainsResponseSuccess = Pick<Domain, 'id'> & {
652
727
  object: 'domain';
653
728
  };
654
- interface VerifyDomainsResponse {
655
- data: VerifyDomainsResponseSuccess | null;
656
- error: ErrorResponse | null;
657
- }
729
+ type VerifyDomainsResponse = {
730
+ data: VerifyDomainsResponseSuccess;
731
+ error: null;
732
+ } | {
733
+ data: null;
734
+ error: ErrorResponse;
735
+ };
658
736
 
659
737
  declare class Domains {
660
738
  private readonly resend;
@@ -667,14 +745,17 @@ declare class Domains {
667
745
  verify(id: string): Promise<VerifyDomainsResponse>;
668
746
  }
669
747
 
670
- interface CancelEmailResponse {
671
- data: CancelEmailResponseSuccess | null;
672
- error: ErrorResponse | null;
673
- }
674
748
  interface CancelEmailResponseSuccess {
675
749
  object: 'email';
676
750
  id: string;
677
751
  }
752
+ type CancelEmailResponse = {
753
+ data: CancelEmailResponseSuccess;
754
+ error: null;
755
+ } | {
756
+ data: null;
757
+ error: ErrorResponse;
758
+ };
678
759
 
679
760
  interface GetEmailResponseSuccess {
680
761
  bcc: string[] | null;
@@ -691,10 +772,13 @@ interface GetEmailResponseSuccess {
691
772
  scheduled_at: string | null;
692
773
  object: 'email';
693
774
  }
694
- interface GetEmailResponse {
695
- data: GetEmailResponseSuccess | null;
696
- error: ErrorResponse | null;
697
- }
775
+ type GetEmailResponse = {
776
+ data: GetEmailResponseSuccess;
777
+ error: null;
778
+ } | {
779
+ data: null;
780
+ error: ErrorResponse;
781
+ };
698
782
 
699
783
  interface UpdateEmailOptions {
700
784
  id: string;
@@ -704,10 +788,13 @@ interface UpdateEmailResponseSuccess {
704
788
  id: string;
705
789
  object: 'email';
706
790
  }
707
- interface UpdateEmailResponse {
708
- data: UpdateEmailResponseSuccess | null;
709
- error: ErrorResponse | null;
710
- }
791
+ type UpdateEmailResponse = {
792
+ data: UpdateEmailResponseSuccess;
793
+ error: null;
794
+ } | {
795
+ data: null;
796
+ error: ErrorResponse;
797
+ };
711
798
 
712
799
  declare class Emails {
713
800
  private readonly resend;
@@ -732,28 +819,46 @@ declare class Resend {
732
819
  readonly emails: Emails;
733
820
  constructor(key?: string | undefined);
734
821
  fetchRequest<T>(path: string, options?: {}): Promise<{
735
- data: T | null;
736
- error: ErrorResponse | null;
822
+ data: T;
823
+ error: null;
824
+ } | {
825
+ data: null;
826
+ error: ErrorResponse;
737
827
  }>;
738
828
  post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<{
739
- data: T | null;
740
- error: ErrorResponse | null;
829
+ data: null;
830
+ error: ErrorResponse;
831
+ } | {
832
+ data: T;
833
+ error: null;
741
834
  }>;
742
835
  get<T>(path: string, options?: GetOptions): Promise<{
743
- data: T | null;
744
- error: ErrorResponse | null;
836
+ data: null;
837
+ error: ErrorResponse;
838
+ } | {
839
+ data: T;
840
+ error: null;
745
841
  }>;
746
842
  put<T>(path: string, entity: unknown, options?: PutOptions): Promise<{
747
- data: T | null;
748
- error: ErrorResponse | null;
843
+ data: null;
844
+ error: ErrorResponse;
845
+ } | {
846
+ data: T;
847
+ error: null;
749
848
  }>;
750
849
  patch<T>(path: string, entity: unknown, options?: PatchOptions): Promise<{
751
- data: T | null;
752
- error: ErrorResponse | null;
850
+ data: null;
851
+ error: ErrorResponse;
852
+ } | {
853
+ data: T;
854
+ error: null;
753
855
  }>;
754
856
  delete<T>(path: string, query?: unknown): Promise<{
755
- data: T | null;
756
- error: ErrorResponse | null;
857
+ data: null;
858
+ error: ErrorResponse;
859
+ } | {
860
+ data: T;
861
+ error: null;
757
862
  }>;
758
863
  }
759
864
 
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ __export(src_exports, {
72
72
  module.exports = __toCommonJS(src_exports);
73
73
 
74
74
  // package.json
75
- var version = "4.6.0";
75
+ var version = "4.7.0-canary.0";
76
76
 
77
77
  // src/api-keys/api-keys.ts
78
78
  var ApiKeys = class {
package/dist/index.mjs CHANGED
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
39
39
  };
40
40
 
41
41
  // package.json
42
- var version = "4.6.0";
42
+ var version = "4.7.0-canary.0";
43
43
 
44
44
  // src/api-keys/api-keys.ts
45
45
  var ApiKeys = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend",
3
- "version": "4.6.0",
3
+ "version": "4.7.0-canary.0",
4
4
  "description": "Node.js library for the Resend API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",