resend 6.1.0-canary.1 → 6.1.1
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 +461 -182
- package/dist/index.d.ts +461 -182
- package/dist/index.js +131 -123
- package/dist/index.mjs +131 -123
- package/package.json +4 -4
- package/readme.md +14 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,42 +1,17 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
interface PostOptions {
|
|
8
|
-
query?: {
|
|
9
|
-
[key: string]: unknown;
|
|
10
|
-
};
|
|
3
|
+
interface ApiKey {
|
|
4
|
+
created_at: string;
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
11
7
|
}
|
|
12
8
|
|
|
13
|
-
interface
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
interface DomainApiOptions {
|
|
10
|
+
name: string;
|
|
11
|
+
region?: string;
|
|
12
|
+
custom_return_path?: string;
|
|
17
13
|
}
|
|
18
14
|
|
|
19
|
-
type RateLimit = {
|
|
20
|
-
/**
|
|
21
|
-
* The maximum amount of requests that can be made in the time window of {@link shouldResetAfter}.
|
|
22
|
-
*/
|
|
23
|
-
limit: number;
|
|
24
|
-
/**
|
|
25
|
-
* The amount of requests that can still be made before hitting {@link RateLimit.limit}.
|
|
26
|
-
*
|
|
27
|
-
* Resets after the seconds in {@link RateLimit.shouldResetAfter} go by.
|
|
28
|
-
*/
|
|
29
|
-
remainingRequests: number;
|
|
30
|
-
/**
|
|
31
|
-
* The number of seconds after which the rate limiting will reset,
|
|
32
|
-
* and {@link RateLimit.remainingRequests} goes back to the value of
|
|
33
|
-
* {@link RateLimit.limit}.
|
|
34
|
-
*
|
|
35
|
-
* @see {@link import('./interfaces').Response.retryAfter}
|
|
36
|
-
*/
|
|
37
|
-
shouldResetAfter: number;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
15
|
declare const RESEND_ERROR_CODES_BY_KEY: {
|
|
41
16
|
readonly missing_required_field: 422;
|
|
42
17
|
readonly invalid_idempotency_key: 400;
|
|
@@ -47,7 +22,7 @@ declare const RESEND_ERROR_CODES_BY_KEY: {
|
|
|
47
22
|
readonly invalid_region: 422;
|
|
48
23
|
readonly rate_limit_exceeded: 429;
|
|
49
24
|
readonly missing_api_key: 401;
|
|
50
|
-
readonly
|
|
25
|
+
readonly invalid_api_key: 403;
|
|
51
26
|
readonly invalid_from_address: 403;
|
|
52
27
|
readonly validation_error: 403;
|
|
53
28
|
readonly not_found: 404;
|
|
@@ -56,26 +31,100 @@ declare const RESEND_ERROR_CODES_BY_KEY: {
|
|
|
56
31
|
readonly internal_server_error: 500;
|
|
57
32
|
};
|
|
58
33
|
type RESEND_ERROR_CODE_KEY = keyof typeof RESEND_ERROR_CODES_BY_KEY;
|
|
59
|
-
|
|
60
|
-
message: string;
|
|
61
|
-
name: Exclude<RESEND_ERROR_CODE_KEY, 'rate_limit_exceeded'>;
|
|
62
|
-
} | {
|
|
34
|
+
interface ErrorResponse {
|
|
63
35
|
message: string;
|
|
64
|
-
name:
|
|
36
|
+
name: RESEND_ERROR_CODE_KEY;
|
|
37
|
+
}
|
|
38
|
+
type Tag$1 = {
|
|
39
|
+
name: string;
|
|
40
|
+
value: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
interface EmailApiAttachment {
|
|
44
|
+
content?: string | Buffer;
|
|
45
|
+
filename?: string | false | undefined;
|
|
46
|
+
path?: string;
|
|
47
|
+
content_type?: string;
|
|
48
|
+
content_id?: string;
|
|
49
|
+
}
|
|
50
|
+
interface EmailApiOptions {
|
|
51
|
+
from: string;
|
|
52
|
+
to: string | string[];
|
|
53
|
+
subject: string;
|
|
54
|
+
region?: string;
|
|
55
|
+
headers?: Record<string, string>;
|
|
56
|
+
html?: string;
|
|
57
|
+
text?: string;
|
|
58
|
+
bcc?: string | string[];
|
|
59
|
+
cc?: string | string[];
|
|
60
|
+
reply_to?: string | string[];
|
|
61
|
+
scheduled_at?: string;
|
|
62
|
+
tags?: Tag$1[];
|
|
63
|
+
attachments?: EmailApiAttachment[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface GetOptions {
|
|
67
|
+
query?: Record<string, unknown>;
|
|
68
|
+
headers?: HeadersInit;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface IdempotentRequest {
|
|
65
72
|
/**
|
|
66
|
-
*
|
|
73
|
+
* Unique key that ensures the same operation is not processed multiple times.
|
|
74
|
+
* Allows for safe retries without duplicating operations.
|
|
75
|
+
* If provided, will be sent as the `Idempotency-Key` header.
|
|
67
76
|
*/
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
idempotencyKey?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface List<T> {
|
|
81
|
+
readonly object: 'list';
|
|
82
|
+
data: T[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
type PaginationOptions = {
|
|
86
|
+
/**
|
|
87
|
+
* Maximum number of items to return (1-100, default: 20)
|
|
88
|
+
*/
|
|
89
|
+
limit?: number;
|
|
90
|
+
} & ({
|
|
91
|
+
/**
|
|
92
|
+
* Get items after this cursor (cannot be used with 'before')
|
|
93
|
+
*/
|
|
94
|
+
after?: string;
|
|
95
|
+
before?: never;
|
|
74
96
|
} | {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Get items before this cursor (cannot be used with 'after')
|
|
99
|
+
*/
|
|
100
|
+
before?: string;
|
|
101
|
+
after?: never;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
interface PatchOptions {
|
|
105
|
+
query?: {
|
|
106
|
+
[key: string]: unknown;
|
|
107
|
+
};
|
|
108
|
+
headers?: HeadersInit;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface PostOptions {
|
|
112
|
+
query?: {
|
|
113
|
+
[key: string]: unknown;
|
|
114
|
+
};
|
|
115
|
+
headers?: HeadersInit;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface PutOptions {
|
|
119
|
+
query?: {
|
|
120
|
+
[key: string]: unknown;
|
|
121
|
+
};
|
|
122
|
+
headers?: HeadersInit;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
type RequireAtLeastOne<T> = {
|
|
126
|
+
[K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
|
|
127
|
+
}[keyof T];
|
|
79
128
|
|
|
80
129
|
interface CreateApiKeyOptions {
|
|
81
130
|
name: string;
|
|
@@ -88,19 +137,36 @@ interface CreateApiKeyResponseSuccess {
|
|
|
88
137
|
token: string;
|
|
89
138
|
id: string;
|
|
90
139
|
}
|
|
91
|
-
type CreateApiKeyResponse =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
140
|
+
type CreateApiKeyResponse = {
|
|
141
|
+
data: CreateApiKeyResponseSuccess;
|
|
142
|
+
error: null;
|
|
143
|
+
} | {
|
|
144
|
+
data: null;
|
|
145
|
+
error: ErrorResponse;
|
|
146
|
+
};
|
|
98
147
|
|
|
99
|
-
type
|
|
100
|
-
type
|
|
148
|
+
type ListApiKeysOptions = PaginationOptions;
|
|
149
|
+
type ListApiKeysResponseSuccess = {
|
|
150
|
+
object: 'list';
|
|
151
|
+
has_more: boolean;
|
|
152
|
+
data: Pick<ApiKey, 'name' | 'id' | 'created_at'>[];
|
|
153
|
+
};
|
|
154
|
+
type ListApiKeysResponse = {
|
|
155
|
+
data: ListApiKeysResponseSuccess;
|
|
156
|
+
error: null;
|
|
157
|
+
} | {
|
|
158
|
+
data: null;
|
|
159
|
+
error: ErrorResponse;
|
|
160
|
+
};
|
|
101
161
|
|
|
102
162
|
type RemoveApiKeyResponseSuccess = {};
|
|
103
|
-
type RemoveApiKeyResponse =
|
|
163
|
+
type RemoveApiKeyResponse = {
|
|
164
|
+
data: RemoveApiKeyResponseSuccess;
|
|
165
|
+
error: null;
|
|
166
|
+
} | {
|
|
167
|
+
data: null;
|
|
168
|
+
error: ErrorResponse;
|
|
169
|
+
};
|
|
104
170
|
|
|
105
171
|
interface Audience {
|
|
106
172
|
created_at: string;
|
|
@@ -116,37 +182,50 @@ interface CreateAudienceRequestOptions extends PostOptions {
|
|
|
116
182
|
interface CreateAudienceResponseSuccess extends Pick<Audience, 'name' | 'id'> {
|
|
117
183
|
object: 'audience';
|
|
118
184
|
}
|
|
119
|
-
type CreateAudienceResponse =
|
|
185
|
+
type CreateAudienceResponse = {
|
|
186
|
+
data: CreateAudienceResponseSuccess;
|
|
187
|
+
error: null;
|
|
188
|
+
} | {
|
|
189
|
+
data: null;
|
|
190
|
+
error: ErrorResponse;
|
|
191
|
+
};
|
|
120
192
|
|
|
121
193
|
interface GetAudienceResponseSuccess extends Pick<Audience, 'id' | 'name' | 'created_at'> {
|
|
122
194
|
object: 'audience';
|
|
123
195
|
}
|
|
124
|
-
type GetAudienceResponse =
|
|
196
|
+
type GetAudienceResponse = {
|
|
197
|
+
data: GetAudienceResponseSuccess;
|
|
198
|
+
error: null;
|
|
199
|
+
} | {
|
|
200
|
+
data: null;
|
|
201
|
+
error: ErrorResponse;
|
|
202
|
+
};
|
|
125
203
|
|
|
204
|
+
type ListAudiencesOptions = PaginationOptions;
|
|
126
205
|
type ListAudiencesResponseSuccess = {
|
|
127
206
|
object: 'list';
|
|
128
207
|
data: Audience[];
|
|
208
|
+
has_more: boolean;
|
|
209
|
+
};
|
|
210
|
+
type ListAudiencesResponse = {
|
|
211
|
+
data: ListAudiencesResponseSuccess;
|
|
212
|
+
error: null;
|
|
213
|
+
} | {
|
|
214
|
+
data: null;
|
|
215
|
+
error: ErrorResponse;
|
|
129
216
|
};
|
|
130
|
-
type ListAudiencesResponse = Response<ListAudiencesResponseSuccess>;
|
|
131
217
|
|
|
132
218
|
interface RemoveAudiencesResponseSuccess extends Pick<Audience, 'id'> {
|
|
133
219
|
object: 'audience';
|
|
134
220
|
deleted: boolean;
|
|
135
221
|
}
|
|
136
|
-
type RemoveAudiencesResponse =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
*/
|
|
144
|
-
idempotencyKey?: string;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
type RequireAtLeastOne<T> = {
|
|
148
|
-
[K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
|
|
149
|
-
}[keyof T];
|
|
222
|
+
type RemoveAudiencesResponse = {
|
|
223
|
+
data: RemoveAudiencesResponseSuccess;
|
|
224
|
+
error: null;
|
|
225
|
+
} | {
|
|
226
|
+
data: null;
|
|
227
|
+
error: ErrorResponse;
|
|
228
|
+
};
|
|
150
229
|
|
|
151
230
|
interface EmailRenderOptions$1 {
|
|
152
231
|
/**
|
|
@@ -238,7 +317,13 @@ interface CreateEmailResponseSuccess {
|
|
|
238
317
|
/** The ID of the newly created email. */
|
|
239
318
|
id: string;
|
|
240
319
|
}
|
|
241
|
-
type CreateEmailResponse =
|
|
320
|
+
type CreateEmailResponse = {
|
|
321
|
+
data: CreateEmailResponseSuccess;
|
|
322
|
+
error: null;
|
|
323
|
+
} | {
|
|
324
|
+
data: null;
|
|
325
|
+
error: ErrorResponse;
|
|
326
|
+
};
|
|
242
327
|
interface Attachment {
|
|
243
328
|
/** Content of an attached file. */
|
|
244
329
|
content?: string | Buffer;
|
|
@@ -267,14 +352,52 @@ type Tag = {
|
|
|
267
352
|
|
|
268
353
|
type CreateBatchOptions = CreateEmailOptions[];
|
|
269
354
|
interface CreateBatchRequestOptions extends PostOptions, IdempotentRequest {
|
|
355
|
+
/**
|
|
356
|
+
* @default 'strict'
|
|
357
|
+
*/
|
|
358
|
+
batchValidation?: 'strict' | 'permissive';
|
|
270
359
|
}
|
|
271
|
-
|
|
360
|
+
type CreateBatchSuccessResponse<Options extends CreateBatchRequestOptions = CreateBatchRequestOptions> = {
|
|
272
361
|
data: {
|
|
273
362
|
/** The ID of the newly created email. */
|
|
274
363
|
id: string;
|
|
275
364
|
}[];
|
|
365
|
+
} & (Options['batchValidation'] extends 'permissive' ? {
|
|
366
|
+
/**
|
|
367
|
+
* Only present when header "x-batch-validation" is set to 'permissive'.
|
|
368
|
+
*/
|
|
369
|
+
errors: {
|
|
370
|
+
/**
|
|
371
|
+
* The index of the failed email in the batch
|
|
372
|
+
*/
|
|
373
|
+
index: number;
|
|
374
|
+
/**
|
|
375
|
+
* The error message for the failed email
|
|
376
|
+
*/
|
|
377
|
+
message: string;
|
|
378
|
+
}[];
|
|
379
|
+
} : Record<string, never>);
|
|
380
|
+
type CreateBatchResponse<Options extends CreateBatchRequestOptions> = {
|
|
381
|
+
data: CreateBatchSuccessResponse<Options>;
|
|
382
|
+
error: null;
|
|
383
|
+
} | {
|
|
384
|
+
data: null;
|
|
385
|
+
error: ErrorResponse;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
interface Broadcast {
|
|
389
|
+
id: string;
|
|
390
|
+
name: string;
|
|
391
|
+
audience_id: string | null;
|
|
392
|
+
from: string | null;
|
|
393
|
+
subject: string | null;
|
|
394
|
+
reply_to: string[] | null;
|
|
395
|
+
preview_text: string | null;
|
|
396
|
+
status: 'draft' | 'sent' | 'queued';
|
|
397
|
+
created_at: string;
|
|
398
|
+
scheduled_at: string | null;
|
|
399
|
+
sent_at: string | null;
|
|
276
400
|
}
|
|
277
|
-
type CreateBatchResponse = Response<CreateBatchSuccessResponse>;
|
|
278
401
|
|
|
279
402
|
interface EmailRenderOptions {
|
|
280
403
|
/**
|
|
@@ -341,7 +464,50 @@ interface CreateBroadcastResponseSuccess {
|
|
|
341
464
|
/** The ID of the newly sent broadcasts. */
|
|
342
465
|
id: string;
|
|
343
466
|
}
|
|
344
|
-
type CreateBroadcastResponse =
|
|
467
|
+
type CreateBroadcastResponse = {
|
|
468
|
+
data: CreateBroadcastResponseSuccess;
|
|
469
|
+
error: null;
|
|
470
|
+
} | {
|
|
471
|
+
data: null;
|
|
472
|
+
error: ErrorResponse;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
interface GetBroadcastResponseSuccess extends Broadcast {
|
|
476
|
+
object: 'broadcast';
|
|
477
|
+
}
|
|
478
|
+
type GetBroadcastResponse = {
|
|
479
|
+
data: GetBroadcastResponseSuccess;
|
|
480
|
+
error: null;
|
|
481
|
+
} | {
|
|
482
|
+
data: null;
|
|
483
|
+
error: ErrorResponse;
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
type ListBroadcastsOptions = PaginationOptions;
|
|
487
|
+
type ListBroadcastsResponseSuccess = {
|
|
488
|
+
object: 'list';
|
|
489
|
+
has_more: boolean;
|
|
490
|
+
data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
|
|
491
|
+
};
|
|
492
|
+
type ListBroadcastsResponse = {
|
|
493
|
+
data: ListBroadcastsResponseSuccess;
|
|
494
|
+
error: null;
|
|
495
|
+
} | {
|
|
496
|
+
data: null;
|
|
497
|
+
error: ErrorResponse;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
interface RemoveBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
|
|
501
|
+
object: 'broadcast';
|
|
502
|
+
deleted: boolean;
|
|
503
|
+
}
|
|
504
|
+
type RemoveBroadcastResponse = {
|
|
505
|
+
data: RemoveBroadcastResponseSuccess;
|
|
506
|
+
error: null;
|
|
507
|
+
} | {
|
|
508
|
+
data: null;
|
|
509
|
+
error: ErrorResponse;
|
|
510
|
+
};
|
|
345
511
|
|
|
346
512
|
interface SendBroadcastBaseOptions {
|
|
347
513
|
/**
|
|
@@ -360,7 +526,35 @@ interface SendBroadcastResponseSuccess {
|
|
|
360
526
|
/** The ID of the sent broadcast. */
|
|
361
527
|
id: string;
|
|
362
528
|
}
|
|
363
|
-
type SendBroadcastResponse =
|
|
529
|
+
type SendBroadcastResponse = {
|
|
530
|
+
data: SendBroadcastResponseSuccess;
|
|
531
|
+
error: null;
|
|
532
|
+
} | {
|
|
533
|
+
data: null;
|
|
534
|
+
error: ErrorResponse;
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
interface UpdateBroadcastResponseSuccess {
|
|
538
|
+
id: string;
|
|
539
|
+
}
|
|
540
|
+
type UpdateBroadcastOptions = {
|
|
541
|
+
name?: string;
|
|
542
|
+
audienceId?: string;
|
|
543
|
+
from?: string;
|
|
544
|
+
html?: string;
|
|
545
|
+
react?: React.ReactNode;
|
|
546
|
+
text?: string;
|
|
547
|
+
subject?: string;
|
|
548
|
+
replyTo?: string[];
|
|
549
|
+
previewText?: string;
|
|
550
|
+
};
|
|
551
|
+
type UpdateBroadcastResponse = {
|
|
552
|
+
data: UpdateBroadcastResponseSuccess;
|
|
553
|
+
error: null;
|
|
554
|
+
} | {
|
|
555
|
+
data: null;
|
|
556
|
+
error: ErrorResponse;
|
|
557
|
+
};
|
|
364
558
|
|
|
365
559
|
interface Contact {
|
|
366
560
|
created_at: string;
|
|
@@ -410,7 +604,13 @@ interface CreateContactRequestOptions extends PostOptions {
|
|
|
410
604
|
interface CreateContactResponseSuccess extends Pick<Contact, 'id'> {
|
|
411
605
|
object: 'contact';
|
|
412
606
|
}
|
|
413
|
-
type CreateContactResponse =
|
|
607
|
+
type CreateContactResponse = {
|
|
608
|
+
data: CreateContactResponseSuccess;
|
|
609
|
+
error: null;
|
|
610
|
+
} | {
|
|
611
|
+
data: null;
|
|
612
|
+
error: ErrorResponse;
|
|
613
|
+
};
|
|
414
614
|
|
|
415
615
|
type GetContactOptions = {
|
|
416
616
|
audienceId: string;
|
|
@@ -418,16 +618,29 @@ type GetContactOptions = {
|
|
|
418
618
|
interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'email' | 'created_at' | 'first_name' | 'last_name' | 'unsubscribed'> {
|
|
419
619
|
object: 'contact';
|
|
420
620
|
}
|
|
421
|
-
type GetContactResponse =
|
|
621
|
+
type GetContactResponse = {
|
|
622
|
+
data: GetContactResponseSuccess;
|
|
623
|
+
error: null;
|
|
624
|
+
} | {
|
|
625
|
+
data: null;
|
|
626
|
+
error: ErrorResponse;
|
|
627
|
+
};
|
|
422
628
|
|
|
423
|
-
|
|
629
|
+
type ListContactsOptions = {
|
|
424
630
|
audienceId: string;
|
|
425
|
-
}
|
|
631
|
+
} & PaginationOptions;
|
|
426
632
|
interface ListContactsResponseSuccess {
|
|
427
633
|
object: 'list';
|
|
428
634
|
data: Contact[];
|
|
635
|
+
has_more: boolean;
|
|
429
636
|
}
|
|
430
|
-
type ListContactsResponse =
|
|
637
|
+
type ListContactsResponse = {
|
|
638
|
+
data: ListContactsResponseSuccess;
|
|
639
|
+
error: null;
|
|
640
|
+
} | {
|
|
641
|
+
data: null;
|
|
642
|
+
error: ErrorResponse;
|
|
643
|
+
};
|
|
431
644
|
|
|
432
645
|
type RemoveContactsResponseSuccess = {
|
|
433
646
|
object: 'contact';
|
|
@@ -437,7 +650,13 @@ type RemoveContactsResponseSuccess = {
|
|
|
437
650
|
type RemoveContactOptions = SelectingField & {
|
|
438
651
|
audienceId: string;
|
|
439
652
|
};
|
|
440
|
-
type RemoveContactsResponse =
|
|
653
|
+
type RemoveContactsResponse = {
|
|
654
|
+
data: RemoveContactsResponseSuccess;
|
|
655
|
+
error: null;
|
|
656
|
+
} | {
|
|
657
|
+
data: null;
|
|
658
|
+
error: ErrorResponse;
|
|
659
|
+
};
|
|
441
660
|
|
|
442
661
|
type UpdateContactOptions = {
|
|
443
662
|
audienceId: string;
|
|
@@ -448,9 +667,16 @@ type UpdateContactOptions = {
|
|
|
448
667
|
type UpdateContactResponseSuccess = Pick<Contact, 'id'> & {
|
|
449
668
|
object: 'contact';
|
|
450
669
|
};
|
|
451
|
-
type UpdateContactResponse =
|
|
670
|
+
type UpdateContactResponse = {
|
|
671
|
+
data: UpdateContactResponseSuccess;
|
|
672
|
+
error: null;
|
|
673
|
+
} | {
|
|
674
|
+
data: null;
|
|
675
|
+
error: ErrorResponse;
|
|
676
|
+
};
|
|
452
677
|
|
|
453
678
|
type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1';
|
|
679
|
+
type DomainNameservers = 'Amazon Route 53' | 'Cloudflare' | 'Digital Ocean' | 'GoDaddy' | 'Google Domains' | 'Namecheap' | 'Unidentified' | 'Vercel';
|
|
454
680
|
type DomainStatus = 'pending' | 'verified' | 'failed' | 'temporary_failure' | 'not_started';
|
|
455
681
|
type DomainRecords = DomainSpfRecord | DomainDkimRecord;
|
|
456
682
|
interface DomainSpfRecord {
|
|
@@ -493,24 +719,51 @@ interface CreateDomainRequestOptions extends PostOptions {
|
|
|
493
719
|
interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> {
|
|
494
720
|
records: DomainRecords[];
|
|
495
721
|
}
|
|
496
|
-
type CreateDomainResponse =
|
|
722
|
+
type CreateDomainResponse = {
|
|
723
|
+
data: CreateDomainResponseSuccess;
|
|
724
|
+
error: null;
|
|
725
|
+
} | {
|
|
726
|
+
data: null;
|
|
727
|
+
error: ErrorResponse;
|
|
728
|
+
};
|
|
497
729
|
|
|
498
730
|
interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> {
|
|
499
731
|
object: 'domain';
|
|
500
732
|
records: DomainRecords[];
|
|
501
733
|
}
|
|
502
|
-
type GetDomainResponse =
|
|
734
|
+
type GetDomainResponse = {
|
|
735
|
+
data: GetDomainResponseSuccess;
|
|
736
|
+
error: null;
|
|
737
|
+
} | {
|
|
738
|
+
data: null;
|
|
739
|
+
error: ErrorResponse;
|
|
740
|
+
};
|
|
503
741
|
|
|
742
|
+
type ListDomainsOptions = PaginationOptions;
|
|
504
743
|
type ListDomainsResponseSuccess = {
|
|
505
744
|
data: Domain[];
|
|
745
|
+
object: 'list';
|
|
746
|
+
has_more: boolean;
|
|
747
|
+
};
|
|
748
|
+
type ListDomainsResponse = {
|
|
749
|
+
data: ListDomainsResponseSuccess;
|
|
750
|
+
error: null;
|
|
751
|
+
} | {
|
|
752
|
+
data: null;
|
|
753
|
+
error: ErrorResponse;
|
|
506
754
|
};
|
|
507
|
-
type ListDomainsResponse = Response<ListDomainsResponseSuccess>;
|
|
508
755
|
|
|
509
756
|
type RemoveDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
510
757
|
object: 'domain';
|
|
511
758
|
deleted: boolean;
|
|
512
759
|
};
|
|
513
|
-
type RemoveDomainsResponse =
|
|
760
|
+
type RemoveDomainsResponse = {
|
|
761
|
+
data: RemoveDomainsResponseSuccess;
|
|
762
|
+
error: null;
|
|
763
|
+
} | {
|
|
764
|
+
data: null;
|
|
765
|
+
error: ErrorResponse;
|
|
766
|
+
};
|
|
514
767
|
|
|
515
768
|
interface UpdateDomainsOptions {
|
|
516
769
|
id: string;
|
|
@@ -521,12 +774,36 @@ interface UpdateDomainsOptions {
|
|
|
521
774
|
type UpdateDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
522
775
|
object: 'domain';
|
|
523
776
|
};
|
|
524
|
-
type UpdateDomainsResponse =
|
|
777
|
+
type UpdateDomainsResponse = {
|
|
778
|
+
data: UpdateDomainsResponseSuccess;
|
|
779
|
+
error: null;
|
|
780
|
+
} | {
|
|
781
|
+
data: null;
|
|
782
|
+
error: ErrorResponse;
|
|
783
|
+
};
|
|
525
784
|
|
|
526
785
|
type VerifyDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
527
786
|
object: 'domain';
|
|
528
787
|
};
|
|
529
|
-
type VerifyDomainsResponse =
|
|
788
|
+
type VerifyDomainsResponse = {
|
|
789
|
+
data: VerifyDomainsResponseSuccess;
|
|
790
|
+
error: null;
|
|
791
|
+
} | {
|
|
792
|
+
data: null;
|
|
793
|
+
error: ErrorResponse;
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
interface CancelEmailResponseSuccess {
|
|
797
|
+
object: 'email';
|
|
798
|
+
id: string;
|
|
799
|
+
}
|
|
800
|
+
type CancelEmailResponse = {
|
|
801
|
+
data: CancelEmailResponseSuccess;
|
|
802
|
+
error: null;
|
|
803
|
+
} | {
|
|
804
|
+
data: null;
|
|
805
|
+
error: ErrorResponse;
|
|
806
|
+
};
|
|
530
807
|
|
|
531
808
|
interface GetEmailResponseSuccess {
|
|
532
809
|
bcc: string[] | null;
|
|
@@ -547,13 +824,35 @@ interface GetEmailResponseSuccess {
|
|
|
547
824
|
scheduled_at: string | null;
|
|
548
825
|
object: 'email';
|
|
549
826
|
}
|
|
550
|
-
type GetEmailResponse =
|
|
827
|
+
type GetEmailResponse = {
|
|
828
|
+
data: GetEmailResponseSuccess;
|
|
829
|
+
error: null;
|
|
830
|
+
} | {
|
|
831
|
+
data: null;
|
|
832
|
+
error: ErrorResponse;
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
interface UpdateEmailOptions {
|
|
836
|
+
id: string;
|
|
837
|
+
scheduledAt: string;
|
|
838
|
+
}
|
|
839
|
+
interface UpdateEmailResponseSuccess {
|
|
840
|
+
id: string;
|
|
841
|
+
object: 'email';
|
|
842
|
+
}
|
|
843
|
+
type UpdateEmailResponse = {
|
|
844
|
+
data: UpdateEmailResponseSuccess;
|
|
845
|
+
error: null;
|
|
846
|
+
} | {
|
|
847
|
+
data: null;
|
|
848
|
+
error: ErrorResponse;
|
|
849
|
+
};
|
|
551
850
|
|
|
552
851
|
declare class ApiKeys {
|
|
553
852
|
private readonly resend;
|
|
554
853
|
constructor(resend: Resend);
|
|
555
854
|
create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>;
|
|
556
|
-
list(): Promise<ListApiKeysResponse>;
|
|
855
|
+
list(options?: ListApiKeysOptions): Promise<ListApiKeysResponse>;
|
|
557
856
|
remove(id: string): Promise<RemoveApiKeyResponse>;
|
|
558
857
|
}
|
|
559
858
|
|
|
@@ -561,84 +860,29 @@ declare class Audiences {
|
|
|
561
860
|
private readonly resend;
|
|
562
861
|
constructor(resend: Resend);
|
|
563
862
|
create(payload: CreateAudienceOptions, options?: CreateAudienceRequestOptions): Promise<CreateAudienceResponse>;
|
|
564
|
-
list(): Promise<ListAudiencesResponse>;
|
|
863
|
+
list(options?: ListAudiencesOptions): Promise<ListAudiencesResponse>;
|
|
565
864
|
get(id: string): Promise<GetAudienceResponse>;
|
|
566
865
|
remove(id: string): Promise<RemoveAudiencesResponse>;
|
|
567
866
|
}
|
|
568
867
|
|
|
569
868
|
declare class Batch {
|
|
570
869
|
private readonly resend;
|
|
571
|
-
private renderAsync?;
|
|
572
870
|
constructor(resend: Resend);
|
|
573
|
-
send(payload: CreateBatchOptions, options?:
|
|
574
|
-
create(payload: CreateBatchOptions, options?:
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
interface Broadcast {
|
|
578
|
-
id: string;
|
|
579
|
-
name: string;
|
|
580
|
-
audience_id: string | null;
|
|
581
|
-
from: string | null;
|
|
582
|
-
subject: string | null;
|
|
583
|
-
reply_to: string[] | null;
|
|
584
|
-
preview_text: string | null;
|
|
585
|
-
status: 'draft' | 'sent' | 'queued';
|
|
586
|
-
created_at: string;
|
|
587
|
-
scheduled_at: string | null;
|
|
588
|
-
sent_at: string | null;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
interface GetBroadcastResponseSuccess extends Broadcast {
|
|
592
|
-
object: 'broadcast';
|
|
593
|
-
}
|
|
594
|
-
type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;
|
|
595
|
-
|
|
596
|
-
type ListBroadcastsResponseSuccess = {
|
|
597
|
-
object: 'list';
|
|
598
|
-
data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
|
|
599
|
-
};
|
|
600
|
-
type ListBroadcastsResponse = Response<ListBroadcastsResponseSuccess>;
|
|
601
|
-
|
|
602
|
-
interface RemoveBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
|
|
603
|
-
object: 'broadcast';
|
|
604
|
-
deleted: boolean;
|
|
871
|
+
send<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>;
|
|
872
|
+
create<Options extends CreateBatchRequestOptions>(payload: CreateBatchOptions, options?: Options): Promise<CreateBatchResponse<Options>>;
|
|
605
873
|
}
|
|
606
|
-
type RemoveBroadcastResponse = Response<RemoveBroadcastResponseSuccess>;
|
|
607
|
-
|
|
608
|
-
interface UpdateBroadcastResponseSuccess {
|
|
609
|
-
id: string;
|
|
610
|
-
}
|
|
611
|
-
type UpdateBroadcastOptions = {
|
|
612
|
-
name?: string;
|
|
613
|
-
audienceId?: string;
|
|
614
|
-
from?: string;
|
|
615
|
-
html?: string;
|
|
616
|
-
react?: React.ReactNode;
|
|
617
|
-
text?: string;
|
|
618
|
-
subject?: string;
|
|
619
|
-
replyTo?: string[];
|
|
620
|
-
previewText?: string;
|
|
621
|
-
};
|
|
622
|
-
type UpdateBroadcastResponse = Response<UpdateBroadcastResponseSuccess>;
|
|
623
874
|
|
|
624
875
|
declare class Broadcasts {
|
|
625
876
|
private readonly resend;
|
|
626
|
-
private renderAsync?;
|
|
627
877
|
constructor(resend: Resend);
|
|
628
878
|
create(payload: CreateBroadcastOptions, options?: CreateBroadcastRequestOptions): Promise<SendBroadcastResponse>;
|
|
629
879
|
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
630
|
-
list(): Promise<ListBroadcastsResponse>;
|
|
880
|
+
list(options?: ListBroadcastsOptions): Promise<ListBroadcastsResponse>;
|
|
631
881
|
get(id: string): Promise<GetBroadcastResponse>;
|
|
632
882
|
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
633
883
|
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
634
884
|
}
|
|
635
885
|
|
|
636
|
-
interface PatchOptions {
|
|
637
|
-
query?: {
|
|
638
|
-
[key: string]: unknown;
|
|
639
|
-
};
|
|
640
|
-
}
|
|
641
|
-
|
|
642
886
|
declare class Contacts {
|
|
643
887
|
private readonly resend;
|
|
644
888
|
constructor(resend: Resend);
|
|
@@ -653,36 +897,35 @@ declare class Domains {
|
|
|
653
897
|
private readonly resend;
|
|
654
898
|
constructor(resend: Resend);
|
|
655
899
|
create(payload: CreateDomainOptions, options?: CreateDomainRequestOptions): Promise<CreateDomainResponse>;
|
|
656
|
-
list(): Promise<ListDomainsResponse>;
|
|
900
|
+
list(options?: ListDomainsOptions): Promise<ListDomainsResponse>;
|
|
657
901
|
get(id: string): Promise<GetDomainResponse>;
|
|
658
902
|
update(payload: UpdateDomainsOptions): Promise<UpdateDomainsResponse>;
|
|
659
903
|
remove(id: string): Promise<RemoveDomainsResponse>;
|
|
660
904
|
verify(id: string): Promise<VerifyDomainsResponse>;
|
|
661
905
|
}
|
|
662
906
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
}
|
|
677
|
-
type UpdateEmailResponse = Response<UpdateEmailResponseSuccess>;
|
|
907
|
+
type ListEmailsOptions = PaginationOptions;
|
|
908
|
+
type ListEmail = Omit<GetEmailResponseSuccess, 'html' | 'text' | 'tags' | 'object'>;
|
|
909
|
+
type ListEmailsResponseSuccess = {
|
|
910
|
+
object: 'list';
|
|
911
|
+
has_more: boolean;
|
|
912
|
+
data: ListEmail[];
|
|
913
|
+
};
|
|
914
|
+
type ListEmailsResponse = {
|
|
915
|
+
data: ListEmailsResponseSuccess;
|
|
916
|
+
error: null;
|
|
917
|
+
} | {
|
|
918
|
+
data: null;
|
|
919
|
+
error: ErrorResponse;
|
|
920
|
+
};
|
|
678
921
|
|
|
679
922
|
declare class Emails {
|
|
680
923
|
private readonly resend;
|
|
681
|
-
private renderAsync?;
|
|
682
924
|
constructor(resend: Resend);
|
|
683
925
|
send(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
684
926
|
create(payload: CreateEmailOptions, options?: CreateEmailRequestOptions): Promise<CreateEmailResponse>;
|
|
685
927
|
get(id: string): Promise<GetEmailResponse>;
|
|
928
|
+
list(options?: ListEmailsOptions): Promise<ListEmailsResponse>;
|
|
686
929
|
update(payload: UpdateEmailOptions): Promise<UpdateEmailResponse>;
|
|
687
930
|
cancel(id: string): Promise<CancelEmailResponse>;
|
|
688
931
|
}
|
|
@@ -698,12 +941,48 @@ declare class Resend {
|
|
|
698
941
|
readonly domains: Domains;
|
|
699
942
|
readonly emails: Emails;
|
|
700
943
|
constructor(key?: string | undefined);
|
|
701
|
-
fetchRequest<T>(path: string, options?: {}): Promise<
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
|
|
944
|
+
fetchRequest<T>(path: string, options?: {}): Promise<{
|
|
945
|
+
data: T;
|
|
946
|
+
error: null;
|
|
947
|
+
} | {
|
|
948
|
+
data: null;
|
|
949
|
+
error: ErrorResponse;
|
|
950
|
+
}>;
|
|
951
|
+
post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<{
|
|
952
|
+
data: null;
|
|
953
|
+
error: ErrorResponse;
|
|
954
|
+
} | {
|
|
955
|
+
data: T;
|
|
956
|
+
error: null;
|
|
957
|
+
}>;
|
|
958
|
+
get<T>(path: string, options?: GetOptions): Promise<{
|
|
959
|
+
data: null;
|
|
960
|
+
error: ErrorResponse;
|
|
961
|
+
} | {
|
|
962
|
+
data: T;
|
|
963
|
+
error: null;
|
|
964
|
+
}>;
|
|
965
|
+
put<T>(path: string, entity: unknown, options?: PutOptions): Promise<{
|
|
966
|
+
data: null;
|
|
967
|
+
error: ErrorResponse;
|
|
968
|
+
} | {
|
|
969
|
+
data: T;
|
|
970
|
+
error: null;
|
|
971
|
+
}>;
|
|
972
|
+
patch<T>(path: string, entity: unknown, options?: PatchOptions): Promise<{
|
|
973
|
+
data: null;
|
|
974
|
+
error: ErrorResponse;
|
|
975
|
+
} | {
|
|
976
|
+
data: T;
|
|
977
|
+
error: null;
|
|
978
|
+
}>;
|
|
979
|
+
delete<T>(path: string, query?: unknown): Promise<{
|
|
980
|
+
data: null;
|
|
981
|
+
error: ErrorResponse;
|
|
982
|
+
} | {
|
|
983
|
+
data: T;
|
|
984
|
+
error: null;
|
|
985
|
+
}>;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
export { type ApiKey, type Attachment, type Audience, type Broadcast, type CancelEmailResponse, type CancelEmailResponseSuccess, type Contact, type CreateApiKeyOptions, type CreateApiKeyRequestOptions, type CreateApiKeyResponse, type CreateApiKeyResponseSuccess, type CreateAudienceOptions, type CreateAudienceRequestOptions, type CreateAudienceResponse, type CreateAudienceResponseSuccess, type CreateBatchOptions, type CreateBatchRequestOptions, type CreateBatchResponse, type CreateBatchSuccessResponse, type CreateBroadcastOptions, type CreateBroadcastRequestOptions, type CreateBroadcastResponse, type CreateBroadcastResponseSuccess, type CreateContactOptions, type CreateContactRequestOptions, type CreateContactResponse, type CreateContactResponseSuccess, type CreateDomainOptions, type CreateDomainRequestOptions, type CreateDomainResponse, type CreateDomainResponseSuccess, type CreateEmailOptions, type CreateEmailRequestOptions, type CreateEmailResponse, type CreateEmailResponseSuccess, type Domain, type DomainApiOptions, type DomainDkimRecord, type DomainNameservers, type DomainRecords, type DomainRegion, type DomainSpfRecord, type DomainStatus, type EmailApiAttachment, type EmailApiOptions, type ErrorResponse, type GetAudienceResponse, type GetAudienceResponseSuccess, type GetBroadcastResponse, type GetBroadcastResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type GetOptions, type IdempotentRequest, type List, type ListApiKeysOptions, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAudiencesOptions, type ListAudiencesResponse, type ListAudiencesResponseSuccess, type ListBroadcastsOptions, type ListBroadcastsResponse, type ListBroadcastsResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsOptions, type ListDomainsResponse, type ListDomainsResponseSuccess, type PaginationOptions, type PatchOptions, type PostOptions, type PutOptions, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveAudiencesResponse, type RemoveAudiencesResponseSuccess, type RemoveBroadcastResponse, type RemoveBroadcastResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, type RequireAtLeastOne, Resend, type SelectingField, type SendBroadcastOptions, type SendBroadcastRequestOptions, type SendBroadcastResponse, type SendBroadcastResponseSuccess, type Tag, type UpdateBroadcastOptions, type UpdateBroadcastResponse, type UpdateBroadcastResponseSuccess, type UpdateContactOptions, type UpdateContactResponse, type UpdateContactResponseSuccess, type UpdateDomainsOptions, type UpdateDomainsResponse, type UpdateDomainsResponseSuccess, type UpdateEmailOptions, type UpdateEmailResponse, type UpdateEmailResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess };
|