@unsent/sdk 0.25.2
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/.eslintrc.cjs +10 -0
- package/LICENSE +21 -0
- package/README.md +328 -0
- package/dist/index.d.mts +1054 -0
- package/dist/index.d.ts +1054 -0
- package/dist/index.js +228 -0
- package/dist/index.mjs +201 -0
- package/package.json +29 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1054 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type ErrorResponse = {
|
|
4
|
+
message: string;
|
|
5
|
+
code: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This file was auto-generated by openapi-typescript.
|
|
10
|
+
* Do not make direct changes to the file.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface paths {
|
|
14
|
+
"/v1/domains": {
|
|
15
|
+
parameters: {
|
|
16
|
+
query?: never;
|
|
17
|
+
header?: never;
|
|
18
|
+
path?: never;
|
|
19
|
+
cookie?: never;
|
|
20
|
+
};
|
|
21
|
+
get: {
|
|
22
|
+
parameters: {
|
|
23
|
+
query?: never;
|
|
24
|
+
header?: never;
|
|
25
|
+
path?: never;
|
|
26
|
+
cookie?: never;
|
|
27
|
+
};
|
|
28
|
+
requestBody?: never;
|
|
29
|
+
responses: {
|
|
30
|
+
/** @description Retrieve domains accessible by the API key */
|
|
31
|
+
200: {
|
|
32
|
+
headers: {
|
|
33
|
+
[name: string]: unknown;
|
|
34
|
+
};
|
|
35
|
+
content: {
|
|
36
|
+
"application/json": {
|
|
37
|
+
/**
|
|
38
|
+
* @description The ID of the domain
|
|
39
|
+
* @example 1
|
|
40
|
+
*/
|
|
41
|
+
id: number;
|
|
42
|
+
/**
|
|
43
|
+
* @description The name of the domain
|
|
44
|
+
* @example example.com
|
|
45
|
+
*/
|
|
46
|
+
name: string;
|
|
47
|
+
/**
|
|
48
|
+
* @description The ID of the team
|
|
49
|
+
* @example 1
|
|
50
|
+
*/
|
|
51
|
+
teamId: number;
|
|
52
|
+
/** @enum {string} */
|
|
53
|
+
status: "NOT_STARTED" | "PENDING" | "SUCCESS" | "FAILED" | "TEMPORARY_FAILURE";
|
|
54
|
+
/** @default us-east-1 */
|
|
55
|
+
region: string;
|
|
56
|
+
/** @default false */
|
|
57
|
+
clickTracking: boolean;
|
|
58
|
+
/** @default false */
|
|
59
|
+
openTracking: boolean;
|
|
60
|
+
publicKey: string;
|
|
61
|
+
dkimStatus?: string | null;
|
|
62
|
+
spfDetails?: string | null;
|
|
63
|
+
createdAt: string;
|
|
64
|
+
updatedAt: string;
|
|
65
|
+
/** @default false */
|
|
66
|
+
dmarcAdded: boolean;
|
|
67
|
+
/** @default false */
|
|
68
|
+
isVerifying: boolean;
|
|
69
|
+
errorMessage?: string | null;
|
|
70
|
+
subdomain?: string | null;
|
|
71
|
+
verificationError?: string | null;
|
|
72
|
+
lastCheckedTime?: string | null;
|
|
73
|
+
dnsRecords: {
|
|
74
|
+
/**
|
|
75
|
+
* @description DNS record type
|
|
76
|
+
* @example TXT
|
|
77
|
+
* @enum {string}
|
|
78
|
+
*/
|
|
79
|
+
type: "MX" | "TXT";
|
|
80
|
+
/**
|
|
81
|
+
* @description DNS record name
|
|
82
|
+
* @example mail
|
|
83
|
+
*/
|
|
84
|
+
name: string;
|
|
85
|
+
/**
|
|
86
|
+
* @description DNS record value
|
|
87
|
+
* @example v=spf1 include:amazonses.com ~all
|
|
88
|
+
*/
|
|
89
|
+
value: string;
|
|
90
|
+
/**
|
|
91
|
+
* @description DNS record TTL
|
|
92
|
+
* @example Auto
|
|
93
|
+
*/
|
|
94
|
+
ttl: string;
|
|
95
|
+
/**
|
|
96
|
+
* @description DNS record priority
|
|
97
|
+
* @example 10
|
|
98
|
+
*/
|
|
99
|
+
priority?: string | null;
|
|
100
|
+
/** @enum {string} */
|
|
101
|
+
status: "NOT_STARTED" | "PENDING" | "SUCCESS" | "FAILED" | "TEMPORARY_FAILURE";
|
|
102
|
+
/** @description Whether the record is recommended */
|
|
103
|
+
recommended?: boolean;
|
|
104
|
+
}[];
|
|
105
|
+
}[];
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
put?: never;
|
|
111
|
+
post: {
|
|
112
|
+
parameters: {
|
|
113
|
+
query?: never;
|
|
114
|
+
header?: never;
|
|
115
|
+
path?: never;
|
|
116
|
+
cookie?: never;
|
|
117
|
+
};
|
|
118
|
+
requestBody: {
|
|
119
|
+
content: {
|
|
120
|
+
"application/json": {
|
|
121
|
+
name: string;
|
|
122
|
+
region: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
responses: {
|
|
127
|
+
/** @description Create a new domain */
|
|
128
|
+
200: {
|
|
129
|
+
headers: {
|
|
130
|
+
[name: string]: unknown;
|
|
131
|
+
};
|
|
132
|
+
content: {
|
|
133
|
+
"application/json": {
|
|
134
|
+
/**
|
|
135
|
+
* @description The ID of the domain
|
|
136
|
+
* @example 1
|
|
137
|
+
*/
|
|
138
|
+
id: number;
|
|
139
|
+
/**
|
|
140
|
+
* @description The name of the domain
|
|
141
|
+
* @example example.com
|
|
142
|
+
*/
|
|
143
|
+
name: string;
|
|
144
|
+
/**
|
|
145
|
+
* @description The ID of the team
|
|
146
|
+
* @example 1
|
|
147
|
+
*/
|
|
148
|
+
teamId: number;
|
|
149
|
+
/** @enum {string} */
|
|
150
|
+
status: "NOT_STARTED" | "PENDING" | "SUCCESS" | "FAILED" | "TEMPORARY_FAILURE";
|
|
151
|
+
/** @default us-east-1 */
|
|
152
|
+
region: string;
|
|
153
|
+
/** @default false */
|
|
154
|
+
clickTracking: boolean;
|
|
155
|
+
/** @default false */
|
|
156
|
+
openTracking: boolean;
|
|
157
|
+
publicKey: string;
|
|
158
|
+
dkimStatus?: string | null;
|
|
159
|
+
spfDetails?: string | null;
|
|
160
|
+
createdAt: string;
|
|
161
|
+
updatedAt: string;
|
|
162
|
+
/** @default false */
|
|
163
|
+
dmarcAdded: boolean;
|
|
164
|
+
/** @default false */
|
|
165
|
+
isVerifying: boolean;
|
|
166
|
+
errorMessage?: string | null;
|
|
167
|
+
subdomain?: string | null;
|
|
168
|
+
verificationError?: string | null;
|
|
169
|
+
lastCheckedTime?: string | null;
|
|
170
|
+
dnsRecords: {
|
|
171
|
+
/**
|
|
172
|
+
* @description DNS record type
|
|
173
|
+
* @example TXT
|
|
174
|
+
* @enum {string}
|
|
175
|
+
*/
|
|
176
|
+
type: "MX" | "TXT";
|
|
177
|
+
/**
|
|
178
|
+
* @description DNS record name
|
|
179
|
+
* @example mail
|
|
180
|
+
*/
|
|
181
|
+
name: string;
|
|
182
|
+
/**
|
|
183
|
+
* @description DNS record value
|
|
184
|
+
* @example v=spf1 include:amazonses.com ~all
|
|
185
|
+
*/
|
|
186
|
+
value: string;
|
|
187
|
+
/**
|
|
188
|
+
* @description DNS record TTL
|
|
189
|
+
* @example Auto
|
|
190
|
+
*/
|
|
191
|
+
ttl: string;
|
|
192
|
+
/**
|
|
193
|
+
* @description DNS record priority
|
|
194
|
+
* @example 10
|
|
195
|
+
*/
|
|
196
|
+
priority?: string | null;
|
|
197
|
+
/** @enum {string} */
|
|
198
|
+
status: "NOT_STARTED" | "PENDING" | "SUCCESS" | "FAILED" | "TEMPORARY_FAILURE";
|
|
199
|
+
/** @description Whether the record is recommended */
|
|
200
|
+
recommended?: boolean;
|
|
201
|
+
}[];
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
delete?: never;
|
|
208
|
+
options?: never;
|
|
209
|
+
head?: never;
|
|
210
|
+
patch?: never;
|
|
211
|
+
trace?: never;
|
|
212
|
+
};
|
|
213
|
+
"/v1/domains/{id}/verify": {
|
|
214
|
+
parameters: {
|
|
215
|
+
query?: never;
|
|
216
|
+
header?: never;
|
|
217
|
+
path?: never;
|
|
218
|
+
cookie?: never;
|
|
219
|
+
};
|
|
220
|
+
get?: never;
|
|
221
|
+
put: {
|
|
222
|
+
parameters: {
|
|
223
|
+
query?: never;
|
|
224
|
+
header?: never;
|
|
225
|
+
path: {
|
|
226
|
+
id: number | null;
|
|
227
|
+
};
|
|
228
|
+
cookie?: never;
|
|
229
|
+
};
|
|
230
|
+
requestBody?: never;
|
|
231
|
+
responses: {
|
|
232
|
+
/** @description Verify domain */
|
|
233
|
+
200: {
|
|
234
|
+
headers: {
|
|
235
|
+
[name: string]: unknown;
|
|
236
|
+
};
|
|
237
|
+
content: {
|
|
238
|
+
"application/json": {
|
|
239
|
+
message: string;
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
/** @description Forbidden - API key doesn't have access to this domain */
|
|
244
|
+
403: {
|
|
245
|
+
headers: {
|
|
246
|
+
[name: string]: unknown;
|
|
247
|
+
};
|
|
248
|
+
content: {
|
|
249
|
+
"application/json": {
|
|
250
|
+
error: string;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
/** @description Domain not found */
|
|
255
|
+
404: {
|
|
256
|
+
headers: {
|
|
257
|
+
[name: string]: unknown;
|
|
258
|
+
};
|
|
259
|
+
content: {
|
|
260
|
+
"application/json": {
|
|
261
|
+
error: string;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
post?: never;
|
|
268
|
+
delete?: never;
|
|
269
|
+
options?: never;
|
|
270
|
+
head?: never;
|
|
271
|
+
patch?: never;
|
|
272
|
+
trace?: never;
|
|
273
|
+
};
|
|
274
|
+
"/v1/domains/{id}": {
|
|
275
|
+
parameters: {
|
|
276
|
+
query?: never;
|
|
277
|
+
header?: never;
|
|
278
|
+
path?: never;
|
|
279
|
+
cookie?: never;
|
|
280
|
+
};
|
|
281
|
+
get: {
|
|
282
|
+
parameters: {
|
|
283
|
+
query?: never;
|
|
284
|
+
header?: never;
|
|
285
|
+
path: {
|
|
286
|
+
id: number | null;
|
|
287
|
+
};
|
|
288
|
+
cookie?: never;
|
|
289
|
+
};
|
|
290
|
+
requestBody?: never;
|
|
291
|
+
responses: {
|
|
292
|
+
/** @description Retrieve the domain */
|
|
293
|
+
200: {
|
|
294
|
+
headers: {
|
|
295
|
+
[name: string]: unknown;
|
|
296
|
+
};
|
|
297
|
+
content: {
|
|
298
|
+
"application/json": {
|
|
299
|
+
/**
|
|
300
|
+
* @description The ID of the domain
|
|
301
|
+
* @example 1
|
|
302
|
+
*/
|
|
303
|
+
id: number;
|
|
304
|
+
/**
|
|
305
|
+
* @description The name of the domain
|
|
306
|
+
* @example example.com
|
|
307
|
+
*/
|
|
308
|
+
name: string;
|
|
309
|
+
/**
|
|
310
|
+
* @description The ID of the team
|
|
311
|
+
* @example 1
|
|
312
|
+
*/
|
|
313
|
+
teamId: number;
|
|
314
|
+
/** @enum {string} */
|
|
315
|
+
status: "NOT_STARTED" | "PENDING" | "SUCCESS" | "FAILED" | "TEMPORARY_FAILURE";
|
|
316
|
+
/** @default us-east-1 */
|
|
317
|
+
region: string;
|
|
318
|
+
/** @default false */
|
|
319
|
+
clickTracking: boolean;
|
|
320
|
+
/** @default false */
|
|
321
|
+
openTracking: boolean;
|
|
322
|
+
publicKey: string;
|
|
323
|
+
dkimStatus?: string | null;
|
|
324
|
+
spfDetails?: string | null;
|
|
325
|
+
createdAt: string;
|
|
326
|
+
updatedAt: string;
|
|
327
|
+
/** @default false */
|
|
328
|
+
dmarcAdded: boolean;
|
|
329
|
+
/** @default false */
|
|
330
|
+
isVerifying: boolean;
|
|
331
|
+
errorMessage?: string | null;
|
|
332
|
+
subdomain?: string | null;
|
|
333
|
+
verificationError?: string | null;
|
|
334
|
+
lastCheckedTime?: string | null;
|
|
335
|
+
dnsRecords: {
|
|
336
|
+
/**
|
|
337
|
+
* @description DNS record type
|
|
338
|
+
* @example TXT
|
|
339
|
+
* @enum {string}
|
|
340
|
+
*/
|
|
341
|
+
type: "MX" | "TXT";
|
|
342
|
+
/**
|
|
343
|
+
* @description DNS record name
|
|
344
|
+
* @example mail
|
|
345
|
+
*/
|
|
346
|
+
name: string;
|
|
347
|
+
/**
|
|
348
|
+
* @description DNS record value
|
|
349
|
+
* @example v=spf1 include:amazonses.com ~all
|
|
350
|
+
*/
|
|
351
|
+
value: string;
|
|
352
|
+
/**
|
|
353
|
+
* @description DNS record TTL
|
|
354
|
+
* @example Auto
|
|
355
|
+
*/
|
|
356
|
+
ttl: string;
|
|
357
|
+
/**
|
|
358
|
+
* @description DNS record priority
|
|
359
|
+
* @example 10
|
|
360
|
+
*/
|
|
361
|
+
priority?: string | null;
|
|
362
|
+
/** @enum {string} */
|
|
363
|
+
status: "NOT_STARTED" | "PENDING" | "SUCCESS" | "FAILED" | "TEMPORARY_FAILURE";
|
|
364
|
+
/** @description Whether the record is recommended */
|
|
365
|
+
recommended?: boolean;
|
|
366
|
+
}[];
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
put?: never;
|
|
373
|
+
post?: never;
|
|
374
|
+
delete?: never;
|
|
375
|
+
options?: never;
|
|
376
|
+
head?: never;
|
|
377
|
+
patch?: never;
|
|
378
|
+
trace?: never;
|
|
379
|
+
};
|
|
380
|
+
"/v1/emails/{emailId}": {
|
|
381
|
+
parameters: {
|
|
382
|
+
query?: never;
|
|
383
|
+
header?: never;
|
|
384
|
+
path?: never;
|
|
385
|
+
cookie?: never;
|
|
386
|
+
};
|
|
387
|
+
get: {
|
|
388
|
+
parameters: {
|
|
389
|
+
query?: never;
|
|
390
|
+
header?: never;
|
|
391
|
+
path: {
|
|
392
|
+
emailId: string;
|
|
393
|
+
};
|
|
394
|
+
cookie?: never;
|
|
395
|
+
};
|
|
396
|
+
requestBody?: never;
|
|
397
|
+
responses: {
|
|
398
|
+
/** @description Retrieve the email */
|
|
399
|
+
200: {
|
|
400
|
+
headers: {
|
|
401
|
+
[name: string]: unknown;
|
|
402
|
+
};
|
|
403
|
+
content: {
|
|
404
|
+
"application/json": {
|
|
405
|
+
id: string;
|
|
406
|
+
teamId: number;
|
|
407
|
+
to: string | string[];
|
|
408
|
+
replyTo?: string | string[];
|
|
409
|
+
cc?: string | string[];
|
|
410
|
+
bcc?: string | string[];
|
|
411
|
+
from: string;
|
|
412
|
+
subject: string;
|
|
413
|
+
html: string | null;
|
|
414
|
+
text: string | null;
|
|
415
|
+
createdAt: string;
|
|
416
|
+
updatedAt: string;
|
|
417
|
+
emailEvents: {
|
|
418
|
+
emailId: string;
|
|
419
|
+
/** @enum {string} */
|
|
420
|
+
status: "SCHEDULED" | "QUEUED" | "SENT" | "DELIVERY_DELAYED" | "BOUNCED" | "REJECTED" | "RENDERING_FAILURE" | "DELIVERED" | "OPENED" | "CLICKED" | "COMPLAINED" | "FAILED" | "CANCELLED" | "SUPPRESSED";
|
|
421
|
+
createdAt: string;
|
|
422
|
+
data?: unknown;
|
|
423
|
+
}[];
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
put?: never;
|
|
430
|
+
post?: never;
|
|
431
|
+
delete?: never;
|
|
432
|
+
options?: never;
|
|
433
|
+
head?: never;
|
|
434
|
+
patch: {
|
|
435
|
+
parameters: {
|
|
436
|
+
query?: never;
|
|
437
|
+
header?: never;
|
|
438
|
+
path: {
|
|
439
|
+
emailId: string;
|
|
440
|
+
};
|
|
441
|
+
cookie?: never;
|
|
442
|
+
};
|
|
443
|
+
requestBody: {
|
|
444
|
+
content: {
|
|
445
|
+
"application/json": {
|
|
446
|
+
/** Format: date-time */
|
|
447
|
+
scheduledAt: string;
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
responses: {
|
|
452
|
+
/** @description Retrieve the user */
|
|
453
|
+
200: {
|
|
454
|
+
headers: {
|
|
455
|
+
[name: string]: unknown;
|
|
456
|
+
};
|
|
457
|
+
content: {
|
|
458
|
+
"application/json": {
|
|
459
|
+
emailId?: string;
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
trace?: never;
|
|
466
|
+
};
|
|
467
|
+
"/v1/emails": {
|
|
468
|
+
parameters: {
|
|
469
|
+
query?: never;
|
|
470
|
+
header?: never;
|
|
471
|
+
path?: never;
|
|
472
|
+
cookie?: never;
|
|
473
|
+
};
|
|
474
|
+
get: {
|
|
475
|
+
parameters: {
|
|
476
|
+
query?: {
|
|
477
|
+
page?: string;
|
|
478
|
+
limit?: string;
|
|
479
|
+
startDate?: string;
|
|
480
|
+
endDate?: string;
|
|
481
|
+
domainId?: string | string[];
|
|
482
|
+
};
|
|
483
|
+
header?: never;
|
|
484
|
+
path?: never;
|
|
485
|
+
cookie?: never;
|
|
486
|
+
};
|
|
487
|
+
requestBody?: never;
|
|
488
|
+
responses: {
|
|
489
|
+
/** @description Retrieve a list of emails */
|
|
490
|
+
200: {
|
|
491
|
+
headers: {
|
|
492
|
+
[name: string]: unknown;
|
|
493
|
+
};
|
|
494
|
+
content: {
|
|
495
|
+
"application/json": {
|
|
496
|
+
data: {
|
|
497
|
+
id: string;
|
|
498
|
+
to: string | string[];
|
|
499
|
+
replyTo?: string | string[] | unknown;
|
|
500
|
+
cc?: string | string[] | unknown;
|
|
501
|
+
bcc?: string | string[] | unknown;
|
|
502
|
+
from: string;
|
|
503
|
+
subject: string;
|
|
504
|
+
html: string | null;
|
|
505
|
+
text: string | null;
|
|
506
|
+
createdAt: string;
|
|
507
|
+
updatedAt: string;
|
|
508
|
+
/** @enum {string|null} */
|
|
509
|
+
latestStatus: "SCHEDULED" | "QUEUED" | "SENT" | "DELIVERY_DELAYED" | "BOUNCED" | "REJECTED" | "RENDERING_FAILURE" | "DELIVERED" | "OPENED" | "CLICKED" | "COMPLAINED" | "FAILED" | "CANCELLED" | "SUPPRESSED" | null;
|
|
510
|
+
/** Format: date-time */
|
|
511
|
+
scheduledAt: string | null;
|
|
512
|
+
domainId: number | null;
|
|
513
|
+
}[];
|
|
514
|
+
count: number;
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
put?: never;
|
|
521
|
+
post: {
|
|
522
|
+
parameters: {
|
|
523
|
+
query?: never;
|
|
524
|
+
header?: never;
|
|
525
|
+
path?: never;
|
|
526
|
+
cookie?: never;
|
|
527
|
+
};
|
|
528
|
+
requestBody: {
|
|
529
|
+
content: {
|
|
530
|
+
"application/json": {
|
|
531
|
+
to: string | string[];
|
|
532
|
+
from: string;
|
|
533
|
+
/** @description Optional when templateId is provided */
|
|
534
|
+
subject?: string;
|
|
535
|
+
/** @description ID of a template from the dashboard */
|
|
536
|
+
templateId?: string;
|
|
537
|
+
variables?: {
|
|
538
|
+
[key: string]: string;
|
|
539
|
+
};
|
|
540
|
+
replyTo?: string | string[];
|
|
541
|
+
cc?: string | string[];
|
|
542
|
+
bcc?: string | string[];
|
|
543
|
+
text?: string | null;
|
|
544
|
+
html?: string | null;
|
|
545
|
+
/** @description Custom headers to included with the emails */
|
|
546
|
+
headers?: {
|
|
547
|
+
[key: string]: string;
|
|
548
|
+
};
|
|
549
|
+
attachments?: {
|
|
550
|
+
filename: string;
|
|
551
|
+
content: string;
|
|
552
|
+
}[];
|
|
553
|
+
/** Format: date-time */
|
|
554
|
+
scheduledAt?: string;
|
|
555
|
+
inReplyToId?: string | null;
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
responses: {
|
|
560
|
+
/** @description Retrieve the user */
|
|
561
|
+
200: {
|
|
562
|
+
headers: {
|
|
563
|
+
[name: string]: unknown;
|
|
564
|
+
};
|
|
565
|
+
content: {
|
|
566
|
+
"application/json": {
|
|
567
|
+
emailId?: string;
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
delete?: never;
|
|
574
|
+
options?: never;
|
|
575
|
+
head?: never;
|
|
576
|
+
patch?: never;
|
|
577
|
+
trace?: never;
|
|
578
|
+
};
|
|
579
|
+
"/v1/emails/batch": {
|
|
580
|
+
parameters: {
|
|
581
|
+
query?: never;
|
|
582
|
+
header?: never;
|
|
583
|
+
path?: never;
|
|
584
|
+
cookie?: never;
|
|
585
|
+
};
|
|
586
|
+
get?: never;
|
|
587
|
+
put?: never;
|
|
588
|
+
post: {
|
|
589
|
+
parameters: {
|
|
590
|
+
query?: never;
|
|
591
|
+
header?: never;
|
|
592
|
+
path?: never;
|
|
593
|
+
cookie?: never;
|
|
594
|
+
};
|
|
595
|
+
requestBody: {
|
|
596
|
+
content: {
|
|
597
|
+
"application/json": {
|
|
598
|
+
to: string | string[];
|
|
599
|
+
from: string;
|
|
600
|
+
/** @description Optional when templateId is provided */
|
|
601
|
+
subject?: string;
|
|
602
|
+
/** @description ID of a template from the dashboard */
|
|
603
|
+
templateId?: string;
|
|
604
|
+
variables?: {
|
|
605
|
+
[key: string]: string;
|
|
606
|
+
};
|
|
607
|
+
replyTo?: string | string[];
|
|
608
|
+
cc?: string | string[];
|
|
609
|
+
bcc?: string | string[];
|
|
610
|
+
text?: string | null;
|
|
611
|
+
html?: string | null;
|
|
612
|
+
/** @description Custom headers to included with the emails */
|
|
613
|
+
headers?: {
|
|
614
|
+
[key: string]: string;
|
|
615
|
+
};
|
|
616
|
+
attachments?: {
|
|
617
|
+
filename: string;
|
|
618
|
+
content: string;
|
|
619
|
+
}[];
|
|
620
|
+
/** Format: date-time */
|
|
621
|
+
scheduledAt?: string;
|
|
622
|
+
inReplyToId?: string | null;
|
|
623
|
+
}[];
|
|
624
|
+
};
|
|
625
|
+
};
|
|
626
|
+
responses: {
|
|
627
|
+
/** @description List of successfully created email IDs */
|
|
628
|
+
200: {
|
|
629
|
+
headers: {
|
|
630
|
+
[name: string]: unknown;
|
|
631
|
+
};
|
|
632
|
+
content: {
|
|
633
|
+
"application/json": {
|
|
634
|
+
data: {
|
|
635
|
+
emailId: string;
|
|
636
|
+
}[];
|
|
637
|
+
};
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
};
|
|
641
|
+
};
|
|
642
|
+
delete?: never;
|
|
643
|
+
options?: never;
|
|
644
|
+
head?: never;
|
|
645
|
+
patch?: never;
|
|
646
|
+
trace?: never;
|
|
647
|
+
};
|
|
648
|
+
"/v1/emails/{emailId}/cancel": {
|
|
649
|
+
parameters: {
|
|
650
|
+
query?: never;
|
|
651
|
+
header?: never;
|
|
652
|
+
path?: never;
|
|
653
|
+
cookie?: never;
|
|
654
|
+
};
|
|
655
|
+
get?: never;
|
|
656
|
+
put?: never;
|
|
657
|
+
post: {
|
|
658
|
+
parameters: {
|
|
659
|
+
query?: never;
|
|
660
|
+
header?: never;
|
|
661
|
+
path: {
|
|
662
|
+
emailId: string;
|
|
663
|
+
};
|
|
664
|
+
cookie?: never;
|
|
665
|
+
};
|
|
666
|
+
requestBody?: never;
|
|
667
|
+
responses: {
|
|
668
|
+
/** @description Retrieve the user */
|
|
669
|
+
200: {
|
|
670
|
+
headers: {
|
|
671
|
+
[name: string]: unknown;
|
|
672
|
+
};
|
|
673
|
+
content: {
|
|
674
|
+
"application/json": {
|
|
675
|
+
emailId?: string;
|
|
676
|
+
};
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
delete?: never;
|
|
682
|
+
options?: never;
|
|
683
|
+
head?: never;
|
|
684
|
+
patch?: never;
|
|
685
|
+
trace?: never;
|
|
686
|
+
};
|
|
687
|
+
"/v1/contactBooks/{contactBookId}/contacts": {
|
|
688
|
+
parameters: {
|
|
689
|
+
query?: never;
|
|
690
|
+
header?: never;
|
|
691
|
+
path?: never;
|
|
692
|
+
cookie?: never;
|
|
693
|
+
};
|
|
694
|
+
get: {
|
|
695
|
+
parameters: {
|
|
696
|
+
query?: {
|
|
697
|
+
emails?: string;
|
|
698
|
+
page?: number;
|
|
699
|
+
limit?: number;
|
|
700
|
+
ids?: string;
|
|
701
|
+
};
|
|
702
|
+
header?: never;
|
|
703
|
+
path: {
|
|
704
|
+
contactBookId: string;
|
|
705
|
+
};
|
|
706
|
+
cookie?: never;
|
|
707
|
+
};
|
|
708
|
+
requestBody?: never;
|
|
709
|
+
responses: {
|
|
710
|
+
/** @description Retrieve multiple contacts */
|
|
711
|
+
200: {
|
|
712
|
+
headers: {
|
|
713
|
+
[name: string]: unknown;
|
|
714
|
+
};
|
|
715
|
+
content: {
|
|
716
|
+
"application/json": {
|
|
717
|
+
id: string;
|
|
718
|
+
firstName?: string | null;
|
|
719
|
+
lastName?: string | null;
|
|
720
|
+
email: string;
|
|
721
|
+
/** @default true */
|
|
722
|
+
subscribed: boolean;
|
|
723
|
+
properties: {
|
|
724
|
+
[key: string]: string;
|
|
725
|
+
};
|
|
726
|
+
contactBookId: string;
|
|
727
|
+
createdAt: string;
|
|
728
|
+
updatedAt: string;
|
|
729
|
+
}[];
|
|
730
|
+
};
|
|
731
|
+
};
|
|
732
|
+
};
|
|
733
|
+
};
|
|
734
|
+
put?: never;
|
|
735
|
+
post: {
|
|
736
|
+
parameters: {
|
|
737
|
+
query?: never;
|
|
738
|
+
header?: never;
|
|
739
|
+
path: {
|
|
740
|
+
contactBookId: string;
|
|
741
|
+
};
|
|
742
|
+
cookie?: never;
|
|
743
|
+
};
|
|
744
|
+
requestBody: {
|
|
745
|
+
content: {
|
|
746
|
+
"application/json": {
|
|
747
|
+
email: string;
|
|
748
|
+
firstName?: string;
|
|
749
|
+
lastName?: string;
|
|
750
|
+
properties?: {
|
|
751
|
+
[key: string]: string;
|
|
752
|
+
};
|
|
753
|
+
subscribed?: boolean;
|
|
754
|
+
};
|
|
755
|
+
};
|
|
756
|
+
};
|
|
757
|
+
responses: {
|
|
758
|
+
/** @description Retrieve the user */
|
|
759
|
+
200: {
|
|
760
|
+
headers: {
|
|
761
|
+
[name: string]: unknown;
|
|
762
|
+
};
|
|
763
|
+
content: {
|
|
764
|
+
"application/json": {
|
|
765
|
+
contactId?: string;
|
|
766
|
+
};
|
|
767
|
+
};
|
|
768
|
+
};
|
|
769
|
+
};
|
|
770
|
+
};
|
|
771
|
+
delete?: never;
|
|
772
|
+
options?: never;
|
|
773
|
+
head?: never;
|
|
774
|
+
patch?: never;
|
|
775
|
+
trace?: never;
|
|
776
|
+
};
|
|
777
|
+
"/v1/contactBooks/{contactBookId}/contacts/{contactId}": {
|
|
778
|
+
parameters: {
|
|
779
|
+
query?: never;
|
|
780
|
+
header?: never;
|
|
781
|
+
path?: never;
|
|
782
|
+
cookie?: never;
|
|
783
|
+
};
|
|
784
|
+
get: {
|
|
785
|
+
parameters: {
|
|
786
|
+
query?: never;
|
|
787
|
+
header?: never;
|
|
788
|
+
path: {
|
|
789
|
+
contactBookId: string;
|
|
790
|
+
contactId: string;
|
|
791
|
+
};
|
|
792
|
+
cookie?: never;
|
|
793
|
+
};
|
|
794
|
+
requestBody?: never;
|
|
795
|
+
responses: {
|
|
796
|
+
/** @description Retrieve the contact */
|
|
797
|
+
200: {
|
|
798
|
+
headers: {
|
|
799
|
+
[name: string]: unknown;
|
|
800
|
+
};
|
|
801
|
+
content: {
|
|
802
|
+
"application/json": {
|
|
803
|
+
id: string;
|
|
804
|
+
firstName?: string | null;
|
|
805
|
+
lastName?: string | null;
|
|
806
|
+
email: string;
|
|
807
|
+
/** @default true */
|
|
808
|
+
subscribed: boolean;
|
|
809
|
+
properties: {
|
|
810
|
+
[key: string]: string;
|
|
811
|
+
};
|
|
812
|
+
contactBookId: string;
|
|
813
|
+
createdAt: string;
|
|
814
|
+
updatedAt: string;
|
|
815
|
+
};
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
};
|
|
819
|
+
};
|
|
820
|
+
put: {
|
|
821
|
+
parameters: {
|
|
822
|
+
query?: never;
|
|
823
|
+
header?: never;
|
|
824
|
+
path: {
|
|
825
|
+
contactBookId: string;
|
|
826
|
+
};
|
|
827
|
+
cookie?: never;
|
|
828
|
+
};
|
|
829
|
+
requestBody: {
|
|
830
|
+
content: {
|
|
831
|
+
"application/json": {
|
|
832
|
+
email: string;
|
|
833
|
+
firstName?: string;
|
|
834
|
+
lastName?: string;
|
|
835
|
+
properties?: {
|
|
836
|
+
[key: string]: string;
|
|
837
|
+
};
|
|
838
|
+
subscribed?: boolean;
|
|
839
|
+
};
|
|
840
|
+
};
|
|
841
|
+
};
|
|
842
|
+
responses: {
|
|
843
|
+
/** @description Contact upserted successfully */
|
|
844
|
+
200: {
|
|
845
|
+
headers: {
|
|
846
|
+
[name: string]: unknown;
|
|
847
|
+
};
|
|
848
|
+
content: {
|
|
849
|
+
"application/json": {
|
|
850
|
+
contactId: string;
|
|
851
|
+
};
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
};
|
|
855
|
+
};
|
|
856
|
+
post?: never;
|
|
857
|
+
delete: {
|
|
858
|
+
parameters: {
|
|
859
|
+
query?: never;
|
|
860
|
+
header?: never;
|
|
861
|
+
path: {
|
|
862
|
+
contactBookId: string;
|
|
863
|
+
contactId: string;
|
|
864
|
+
};
|
|
865
|
+
cookie?: never;
|
|
866
|
+
};
|
|
867
|
+
requestBody?: never;
|
|
868
|
+
responses: {
|
|
869
|
+
/** @description Contact deleted successfully */
|
|
870
|
+
200: {
|
|
871
|
+
headers: {
|
|
872
|
+
[name: string]: unknown;
|
|
873
|
+
};
|
|
874
|
+
content: {
|
|
875
|
+
"application/json": {
|
|
876
|
+
success: boolean;
|
|
877
|
+
};
|
|
878
|
+
};
|
|
879
|
+
};
|
|
880
|
+
};
|
|
881
|
+
};
|
|
882
|
+
options?: never;
|
|
883
|
+
head?: never;
|
|
884
|
+
patch: {
|
|
885
|
+
parameters: {
|
|
886
|
+
query?: never;
|
|
887
|
+
header?: never;
|
|
888
|
+
path: {
|
|
889
|
+
contactBookId: string;
|
|
890
|
+
contactId: string;
|
|
891
|
+
};
|
|
892
|
+
cookie?: never;
|
|
893
|
+
};
|
|
894
|
+
requestBody: {
|
|
895
|
+
content: {
|
|
896
|
+
"application/json": {
|
|
897
|
+
firstName?: string;
|
|
898
|
+
lastName?: string;
|
|
899
|
+
properties?: {
|
|
900
|
+
[key: string]: string;
|
|
901
|
+
};
|
|
902
|
+
subscribed?: boolean;
|
|
903
|
+
};
|
|
904
|
+
};
|
|
905
|
+
};
|
|
906
|
+
responses: {
|
|
907
|
+
/** @description Retrieve the user */
|
|
908
|
+
200: {
|
|
909
|
+
headers: {
|
|
910
|
+
[name: string]: unknown;
|
|
911
|
+
};
|
|
912
|
+
content: {
|
|
913
|
+
"application/json": {
|
|
914
|
+
contactId?: string;
|
|
915
|
+
};
|
|
916
|
+
};
|
|
917
|
+
};
|
|
918
|
+
};
|
|
919
|
+
};
|
|
920
|
+
trace?: never;
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
type CreateContactPayload = paths["/v1/contactBooks/{contactBookId}/contacts"]["post"]["requestBody"]["content"]["application/json"];
|
|
925
|
+
type CreateContactResponse = {
|
|
926
|
+
data: CreateContactResponseSuccess | null;
|
|
927
|
+
error: ErrorResponse | null;
|
|
928
|
+
};
|
|
929
|
+
type CreateContactResponseSuccess = paths["/v1/contactBooks/{contactBookId}/contacts"]["post"]["responses"]["200"]["content"]["application/json"];
|
|
930
|
+
type GetContactResponseSuccess = paths["/v1/contactBooks/{contactBookId}/contacts/{contactId}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
931
|
+
type GetContactResponse = {
|
|
932
|
+
data: GetContactResponseSuccess | null;
|
|
933
|
+
error: ErrorResponse | null;
|
|
934
|
+
};
|
|
935
|
+
type UpdateContactPayload = paths["/v1/contactBooks/{contactBookId}/contacts/{contactId}"]["patch"]["requestBody"]["content"]["application/json"];
|
|
936
|
+
type UpdateContactResponseSuccess = paths["/v1/contactBooks/{contactBookId}/contacts/{contactId}"]["patch"]["responses"]["200"]["content"]["application/json"];
|
|
937
|
+
type UpdateContactResponse = {
|
|
938
|
+
data: UpdateContactResponseSuccess | null;
|
|
939
|
+
error: ErrorResponse | null;
|
|
940
|
+
};
|
|
941
|
+
type UpsertContactPayload = paths["/v1/contactBooks/{contactBookId}/contacts/{contactId}"]["put"]["requestBody"]["content"]["application/json"];
|
|
942
|
+
type UpsertContactResponseSuccess = paths["/v1/contactBooks/{contactBookId}/contacts/{contactId}"]["put"]["responses"]["200"]["content"]["application/json"];
|
|
943
|
+
type UpsertContactResponse = {
|
|
944
|
+
data: UpsertContactResponseSuccess | null;
|
|
945
|
+
error: ErrorResponse | null;
|
|
946
|
+
};
|
|
947
|
+
type DeleteContactResponse = {
|
|
948
|
+
data: {
|
|
949
|
+
success: boolean;
|
|
950
|
+
} | null;
|
|
951
|
+
error: ErrorResponse | null;
|
|
952
|
+
};
|
|
953
|
+
declare class Contacts {
|
|
954
|
+
private readonly unsent;
|
|
955
|
+
constructor(unsent: unsent);
|
|
956
|
+
create(contactBookId: string, payload: CreateContactPayload): Promise<CreateContactResponse>;
|
|
957
|
+
get(contactBookId: string, contactId: string): Promise<GetContactResponse>;
|
|
958
|
+
update(contactBookId: string, contactId: string, payload: UpdateContactPayload): Promise<UpdateContactResponse>;
|
|
959
|
+
upsert(contactBookId: string, contactId: string, payload: UpsertContactPayload): Promise<UpsertContactResponse>;
|
|
960
|
+
delete(contactBookId: string, contactId: string): Promise<DeleteContactResponse>;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
type SendEmailPayload = paths["/v1/emails"]["post"]["requestBody"]["content"]["application/json"] & {
|
|
964
|
+
react?: React.ReactElement;
|
|
965
|
+
};
|
|
966
|
+
type CreateEmailResponse = {
|
|
967
|
+
data: CreateEmailResponseSuccess | null;
|
|
968
|
+
error: ErrorResponse | null;
|
|
969
|
+
};
|
|
970
|
+
type CreateEmailResponseSuccess = paths["/v1/emails"]["post"]["responses"]["200"]["content"]["application/json"];
|
|
971
|
+
type GetEmailResponseSuccess = paths["/v1/emails/{emailId}"]["get"]["responses"]["200"]["content"]["application/json"];
|
|
972
|
+
type GetEmailResponse = {
|
|
973
|
+
data: GetEmailResponseSuccess | null;
|
|
974
|
+
error: ErrorResponse | null;
|
|
975
|
+
};
|
|
976
|
+
type UpdateEmailPayload = paths["/v1/emails/{emailId}"]["patch"]["requestBody"]["content"]["application/json"] & {
|
|
977
|
+
react?: React.ReactElement;
|
|
978
|
+
};
|
|
979
|
+
type UpdateEmailResponse = {
|
|
980
|
+
data: UpdateEmailResponseSuccess | null;
|
|
981
|
+
error: ErrorResponse | null;
|
|
982
|
+
};
|
|
983
|
+
type UpdateEmailResponseSuccess = paths["/v1/emails/{emailId}"]["patch"]["responses"]["200"]["content"]["application/json"];
|
|
984
|
+
type CancelEmailResponse = {
|
|
985
|
+
data: CancelEmailResponseSuccess | null;
|
|
986
|
+
error: ErrorResponse | null;
|
|
987
|
+
};
|
|
988
|
+
type CancelEmailResponseSuccess = paths["/v1/emails/{emailId}/cancel"]["post"]["responses"]["200"]["content"]["application/json"];
|
|
989
|
+
/**
|
|
990
|
+
* Payload for sending multiple emails in a single batch request.
|
|
991
|
+
*/
|
|
992
|
+
type BatchEmailPayload = paths["/v1/emails/batch"]["post"]["requestBody"]["content"]["application/json"];
|
|
993
|
+
/**
|
|
994
|
+
* Successful response schema for batch email send.
|
|
995
|
+
*/
|
|
996
|
+
type BatchEmailResponseSuccess = paths["/v1/emails/batch"]["post"]["responses"]["200"]["content"]["application/json"];
|
|
997
|
+
/**
|
|
998
|
+
* Response structure for the batch method.
|
|
999
|
+
*/
|
|
1000
|
+
type BatchEmailResponse = {
|
|
1001
|
+
data: BatchEmailResponseSuccess["data"] | null;
|
|
1002
|
+
error: ErrorResponse | null;
|
|
1003
|
+
};
|
|
1004
|
+
declare class Emails {
|
|
1005
|
+
private readonly unsent;
|
|
1006
|
+
constructor(unsent: unsent);
|
|
1007
|
+
send(payload: SendEmailPayload): Promise<CreateEmailResponse>;
|
|
1008
|
+
create(payload: SendEmailPayload): Promise<CreateEmailResponse>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Send up to 100 emails in a single request.
|
|
1011
|
+
*
|
|
1012
|
+
* @param payload An array of email payloads. Max 100 emails.
|
|
1013
|
+
* @returns A promise that resolves to the list of created email IDs or an error.
|
|
1014
|
+
*/
|
|
1015
|
+
batch(payload: BatchEmailPayload): Promise<BatchEmailResponse>;
|
|
1016
|
+
get(id: string): Promise<GetEmailResponse>;
|
|
1017
|
+
update(id: string, payload: UpdateEmailPayload): Promise<UpdateEmailResponse>;
|
|
1018
|
+
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
declare class unsent {
|
|
1022
|
+
readonly key?: string | undefined;
|
|
1023
|
+
private readonly headers;
|
|
1024
|
+
readonly emails: Emails;
|
|
1025
|
+
readonly contacts: Contacts;
|
|
1026
|
+
url: string;
|
|
1027
|
+
constructor(key?: string | undefined, url?: string);
|
|
1028
|
+
fetchRequest<T>(path: string, options?: {}): Promise<{
|
|
1029
|
+
data: T | null;
|
|
1030
|
+
error: ErrorResponse | null;
|
|
1031
|
+
}>;
|
|
1032
|
+
post<T>(path: string, body: unknown): Promise<{
|
|
1033
|
+
data: T | null;
|
|
1034
|
+
error: ErrorResponse | null;
|
|
1035
|
+
}>;
|
|
1036
|
+
get<T>(path: string): Promise<{
|
|
1037
|
+
data: T | null;
|
|
1038
|
+
error: ErrorResponse | null;
|
|
1039
|
+
}>;
|
|
1040
|
+
put<T>(path: string, body: any): Promise<{
|
|
1041
|
+
data: T | null;
|
|
1042
|
+
error: ErrorResponse | null;
|
|
1043
|
+
}>;
|
|
1044
|
+
patch<T>(path: string, body: any): Promise<{
|
|
1045
|
+
data: T | null;
|
|
1046
|
+
error: ErrorResponse | null;
|
|
1047
|
+
}>;
|
|
1048
|
+
delete<T>(path: string, body?: unknown): Promise<{
|
|
1049
|
+
data: T | null;
|
|
1050
|
+
error: ErrorResponse | null;
|
|
1051
|
+
}>;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
export { unsent };
|