resend 6.0.1 → 6.1.0-canary.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 +224 -389
- package/dist/index.d.ts +224 -389
- package/dist/index.js +70 -18
- package/dist/index.mjs +67 -15
- package/package.json +22 -24
- package/readme.md +10 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
|
|
3
3
|
interface GetOptions {
|
|
4
4
|
query?: Record<string, unknown>;
|
|
@@ -16,6 +16,27 @@ interface PutOptions {
|
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
|
|
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
|
+
|
|
19
40
|
declare const RESEND_ERROR_CODES_BY_KEY: {
|
|
20
41
|
readonly missing_required_field: 422;
|
|
21
42
|
readonly invalid_idempotency_key: 400;
|
|
@@ -35,10 +56,26 @@ declare const RESEND_ERROR_CODES_BY_KEY: {
|
|
|
35
56
|
readonly internal_server_error: 500;
|
|
36
57
|
};
|
|
37
58
|
type RESEND_ERROR_CODE_KEY = keyof typeof RESEND_ERROR_CODES_BY_KEY;
|
|
38
|
-
|
|
59
|
+
type ErrorResponse = {
|
|
39
60
|
message: string;
|
|
40
|
-
name: RESEND_ERROR_CODE_KEY
|
|
41
|
-
}
|
|
61
|
+
name: Exclude<RESEND_ERROR_CODE_KEY, 'rate_limit_exceeded'>;
|
|
62
|
+
} | {
|
|
63
|
+
message: string;
|
|
64
|
+
name: Extract<RESEND_ERROR_CODE_KEY, 'rate_limit_exceeded'>;
|
|
65
|
+
/**
|
|
66
|
+
* Time in seconds.
|
|
67
|
+
*/
|
|
68
|
+
retryAfter: number;
|
|
69
|
+
};
|
|
70
|
+
type Response<Data> = {
|
|
71
|
+
data: Data;
|
|
72
|
+
rateLimiting: RateLimit;
|
|
73
|
+
error: null;
|
|
74
|
+
} | {
|
|
75
|
+
data: null;
|
|
76
|
+
rateLimiting: RateLimit | null;
|
|
77
|
+
error: ErrorResponse;
|
|
78
|
+
};
|
|
42
79
|
|
|
43
80
|
interface CreateApiKeyOptions {
|
|
44
81
|
name: string;
|
|
@@ -51,13 +88,7 @@ interface CreateApiKeyResponseSuccess {
|
|
|
51
88
|
token: string;
|
|
52
89
|
id: string;
|
|
53
90
|
}
|
|
54
|
-
type CreateApiKeyResponse =
|
|
55
|
-
data: CreateApiKeyResponseSuccess;
|
|
56
|
-
error: null;
|
|
57
|
-
} | {
|
|
58
|
-
data: null;
|
|
59
|
-
error: ErrorResponse;
|
|
60
|
-
};
|
|
91
|
+
type CreateApiKeyResponse = Response<CreateApiKeyResponseSuccess>;
|
|
61
92
|
|
|
62
93
|
interface ApiKey {
|
|
63
94
|
created_at: string;
|
|
@@ -66,30 +97,10 @@ interface ApiKey {
|
|
|
66
97
|
}
|
|
67
98
|
|
|
68
99
|
type ListApiKeysResponseSuccess = Pick<ApiKey, 'name' | 'id' | 'created_at'>[];
|
|
69
|
-
type ListApiKeysResponse =
|
|
70
|
-
data: ListApiKeysResponseSuccess;
|
|
71
|
-
error: null;
|
|
72
|
-
} | {
|
|
73
|
-
data: null;
|
|
74
|
-
error: ErrorResponse;
|
|
75
|
-
};
|
|
100
|
+
type ListApiKeysResponse = Response<ListApiKeysResponseSuccess>;
|
|
76
101
|
|
|
77
102
|
type RemoveApiKeyResponseSuccess = {};
|
|
78
|
-
type RemoveApiKeyResponse =
|
|
79
|
-
data: RemoveApiKeyResponseSuccess;
|
|
80
|
-
error: null;
|
|
81
|
-
} | {
|
|
82
|
-
data: null;
|
|
83
|
-
error: ErrorResponse;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
declare class ApiKeys {
|
|
87
|
-
private readonly resend;
|
|
88
|
-
constructor(resend: Resend);
|
|
89
|
-
create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>;
|
|
90
|
-
list(): Promise<ListApiKeysResponse>;
|
|
91
|
-
remove(id: string): Promise<RemoveApiKeyResponse>;
|
|
92
|
-
}
|
|
103
|
+
type RemoveApiKeyResponse = Response<RemoveApiKeyResponseSuccess>;
|
|
93
104
|
|
|
94
105
|
interface Audience {
|
|
95
106
|
created_at: string;
|
|
@@ -105,57 +116,24 @@ interface CreateAudienceRequestOptions extends PostOptions {
|
|
|
105
116
|
interface CreateAudienceResponseSuccess extends Pick<Audience, 'name' | 'id'> {
|
|
106
117
|
object: 'audience';
|
|
107
118
|
}
|
|
108
|
-
type CreateAudienceResponse =
|
|
109
|
-
data: CreateAudienceResponseSuccess;
|
|
110
|
-
error: null;
|
|
111
|
-
} | {
|
|
112
|
-
data: null;
|
|
113
|
-
error: ErrorResponse;
|
|
114
|
-
};
|
|
119
|
+
type CreateAudienceResponse = Response<CreateAudienceResponseSuccess>;
|
|
115
120
|
|
|
116
121
|
interface GetAudienceResponseSuccess extends Pick<Audience, 'id' | 'name' | 'created_at'> {
|
|
117
122
|
object: 'audience';
|
|
118
123
|
}
|
|
119
|
-
type GetAudienceResponse =
|
|
120
|
-
data: GetAudienceResponseSuccess;
|
|
121
|
-
error: null;
|
|
122
|
-
} | {
|
|
123
|
-
data: null;
|
|
124
|
-
error: ErrorResponse;
|
|
125
|
-
};
|
|
124
|
+
type GetAudienceResponse = Response<GetAudienceResponseSuccess>;
|
|
126
125
|
|
|
127
126
|
type ListAudiencesResponseSuccess = {
|
|
128
127
|
object: 'list';
|
|
129
128
|
data: Audience[];
|
|
130
129
|
};
|
|
131
|
-
type ListAudiencesResponse =
|
|
132
|
-
data: ListAudiencesResponseSuccess;
|
|
133
|
-
error: null;
|
|
134
|
-
} | {
|
|
135
|
-
data: null;
|
|
136
|
-
error: ErrorResponse;
|
|
137
|
-
};
|
|
130
|
+
type ListAudiencesResponse = Response<ListAudiencesResponseSuccess>;
|
|
138
131
|
|
|
139
132
|
interface RemoveAudiencesResponseSuccess extends Pick<Audience, 'id'> {
|
|
140
133
|
object: 'audience';
|
|
141
134
|
deleted: boolean;
|
|
142
135
|
}
|
|
143
|
-
type RemoveAudiencesResponse =
|
|
144
|
-
data: RemoveAudiencesResponseSuccess;
|
|
145
|
-
error: null;
|
|
146
|
-
} | {
|
|
147
|
-
data: null;
|
|
148
|
-
error: ErrorResponse;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
declare class Audiences {
|
|
152
|
-
private readonly resend;
|
|
153
|
-
constructor(resend: Resend);
|
|
154
|
-
create(payload: CreateAudienceOptions, options?: CreateAudienceRequestOptions): Promise<CreateAudienceResponse>;
|
|
155
|
-
list(): Promise<ListAudiencesResponse>;
|
|
156
|
-
get(id: string): Promise<GetAudienceResponse>;
|
|
157
|
-
remove(id: string): Promise<RemoveAudiencesResponse>;
|
|
158
|
-
}
|
|
136
|
+
type RemoveAudiencesResponse = Response<RemoveAudiencesResponseSuccess>;
|
|
159
137
|
|
|
160
138
|
interface IdempotentRequest {
|
|
161
139
|
/**
|
|
@@ -176,7 +154,7 @@ interface EmailRenderOptions$1 {
|
|
|
176
154
|
*
|
|
177
155
|
* @link https://resend.com/docs/api-reference/emails/send-email#body-parameters
|
|
178
156
|
*/
|
|
179
|
-
react: React.ReactNode;
|
|
157
|
+
react: React$1.ReactNode;
|
|
180
158
|
/**
|
|
181
159
|
* The HTML version of the message.
|
|
182
160
|
*
|
|
@@ -260,13 +238,7 @@ interface CreateEmailResponseSuccess {
|
|
|
260
238
|
/** The ID of the newly created email. */
|
|
261
239
|
id: string;
|
|
262
240
|
}
|
|
263
|
-
type CreateEmailResponse =
|
|
264
|
-
data: CreateEmailResponseSuccess;
|
|
265
|
-
error: null;
|
|
266
|
-
} | {
|
|
267
|
-
data: null;
|
|
268
|
-
error: ErrorResponse;
|
|
269
|
-
};
|
|
241
|
+
type CreateEmailResponse = Response<CreateEmailResponseSuccess>;
|
|
270
242
|
interface Attachment {
|
|
271
243
|
/** Content of an attached file. */
|
|
272
244
|
content?: string | Buffer;
|
|
@@ -302,21 +274,7 @@ interface CreateBatchSuccessResponse {
|
|
|
302
274
|
id: string;
|
|
303
275
|
}[];
|
|
304
276
|
}
|
|
305
|
-
type CreateBatchResponse =
|
|
306
|
-
data: CreateBatchSuccessResponse;
|
|
307
|
-
error: null;
|
|
308
|
-
} | {
|
|
309
|
-
data: null;
|
|
310
|
-
error: ErrorResponse;
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
declare class Batch {
|
|
314
|
-
private readonly resend;
|
|
315
|
-
private renderAsync?;
|
|
316
|
-
constructor(resend: Resend);
|
|
317
|
-
send(payload: CreateBatchOptions, options?: CreateBatchRequestOptions): Promise<CreateBatchResponse>;
|
|
318
|
-
create(payload: CreateBatchOptions, options?: CreateBatchRequestOptions): Promise<CreateBatchResponse>;
|
|
319
|
-
}
|
|
277
|
+
type CreateBatchResponse = Response<CreateBatchSuccessResponse>;
|
|
320
278
|
|
|
321
279
|
interface EmailRenderOptions {
|
|
322
280
|
/**
|
|
@@ -324,7 +282,7 @@ interface EmailRenderOptions {
|
|
|
324
282
|
*
|
|
325
283
|
* @link https://resend.com/docs/api-reference/broadcasts/create#body-parameters
|
|
326
284
|
*/
|
|
327
|
-
react: React.ReactNode;
|
|
285
|
+
react: React$1.ReactNode;
|
|
328
286
|
/**
|
|
329
287
|
* The HTML version of the message.
|
|
330
288
|
*
|
|
@@ -383,62 +341,7 @@ interface CreateBroadcastResponseSuccess {
|
|
|
383
341
|
/** The ID of the newly sent broadcasts. */
|
|
384
342
|
id: string;
|
|
385
343
|
}
|
|
386
|
-
type CreateBroadcastResponse =
|
|
387
|
-
data: CreateBroadcastResponseSuccess;
|
|
388
|
-
error: null;
|
|
389
|
-
} | {
|
|
390
|
-
data: null;
|
|
391
|
-
error: ErrorResponse;
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
interface Broadcast {
|
|
395
|
-
id: string;
|
|
396
|
-
name: string;
|
|
397
|
-
audience_id: string | null;
|
|
398
|
-
from: string | null;
|
|
399
|
-
subject: string | null;
|
|
400
|
-
reply_to: string[] | null;
|
|
401
|
-
preview_text: string | null;
|
|
402
|
-
status: 'draft' | 'sent' | 'queued';
|
|
403
|
-
created_at: string;
|
|
404
|
-
scheduled_at: string | null;
|
|
405
|
-
sent_at: string | null;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
interface GetBroadcastResponseSuccess extends Broadcast {
|
|
409
|
-
object: 'broadcast';
|
|
410
|
-
}
|
|
411
|
-
type GetBroadcastResponse = {
|
|
412
|
-
data: GetBroadcastResponseSuccess;
|
|
413
|
-
error: null;
|
|
414
|
-
} | {
|
|
415
|
-
data: null;
|
|
416
|
-
error: ErrorResponse;
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
type ListBroadcastsResponseSuccess = {
|
|
420
|
-
object: 'list';
|
|
421
|
-
data: Pick<Broadcast, 'id' | 'name' | 'audience_id' | 'status' | 'created_at' | 'scheduled_at' | 'sent_at'>[];
|
|
422
|
-
};
|
|
423
|
-
type ListBroadcastsResponse = {
|
|
424
|
-
data: ListBroadcastsResponseSuccess;
|
|
425
|
-
error: null;
|
|
426
|
-
} | {
|
|
427
|
-
data: null;
|
|
428
|
-
error: ErrorResponse;
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
interface RemoveBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
|
|
432
|
-
object: 'broadcast';
|
|
433
|
-
deleted: boolean;
|
|
434
|
-
}
|
|
435
|
-
type RemoveBroadcastResponse = {
|
|
436
|
-
data: RemoveBroadcastResponseSuccess;
|
|
437
|
-
error: null;
|
|
438
|
-
} | {
|
|
439
|
-
data: null;
|
|
440
|
-
error: ErrorResponse;
|
|
441
|
-
};
|
|
344
|
+
type CreateBroadcastResponse = Response<CreateBroadcastResponseSuccess>;
|
|
442
345
|
|
|
443
346
|
interface SendBroadcastBaseOptions {
|
|
444
347
|
/**
|
|
@@ -457,52 +360,7 @@ interface SendBroadcastResponseSuccess {
|
|
|
457
360
|
/** The ID of the sent broadcast. */
|
|
458
361
|
id: string;
|
|
459
362
|
}
|
|
460
|
-
type SendBroadcastResponse =
|
|
461
|
-
data: SendBroadcastResponseSuccess;
|
|
462
|
-
error: null;
|
|
463
|
-
} | {
|
|
464
|
-
data: null;
|
|
465
|
-
error: ErrorResponse;
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
interface UpdateBroadcastResponseSuccess {
|
|
469
|
-
id: string;
|
|
470
|
-
}
|
|
471
|
-
interface UpdateBroadcastOptions {
|
|
472
|
-
name?: string;
|
|
473
|
-
audienceId?: string;
|
|
474
|
-
from?: string;
|
|
475
|
-
html?: string;
|
|
476
|
-
text?: string;
|
|
477
|
-
subject?: string;
|
|
478
|
-
replyTo?: string[];
|
|
479
|
-
previewText?: string;
|
|
480
|
-
}
|
|
481
|
-
type UpdateBroadcastResponse = {
|
|
482
|
-
data: UpdateBroadcastResponseSuccess;
|
|
483
|
-
error: null;
|
|
484
|
-
} | {
|
|
485
|
-
data: null;
|
|
486
|
-
error: ErrorResponse;
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
declare class Broadcasts {
|
|
490
|
-
private readonly resend;
|
|
491
|
-
private renderAsync?;
|
|
492
|
-
constructor(resend: Resend);
|
|
493
|
-
create(payload: CreateBroadcastOptions, options?: CreateBroadcastRequestOptions): Promise<SendBroadcastResponse>;
|
|
494
|
-
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
495
|
-
list(): Promise<ListBroadcastsResponse>;
|
|
496
|
-
get(id: string): Promise<GetBroadcastResponse>;
|
|
497
|
-
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
498
|
-
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
interface PatchOptions {
|
|
502
|
-
query?: {
|
|
503
|
-
[key: string]: unknown;
|
|
504
|
-
};
|
|
505
|
-
}
|
|
363
|
+
type SendBroadcastResponse = Response<SendBroadcastResponseSuccess>;
|
|
506
364
|
|
|
507
365
|
interface Contact {
|
|
508
366
|
created_at: string;
|
|
@@ -512,6 +370,33 @@ interface Contact {
|
|
|
512
370
|
last_name?: string;
|
|
513
371
|
unsubscribed: boolean;
|
|
514
372
|
}
|
|
373
|
+
type SelectingField = {
|
|
374
|
+
/**
|
|
375
|
+
* The contact id.
|
|
376
|
+
*
|
|
377
|
+
* @link https://resend.com/docs/api-reference/contacts/delete-contact#body-parameters
|
|
378
|
+
*/
|
|
379
|
+
id: string;
|
|
380
|
+
/**
|
|
381
|
+
* The contact email.
|
|
382
|
+
*
|
|
383
|
+
* @link https://resend.com/docs/api-reference/contacts/delete-contact#body-parameters
|
|
384
|
+
*/
|
|
385
|
+
email?: undefined | null;
|
|
386
|
+
} | {
|
|
387
|
+
/**
|
|
388
|
+
* The contact id.
|
|
389
|
+
*
|
|
390
|
+
* @link https://resend.com/docs/api-reference/contacts/delete-contact#body-parameters
|
|
391
|
+
*/
|
|
392
|
+
id?: undefined | null;
|
|
393
|
+
/**
|
|
394
|
+
* The contact email.
|
|
395
|
+
*
|
|
396
|
+
* @link https://resend.com/docs/api-reference/contacts/delete-contact#body-parameters
|
|
397
|
+
*/
|
|
398
|
+
email: string;
|
|
399
|
+
};
|
|
515
400
|
|
|
516
401
|
interface CreateContactOptions {
|
|
517
402
|
audienceId: string;
|
|
@@ -525,29 +410,15 @@ interface CreateContactRequestOptions extends PostOptions {
|
|
|
525
410
|
interface CreateContactResponseSuccess extends Pick<Contact, 'id'> {
|
|
526
411
|
object: 'contact';
|
|
527
412
|
}
|
|
528
|
-
type CreateContactResponse =
|
|
529
|
-
data: CreateContactResponseSuccess;
|
|
530
|
-
error: null;
|
|
531
|
-
} | {
|
|
532
|
-
data: null;
|
|
533
|
-
error: ErrorResponse;
|
|
534
|
-
};
|
|
413
|
+
type CreateContactResponse = Response<CreateContactResponseSuccess>;
|
|
535
414
|
|
|
536
|
-
|
|
415
|
+
type GetContactOptions = {
|
|
537
416
|
audienceId: string;
|
|
538
|
-
|
|
539
|
-
email?: string;
|
|
540
|
-
}
|
|
417
|
+
} & SelectingField;
|
|
541
418
|
interface GetContactResponseSuccess extends Pick<Contact, 'id' | 'email' | 'created_at' | 'first_name' | 'last_name' | 'unsubscribed'> {
|
|
542
419
|
object: 'contact';
|
|
543
420
|
}
|
|
544
|
-
type GetContactResponse =
|
|
545
|
-
data: GetContactResponseSuccess;
|
|
546
|
-
error: null;
|
|
547
|
-
} | {
|
|
548
|
-
data: null;
|
|
549
|
-
error: ErrorResponse;
|
|
550
|
-
};
|
|
421
|
+
type GetContactResponse = Response<GetContactResponseSuccess>;
|
|
551
422
|
|
|
552
423
|
interface ListContactsOptions {
|
|
553
424
|
audienceId: string;
|
|
@@ -556,74 +427,28 @@ interface ListContactsResponseSuccess {
|
|
|
556
427
|
object: 'list';
|
|
557
428
|
data: Contact[];
|
|
558
429
|
}
|
|
559
|
-
type ListContactsResponse =
|
|
560
|
-
data: ListContactsResponseSuccess;
|
|
561
|
-
error: null;
|
|
562
|
-
} | {
|
|
563
|
-
data: null;
|
|
564
|
-
error: ErrorResponse;
|
|
565
|
-
};
|
|
430
|
+
type ListContactsResponse = Response<ListContactsResponseSuccess>;
|
|
566
431
|
|
|
567
432
|
type RemoveContactsResponseSuccess = {
|
|
568
433
|
object: 'contact';
|
|
569
434
|
deleted: boolean;
|
|
570
435
|
contact: string;
|
|
571
436
|
};
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* The contact id.
|
|
575
|
-
*
|
|
576
|
-
* @link https://resend.com/docs/api-reference/contacts/delete-contact#body-parameters
|
|
577
|
-
*/
|
|
578
|
-
id?: string;
|
|
579
|
-
/**
|
|
580
|
-
* The contact email.
|
|
581
|
-
*
|
|
582
|
-
* @link https://resend.com/docs/api-reference/contacts/delete-contact#body-parameters
|
|
583
|
-
*/
|
|
584
|
-
email?: string;
|
|
585
|
-
}
|
|
586
|
-
interface RemoveContactOptions extends RemoveByOptions {
|
|
437
|
+
type RemoveContactOptions = SelectingField & {
|
|
587
438
|
audienceId: string;
|
|
588
|
-
}
|
|
589
|
-
type RemoveContactsResponse = {
|
|
590
|
-
data: RemoveContactsResponseSuccess;
|
|
591
|
-
error: null;
|
|
592
|
-
} | {
|
|
593
|
-
data: null;
|
|
594
|
-
error: ErrorResponse;
|
|
595
439
|
};
|
|
440
|
+
type RemoveContactsResponse = Response<RemoveContactsResponseSuccess>;
|
|
596
441
|
|
|
597
|
-
|
|
598
|
-
id?: string;
|
|
599
|
-
email?: string;
|
|
600
|
-
}
|
|
601
|
-
interface UpdateContactOptions extends UpdateContactBaseOptions {
|
|
442
|
+
type UpdateContactOptions = {
|
|
602
443
|
audienceId: string;
|
|
603
444
|
unsubscribed?: boolean;
|
|
604
445
|
firstName?: string;
|
|
605
446
|
lastName?: string;
|
|
606
|
-
}
|
|
447
|
+
} & SelectingField;
|
|
607
448
|
type UpdateContactResponseSuccess = Pick<Contact, 'id'> & {
|
|
608
449
|
object: 'contact';
|
|
609
450
|
};
|
|
610
|
-
type UpdateContactResponse =
|
|
611
|
-
data: UpdateContactResponseSuccess;
|
|
612
|
-
error: null;
|
|
613
|
-
} | {
|
|
614
|
-
data: null;
|
|
615
|
-
error: ErrorResponse;
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
declare class Contacts {
|
|
619
|
-
private readonly resend;
|
|
620
|
-
constructor(resend: Resend);
|
|
621
|
-
create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
|
|
622
|
-
list(options: ListContactsOptions): Promise<ListContactsResponse>;
|
|
623
|
-
get(options: GetContactOptions): Promise<GetContactResponse>;
|
|
624
|
-
update(payload: UpdateContactOptions): Promise<UpdateContactResponse>;
|
|
625
|
-
remove(payload: RemoveContactOptions): Promise<RemoveContactsResponse>;
|
|
626
|
-
}
|
|
451
|
+
type UpdateContactResponse = Response<UpdateContactResponseSuccess>;
|
|
627
452
|
|
|
628
453
|
type DomainRegion = 'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1';
|
|
629
454
|
type DomainStatus = 'pending' | 'verified' | 'failed' | 'temporary_failure' | 'not_started';
|
|
@@ -668,48 +493,24 @@ interface CreateDomainRequestOptions extends PostOptions {
|
|
|
668
493
|
interface CreateDomainResponseSuccess extends Pick<Domain, 'name' | 'id' | 'status' | 'created_at' | 'region'> {
|
|
669
494
|
records: DomainRecords[];
|
|
670
495
|
}
|
|
671
|
-
type CreateDomainResponse =
|
|
672
|
-
data: CreateDomainResponseSuccess;
|
|
673
|
-
error: null;
|
|
674
|
-
} | {
|
|
675
|
-
data: null;
|
|
676
|
-
error: ErrorResponse;
|
|
677
|
-
};
|
|
496
|
+
type CreateDomainResponse = Response<CreateDomainResponseSuccess>;
|
|
678
497
|
|
|
679
498
|
interface GetDomainResponseSuccess extends Pick<Domain, 'id' | 'name' | 'created_at' | 'region' | 'status'> {
|
|
680
499
|
object: 'domain';
|
|
681
500
|
records: DomainRecords[];
|
|
682
501
|
}
|
|
683
|
-
type GetDomainResponse =
|
|
684
|
-
data: GetDomainResponseSuccess;
|
|
685
|
-
error: null;
|
|
686
|
-
} | {
|
|
687
|
-
data: null;
|
|
688
|
-
error: ErrorResponse;
|
|
689
|
-
};
|
|
502
|
+
type GetDomainResponse = Response<GetDomainResponseSuccess>;
|
|
690
503
|
|
|
691
504
|
type ListDomainsResponseSuccess = {
|
|
692
505
|
data: Domain[];
|
|
693
506
|
};
|
|
694
|
-
type ListDomainsResponse =
|
|
695
|
-
data: ListDomainsResponseSuccess;
|
|
696
|
-
error: null;
|
|
697
|
-
} | {
|
|
698
|
-
data: null;
|
|
699
|
-
error: ErrorResponse;
|
|
700
|
-
};
|
|
507
|
+
type ListDomainsResponse = Response<ListDomainsResponseSuccess>;
|
|
701
508
|
|
|
702
509
|
type RemoveDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
703
510
|
object: 'domain';
|
|
704
511
|
deleted: boolean;
|
|
705
512
|
};
|
|
706
|
-
type RemoveDomainsResponse =
|
|
707
|
-
data: RemoveDomainsResponseSuccess;
|
|
708
|
-
error: null;
|
|
709
|
-
} | {
|
|
710
|
-
data: null;
|
|
711
|
-
error: ErrorResponse;
|
|
712
|
-
};
|
|
513
|
+
type RemoveDomainsResponse = Response<RemoveDomainsResponseSuccess>;
|
|
713
514
|
|
|
714
515
|
interface UpdateDomainsOptions {
|
|
715
516
|
id: string;
|
|
@@ -720,47 +521,12 @@ interface UpdateDomainsOptions {
|
|
|
720
521
|
type UpdateDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
721
522
|
object: 'domain';
|
|
722
523
|
};
|
|
723
|
-
type UpdateDomainsResponse =
|
|
724
|
-
data: UpdateDomainsResponseSuccess;
|
|
725
|
-
error: null;
|
|
726
|
-
} | {
|
|
727
|
-
data: null;
|
|
728
|
-
error: ErrorResponse;
|
|
729
|
-
};
|
|
524
|
+
type UpdateDomainsResponse = Response<UpdateDomainsResponseSuccess>;
|
|
730
525
|
|
|
731
526
|
type VerifyDomainsResponseSuccess = Pick<Domain, 'id'> & {
|
|
732
527
|
object: 'domain';
|
|
733
528
|
};
|
|
734
|
-
type VerifyDomainsResponse =
|
|
735
|
-
data: VerifyDomainsResponseSuccess;
|
|
736
|
-
error: null;
|
|
737
|
-
} | {
|
|
738
|
-
data: null;
|
|
739
|
-
error: ErrorResponse;
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
declare class Domains {
|
|
743
|
-
private readonly resend;
|
|
744
|
-
constructor(resend: Resend);
|
|
745
|
-
create(payload: CreateDomainOptions, options?: CreateDomainRequestOptions): Promise<CreateDomainResponse>;
|
|
746
|
-
list(): Promise<ListDomainsResponse>;
|
|
747
|
-
get(id: string): Promise<GetDomainResponse>;
|
|
748
|
-
update(payload: UpdateDomainsOptions): Promise<UpdateDomainsResponse>;
|
|
749
|
-
remove(id: string): Promise<RemoveDomainsResponse>;
|
|
750
|
-
verify(id: string): Promise<VerifyDomainsResponse>;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
interface CancelEmailResponseSuccess {
|
|
754
|
-
object: 'email';
|
|
755
|
-
id: string;
|
|
756
|
-
}
|
|
757
|
-
type CancelEmailResponse = {
|
|
758
|
-
data: CancelEmailResponseSuccess;
|
|
759
|
-
error: null;
|
|
760
|
-
} | {
|
|
761
|
-
data: null;
|
|
762
|
-
error: ErrorResponse;
|
|
763
|
-
};
|
|
529
|
+
type VerifyDomainsResponse = Response<VerifyDomainsResponseSuccess>;
|
|
764
530
|
|
|
765
531
|
interface GetEmailResponseSuccess {
|
|
766
532
|
bcc: string[] | null;
|
|
@@ -781,13 +547,124 @@ interface GetEmailResponseSuccess {
|
|
|
781
547
|
scheduled_at: string | null;
|
|
782
548
|
object: 'email';
|
|
783
549
|
}
|
|
784
|
-
type GetEmailResponse =
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
550
|
+
type GetEmailResponse = Response<GetEmailResponseSuccess>;
|
|
551
|
+
|
|
552
|
+
declare class ApiKeys {
|
|
553
|
+
private readonly resend;
|
|
554
|
+
constructor(resend: Resend);
|
|
555
|
+
create(payload: CreateApiKeyOptions, options?: CreateApiKeyRequestOptions): Promise<CreateApiKeyResponse>;
|
|
556
|
+
list(): Promise<ListApiKeysResponse>;
|
|
557
|
+
remove(id: string): Promise<RemoveApiKeyResponse>;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
declare class Audiences {
|
|
561
|
+
private readonly resend;
|
|
562
|
+
constructor(resend: Resend);
|
|
563
|
+
create(payload: CreateAudienceOptions, options?: CreateAudienceRequestOptions): Promise<CreateAudienceResponse>;
|
|
564
|
+
list(): Promise<ListAudiencesResponse>;
|
|
565
|
+
get(id: string): Promise<GetAudienceResponse>;
|
|
566
|
+
remove(id: string): Promise<RemoveAudiencesResponse>;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
declare class Batch {
|
|
570
|
+
private readonly resend;
|
|
571
|
+
private renderAsync?;
|
|
572
|
+
constructor(resend: Resend);
|
|
573
|
+
send(payload: CreateBatchOptions, options?: CreateBatchRequestOptions): Promise<CreateBatchResponse>;
|
|
574
|
+
create(payload: CreateBatchOptions, options?: CreateBatchRequestOptions): Promise<CreateBatchResponse>;
|
|
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'>[];
|
|
790
599
|
};
|
|
600
|
+
type ListBroadcastsResponse = Response<ListBroadcastsResponseSuccess>;
|
|
601
|
+
|
|
602
|
+
interface RemoveBroadcastResponseSuccess extends Pick<Broadcast, 'id'> {
|
|
603
|
+
object: 'broadcast';
|
|
604
|
+
deleted: boolean;
|
|
605
|
+
}
|
|
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
|
+
|
|
624
|
+
declare class Broadcasts {
|
|
625
|
+
private readonly resend;
|
|
626
|
+
private renderAsync?;
|
|
627
|
+
constructor(resend: Resend);
|
|
628
|
+
create(payload: CreateBroadcastOptions, options?: CreateBroadcastRequestOptions): Promise<SendBroadcastResponse>;
|
|
629
|
+
send(id: string, payload?: SendBroadcastOptions): Promise<SendBroadcastResponse>;
|
|
630
|
+
list(): Promise<ListBroadcastsResponse>;
|
|
631
|
+
get(id: string): Promise<GetBroadcastResponse>;
|
|
632
|
+
remove(id: string): Promise<RemoveBroadcastResponse>;
|
|
633
|
+
update(id: string, payload: UpdateBroadcastOptions): Promise<UpdateBroadcastResponse>;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
interface PatchOptions {
|
|
637
|
+
query?: {
|
|
638
|
+
[key: string]: unknown;
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
declare class Contacts {
|
|
643
|
+
private readonly resend;
|
|
644
|
+
constructor(resend: Resend);
|
|
645
|
+
create(payload: CreateContactOptions, options?: CreateContactRequestOptions): Promise<CreateContactResponse>;
|
|
646
|
+
list(options: ListContactsOptions): Promise<ListContactsResponse>;
|
|
647
|
+
get(options: GetContactOptions): Promise<GetContactResponse>;
|
|
648
|
+
update(options: UpdateContactOptions): Promise<UpdateContactResponse>;
|
|
649
|
+
remove(payload: RemoveContactOptions): Promise<RemoveContactsResponse>;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
declare class Domains {
|
|
653
|
+
private readonly resend;
|
|
654
|
+
constructor(resend: Resend);
|
|
655
|
+
create(payload: CreateDomainOptions, options?: CreateDomainRequestOptions): Promise<CreateDomainResponse>;
|
|
656
|
+
list(): Promise<ListDomainsResponse>;
|
|
657
|
+
get(id: string): Promise<GetDomainResponse>;
|
|
658
|
+
update(payload: UpdateDomainsOptions): Promise<UpdateDomainsResponse>;
|
|
659
|
+
remove(id: string): Promise<RemoveDomainsResponse>;
|
|
660
|
+
verify(id: string): Promise<VerifyDomainsResponse>;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
interface CancelEmailResponseSuccess {
|
|
664
|
+
object: 'email';
|
|
665
|
+
id: string;
|
|
666
|
+
}
|
|
667
|
+
type CancelEmailResponse = Response<CancelEmailResponseSuccess>;
|
|
791
668
|
|
|
792
669
|
interface UpdateEmailOptions {
|
|
793
670
|
id: string;
|
|
@@ -797,13 +674,7 @@ interface UpdateEmailResponseSuccess {
|
|
|
797
674
|
id: string;
|
|
798
675
|
object: 'email';
|
|
799
676
|
}
|
|
800
|
-
type UpdateEmailResponse =
|
|
801
|
-
data: UpdateEmailResponseSuccess;
|
|
802
|
-
error: null;
|
|
803
|
-
} | {
|
|
804
|
-
data: null;
|
|
805
|
-
error: ErrorResponse;
|
|
806
|
-
};
|
|
677
|
+
type UpdateEmailResponse = Response<UpdateEmailResponseSuccess>;
|
|
807
678
|
|
|
808
679
|
declare class Emails {
|
|
809
680
|
private readonly resend;
|
|
@@ -827,48 +698,12 @@ declare class Resend {
|
|
|
827
698
|
readonly domains: Domains;
|
|
828
699
|
readonly emails: Emails;
|
|
829
700
|
constructor(key?: string | undefined);
|
|
830
|
-
fetchRequest<T>(path: string, options?: {}): Promise<
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
error: ErrorResponse;
|
|
840
|
-
} | {
|
|
841
|
-
data: T;
|
|
842
|
-
error: null;
|
|
843
|
-
}>;
|
|
844
|
-
get<T>(path: string, options?: GetOptions): Promise<{
|
|
845
|
-
data: null;
|
|
846
|
-
error: ErrorResponse;
|
|
847
|
-
} | {
|
|
848
|
-
data: T;
|
|
849
|
-
error: null;
|
|
850
|
-
}>;
|
|
851
|
-
put<T>(path: string, entity: unknown, options?: PutOptions): Promise<{
|
|
852
|
-
data: null;
|
|
853
|
-
error: ErrorResponse;
|
|
854
|
-
} | {
|
|
855
|
-
data: T;
|
|
856
|
-
error: null;
|
|
857
|
-
}>;
|
|
858
|
-
patch<T>(path: string, entity: unknown, options?: PatchOptions): Promise<{
|
|
859
|
-
data: null;
|
|
860
|
-
error: ErrorResponse;
|
|
861
|
-
} | {
|
|
862
|
-
data: T;
|
|
863
|
-
error: null;
|
|
864
|
-
}>;
|
|
865
|
-
delete<T>(path: string, query?: unknown): Promise<{
|
|
866
|
-
data: null;
|
|
867
|
-
error: ErrorResponse;
|
|
868
|
-
} | {
|
|
869
|
-
data: T;
|
|
870
|
-
error: null;
|
|
871
|
-
}>;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
export { Attachment, CreateApiKeyOptions, CreateApiKeyRequestOptions, CreateApiKeyResponse, CreateApiKeyResponseSuccess, CreateAudienceOptions, CreateAudienceRequestOptions, CreateAudienceResponse, CreateAudienceResponseSuccess, CreateBatchOptions, CreateBatchRequestOptions, CreateBatchResponse, CreateBatchSuccessResponse, CreateBroadcastOptions, CreateBroadcastRequestOptions, CreateBroadcastResponse, CreateBroadcastResponseSuccess, CreateContactOptions, CreateContactRequestOptions, CreateContactResponse, CreateContactResponseSuccess, CreateDomainOptions, CreateDomainRequestOptions, CreateDomainResponse, CreateDomainResponseSuccess, CreateEmailOptions, CreateEmailRequestOptions, CreateEmailResponse, CreateEmailResponseSuccess, ErrorResponse, GetAudienceResponse, GetAudienceResponseSuccess, GetContactOptions, GetContactResponse, GetContactResponseSuccess, GetDomainResponse, GetDomainResponseSuccess, GetEmailResponse, GetEmailResponseSuccess, ListApiKeysResponse, ListApiKeysResponseSuccess, ListAudiencesResponse, ListAudiencesResponseSuccess, ListContactsOptions, ListContactsResponse, ListContactsResponseSuccess, ListDomainsResponse, ListDomainsResponseSuccess, RemoveApiKeyResponse, RemoveApiKeyResponseSuccess, RemoveAudiencesResponse, RemoveAudiencesResponseSuccess, RemoveContactOptions, RemoveContactsResponse, RemoveContactsResponseSuccess, RemoveDomainsResponse, RemoveDomainsResponseSuccess, Resend, SendBroadcastOptions, SendBroadcastRequestOptions, SendBroadcastResponse, SendBroadcastResponseSuccess, Tag, UpdateContactOptions, UpdateContactResponse, UpdateContactResponseSuccess, UpdateDomainsOptions, UpdateDomainsResponse, UpdateDomainsResponseSuccess, VerifyDomainsResponse, VerifyDomainsResponseSuccess };
|
|
701
|
+
fetchRequest<T>(path: string, options?: {}): Promise<Response<T>>;
|
|
702
|
+
post<T>(path: string, entity?: unknown, options?: PostOptions & IdempotentRequest): Promise<Response<T>>;
|
|
703
|
+
get<T>(path: string, options?: GetOptions): Promise<Response<T>>;
|
|
704
|
+
put<T>(path: string, entity: unknown, options?: PutOptions): Promise<Response<T>>;
|
|
705
|
+
patch<T>(path: string, entity: unknown, options?: PatchOptions): Promise<Response<T>>;
|
|
706
|
+
delete<T>(path: string, query?: unknown): Promise<Response<T>>;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
export { type Attachment, 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 ErrorResponse, type GetAudienceResponse, type GetAudienceResponseSuccess, type GetContactOptions, type GetContactResponse, type GetContactResponseSuccess, type GetDomainResponse, type GetDomainResponseSuccess, type GetEmailResponse, type GetEmailResponseSuccess, type ListApiKeysResponse, type ListApiKeysResponseSuccess, type ListAudiencesResponse, type ListAudiencesResponseSuccess, type ListContactsOptions, type ListContactsResponse, type ListContactsResponseSuccess, type ListDomainsResponse, type ListDomainsResponseSuccess, type RemoveApiKeyResponse, type RemoveApiKeyResponseSuccess, type RemoveAudiencesResponse, type RemoveAudiencesResponseSuccess, type RemoveContactOptions, type RemoveContactsResponse, type RemoveContactsResponseSuccess, type RemoveDomainsResponse, type RemoveDomainsResponseSuccess, Resend, type SendBroadcastOptions, type SendBroadcastRequestOptions, type SendBroadcastResponse, type SendBroadcastResponseSuccess, type Tag, type UpdateContactOptions, type UpdateContactResponse, type UpdateContactResponseSuccess, type UpdateDomainsOptions, type UpdateDomainsResponse, type UpdateDomainsResponseSuccess, type VerifyDomainsResponse, type VerifyDomainsResponseSuccess };
|