mailchannels-sdk 0.7.2 → 0.7.4
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/README.md +1 -1
- package/dist/mailchannels.d.mts +872 -882
- package/dist/mailchannels.mjs +2037 -2309
- package/package.json +12 -16
- package/dist/mailchannels.d.ts +0 -1989
package/dist/mailchannels.d.ts
DELETED
|
@@ -1,1989 +0,0 @@
|
|
|
1
|
-
import { FetchOptions } from 'ofetch';
|
|
2
|
-
|
|
3
|
-
declare class MailChannelsClient {
|
|
4
|
-
#private;
|
|
5
|
-
private static BASE_URL;
|
|
6
|
-
constructor(key: string);
|
|
7
|
-
protected _fetch<T>(path: string, options?: FetchOptions<"json">): Promise<T>;
|
|
8
|
-
post<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
|
|
9
|
-
get<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
|
|
10
|
-
delete<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
|
|
11
|
-
put<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
|
|
12
|
-
patch<T>(path: string, options?: Omit<FetchOptions<"json">, "method">): Promise<T>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface ErrorResponse {
|
|
16
|
-
message: string;
|
|
17
|
-
statusCode: number | null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface SuccessResponse {
|
|
21
|
-
/**
|
|
22
|
-
* Whether the operation was successful.
|
|
23
|
-
*/
|
|
24
|
-
success: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Error information if the operation failed.
|
|
27
|
-
*/
|
|
28
|
-
error: ErrorResponse | null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type DataResponse$1<T> = {
|
|
32
|
-
/**
|
|
33
|
-
* The response data.
|
|
34
|
-
*/
|
|
35
|
-
data: T;
|
|
36
|
-
/**
|
|
37
|
-
* Error information if the operation failed.
|
|
38
|
-
*/
|
|
39
|
-
error: null;
|
|
40
|
-
} | {
|
|
41
|
-
/**
|
|
42
|
-
* The response data.
|
|
43
|
-
*/
|
|
44
|
-
data: null;
|
|
45
|
-
/**
|
|
46
|
-
* Error information if the operation failed.
|
|
47
|
-
*/
|
|
48
|
-
error: ErrorResponse;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
interface EmailsSendRecipient {
|
|
52
|
-
/**
|
|
53
|
-
* The email address of the recipient.
|
|
54
|
-
*/
|
|
55
|
-
email: string;
|
|
56
|
-
/**
|
|
57
|
-
* The name of the recipient. Display name in raw text, e.g. John Doe, 张三.
|
|
58
|
-
*/
|
|
59
|
-
name?: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
interface EmailsSendAttachment {
|
|
63
|
-
/**
|
|
64
|
-
* The attachment data, encoded in base64.
|
|
65
|
-
*/
|
|
66
|
-
content: string;
|
|
67
|
-
/**
|
|
68
|
-
* The name of the attachment file.
|
|
69
|
-
*/
|
|
70
|
-
filename: string;
|
|
71
|
-
/**
|
|
72
|
-
* The MIME type of the attachment.
|
|
73
|
-
*/
|
|
74
|
-
type: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
interface EmailsSendTracking {
|
|
78
|
-
/**
|
|
79
|
-
* Track when a recipient clicks a link in your email.
|
|
80
|
-
* @default false
|
|
81
|
-
*/
|
|
82
|
-
click?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Track when a recipient opens your email. Please note that some email clients may not support open tracking.
|
|
85
|
-
* @default false
|
|
86
|
-
*/
|
|
87
|
-
open?: boolean;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
interface EmailsSendOptionsBase {
|
|
91
|
-
/**
|
|
92
|
-
* An array of attachments to be sent with the email.
|
|
93
|
-
*/
|
|
94
|
-
attachments?: EmailsSendAttachment[];
|
|
95
|
-
/**
|
|
96
|
-
* The campaign identifier. If specified, this ID will be included in all relevant webhooks. It can be up to 48 UTF-8 characters long and must not contain spaces.
|
|
97
|
-
*/
|
|
98
|
-
campaignId?: string;
|
|
99
|
-
/**
|
|
100
|
-
* The BCC recipients of the email. Can be an array of email addresses or an array of objects with email and name properties or a single email address string or an object with email and name properties.
|
|
101
|
-
* @example
|
|
102
|
-
* [
|
|
103
|
-
* { email: 'email1@example.com', name: 'Example1' },
|
|
104
|
-
* { email: 'email2@example.com', name: 'Example2' }
|
|
105
|
-
* ]
|
|
106
|
-
* @example
|
|
107
|
-
* { email: 'email@example.com', name: 'Example' }
|
|
108
|
-
* @example
|
|
109
|
-
* ['email1@example.com', 'email2@example.com']
|
|
110
|
-
* @example
|
|
111
|
-
* 'email@example.com'
|
|
112
|
-
* @example
|
|
113
|
-
* 'Name <email@example.com>'
|
|
114
|
-
*/
|
|
115
|
-
bcc?: EmailsSendRecipient[] | EmailsSendRecipient | string[] | string;
|
|
116
|
-
/**
|
|
117
|
-
* The CC recipients of the email. Can be an array of email addresses or an array of objects with email and name properties or a single email address string or an object with email and name properties.
|
|
118
|
-
* @example
|
|
119
|
-
* [
|
|
120
|
-
* { email: 'email1@example.com', name: 'Example1' },
|
|
121
|
-
* { email: 'email2@example.com', name: 'Example2' }
|
|
122
|
-
* ]
|
|
123
|
-
* @example
|
|
124
|
-
* { email: 'email@example.com', name: 'Example' }
|
|
125
|
-
* @example
|
|
126
|
-
* ['email1@example.com', 'email2@example.com']
|
|
127
|
-
* @example
|
|
128
|
-
* 'email@example.com'
|
|
129
|
-
* @example
|
|
130
|
-
* 'Name <email@example.com>'
|
|
131
|
-
*/
|
|
132
|
-
cc?: EmailsSendRecipient[] | EmailsSendRecipient | string[] | string;
|
|
133
|
-
/**
|
|
134
|
-
* The DKIM settings for the email.
|
|
135
|
-
*/
|
|
136
|
-
dkim?: {
|
|
137
|
-
/**
|
|
138
|
-
* Domain used for DKIM signing.
|
|
139
|
-
*/
|
|
140
|
-
domain: string;
|
|
141
|
-
/**
|
|
142
|
-
* DKIM private key encoded in Base64.
|
|
143
|
-
*/
|
|
144
|
-
privateKey?: string;
|
|
145
|
-
/**
|
|
146
|
-
* DKIM selector in the domain DNS records.
|
|
147
|
-
*/
|
|
148
|
-
selector: string;
|
|
149
|
-
};
|
|
150
|
-
/**
|
|
151
|
-
* Optional envelope sender address. If not set, the envelope sender defaults to the `from.email` field. Can be overridden per-personalization. Only the email portion is used; the name field is ignored.
|
|
152
|
-
* @example
|
|
153
|
-
* { email: 'email@example.com', name: 'Example' }
|
|
154
|
-
* @example
|
|
155
|
-
* 'email@example.com'
|
|
156
|
-
* @example
|
|
157
|
-
* 'Name <email@example.com>'
|
|
158
|
-
*/
|
|
159
|
-
envelopeFrom?: EmailsSendRecipient | string;
|
|
160
|
-
/**
|
|
161
|
-
* The sender of the email. Can be a string or an object with email and name properties.
|
|
162
|
-
* @example
|
|
163
|
-
* { email: 'email@example.com', name: 'Example' }
|
|
164
|
-
* @example
|
|
165
|
-
* 'email@example.com'
|
|
166
|
-
* @example
|
|
167
|
-
* 'Name <email@example.com>'
|
|
168
|
-
*/
|
|
169
|
-
from: EmailsSendRecipient | string;
|
|
170
|
-
/**
|
|
171
|
-
* An object containing key-value pairs, where both keys (header names) and values must be strings. These pairs represent custom headers to be substituted.
|
|
172
|
-
*
|
|
173
|
-
* Please note the following restrictions and behavior:
|
|
174
|
-
* - **Reserved headers**: The following headers cannot be modified: `Authentication-Results`, `BCC`, `CC`, `Content-Transfer-Encoding`, `Content-Type`, `DKIM-Signature`, `From`, `Message-ID`, `Received`, `Reply-To`, `Subject`, `To`.
|
|
175
|
-
* - **Header precedence**: If a header is defined in both the personalizations object and the root headers, the value from personalizations will be used.
|
|
176
|
-
* - **Case sensitivity**: Headers are treated as case-insensitive. If multiple headers differ only by case, only one will be used, with no guarantee of which one.
|
|
177
|
-
*/
|
|
178
|
-
headers?: Record<string, string>;
|
|
179
|
-
/**
|
|
180
|
-
* The recipient of the email. Can be an array of email addresses or an array of objects with `email` and `name` properties or a single email address string or an object with `email` and `name` properties.
|
|
181
|
-
* @example
|
|
182
|
-
* [
|
|
183
|
-
* { email: 'email1@example.com', name: 'Example1' },
|
|
184
|
-
* { email: 'email2@example.com', name: 'Example2' },
|
|
185
|
-
* ]
|
|
186
|
-
* @example
|
|
187
|
-
* { email: 'email@example.com', name: 'Example' }
|
|
188
|
-
* @example
|
|
189
|
-
* ['email1@example.com', 'email2@example.com']
|
|
190
|
-
* @example
|
|
191
|
-
* 'email@example.com'
|
|
192
|
-
* @example
|
|
193
|
-
* 'Name <email@example.com>'
|
|
194
|
-
*/
|
|
195
|
-
to: EmailsSendRecipient[] | EmailsSendRecipient | string[] | string;
|
|
196
|
-
/**
|
|
197
|
-
* Adjust open and click tracking for the message. Please note that enabling tracking for your messages requires a subscription that supports open and click tracking.
|
|
198
|
-
*
|
|
199
|
-
* Only links (`<a>` tags) meeting all of the following conditions are processed for click tracking:
|
|
200
|
-
* - The URL is non-empty.
|
|
201
|
-
* - The URL starts with `http` or `https`.
|
|
202
|
-
* - The link does not have a `clicktracking` attribute set to `off`.
|
|
203
|
-
*/
|
|
204
|
-
tracking?: EmailsSendTracking;
|
|
205
|
-
/**
|
|
206
|
-
* A single `replyTo` recipient object, or a single email address.
|
|
207
|
-
* @example
|
|
208
|
-
* { email: 'email@example.com', name: 'Example' }
|
|
209
|
-
* @example
|
|
210
|
-
* 'email@example.com'
|
|
211
|
-
* @example
|
|
212
|
-
* 'Name <email@example.com>'
|
|
213
|
-
*/
|
|
214
|
-
replyTo?: EmailsSendRecipient | string;
|
|
215
|
-
/**
|
|
216
|
-
* The subject of the email.
|
|
217
|
-
*/
|
|
218
|
-
subject: string;
|
|
219
|
-
/**
|
|
220
|
-
* Data to be used if the email is a mustache template, key-value pairs of variables to set for template rendering. Keys must be strings.
|
|
221
|
-
*
|
|
222
|
-
* the values can be one of the following types:
|
|
223
|
-
* - string
|
|
224
|
-
* - number
|
|
225
|
-
* - boolean
|
|
226
|
-
* - list, whose values are all of permitted types
|
|
227
|
-
* - map, whose keys must be strings, and whose values are all of permitted types
|
|
228
|
-
*/
|
|
229
|
-
mustaches?: Record<string, unknown>;
|
|
230
|
-
/**
|
|
231
|
-
* Mark these messages as transactional or non-transactional. In order for a message to be marked as non-transactional, it must have exactly one recipient per personalization, and it must be DKIM signed. 400 Bad Request will be returned if there are more than one recipient in any personalization for non-transactional messages. If a message is marked as non-transactional, it changes the sending process as follows:
|
|
232
|
-
*
|
|
233
|
-
* List-Unsubscribe headers will be added.
|
|
234
|
-
* @default true
|
|
235
|
-
*/
|
|
236
|
-
transactional?: boolean;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
type EmailsSendOptions = EmailsSendOptionsBase & (
|
|
240
|
-
| {
|
|
241
|
-
/**
|
|
242
|
-
* The HTML content of the email.
|
|
243
|
-
* @example
|
|
244
|
-
* '<p>Hello World</p>'
|
|
245
|
-
*/
|
|
246
|
-
html: string;
|
|
247
|
-
/**
|
|
248
|
-
* The plain text content of the email (optional when html is provided).
|
|
249
|
-
* @example
|
|
250
|
-
* 'Hello World'
|
|
251
|
-
*/
|
|
252
|
-
text?: string;
|
|
253
|
-
}
|
|
254
|
-
| {
|
|
255
|
-
/**
|
|
256
|
-
* The HTML content of the email (optional when text is provided).
|
|
257
|
-
* @example
|
|
258
|
-
* '<p>Hello World</p>'
|
|
259
|
-
*/
|
|
260
|
-
html?: string;
|
|
261
|
-
/**
|
|
262
|
-
* The plain text content of the email.
|
|
263
|
-
* @example
|
|
264
|
-
* 'Hello World'
|
|
265
|
-
*/
|
|
266
|
-
text: string;
|
|
267
|
-
}
|
|
268
|
-
);
|
|
269
|
-
|
|
270
|
-
type EmailsSendResponse = SuccessResponse & DataResponse$1<{
|
|
271
|
-
/**
|
|
272
|
-
* Fully rendered message if `dryRun` was set to `true`. A string representation of a rendered message, one per personalization in the request.
|
|
273
|
-
*/
|
|
274
|
-
rendered?: string[];
|
|
275
|
-
/**
|
|
276
|
-
* The Request ID is a unique identifier generated by the service to track the HTTP request. It will also be included in all webhooks for reference.
|
|
277
|
-
*/
|
|
278
|
-
requestId?: string;
|
|
279
|
-
results?: {
|
|
280
|
-
/**
|
|
281
|
-
* The index of the personalization in the request. Starts at 0.
|
|
282
|
-
*/
|
|
283
|
-
index?: number;
|
|
284
|
-
/**
|
|
285
|
-
* The Message ID is a unique identifier generated by the service. Each personalization has a distinct Message ID, which is also used in the `Message-Id` header and included in webhooks.
|
|
286
|
-
*/
|
|
287
|
-
messageId: string;
|
|
288
|
-
/**
|
|
289
|
-
* A human-readable explanation of the status.
|
|
290
|
-
*/
|
|
291
|
-
reason?: string;
|
|
292
|
-
/**
|
|
293
|
-
* The status of the message. Note that 'sent' is a temporary status; the final status will be provided through webhooks, if configured.
|
|
294
|
-
*/
|
|
295
|
-
status: "sent" | "failed";
|
|
296
|
-
}[];
|
|
297
|
-
}>;
|
|
298
|
-
|
|
299
|
-
type EmailsSendAsyncResponse = DataResponse<{
|
|
300
|
-
/**
|
|
301
|
-
* ISO 8601 timestamp when the request was queued for processing.
|
|
302
|
-
*/
|
|
303
|
-
queuedAt: string[];
|
|
304
|
-
/**
|
|
305
|
-
* Unique identifier for tracking this async request. Will be included in all webhook events for this request.
|
|
306
|
-
*/
|
|
307
|
-
requestId: string;
|
|
308
|
-
}>;
|
|
309
|
-
|
|
310
|
-
interface EmailsCreateDkimKeyOptions {
|
|
311
|
-
/**
|
|
312
|
-
* Algorithm used for the new key pair Currently, only RSA is supported.
|
|
313
|
-
* @default "rsa"
|
|
314
|
-
*/
|
|
315
|
-
algorithm?: "rsa";
|
|
316
|
-
/**
|
|
317
|
-
* Key length in bits. For RSA, must be a multiple of 1024. Common values: 1024 or 2048.
|
|
318
|
-
* @default 2048
|
|
319
|
-
*/
|
|
320
|
-
length?: 1024 | 2048 | 3072 | 4096;
|
|
321
|
-
/**
|
|
322
|
-
* Selector for the new key pair. Must be a maximum of 63 characters.
|
|
323
|
-
*/
|
|
324
|
-
selector: string;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
type EmailsDkimKeyStatus = "active" | "retired" | "revoked" | "rotated";
|
|
328
|
-
|
|
329
|
-
interface EmailsDkimKey {
|
|
330
|
-
/**
|
|
331
|
-
* Algorithm used for the key pair.
|
|
332
|
-
*/
|
|
333
|
-
algorithm: string;
|
|
334
|
-
/**
|
|
335
|
-
* Timestamp when the key pair was created.
|
|
336
|
-
*/
|
|
337
|
-
createdAt?: string;
|
|
338
|
-
/**
|
|
339
|
-
* Suggested DNS records for the DKIM key.
|
|
340
|
-
*/
|
|
341
|
-
dnsRecords: {
|
|
342
|
-
name: string;
|
|
343
|
-
type: string;
|
|
344
|
-
value: string;
|
|
345
|
-
}[];
|
|
346
|
-
/**
|
|
347
|
-
* Domain associated with the key pair.
|
|
348
|
-
*/
|
|
349
|
-
domain: string;
|
|
350
|
-
/**
|
|
351
|
-
* UTC timestamp after which you can no longer use the rotated key for signing.
|
|
352
|
-
*/
|
|
353
|
-
gracePeriodExpiresAt?: string;
|
|
354
|
-
/**
|
|
355
|
-
* Key length in bits.
|
|
356
|
-
*/
|
|
357
|
-
length: 1024 | 2048 | 3072 | 4096;
|
|
358
|
-
publicKey: string;
|
|
359
|
-
/**
|
|
360
|
-
* UTC timestamp when a rotated key pair is retired.
|
|
361
|
-
*/
|
|
362
|
-
retiresAt?: string;
|
|
363
|
-
/**
|
|
364
|
-
* Selector assigned to the key pair.
|
|
365
|
-
*/
|
|
366
|
-
selector: string;
|
|
367
|
-
/**
|
|
368
|
-
* Status of the key.
|
|
369
|
-
*/
|
|
370
|
-
status: EmailsDkimKeyStatus;
|
|
371
|
-
/**
|
|
372
|
-
* Timestamp when the key was last modified.
|
|
373
|
-
*/
|
|
374
|
-
statusModifiedAt?: string;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
type EmailsCreateDkimKeyResponse = DataResponse$1<EmailsDkimKey>;
|
|
378
|
-
|
|
379
|
-
interface EmailsCheckDomainDkim {
|
|
380
|
-
/**
|
|
381
|
-
* Domain used for DKIM signing.
|
|
382
|
-
*/
|
|
383
|
-
domain?: string;
|
|
384
|
-
/**
|
|
385
|
-
* DKIM private key encoded in Base64.
|
|
386
|
-
*/
|
|
387
|
-
privateKey?: string;
|
|
388
|
-
/**
|
|
389
|
-
* DKIM selector in the domain DNS records.
|
|
390
|
-
*/
|
|
391
|
-
selector?: string;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
interface EmailsCheckDomainOptions {
|
|
395
|
-
/**
|
|
396
|
-
* Each item may include DKIM `domain`, `selector` and `privateKey`. Up to 10 items are allowed. The absence or presence of these fields affects how DKIM settings are validated:
|
|
397
|
-
* 1. If `domain`, `selector`, and `privateKey` are all present, verify using the provided domain, selector, and key.
|
|
398
|
-
* 2. If `domain` and `selector` are present, use the stored private key for the given domain and selector.
|
|
399
|
-
* 3. If only `domain` is present, use all stored keys for the given domain.
|
|
400
|
-
* 4. If none are present, use all stored keys for the `domain` provided in the domain field of the request.
|
|
401
|
-
* 5. If `privateKey` is present, `selector` must be present.
|
|
402
|
-
* 6. If `selector` is present and `domain` is not, the domain will be taken from the domain field of the request.
|
|
403
|
-
*/
|
|
404
|
-
dkim?: EmailsCheckDomainDkim[] | EmailsCheckDomainDkim;
|
|
405
|
-
/**
|
|
406
|
-
* Domain used for sending emails. If `dkim` settings are not provided, or `dkim` settings are provided with no `domain`, the stored dkim settings for this domain will be used.
|
|
407
|
-
*/
|
|
408
|
-
domain: string;
|
|
409
|
-
/**
|
|
410
|
-
* Used exclusively for [Domain Lockdown](https://support.mailchannels.com/hc/en-us/articles/16918954360845-Secure-your-domain-name-against-spoofing-with-Domain-Lockdown) verification. If you're not using senderid to associate your domain with your account, you can disregard this field. The corresponding value is included in the `X-MailChannels-SenderId` header of emails sent via MailChannels.
|
|
411
|
-
*/
|
|
412
|
-
senderId?: string;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
type EmailsCheckDomainVerdict = "passed" | "failed" | "soft failed" | "temporary error" | "permanent error" | "neutral" | "none" | "unknown";
|
|
416
|
-
|
|
417
|
-
type EmailsCheckDomainResponse = DataResponse$1<{
|
|
418
|
-
dkim: {
|
|
419
|
-
domain: string;
|
|
420
|
-
/**
|
|
421
|
-
* The human readable status of the DKIM key used for verification.
|
|
422
|
-
*/
|
|
423
|
-
keyStatus?: EmailsDkimKey["status"] | "provided";
|
|
424
|
-
selector: string;
|
|
425
|
-
/**
|
|
426
|
-
* A human-readable explanation of DKIM check.
|
|
427
|
-
*/
|
|
428
|
-
reason?: string;
|
|
429
|
-
verdict: Extract<EmailsCheckDomainVerdict, "passed" | "failed">;
|
|
430
|
-
}[];
|
|
431
|
-
domainLockdown: {
|
|
432
|
-
/**
|
|
433
|
-
* A human-readable explanation of Domain Lockdown check.
|
|
434
|
-
*/
|
|
435
|
-
reason?: string;
|
|
436
|
-
verdict: Extract<EmailsCheckDomainVerdict, "passed" | "failed">;
|
|
437
|
-
};
|
|
438
|
-
/**
|
|
439
|
-
* These results are here to help avoid [SDNF](https://support.mailchannels.com/hc/en-us/articles/203155500-550-5-2-1-SDNF-Sender-Domain-Not-Found) (Sender Domain Not Found) blocks. For messages not to get blocked by SDNF, we require either an MX or A record to exist for the sender domain.
|
|
440
|
-
*/
|
|
441
|
-
senderDomain: {
|
|
442
|
-
a: {
|
|
443
|
-
/**
|
|
444
|
-
* A human-readable explanation of A record check.
|
|
445
|
-
*/
|
|
446
|
-
reason?: string;
|
|
447
|
-
verdict: Extract<EmailsCheckDomainVerdict, "passed" | "failed">;
|
|
448
|
-
};
|
|
449
|
-
mx: {
|
|
450
|
-
/**
|
|
451
|
-
* A human-readable explanation of MX record check.
|
|
452
|
-
*/
|
|
453
|
-
reason?: string;
|
|
454
|
-
verdict: Extract<EmailsCheckDomainVerdict, "passed" | "failed">;
|
|
455
|
-
};
|
|
456
|
-
/**
|
|
457
|
-
* Overall verdict. Passed if either A or MX record check passed.
|
|
458
|
-
*/
|
|
459
|
-
verdict: Extract<EmailsCheckDomainVerdict, "passed" | "failed">;
|
|
460
|
-
};
|
|
461
|
-
spf: {
|
|
462
|
-
/**
|
|
463
|
-
* A human-readable explanation of SPF check.
|
|
464
|
-
*/
|
|
465
|
-
reason?: string;
|
|
466
|
-
verdict: EmailsCheckDomainVerdict;
|
|
467
|
-
};
|
|
468
|
-
references?: string[];
|
|
469
|
-
}>;
|
|
470
|
-
|
|
471
|
-
interface EmailsGetDkimKeysOptions {
|
|
472
|
-
/**
|
|
473
|
-
* Selector to filter keys by. Must be a maximum of 63 characters.
|
|
474
|
-
*/
|
|
475
|
-
selector?: string;
|
|
476
|
-
/**
|
|
477
|
-
* Status to filter keys by.
|
|
478
|
-
*/
|
|
479
|
-
status?: EmailsDkimKey["status"];
|
|
480
|
-
/**
|
|
481
|
-
* Number of keys to skip before returning results.
|
|
482
|
-
* @default 0
|
|
483
|
-
*/
|
|
484
|
-
offset?: number;
|
|
485
|
-
/**
|
|
486
|
-
* Maximum number of keys to return. Maximum is `100` and minimum is `1`.
|
|
487
|
-
* @default 10
|
|
488
|
-
*/
|
|
489
|
-
limit?: number;
|
|
490
|
-
/**
|
|
491
|
-
* If `true`, includes the suggested DKIM DNS record for each returned key.
|
|
492
|
-
* @default false
|
|
493
|
-
*/
|
|
494
|
-
includeDnsRecord?: boolean;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
498
|
-
|
|
499
|
-
type EmailsGetDkimKeysResponse = DataResponse$1<Optional<EmailsDkimKey, "dnsRecords">[]>;
|
|
500
|
-
|
|
501
|
-
interface EmailsUpdateDkimKeyOptions {
|
|
502
|
-
/**
|
|
503
|
-
* Selector of the DKIM key pair to update. Must be a maximum of 63 characters.
|
|
504
|
-
*/
|
|
505
|
-
selector: string;
|
|
506
|
-
/**
|
|
507
|
-
* New status of the DKIM key pair.
|
|
508
|
-
* - `revoked`: Indicates that the key is compromised and should not be used.
|
|
509
|
-
* - `retired`: Indicates that the key has been rotated and is no longer in use.
|
|
510
|
-
* - `rotated`: Indicates that the key is going through the rotation process. Only active key pairs can be updated to this status, and no new key pair is created. The rotated key can be used to sign emails for 3 days after the status update, and will automatically change to `retired` 2 weeks after update. For a smooth key transition, it is recommended to create and publish a new key pair before signing is disabled for the rotated key.
|
|
511
|
-
*/
|
|
512
|
-
status: Exclude<EmailsDkimKey["status"], "active">;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
interface EmailsRotateDkimKeyOptions {
|
|
516
|
-
newKey: {
|
|
517
|
-
/**
|
|
518
|
-
* Selector for the new key pair. Must be a maximum of 63 characters.
|
|
519
|
-
*/
|
|
520
|
-
selector: string;
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
type EmailsRotateDkimKeyResponse = DataResponse$1<{
|
|
525
|
-
new: EmailsDkimKey;
|
|
526
|
-
rotated: EmailsDkimKey;
|
|
527
|
-
}>;
|
|
528
|
-
|
|
529
|
-
declare class Emails {
|
|
530
|
-
protected mailchannels: MailChannelsClient;
|
|
531
|
-
constructor(mailchannels: MailChannelsClient);
|
|
532
|
-
private _sendEmail;
|
|
533
|
-
/**
|
|
534
|
-
* Sends an email message to one or more recipients.
|
|
535
|
-
* @param options - The email options to send.
|
|
536
|
-
* @param dryRun - When set to `true`, the message will not be sent. Instead, the fully rendered message will be returned in the `data` property of the response. The default value is `false`.
|
|
537
|
-
* @example
|
|
538
|
-
* ```ts
|
|
539
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
540
|
-
* const { success, data, error } = await mailchannels.emails.send({
|
|
541
|
-
* to: 'to@example.com',
|
|
542
|
-
* from: 'from@example.com',
|
|
543
|
-
* subject: 'Test',
|
|
544
|
-
* html: 'Test'
|
|
545
|
-
* })
|
|
546
|
-
* ```
|
|
547
|
-
*/
|
|
548
|
-
send(options: EmailsSendOptions, dryRun?: boolean): Promise<EmailsSendResponse>;
|
|
549
|
-
/**
|
|
550
|
-
* Queues an email message for asynchronous processing and returns immediately with a request ID.
|
|
551
|
-
*
|
|
552
|
-
* The email will be processed in the background, and you'll receive webhook events for all delivery status updates (e.g. `dropped`, `processed`, `delivered`, `hard-bounced`). These webhook events are identical to those sent for the synchronous /send endpoint.
|
|
553
|
-
*
|
|
554
|
-
* Use this endpoint when you need to send emails without waiting for processing to complete. This can improve your application's response time, especially when sending to multiple recipients.
|
|
555
|
-
* @param options - The email options to send.
|
|
556
|
-
* @example
|
|
557
|
-
* ```ts
|
|
558
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
559
|
-
* const { data, error } = await mailchannels.emails.sendAsync({
|
|
560
|
-
* to: 'to@example.com',
|
|
561
|
-
* from: 'from@example.com',
|
|
562
|
-
* subject: 'Test',
|
|
563
|
-
* html: 'Test'
|
|
564
|
-
* })
|
|
565
|
-
* ```
|
|
566
|
-
*/
|
|
567
|
-
sendAsync(options: EmailsSendOptions): Promise<EmailsSendAsyncResponse>;
|
|
568
|
-
/**
|
|
569
|
-
* Validates a domain's email authentication setup by retrieving its DKIM, SPF, and Domain Lockdown status. This endpoint checks whether the domain is properly configured for secure email delivery.
|
|
570
|
-
* @param options - The domain options to check.
|
|
571
|
-
* @example
|
|
572
|
-
* ```ts
|
|
573
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
574
|
-
* const { data, error } = await mailchannels.emails.checkDomain({
|
|
575
|
-
* dkim: [{
|
|
576
|
-
* domain: 'example.com',
|
|
577
|
-
* privateKey: 'your-private-key',
|
|
578
|
-
* selector: 'mailchannels'
|
|
579
|
-
* }],
|
|
580
|
-
* domain: 'example.com',
|
|
581
|
-
* senderId: 'sender-id'
|
|
582
|
-
* })
|
|
583
|
-
* ```
|
|
584
|
-
*/
|
|
585
|
-
checkDomain(options: EmailsCheckDomainOptions): Promise<EmailsCheckDomainResponse>;
|
|
586
|
-
/**
|
|
587
|
-
* Create a DKIM key pair for a specified domain and selector using the specified algorithm and key length, for the current customer.
|
|
588
|
-
* @param domain - The domain to create the DKIM key for.
|
|
589
|
-
* @param options - DKIM key creation options.
|
|
590
|
-
* @example
|
|
591
|
-
* ```ts
|
|
592
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
593
|
-
* const { data, error } = await mailchannels.emails.createDkimKey('example.com', {
|
|
594
|
-
* selector: 'mailchannels'
|
|
595
|
-
* })
|
|
596
|
-
* ```
|
|
597
|
-
*/
|
|
598
|
-
createDkimKey(domain: string, options: EmailsCreateDkimKeyOptions): Promise<EmailsCreateDkimKeyResponse>;
|
|
599
|
-
/**
|
|
600
|
-
* Search for DKIM keys by domain, with optional filters. If selector is provided, at most one key will be returned.
|
|
601
|
-
* @param domain - The domain to search DKIM keys for.
|
|
602
|
-
* @param options - The options to filter DKIM keys by.
|
|
603
|
-
* @example
|
|
604
|
-
* ```ts
|
|
605
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
606
|
-
* const { data, error } = await mailchannels.getDkimKeys('example.com', {
|
|
607
|
-
* includeDnsRecord: true
|
|
608
|
-
* })
|
|
609
|
-
* ```
|
|
610
|
-
*/
|
|
611
|
-
getDkimKeys(domain: string, options?: EmailsGetDkimKeysOptions): Promise<EmailsGetDkimKeysResponse>;
|
|
612
|
-
/**
|
|
613
|
-
* Update fields of an existing DKIM key pair for the specified domain and selector, for the current customer. Currently, only the `status` field can be updated.
|
|
614
|
-
* @param domain - The domain the DKIM key belongs to.
|
|
615
|
-
* @param options - The options to update the DKIM key.
|
|
616
|
-
* @example
|
|
617
|
-
* ```ts
|
|
618
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
619
|
-
* const { success, error } = await mailchannels.emails.updateDkimKey('example.com', {
|
|
620
|
-
* selector: 'mailchannels',
|
|
621
|
-
* status: 'retired'
|
|
622
|
-
* })
|
|
623
|
-
*/
|
|
624
|
-
updateDkimKey(domain: string, options: EmailsUpdateDkimKeyOptions): Promise<SuccessResponse>;
|
|
625
|
-
/**
|
|
626
|
-
* Rotate an active DKIM key pair. Mark the original key as `rotated`, and create a new key pair with the required new key selector, reusing the same algorithm and key length. The rotated key remains valid for signing for a 3-day grace period, and is automatically changed to `retired` 2 weeks after rotation. Publish the new key to its DNS TXT record before rotated key expires for signing as emails sent with an unpublished key will fail DKIM validation by receiving providers. After the grace period, only the new key is valid for signing if published.
|
|
627
|
-
* @param domain - The domain the DKIM key belongs to.
|
|
628
|
-
* @param selector - The selector of the DKIM key to rotate.
|
|
629
|
-
* @param options - The options to rotate the DKIM key.
|
|
630
|
-
* @param options.newKey.selector - The selector for the new key pair. Must be a maximum of 63 characters.
|
|
631
|
-
* @example
|
|
632
|
-
* ```ts
|
|
633
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
634
|
-
* const { data, error } = await mailchannels.emails.rotateDkimKey('example.com', 'mailchannels', {
|
|
635
|
-
* newKey: {
|
|
636
|
-
* selector: 'new-selector'
|
|
637
|
-
* }
|
|
638
|
-
* })
|
|
639
|
-
* ```
|
|
640
|
-
*/
|
|
641
|
-
rotateDkimKey(domain: string, selector: string, options: EmailsRotateDkimKeyOptions): Promise<EmailsRotateDkimKeyResponse>;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
type WebhooksListResponse = DataResponse$1<string[]>;
|
|
645
|
-
|
|
646
|
-
type WebhooksSigningKeyResponse = DataResponse$1<{
|
|
647
|
-
key: string;
|
|
648
|
-
}>;
|
|
649
|
-
|
|
650
|
-
type WebhooksValidateResponse = DataResponse$1<{
|
|
651
|
-
/**
|
|
652
|
-
* Indicates whether all webhook validations passed.
|
|
653
|
-
*/
|
|
654
|
-
allPassed: boolean;
|
|
655
|
-
/**
|
|
656
|
-
* Detailed results for each tested webhook, including whether it returned a 2xx status code, along with its response status code and body.
|
|
657
|
-
*/
|
|
658
|
-
results: {
|
|
659
|
-
/**
|
|
660
|
-
* Indicates whether the webhook responded with a 2xx HTTP status code.
|
|
661
|
-
*/
|
|
662
|
-
result: "passed" | "failed";
|
|
663
|
-
/**
|
|
664
|
-
* The webhook that was validated.
|
|
665
|
-
*/
|
|
666
|
-
webhook: string;
|
|
667
|
-
/**
|
|
668
|
-
* The HTTP response returned by the webhook, including status code and response body. A null value indicates no response was received. Possible reasons include timeouts, connection failures, or other network-related issues.
|
|
669
|
-
*/
|
|
670
|
-
response: {
|
|
671
|
-
/**
|
|
672
|
-
* Response body from webhook. Returns an error if unprocessable or too large.
|
|
673
|
-
*/
|
|
674
|
-
body?: string;
|
|
675
|
-
/**
|
|
676
|
-
* HTTP status code returned by the webhook.
|
|
677
|
-
*/
|
|
678
|
-
status: number;
|
|
679
|
-
} | null;
|
|
680
|
-
}[];
|
|
681
|
-
}>;
|
|
682
|
-
|
|
683
|
-
declare class Webhooks {
|
|
684
|
-
protected mailchannels: MailChannelsClient;
|
|
685
|
-
constructor(mailchannels: MailChannelsClient);
|
|
686
|
-
/**
|
|
687
|
-
* Enrolls the customer to receive event notifications via webhooks.
|
|
688
|
-
* @param endpoint - The URL to receive event notifications. Must be no longer than `8000` characters.
|
|
689
|
-
* @example
|
|
690
|
-
* ```ts
|
|
691
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
692
|
-
* const { success, error } = mailchannels.webhooks.enroll('https://example.com/api/webhooks/mailchannels')
|
|
693
|
-
* ```
|
|
694
|
-
*/
|
|
695
|
-
enroll(endpoint: string): Promise<SuccessResponse>;
|
|
696
|
-
/**
|
|
697
|
-
* Retrieves all registered webhook endpoints associated with the customer.
|
|
698
|
-
* @example
|
|
699
|
-
* ```ts
|
|
700
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
701
|
-
* const { data, error } = await mailchannels.webhooks.list()
|
|
702
|
-
* ```
|
|
703
|
-
*/
|
|
704
|
-
list(): Promise<WebhooksListResponse>;
|
|
705
|
-
/**
|
|
706
|
-
* Deletes all registered webhook endpoints for the customer.
|
|
707
|
-
* @example
|
|
708
|
-
* ```ts
|
|
709
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
710
|
-
* const { success, error } = await mailchannels.webhooks.delete()
|
|
711
|
-
* ```
|
|
712
|
-
*/
|
|
713
|
-
delete(): Promise<SuccessResponse>;
|
|
714
|
-
/**
|
|
715
|
-
* Retrieves the public key used to verify signatures on incoming webhook payloads.
|
|
716
|
-
* @param id - The ID of the key.
|
|
717
|
-
* @example
|
|
718
|
-
* ```ts
|
|
719
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
720
|
-
* const { data, error } = await mailchannels.webhooks.getSigningKey('key-id')
|
|
721
|
-
* ```
|
|
722
|
-
*/
|
|
723
|
-
getSigningKey(id: string): Promise<WebhooksSigningKeyResponse>;
|
|
724
|
-
/**
|
|
725
|
-
* Validates whether your enrolled webhook(s) respond with an HTTP `2xx` status code. Sends a test request to each webhook containing your customer handle, a hardcoded event type (`test`), a hardcoded sender email (`test@mailchannels.com`), a timestamp, a request ID (provided or generated), and an SMTP ID. The response includes the HTTP status code and body returned by each webhook.
|
|
726
|
-
* @param requestId - Optional identifier in the webhook payload. If not provided, a value will be automatically generated. Must not exceed 28 characters.
|
|
727
|
-
* @example
|
|
728
|
-
* ```ts
|
|
729
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
730
|
-
* const { data, error } = await mailchannels.webhooks.validate('optional-request-id')
|
|
731
|
-
* ```
|
|
732
|
-
*/
|
|
733
|
-
validate(requestId?: string): Promise<WebhooksValidateResponse>;
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
interface SubAccountsAccount {
|
|
737
|
-
/**
|
|
738
|
-
* The name of the company associated with the sub-account.
|
|
739
|
-
*/
|
|
740
|
-
companyName: string;
|
|
741
|
-
/**
|
|
742
|
-
* If the sub-account is enabled.
|
|
743
|
-
*/
|
|
744
|
-
enabled: boolean;
|
|
745
|
-
/**
|
|
746
|
-
* The handle for the sub-account.
|
|
747
|
-
*/
|
|
748
|
-
handle: string;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
type SubAccountsCreateResponse = DataResponse$1<SubAccountsAccount>;
|
|
752
|
-
|
|
753
|
-
interface SubAccountsListOptions {
|
|
754
|
-
/**
|
|
755
|
-
* Possible values are `1` to `1000`.
|
|
756
|
-
* @default 1000
|
|
757
|
-
*/
|
|
758
|
-
limit?: number;
|
|
759
|
-
/**
|
|
760
|
-
* The offset for pagination.
|
|
761
|
-
* @default 0
|
|
762
|
-
*/
|
|
763
|
-
offset?: number;
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
type SubAccountsListResponse = DataResponse$1<SubAccountsAccount[]>;
|
|
767
|
-
|
|
768
|
-
interface SubAccountsApiKey {
|
|
769
|
-
/**
|
|
770
|
-
* The API key ID for the sub-account.
|
|
771
|
-
*/
|
|
772
|
-
id: number;
|
|
773
|
-
/**
|
|
774
|
-
* API key for the sub-account.
|
|
775
|
-
*/
|
|
776
|
-
value: string;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
type SubAccountsCreateApiKeyResponse = DataResponse$1<SubAccountsApiKey>;
|
|
780
|
-
|
|
781
|
-
interface SubAccountsListApiKeyOptions {
|
|
782
|
-
/**
|
|
783
|
-
* The maximum number of API keys included in the response. Possible values are `1` to `1000`.
|
|
784
|
-
* @default 100
|
|
785
|
-
*/
|
|
786
|
-
limit?: number;
|
|
787
|
-
/**
|
|
788
|
-
* Offset into the list of API keys to return.
|
|
789
|
-
* @default 0
|
|
790
|
-
*/
|
|
791
|
-
offset?: number;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
type SubAccountsListApiKeyResponse = DataResponse$1<SubAccountsApiKey[]>;
|
|
795
|
-
|
|
796
|
-
interface SubAccountsSmtpPassword {
|
|
797
|
-
/**
|
|
798
|
-
* Whether the SMTP password is enabled.
|
|
799
|
-
*/
|
|
800
|
-
enabled: boolean;
|
|
801
|
-
/**
|
|
802
|
-
* The SMTP password ID for the sub-account.
|
|
803
|
-
*/
|
|
804
|
-
id: number;
|
|
805
|
-
/**
|
|
806
|
-
* SMTP password for the sub-account.
|
|
807
|
-
*/
|
|
808
|
-
value: string;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
type SubAccountsCreateSmtpPasswordResponse = DataResponse$1<SubAccountsSmtpPassword>;
|
|
812
|
-
|
|
813
|
-
type SubAccountsListSmtpPasswordResponse = DataResponse$1<SubAccountsSmtpPassword[]>;
|
|
814
|
-
|
|
815
|
-
interface SubAccountsLimit {
|
|
816
|
-
sends: number;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
type SubAccountsLimitResponse = DataResponse$1<SubAccountsLimit>;
|
|
820
|
-
|
|
821
|
-
interface SubAccountsUsage {
|
|
822
|
-
/**
|
|
823
|
-
* The end date of the current billing period (ISO 8601 format).
|
|
824
|
-
* @example "2025-04-11"
|
|
825
|
-
*/
|
|
826
|
-
endDate?: string;
|
|
827
|
-
/**
|
|
828
|
-
* The start date of the current billing period (ISO 8601 format).
|
|
829
|
-
* @example "2025-03-12"
|
|
830
|
-
*/
|
|
831
|
-
startDate?: string;
|
|
832
|
-
/**
|
|
833
|
-
* The total usage for the current billing period.
|
|
834
|
-
*/
|
|
835
|
-
total: number;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
type SubAccountsUsageResponse = DataResponse$1<SubAccountsUsage>;
|
|
839
|
-
|
|
840
|
-
declare class SubAccounts {
|
|
841
|
-
protected mailchannels: MailChannelsClient;
|
|
842
|
-
private static readonly COMPANY_PATTERN;
|
|
843
|
-
private static readonly HANDLE_PATTERN;
|
|
844
|
-
constructor(mailchannels: MailChannelsClient);
|
|
845
|
-
/**
|
|
846
|
-
* Creates a new sub-account under the parent account. Each sub-account must have a unique handle composed solely of lowercase alphanumeric characters. If no handle is provided, a random handle will be generated. Note that Sub-accounts are only available to parent accounts on 100K and higher plans.
|
|
847
|
-
* @param companyName - The name of the company associated with the sub-account. This name is used for display purposes only and does not affect the functionality of the sub-account. The length must be between 3 and 128 characters.
|
|
848
|
-
* @param handle - A unique name for the sub-account to be created. The length must be between 3 and 128 characters, and it may contain only lowercase letters and numbers. If not provided, a random handle will be generated.
|
|
849
|
-
* @example
|
|
850
|
-
* ```ts
|
|
851
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
852
|
-
* const { data, error } = await mailchannels.subAccounts.create('My Company', 'validhandle123')
|
|
853
|
-
* ```
|
|
854
|
-
*/
|
|
855
|
-
create(companyName: string, handle?: string): Promise<SubAccountsCreateResponse>;
|
|
856
|
-
/**
|
|
857
|
-
* Retrieves all sub-accounts associated with the parent account. The response is paginated with a default limit of 1000 sub-accounts per page and an offset of 0.
|
|
858
|
-
* @param options - The options to filter the list of sub-accounts.
|
|
859
|
-
* @example
|
|
860
|
-
* ```ts
|
|
861
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
862
|
-
* const { data, error } = await mailchannels.subAccounts.list()
|
|
863
|
-
* ```
|
|
864
|
-
*/
|
|
865
|
-
list(options?: SubAccountsListOptions): Promise<SubAccountsListResponse>;
|
|
866
|
-
/**
|
|
867
|
-
* Deletes the sub-account identified by its handle.
|
|
868
|
-
* @param handle - Handle of sub-account to be deleted.
|
|
869
|
-
* ```ts
|
|
870
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
871
|
-
* const { success, error } = await mailchannels.subAccounts.delete('validhandle123')
|
|
872
|
-
* ```
|
|
873
|
-
*/
|
|
874
|
-
delete(handle: string): Promise<SuccessResponse>;
|
|
875
|
-
/**
|
|
876
|
-
* Suspends the sub-account identified by its handle. This action disables the account, preventing it from sending any emails until it is reactivated.
|
|
877
|
-
* @param handle - Handle of sub-account to be suspended.
|
|
878
|
-
* @example
|
|
879
|
-
* ```ts
|
|
880
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
881
|
-
* const { success, error } = await mailchannels.subAccounts.suspend('validhandle123')
|
|
882
|
-
* ```
|
|
883
|
-
*/
|
|
884
|
-
suspend(handle: string): Promise<SuccessResponse>;
|
|
885
|
-
/**
|
|
886
|
-
* Activates a suspended sub-account identified by its handle, restoring its ability to send emails.
|
|
887
|
-
* @param handle - Handle of sub-account to be activated.
|
|
888
|
-
* @example
|
|
889
|
-
* ```ts
|
|
890
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
891
|
-
* const { success, error } = await mailchannels.subAccounts.activate('validhandle123')
|
|
892
|
-
* ```
|
|
893
|
-
*/
|
|
894
|
-
activate(handle: string): Promise<SuccessResponse>;
|
|
895
|
-
/**
|
|
896
|
-
* Creates a new API key for the specified sub-account.
|
|
897
|
-
* @param handle - Handle of the sub-account to create API key for.
|
|
898
|
-
* @example
|
|
899
|
-
* ```ts
|
|
900
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
901
|
-
* const { data, error } = await mailchannels.subAccounts.createApiKey('validhandle123')
|
|
902
|
-
* ```
|
|
903
|
-
*/
|
|
904
|
-
createApiKey(handle: string): Promise<SubAccountsCreateApiKeyResponse>;
|
|
905
|
-
/**
|
|
906
|
-
* Retrieves details of all API keys associated with the specified sub-account. For security reasons, the full API key is not returned; only the key ID and a partially redacted version are provided.
|
|
907
|
-
* @param handle - Handle of the sub-account to retrieve the API key for.
|
|
908
|
-
* @param options - The options to filter the list of API keys.
|
|
909
|
-
* @example
|
|
910
|
-
* ```ts
|
|
911
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
912
|
-
* const { data, error } = await mailchannels.subAccounts.listApiKeys('validhandle123')
|
|
913
|
-
* ```
|
|
914
|
-
*/
|
|
915
|
-
listApiKeys(handle: string, options?: SubAccountsListApiKeyOptions): Promise<SubAccountsListApiKeyResponse>;
|
|
916
|
-
/**
|
|
917
|
-
* Deletes the API key identified by its ID for the specified sub-account.
|
|
918
|
-
* @param handle - Handle of the sub-account for which the API key should be deleted.
|
|
919
|
-
* @param id - The ID of the API key to delete.
|
|
920
|
-
* @example
|
|
921
|
-
* ```ts
|
|
922
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
923
|
-
* const { success, error } = await mailchannels.subAccounts.deleteApiKey('validhandle123', 1)
|
|
924
|
-
* ```
|
|
925
|
-
*/
|
|
926
|
-
deleteApiKey(handle: string, id: number): Promise<SuccessResponse>;
|
|
927
|
-
/**
|
|
928
|
-
* Creates a new SMTP password for the specified sub-account.
|
|
929
|
-
* @param handle - Handle of the sub-account to create SMTP password for.
|
|
930
|
-
* @example
|
|
931
|
-
* ```ts
|
|
932
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
933
|
-
* const { data, error } = await mailchannels.subAccounts.createSmtpPassword('validhandle123')
|
|
934
|
-
* ```
|
|
935
|
-
*/
|
|
936
|
-
createSmtpPassword(handle: string): Promise<SubAccountsCreateSmtpPasswordResponse>;
|
|
937
|
-
/**
|
|
938
|
-
* Retrieves details of all SMTP passwords associated with the specified sub-account. For security, the full SMTP password is not returned; only the password ID and a partially redacted version are provided.
|
|
939
|
-
* @param handle - Handle of the sub-account to retrieve the SMTP password for.
|
|
940
|
-
* @example
|
|
941
|
-
* ```ts
|
|
942
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
943
|
-
* const { data, error } = await mailchannels.subAccounts.listSmtpPasswords('validhandle123')
|
|
944
|
-
* ```
|
|
945
|
-
*/
|
|
946
|
-
listSmtpPasswords(handle: string): Promise<SubAccountsListSmtpPasswordResponse>;
|
|
947
|
-
/**
|
|
948
|
-
* Deletes the SMTP password identified by its ID for the specified sub-account.
|
|
949
|
-
* @param handle - Handle of the sub-account for which the SMTP password should be deleted.
|
|
950
|
-
* @param id - The ID of the SMTP password to delete.
|
|
951
|
-
* @example
|
|
952
|
-
* ```ts
|
|
953
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
954
|
-
* const { success, error } = await mailchannels.subAccounts.deleteSmtpPassword('validhandle123', 1)
|
|
955
|
-
* ```
|
|
956
|
-
*/
|
|
957
|
-
deleteSmtpPassword(handle: string, id: number): Promise<SuccessResponse>;
|
|
958
|
-
/**
|
|
959
|
-
* Retrieves the limit of a specified sub-account. A value of `-1` indicates that the sub-account inherits the parent account's limit, allowing the sub-account to utilize any remaining capacity within the parent account's allocation.
|
|
960
|
-
* @param handle - Handle of the sub-account to retrieve the limit for.
|
|
961
|
-
* @example
|
|
962
|
-
* ```ts
|
|
963
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
964
|
-
* const { data, error } = await mailchannels.subAccounts.getLimit('validhandle123')
|
|
965
|
-
* ```
|
|
966
|
-
*/
|
|
967
|
-
getLimit(handle: string): Promise<SubAccountsLimitResponse>;
|
|
968
|
-
/**
|
|
969
|
-
* Sets the limit for the specified sub-account.
|
|
970
|
-
* @param handle - Handle of the sub-account to set limit for.
|
|
971
|
-
* @param limit - The limits to set for the sub-account. The minimum allowed sends is `0`
|
|
972
|
-
* @example
|
|
973
|
-
* ```ts
|
|
974
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
975
|
-
* const { success, error } = await mailchannels.subAccounts.setLimit('validhandle123', { sends: 1000 })
|
|
976
|
-
* ```
|
|
977
|
-
*/
|
|
978
|
-
setLimit(handle: string, limit: SubAccountsLimit): Promise<SuccessResponse>;
|
|
979
|
-
/**
|
|
980
|
-
* Deletes the limit for the specified sub-account. After a successful deletion, the specified sub-account will be limited to the parent account's limit.
|
|
981
|
-
* @param handle - Handle of the sub-account to delete limit for.
|
|
982
|
-
* @example
|
|
983
|
-
* ```ts
|
|
984
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
985
|
-
* const { success, error } = await mailchannels.subAccounts.deleteLimit('validhandle123')
|
|
986
|
-
* ```
|
|
987
|
-
*/
|
|
988
|
-
deleteLimit(handle: string): Promise<SuccessResponse>;
|
|
989
|
-
/**
|
|
990
|
-
* Retrieves usage statistics for the specified sub-account during the current billing period.
|
|
991
|
-
* @param handle - Handle of the sub-account to query usage stats for.
|
|
992
|
-
* @example
|
|
993
|
-
* ```ts
|
|
994
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
995
|
-
* const { data, error } = await mailchannels.subAccounts.getUsage('validhandle123')
|
|
996
|
-
* ```
|
|
997
|
-
*/
|
|
998
|
-
getUsage(handle: string): Promise<SubAccountsUsageResponse>;
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
interface MetricsEngagement {
|
|
1002
|
-
/**
|
|
1003
|
-
* A series of metrics aggregations bucketed by time interval (e.g. hour, day).
|
|
1004
|
-
*/
|
|
1005
|
-
buckets: {
|
|
1006
|
-
click: MetricsBucket[];
|
|
1007
|
-
clickTrackingDelivered: MetricsBucket[];
|
|
1008
|
-
open: MetricsBucket[];
|
|
1009
|
-
openTrackingDelivered: MetricsBucket[];
|
|
1010
|
-
};
|
|
1011
|
-
click: number;
|
|
1012
|
-
clickTrackingDelivered: number;
|
|
1013
|
-
endTime: string;
|
|
1014
|
-
open: number;
|
|
1015
|
-
openTrackingDelivered: number;
|
|
1016
|
-
startTime: string;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
type MetricsEngagementResponse = DataResponse$1<MetricsEngagement>;
|
|
1020
|
-
|
|
1021
|
-
interface MetricsPerformance {
|
|
1022
|
-
/**
|
|
1023
|
-
* Count of messages bounced during the specified time range.
|
|
1024
|
-
*/
|
|
1025
|
-
bounced: number;
|
|
1026
|
-
/**
|
|
1027
|
-
* A series of metrics aggregations bucketed by time interval (e.g. hour, day).
|
|
1028
|
-
*/
|
|
1029
|
-
buckets: {
|
|
1030
|
-
bounced: MetricsBucket[];
|
|
1031
|
-
delivered: MetricsBucket[];
|
|
1032
|
-
processed: MetricsBucket[];
|
|
1033
|
-
};
|
|
1034
|
-
/**
|
|
1035
|
-
* Count of messages delivered during the specified time range.
|
|
1036
|
-
*/
|
|
1037
|
-
delivered: number;
|
|
1038
|
-
/**
|
|
1039
|
-
* The end of the time range for retrieving message performance metrics (exclusive).
|
|
1040
|
-
*/
|
|
1041
|
-
endTime: string;
|
|
1042
|
-
/**
|
|
1043
|
-
* Count of messages processed during the specified time range.
|
|
1044
|
-
*/
|
|
1045
|
-
processed: number;
|
|
1046
|
-
/**
|
|
1047
|
-
* The beginning of the time range for retrieving message performance metrics (inclusive).
|
|
1048
|
-
*/
|
|
1049
|
-
startTime: string;
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
type MetricsPerformanceResponse = DataResponse$1<MetricsPerformance>;
|
|
1053
|
-
|
|
1054
|
-
interface MetricsRecipientBehaviour {
|
|
1055
|
-
/**
|
|
1056
|
-
* A series of metrics aggregations bucketed by time interval (e.g. hour, day).
|
|
1057
|
-
*/
|
|
1058
|
-
buckets: {
|
|
1059
|
-
unsubscribeDelivered: MetricsBucket[];
|
|
1060
|
-
unsubscribed: MetricsBucket[];
|
|
1061
|
-
};
|
|
1062
|
-
/**
|
|
1063
|
-
* The end of the time range for retrieving recipient behaviour metrics (exclusive).
|
|
1064
|
-
*/
|
|
1065
|
-
endTime: string;
|
|
1066
|
-
/**
|
|
1067
|
-
* The beginning of the time range for retrieving recipient behaviour metrics (inclusive).
|
|
1068
|
-
*/
|
|
1069
|
-
startTime: string;
|
|
1070
|
-
/**
|
|
1071
|
-
* Count of recipients of delivered messages that include at least one of the unsubscribe link or unsubscribe headers. Since the unsubscribe feature requires exactly one recipient per message, this count also represents the total number of delivered messages.
|
|
1072
|
-
*/
|
|
1073
|
-
unsubscribeDelivered: number;
|
|
1074
|
-
/**
|
|
1075
|
-
* Count of unsubscribed events by recipients.
|
|
1076
|
-
*/
|
|
1077
|
-
unsubscribed: number;
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
type MetricsRecipientBehaviourResponse = DataResponse$1<MetricsRecipientBehaviour>;
|
|
1081
|
-
|
|
1082
|
-
interface MetricsVolume {
|
|
1083
|
-
/**
|
|
1084
|
-
* A series of metrics aggregations bucketed by time interval (e.g. hour, day).
|
|
1085
|
-
*/
|
|
1086
|
-
buckets: {
|
|
1087
|
-
delivered: MetricsBucket[];
|
|
1088
|
-
dropped: MetricsBucket[];
|
|
1089
|
-
processed: MetricsBucket[];
|
|
1090
|
-
};
|
|
1091
|
-
/**
|
|
1092
|
-
* Count of messages delivered during the specified time range.
|
|
1093
|
-
*/
|
|
1094
|
-
delivered: number;
|
|
1095
|
-
/**
|
|
1096
|
-
* Count of messages dropped during the specified time range.
|
|
1097
|
-
*/
|
|
1098
|
-
dropped: number;
|
|
1099
|
-
/**
|
|
1100
|
-
* The end of the time range for retrieving message volume metrics (exclusive).
|
|
1101
|
-
*/
|
|
1102
|
-
endTime: string;
|
|
1103
|
-
/**
|
|
1104
|
-
* Count of messages processed during the specified time range.
|
|
1105
|
-
*/
|
|
1106
|
-
processed: number;
|
|
1107
|
-
/**
|
|
1108
|
-
* The beginning of the time range for retrieving message volume metrics (inclusive).
|
|
1109
|
-
*/
|
|
1110
|
-
startTime: string;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
type MetricsVolumeResponse = DataResponse$1<MetricsVolume>;
|
|
1114
|
-
|
|
1115
|
-
type MetricsUsageResponse = DataResponse$1<{
|
|
1116
|
-
/**
|
|
1117
|
-
* The end date of the current billing period (ISO 8601 format).
|
|
1118
|
-
* @example "2025-04-11"
|
|
1119
|
-
*/
|
|
1120
|
-
endDate: string;
|
|
1121
|
-
/**
|
|
1122
|
-
* The start date of the current billing period (ISO 8601 format).
|
|
1123
|
-
* @example "2025-03-12"
|
|
1124
|
-
*/
|
|
1125
|
-
startDate: string;
|
|
1126
|
-
/**
|
|
1127
|
-
* The total usage for the current billing period.
|
|
1128
|
-
*/
|
|
1129
|
-
total: number;
|
|
1130
|
-
}>;
|
|
1131
|
-
|
|
1132
|
-
type MetricsSendersType = "sub-accounts" | "campaigns";
|
|
1133
|
-
|
|
1134
|
-
interface MetricsSendersOptions {
|
|
1135
|
-
/**
|
|
1136
|
-
* The beginning of the time range for retrieving top senders metrics (inclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`. Defaults to one month ago if not provided.
|
|
1137
|
-
* @example "2025-11-02T03:13:35.761763554Z"
|
|
1138
|
-
*/
|
|
1139
|
-
startTime?: string;
|
|
1140
|
-
/**
|
|
1141
|
-
* The end of the time range for retrieving top senders metrics (exclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`. Defaults to the current time if not provided.
|
|
1142
|
-
* @example "2025-12-02T03:13:35.761763554Z"
|
|
1143
|
-
*/
|
|
1144
|
-
endTime?: string;
|
|
1145
|
-
/**
|
|
1146
|
-
* The maximum number of senders to return. Possible values are 1 to 1000.
|
|
1147
|
-
* @default 10
|
|
1148
|
-
*/
|
|
1149
|
-
limit?: number;
|
|
1150
|
-
/**
|
|
1151
|
-
* The number of senders to skip before returning results.
|
|
1152
|
-
* @default 0
|
|
1153
|
-
*/
|
|
1154
|
-
offset?: number;
|
|
1155
|
-
/**
|
|
1156
|
-
* The order in which to sort the results, based on total messages (processed + dropped).
|
|
1157
|
-
* @default "desc"
|
|
1158
|
-
*/
|
|
1159
|
-
sortOrder?: "asc" | "desc";
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
interface MetricsSenders {
|
|
1163
|
-
endTime: string;
|
|
1164
|
-
limit: number;
|
|
1165
|
-
offset: number;
|
|
1166
|
-
senders: {
|
|
1167
|
-
bounced: number;
|
|
1168
|
-
delivered: number;
|
|
1169
|
-
dropped: number;
|
|
1170
|
-
/**
|
|
1171
|
-
* Maximum character length: 255
|
|
1172
|
-
*/
|
|
1173
|
-
name: string;
|
|
1174
|
-
processed: number;
|
|
1175
|
-
}[];
|
|
1176
|
-
startTime: string;
|
|
1177
|
-
/**
|
|
1178
|
-
* The total number of senders in this category that sent messages in the given time range.
|
|
1179
|
-
*/
|
|
1180
|
-
total: number;
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
type MetricsSendersResponse = DataResponse$1<MetricsSenders>;
|
|
1184
|
-
|
|
1185
|
-
interface MetricsBucket {
|
|
1186
|
-
/**
|
|
1187
|
-
* The number of events or occurrences aggregated within this time period.
|
|
1188
|
-
*/
|
|
1189
|
-
count: number;
|
|
1190
|
-
/**
|
|
1191
|
-
* The starting date and time of the time period this bucket represents.
|
|
1192
|
-
*/
|
|
1193
|
-
periodStart: string;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
interface MetricsOptions {
|
|
1197
|
-
/**
|
|
1198
|
-
* The beginning of the time range for retrieving message metrics (inclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`. Defaults to one month ago if not provided.
|
|
1199
|
-
* @example "2025-05-26"
|
|
1200
|
-
*/
|
|
1201
|
-
startTime?: string;
|
|
1202
|
-
/**
|
|
1203
|
-
* The end of the time range for retrieving message metrics (exclusive). Formats: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`. Defaults to the current time if not provided.
|
|
1204
|
-
* @example "2025-05-31T15:16:17Z"
|
|
1205
|
-
*/
|
|
1206
|
-
endTime?: string;
|
|
1207
|
-
/**
|
|
1208
|
-
* The ID of the campaign to filter metrics by. If not provided, metrics for all campaigns will be returned.
|
|
1209
|
-
*/
|
|
1210
|
-
campaignId?: string;
|
|
1211
|
-
/**
|
|
1212
|
-
* The interval for aggregating metrics data.
|
|
1213
|
-
* @default "day"
|
|
1214
|
-
*/
|
|
1215
|
-
interval?: "hour" | "day" | "week" | "month";
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
declare class Metrics {
|
|
1219
|
-
protected mailchannels: MailChannelsClient;
|
|
1220
|
-
constructor(mailchannels: MailChannelsClient);
|
|
1221
|
-
/**
|
|
1222
|
-
* Retrieve engagement metrics for messages sent from your account, including counts of open and click events. Supports optional filters for time range, and campaign ID.
|
|
1223
|
-
* @param options - Options to filter and customize the engagement metrics retrieval.
|
|
1224
|
-
* @example
|
|
1225
|
-
* ```ts
|
|
1226
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1227
|
-
* const { data, error } = await mailchannels.metrics.engagement()
|
|
1228
|
-
* ```
|
|
1229
|
-
*/
|
|
1230
|
-
engagement(options?: MetricsOptions): Promise<MetricsEngagementResponse>;
|
|
1231
|
-
/**
|
|
1232
|
-
* Retrieve performance metrics for messages sent from your account, including counts of processed, delivered, hard-bounced events. Supports optional filters for time range, and campaign ID.
|
|
1233
|
-
* @param options - Options to filter and customize the performance metrics retrieval.
|
|
1234
|
-
* @example
|
|
1235
|
-
* ```ts
|
|
1236
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1237
|
-
* const { data, error } = await mailchannels.metrics.performance()
|
|
1238
|
-
* ```
|
|
1239
|
-
*/
|
|
1240
|
-
performance(options?: MetricsOptions): Promise<MetricsPerformanceResponse>;
|
|
1241
|
-
/**
|
|
1242
|
-
* Retrieve recipient behaviour metrics for messages sent from your account, including counts of unsubscribed events. Supports optional filters for time range, and campaign ID.
|
|
1243
|
-
* @param options - Options to filter and customize the recipient behaviour metrics retrieval.
|
|
1244
|
-
* @example
|
|
1245
|
-
* ```ts
|
|
1246
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1247
|
-
* const { data, error } = await mailchannels.metrics.recipientBehaviour()
|
|
1248
|
-
* ```
|
|
1249
|
-
*/
|
|
1250
|
-
recipientBehaviour(options?: MetricsOptions): Promise<MetricsRecipientBehaviourResponse>;
|
|
1251
|
-
/**
|
|
1252
|
-
* Retrieve volume metrics for messages sent from your account, including counts of processed, delivered and dropped events. Supports optional filters for time range and campaign ID.
|
|
1253
|
-
* @param options - Options to filter and customize the volume metrics retrieval.
|
|
1254
|
-
* @example
|
|
1255
|
-
* ```ts
|
|
1256
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1257
|
-
* const { data, error } = await mailchannels.metrics.volume()
|
|
1258
|
-
* ```
|
|
1259
|
-
*/
|
|
1260
|
-
volume(options?: MetricsOptions): Promise<MetricsVolumeResponse>;
|
|
1261
|
-
/**
|
|
1262
|
-
* Retrieves usage statistics during the current billing period.
|
|
1263
|
-
* @example
|
|
1264
|
-
* ```ts
|
|
1265
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1266
|
-
* const { data, error } = await mailchannels.metrics.usage()
|
|
1267
|
-
* ```
|
|
1268
|
-
*/
|
|
1269
|
-
usage(): Promise<MetricsUsageResponse>;
|
|
1270
|
-
/**
|
|
1271
|
-
* Retrieves a list of senders, either sub-accounts or campaigns, with their associated message metrics. Sorted by total # of sent messages (processed + dropped). Supports optional filter for time range, and optional settings for limit, offset, and sort order. Note: senders without any messages in the given time range will not be included in the results. The default time range is from one month ago to now, and the default sort order is descending.
|
|
1272
|
-
* @param type - The type of senders to retrieve metrics for. Can be either `sub-accounts` or `campaigns`.
|
|
1273
|
-
* @param options - Optional filter options for time range, limit, offset, and sort order.
|
|
1274
|
-
* @example
|
|
1275
|
-
* ```ts
|
|
1276
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1277
|
-
* const { data, error } = await mailchannels.metrics.senders('campaigns')
|
|
1278
|
-
* ```
|
|
1279
|
-
*/
|
|
1280
|
-
senders(type: MetricsSendersType, options?: MetricsSendersOptions): Promise<MetricsSendersResponse>;
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
type SuppressionsTypes = "transactional" | "non-transactional";
|
|
1284
|
-
|
|
1285
|
-
interface SuppressionsCreateOptions {
|
|
1286
|
-
/**
|
|
1287
|
-
* If true, the parent account creates suppression entries for all associated sub-accounts. This field is only applicable to parent accounts. Sub-accounts cannot create entries for other sub-accounts.
|
|
1288
|
-
* @default false
|
|
1289
|
-
*/
|
|
1290
|
-
addToSubAccounts?: boolean;
|
|
1291
|
-
/**
|
|
1292
|
-
* The total number of suppression entries to create, for the parent and/or its sub-accounts, must not exceed `1000`.
|
|
1293
|
-
*/
|
|
1294
|
-
entries: {
|
|
1295
|
-
/**
|
|
1296
|
-
* Must be less than `1024` characters.
|
|
1297
|
-
*/
|
|
1298
|
-
notes?: string;
|
|
1299
|
-
/**
|
|
1300
|
-
* The email address to suppress. Must be a valid email address format and less than `255` characters.
|
|
1301
|
-
*/
|
|
1302
|
-
recipient: string;
|
|
1303
|
-
/**
|
|
1304
|
-
* An array of types of suppression to apply to the recipient.
|
|
1305
|
-
* @default ["non-transactional"]
|
|
1306
|
-
*/
|
|
1307
|
-
types?: SuppressionsTypes[];
|
|
1308
|
-
}[];
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
type SuppressionsSource = "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all";
|
|
1312
|
-
|
|
1313
|
-
interface SuppressionsListOptions {
|
|
1314
|
-
/**
|
|
1315
|
-
* The email address of the suppression entry to search for. If provided, the search will return the suppression entry associated with this recipient. If not provided, the search will return all suppression entries for the account.
|
|
1316
|
-
*/
|
|
1317
|
-
recipient?: string;
|
|
1318
|
-
/**
|
|
1319
|
-
* The source of the suppression entries to filter by. If not provided, suppression entries from all sources will be returned.
|
|
1320
|
-
*/
|
|
1321
|
-
source?: Exclude<SuppressionsSource, "all">;
|
|
1322
|
-
/**
|
|
1323
|
-
* The date and/or time before which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`.
|
|
1324
|
-
*/
|
|
1325
|
-
createdBefore?: string;
|
|
1326
|
-
/**
|
|
1327
|
-
* The date and/or time after which the suppression entries were created. Format: `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SSZ`.
|
|
1328
|
-
*/
|
|
1329
|
-
createdAfter?: string;
|
|
1330
|
-
/**
|
|
1331
|
-
* The maximum number of suppression entries to return. Must be between `1` and `1000`.
|
|
1332
|
-
* @default 1000
|
|
1333
|
-
*/
|
|
1334
|
-
limit?: number;
|
|
1335
|
-
/**
|
|
1336
|
-
* The number of suppression entries to skip before returning results.
|
|
1337
|
-
* @default 0
|
|
1338
|
-
*/
|
|
1339
|
-
offset?: number;
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
interface SuppressionsListEntry {
|
|
1343
|
-
createdAt: string;
|
|
1344
|
-
notes?: string;
|
|
1345
|
-
/**
|
|
1346
|
-
* The email address that is suppressed.
|
|
1347
|
-
*/
|
|
1348
|
-
recipient: string;
|
|
1349
|
-
sender?: string;
|
|
1350
|
-
source: SuppressionsSource;
|
|
1351
|
-
types: SuppressionsTypes[];
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
type SuppressionsListResponse = DataResponse$1<SuppressionsListEntry[]>;
|
|
1355
|
-
|
|
1356
|
-
declare class Suppressions {
|
|
1357
|
-
protected mailchannels: MailChannelsClient;
|
|
1358
|
-
constructor(mailchannels: MailChannelsClient);
|
|
1359
|
-
/**
|
|
1360
|
-
* Creates suppression entries for the specified account. Parent accounts can create suppression entries for all associated sub-accounts. If `types` is not provided, it defaults to `non-transactional`. The operation is atomic, meaning all entries are successfully added or none are added if an error occurs.
|
|
1361
|
-
* @param options - The details of the suppression entries to create.
|
|
1362
|
-
* @example
|
|
1363
|
-
* ```ts
|
|
1364
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1365
|
-
* const { success, error } = await mailchannels.suppressions.create({
|
|
1366
|
-
* // ...
|
|
1367
|
-
* });
|
|
1368
|
-
*/
|
|
1369
|
-
create(options: SuppressionsCreateOptions): Promise<SuccessResponse>;
|
|
1370
|
-
/**
|
|
1371
|
-
* Deletes suppression entry associated with the account based on the specified recipient and source.
|
|
1372
|
-
* @param recipient - The email address of the suppression entry to delete.
|
|
1373
|
-
* @param source - The source of the suppression entry to be deleted. If source is not provided, it defaults to `api`. If source is set to `all`, all suppression entries related to the specified recipient will be deleted.
|
|
1374
|
-
* @example
|
|
1375
|
-
* ```ts
|
|
1376
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1377
|
-
* const { success, error } = await mailchannels.suppressions.delete('name@example.com', 'api');
|
|
1378
|
-
* ```
|
|
1379
|
-
*/
|
|
1380
|
-
delete(recipient: string, source?: SuppressionsSource): Promise<SuccessResponse>;
|
|
1381
|
-
/**
|
|
1382
|
-
* Retrieve suppression entries associated with the specified account. Supports filtering by recipient, source and creation date range. The response is paginated, with a default limit of `1000` entries per page and an offset of `0`.
|
|
1383
|
-
* @example
|
|
1384
|
-
* ```ts
|
|
1385
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1386
|
-
* const { data, error } = await mailchannels.suppressions.list();
|
|
1387
|
-
* ```
|
|
1388
|
-
* @param options - Options to filter and customize the suppression entries retrieval.
|
|
1389
|
-
*/
|
|
1390
|
-
list(options?: SuppressionsListOptions): Promise<SuppressionsListResponse>;
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
type ListNames = "blocklist" | "safelist" | "blacklist" | "whitelist";
|
|
1394
|
-
|
|
1395
|
-
interface ListEntryOptions {
|
|
1396
|
-
/**
|
|
1397
|
-
* This can be a `blocklist`, `safelist`, `blacklist`, or `whitelist`.
|
|
1398
|
-
*/
|
|
1399
|
-
listName: ListNames;
|
|
1400
|
-
/**
|
|
1401
|
-
* This can be a domain, email address, or IP address. The type of the entry is automatically determined based on the value.
|
|
1402
|
-
*/
|
|
1403
|
-
item: string;
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
interface ListEntry {
|
|
1407
|
-
action: Extract<ListNames, "blocklist" | "safelist">;
|
|
1408
|
-
item: string;
|
|
1409
|
-
type: "domain" | "email_address" | "ip_address";
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
type ListEntryResponse = DataResponse$1<ListEntry>;
|
|
1413
|
-
|
|
1414
|
-
type ListEntriesResponse = DataResponse$1<ListEntry[]>;
|
|
1415
|
-
|
|
1416
|
-
interface DomainsData {
|
|
1417
|
-
/**
|
|
1418
|
-
* The domain name.
|
|
1419
|
-
*/
|
|
1420
|
-
domain: string;
|
|
1421
|
-
/**
|
|
1422
|
-
* The abuse policy settings for the domain. These settings determine how spam messages are handled.
|
|
1423
|
-
*/
|
|
1424
|
-
settings?: Partial<{
|
|
1425
|
-
/**
|
|
1426
|
-
* The abuse policy.
|
|
1427
|
-
*/
|
|
1428
|
-
abusePolicy: "block" | "flag" | "quarantine";
|
|
1429
|
-
/**
|
|
1430
|
-
* If `true`, this abuse policy overrides the recipient abuse policy.
|
|
1431
|
-
*/
|
|
1432
|
-
abusePolicyOverride: boolean;
|
|
1433
|
-
/**
|
|
1434
|
-
* The spam header name to use if the abuse policy is set to `flag`.
|
|
1435
|
-
*/
|
|
1436
|
-
spamHeaderName: string;
|
|
1437
|
-
/**
|
|
1438
|
-
* The spam header value to use if the abuse policy is set to `flag`.
|
|
1439
|
-
*/
|
|
1440
|
-
spamHeaderValue: string;
|
|
1441
|
-
}>;
|
|
1442
|
-
/**
|
|
1443
|
-
* A list of email addresses that are the domain admins for the domain.
|
|
1444
|
-
*/
|
|
1445
|
-
admins?: string[] | null;
|
|
1446
|
-
/**
|
|
1447
|
-
* The locations of mail servers to which messages will be delivered after filtering.
|
|
1448
|
-
*/
|
|
1449
|
-
downstreamAddresses?: {
|
|
1450
|
-
/**
|
|
1451
|
-
* The priority of the downstream address. Only addresses with the highest priority (the lowest numerical value) are selected.
|
|
1452
|
-
*/
|
|
1453
|
-
priority: number;
|
|
1454
|
-
/**
|
|
1455
|
-
* Downstream addresses are selected in proportion to their weights. For example, if there are two downstream addresses, A with weight 40, and B with weight 10, then A is selected 80% of the time and B is selected 20% of the time.
|
|
1456
|
-
*/
|
|
1457
|
-
weight: number;
|
|
1458
|
-
/**
|
|
1459
|
-
* TCP port on which the downstream mail server is listening.
|
|
1460
|
-
*/
|
|
1461
|
-
port: number;
|
|
1462
|
-
/**
|
|
1463
|
-
* The canonical hostname of the host providing the service, ending in a dot.
|
|
1464
|
-
*/
|
|
1465
|
-
target: string;
|
|
1466
|
-
}[] | null;
|
|
1467
|
-
/**
|
|
1468
|
-
* A list of aliases for the domain. Mail is accepted for these domains and routed to the `downstreamAddresses` defined for the domain. Must be <= 255 characters.
|
|
1469
|
-
*/
|
|
1470
|
-
aliases?: string[] | null;
|
|
1471
|
-
/**
|
|
1472
|
-
* The subscription `handle` that identifies the subscription that this domain should be provisioned against. Subscription handles can be retrieved from the `subscriptions` service method.
|
|
1473
|
-
*/
|
|
1474
|
-
subscriptionHandle: string;
|
|
1475
|
-
}
|
|
1476
|
-
|
|
1477
|
-
interface DomainsProvisionOptions {
|
|
1478
|
-
/**
|
|
1479
|
-
* If present and set to true, the domain will be associated with the api-key that created it. This means that this api-key must be used for inbound-api actions involving this domain (for example adding safe/block list entries, etc).
|
|
1480
|
-
*/
|
|
1481
|
-
associateKey?: boolean;
|
|
1482
|
-
/**
|
|
1483
|
-
* If present and set to true, the settings (domain settings, downstream addresses, aliases and admins) for the domain will be overwritten with the ones in the request if the domain already exists, unless a section is not included in the request or there is problem updating a setting in which case the previous settings are carried forward.
|
|
1484
|
-
*/
|
|
1485
|
-
overwrite?: boolean;
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
type DomainsBulkProvisionOptions = DomainsProvisionOptions & Pick<DomainsData, "subscriptionHandle">;
|
|
1489
|
-
|
|
1490
|
-
type DomainsProvisionResponse = DataResponse$1<DomainsData>;
|
|
1491
|
-
|
|
1492
|
-
type DomainsBulkProvisionResponse = DataResponse$1<{
|
|
1493
|
-
/**
|
|
1494
|
-
* Domains that were successfully provisioned or updated.
|
|
1495
|
-
*/
|
|
1496
|
-
successes: {
|
|
1497
|
-
/**
|
|
1498
|
-
* The provisioned domain data.
|
|
1499
|
-
*/
|
|
1500
|
-
domain: DomainsData;
|
|
1501
|
-
code: number;
|
|
1502
|
-
comment?: string;
|
|
1503
|
-
}[];
|
|
1504
|
-
/**
|
|
1505
|
-
* Domains that were not successfully provisioned.
|
|
1506
|
-
*/
|
|
1507
|
-
errors: {
|
|
1508
|
-
/**
|
|
1509
|
-
* The failed to provision domain data.
|
|
1510
|
-
*/
|
|
1511
|
-
domain: DomainsData;
|
|
1512
|
-
code: number;
|
|
1513
|
-
comment?: string;
|
|
1514
|
-
}[];
|
|
1515
|
-
}>;
|
|
1516
|
-
|
|
1517
|
-
interface DomainsListOptions {
|
|
1518
|
-
/**
|
|
1519
|
-
* A list of domains to fetch. If this parameter is present, only domains whose name matches an item in this list are returned.
|
|
1520
|
-
*/
|
|
1521
|
-
domains?: string[];
|
|
1522
|
-
/**
|
|
1523
|
-
* The maximum number of domains included in the response. Possible values are 1 to 5000.
|
|
1524
|
-
* @default 10
|
|
1525
|
-
*/
|
|
1526
|
-
limit?: number;
|
|
1527
|
-
/**
|
|
1528
|
-
* Offset into the list of domains to return.
|
|
1529
|
-
* @default 0
|
|
1530
|
-
*/
|
|
1531
|
-
offset?: number;
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
type DomainsListResponse = DataResponse$1<{
|
|
1535
|
-
/**
|
|
1536
|
-
* A list of domains.
|
|
1537
|
-
*/
|
|
1538
|
-
domains: DomainsData[];
|
|
1539
|
-
/**
|
|
1540
|
-
* The total number of domains that are accessible with the given API key that match the list of domains in the 'domains' parameter. If there is no 'domains' parameter, this field is the total number of domains that are accessible with with this API key. A domain is accessible with a given API key if it is associated with that API key, or if it is not associated with any API key.
|
|
1541
|
-
*/
|
|
1542
|
-
total: number;
|
|
1543
|
-
}>;
|
|
1544
|
-
|
|
1545
|
-
interface DomainsCreateLoginLink {
|
|
1546
|
-
/**
|
|
1547
|
-
* If a user browses to this URL, they will be automatically logged in as a domain admin.
|
|
1548
|
-
*/
|
|
1549
|
-
link: string;
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
type DomainsCreateLoginLinkResponse = DataResponse$1<DomainsCreateLoginLink>;
|
|
1553
|
-
|
|
1554
|
-
interface DomainsListDownstreamAddressesOptions {
|
|
1555
|
-
/**
|
|
1556
|
-
* The number of records to return.
|
|
1557
|
-
* @default 10
|
|
1558
|
-
*/
|
|
1559
|
-
limit?: number;
|
|
1560
|
-
/**
|
|
1561
|
-
* The offset into the records to return.
|
|
1562
|
-
* @default 0
|
|
1563
|
-
*/
|
|
1564
|
-
offset?: number;
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
interface DomainsDownstreamAddress {
|
|
1568
|
-
/**
|
|
1569
|
-
* TCP port on which the downstream mail server is listening.
|
|
1570
|
-
*/
|
|
1571
|
-
port: number;
|
|
1572
|
-
/**
|
|
1573
|
-
* The priority of the downstream address. Only addresses with the highest priority (the lowest numerical value) are selected.
|
|
1574
|
-
*/
|
|
1575
|
-
priority: number;
|
|
1576
|
-
/**
|
|
1577
|
-
* The canonical hostname of the host providing the service, ending in a dot.
|
|
1578
|
-
*/
|
|
1579
|
-
target: string;
|
|
1580
|
-
/**
|
|
1581
|
-
* Downstream addresses are selected in proportion to their weights. For example, if there are two downstream addresses, A with weight 40, and B with weight 10, then A is selected 80% of the time and B is selected 20% of the time.
|
|
1582
|
-
*/
|
|
1583
|
-
weight: number;
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
type DomainsListDownstreamAddressesResponse = DataResponse$1<DomainsDownstreamAddress[]>;
|
|
1587
|
-
|
|
1588
|
-
interface DomainsBulkCreateLoginLinkResult {
|
|
1589
|
-
/**
|
|
1590
|
-
* The domain the request was for.
|
|
1591
|
-
*/
|
|
1592
|
-
domain: string;
|
|
1593
|
-
code: 200 | 400 | 401 | 403 | 404 | 500;
|
|
1594
|
-
/**
|
|
1595
|
-
* More information about the result of creating the login link.
|
|
1596
|
-
*/
|
|
1597
|
-
comment?: string;
|
|
1598
|
-
/**
|
|
1599
|
-
* If a user browses to this URL, they will be automatically logged in as a domain admin.
|
|
1600
|
-
*/
|
|
1601
|
-
loginLink: string;
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
interface DomainsBulkCreateLoginLinks {
|
|
1605
|
-
successes: DomainsBulkCreateLoginLinkResult[];
|
|
1606
|
-
errors: Omit<DomainsBulkCreateLoginLinkResult, "loginLink">[];
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
type DomainsBulkCreateLoginLinksResponse = DataResponse$1<DomainsBulkCreateLoginLinks>;
|
|
1610
|
-
|
|
1611
|
-
declare class Domains {
|
|
1612
|
-
protected mailchannels: MailChannelsClient;
|
|
1613
|
-
constructor(mailchannels: MailChannelsClient);
|
|
1614
|
-
/**
|
|
1615
|
-
* Provision a single domain to use MailChannels Inbound.
|
|
1616
|
-
* @param options - The provision options and domain data.
|
|
1617
|
-
* @example
|
|
1618
|
-
* ```ts
|
|
1619
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1620
|
-
* const { data, error } = await mailchannels.domains.provision({
|
|
1621
|
-
* domain: 'example.com',
|
|
1622
|
-
* subscriptionHandle: 'your-subscription-handle'
|
|
1623
|
-
* })
|
|
1624
|
-
* ```
|
|
1625
|
-
*/
|
|
1626
|
-
provision(options: DomainsProvisionOptions & DomainsData): Promise<DomainsProvisionResponse>;
|
|
1627
|
-
/**
|
|
1628
|
-
* Provision up to 1000 domains to use MailChannels Inbound.
|
|
1629
|
-
* @param options - The options to provision the domains.
|
|
1630
|
-
* @param domains - A list of domain data to provision.
|
|
1631
|
-
* @example
|
|
1632
|
-
* ```ts
|
|
1633
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1634
|
-
* const { data, error } = await mailchannels.domains.bulkProvision({
|
|
1635
|
-
* subscriptionHandle: 'your-subscription-handle'
|
|
1636
|
-
* }, [
|
|
1637
|
-
* {
|
|
1638
|
-
* domain: 'example.com',
|
|
1639
|
-
* admins: ['support@example.com']
|
|
1640
|
-
* },
|
|
1641
|
-
* {
|
|
1642
|
-
* domain: 'example2.com'
|
|
1643
|
-
* }
|
|
1644
|
-
* ])
|
|
1645
|
-
* ```
|
|
1646
|
-
*/
|
|
1647
|
-
bulkProvision(options: DomainsBulkProvisionOptions, domains: Omit<DomainsData, "subscriptionHandle">[]): Promise<DomainsBulkProvisionResponse>;
|
|
1648
|
-
/**
|
|
1649
|
-
* Fetch a list of all domains associated with this API key.
|
|
1650
|
-
* @param options - The options to filter the list of domains.
|
|
1651
|
-
* @example
|
|
1652
|
-
* ```ts
|
|
1653
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1654
|
-
* const { data, error } = await mailchannels.domains.list()
|
|
1655
|
-
* ```
|
|
1656
|
-
*/
|
|
1657
|
-
list(options?: DomainsListOptions): Promise<DomainsListResponse>;
|
|
1658
|
-
/**
|
|
1659
|
-
* De-provision a domain to cease protecting it with MailChannels Inbound.
|
|
1660
|
-
* @param domain - The domain name to be removed.
|
|
1661
|
-
* @example
|
|
1662
|
-
* ```ts
|
|
1663
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1664
|
-
* const { success, error } = await mailchannels.domains.delete('example.com')
|
|
1665
|
-
* ```
|
|
1666
|
-
*/
|
|
1667
|
-
delete(domain: string): Promise<SuccessResponse>;
|
|
1668
|
-
/**
|
|
1669
|
-
* Add an entry to a domain blocklist or safelist.
|
|
1670
|
-
* @param domain - The domain name.
|
|
1671
|
-
* @param options - The options to add a list entry.
|
|
1672
|
-
* @example
|
|
1673
|
-
* ```ts
|
|
1674
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1675
|
-
* const { data, error } = await mailchannels.domains.addListEntry('example.com', {
|
|
1676
|
-
* listName: 'safelist',
|
|
1677
|
-
* item: 'name@domain.com'
|
|
1678
|
-
* })
|
|
1679
|
-
* ```
|
|
1680
|
-
*/
|
|
1681
|
-
addListEntry(domain: string, options: ListEntryOptions): Promise<ListEntryResponse>;
|
|
1682
|
-
/**
|
|
1683
|
-
* Get domain list entries.
|
|
1684
|
-
* @param domain - The domain name.
|
|
1685
|
-
* @param listName - The name of the list to fetch. This can be a `blocklist`, `safelist`, `blacklist`, or `whitelist`.
|
|
1686
|
-
* @example
|
|
1687
|
-
* ```ts
|
|
1688
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1689
|
-
* const { data, error } = await mailchannels.domains.listEntries('example.com', 'safelist')
|
|
1690
|
-
* ```
|
|
1691
|
-
*/
|
|
1692
|
-
listEntries(domain: string, listName: ListNames): Promise<ListEntriesResponse>;
|
|
1693
|
-
/**
|
|
1694
|
-
* Delete item from domain list.
|
|
1695
|
-
* @param email - The domain name whose list will be modified.
|
|
1696
|
-
* @param options - The options for the list entry to delete.
|
|
1697
|
-
* @example
|
|
1698
|
-
* ```ts
|
|
1699
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1700
|
-
* const { success, error } = await mailchannels.domains.deleteListEntry('example.com', {
|
|
1701
|
-
* listName: 'safelist',
|
|
1702
|
-
* item: 'name@domain.com'
|
|
1703
|
-
* })
|
|
1704
|
-
* ```
|
|
1705
|
-
*/
|
|
1706
|
-
deleteListEntry(domain: string, options: ListEntryOptions): Promise<SuccessResponse>;
|
|
1707
|
-
/**
|
|
1708
|
-
* Generate a link that allows a user to log in as a domain administrator.
|
|
1709
|
-
* @param domain - The domain name.
|
|
1710
|
-
* @example
|
|
1711
|
-
* ```ts
|
|
1712
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1713
|
-
* const { data, error } = await mailchannels.domains.createLoginLink('example.com')
|
|
1714
|
-
* ```
|
|
1715
|
-
*/
|
|
1716
|
-
createLoginLink(domain: string): Promise<DomainsCreateLoginLinkResponse>;
|
|
1717
|
-
/**
|
|
1718
|
-
* Sets the list of downstream addresses for the domain. This action deletes any existing downstream address for the domain before creating new ones. If the `records` parameter is an empty array, all downstream address records will be deleted.
|
|
1719
|
-
* @param domain - The domain name.
|
|
1720
|
-
* @param records - The list of records to set for the domain. A maximum of 10 records can be set.
|
|
1721
|
-
* @example
|
|
1722
|
-
* ```ts
|
|
1723
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1724
|
-
* const { success, error } = await mailchannels.domains.setDownstreamAddress('example.com', [
|
|
1725
|
-
* {
|
|
1726
|
-
* port: 25,
|
|
1727
|
-
* priority: 10,
|
|
1728
|
-
* target: 'example.com.',
|
|
1729
|
-
* weight: 10
|
|
1730
|
-
* }
|
|
1731
|
-
* ])
|
|
1732
|
-
* ```
|
|
1733
|
-
*/
|
|
1734
|
-
setDownstreamAddress(domain: string, records?: DomainsDownstreamAddress[]): Promise<SuccessResponse>;
|
|
1735
|
-
/**
|
|
1736
|
-
* Retrieve stored downstream addresses for the domain.
|
|
1737
|
-
* @param domain - The domain name.
|
|
1738
|
-
* @param options - The options to filter the list of downstream addresses.
|
|
1739
|
-
* @example
|
|
1740
|
-
* ```ts
|
|
1741
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1742
|
-
* const { data, error } = await mailchannels.domains.listDownstreamAddresses('example.com')
|
|
1743
|
-
* ```
|
|
1744
|
-
*/
|
|
1745
|
-
listDownstreamAddresses(domain: string, options?: DomainsListDownstreamAddressesOptions): Promise<DomainsListDownstreamAddressesResponse>;
|
|
1746
|
-
/**
|
|
1747
|
-
* Update the API key that is associated with a domain.
|
|
1748
|
-
* @param domain - The domain name.
|
|
1749
|
-
* @param key - The new API key to associate with this domain.
|
|
1750
|
-
* @example
|
|
1751
|
-
* ```ts
|
|
1752
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1753
|
-
* const { success, error } = await mailchannels.domains.updateApiKey('example.com', 'your-api-key')
|
|
1754
|
-
* ```
|
|
1755
|
-
*/
|
|
1756
|
-
updateApiKey(domain: string, key: string): Promise<SuccessResponse>;
|
|
1757
|
-
/**
|
|
1758
|
-
* Generate a batch of links that allow a user to log in as a domain administrator to their different domains.
|
|
1759
|
-
* @param domains - The list of domain names. Maximum of `1000` links per request.
|
|
1760
|
-
* @example
|
|
1761
|
-
* ```ts
|
|
1762
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1763
|
-
* const { data, error } = await mailchannels.domains.bulkCreateLoginLinks(['example.com', 'example2.com'])
|
|
1764
|
-
* ```
|
|
1765
|
-
*/
|
|
1766
|
-
bulkCreateLoginLinks(domains: string[]): Promise<DomainsBulkCreateLoginLinksResponse>;
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
|
-
declare class Lists {
|
|
1770
|
-
protected mailchannels: MailChannelsClient;
|
|
1771
|
-
constructor(mailchannels: MailChannelsClient);
|
|
1772
|
-
/**
|
|
1773
|
-
* Add item to account-level list
|
|
1774
|
-
* @param options - The options for the list entry to add.
|
|
1775
|
-
* @example
|
|
1776
|
-
* ```ts
|
|
1777
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1778
|
-
* const { data, error } = await mailchannels.lists.addListEntry({
|
|
1779
|
-
* listName: 'safelist',
|
|
1780
|
-
* item: 'name@domain.com'
|
|
1781
|
-
* })
|
|
1782
|
-
* ```
|
|
1783
|
-
*/
|
|
1784
|
-
addListEntry(options: ListEntryOptions): Promise<ListEntryResponse>;
|
|
1785
|
-
/**
|
|
1786
|
-
* Get account-level list entries.
|
|
1787
|
-
* @param listName - The name of the list to fetch. This can be a `blocklist`, `safelist`, `blacklist`, or `whitelist`.
|
|
1788
|
-
* @example
|
|
1789
|
-
* ```ts
|
|
1790
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1791
|
-
* const { data, error } = await mailchannels.lists.listEntries('safelist')
|
|
1792
|
-
* ```
|
|
1793
|
-
*/
|
|
1794
|
-
listEntries(listName: ListNames): Promise<ListEntriesResponse>;
|
|
1795
|
-
/**
|
|
1796
|
-
* Delete item from account-level list.
|
|
1797
|
-
* @param options - The options for the list entry to delete.
|
|
1798
|
-
* @example
|
|
1799
|
-
* ```ts
|
|
1800
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1801
|
-
* const { success, error } = await mailchannels.lists.deleteListEntry({
|
|
1802
|
-
* listName: 'safelist',
|
|
1803
|
-
* item: 'name@domain.com'
|
|
1804
|
-
* })
|
|
1805
|
-
* ```
|
|
1806
|
-
*/
|
|
1807
|
-
deleteListEntry(options: ListEntryOptions): Promise<SuccessResponse>;
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
interface UsersCreateOptions {
|
|
1811
|
-
/**
|
|
1812
|
-
* Flag to indicate if the user is a domain admin or a regular user.
|
|
1813
|
-
* @default false
|
|
1814
|
-
*/
|
|
1815
|
-
admin?: boolean;
|
|
1816
|
-
/**
|
|
1817
|
-
* Whether or not to filter mail for this recipient. There are three valid values.
|
|
1818
|
-
* - `false` - Filtering policy will be applied to messages intended for this recipient. If this would exceed the protected-addresses limit, return an error.
|
|
1819
|
-
* - `true` - Filtering policy will not be applied to messages intended for this recipient.
|
|
1820
|
-
* - `compute` - Filtering policy will be applied to messages intended for this recipient. If this would exceed the protected-addresses limit, filtering policy will not be applied, and no error will be returned.
|
|
1821
|
-
* @default 'compute'
|
|
1822
|
-
*/
|
|
1823
|
-
filter?: boolean | "compute";
|
|
1824
|
-
/**
|
|
1825
|
-
* safelist and blocklist entries to be added.
|
|
1826
|
-
*/
|
|
1827
|
-
listEntries?: {
|
|
1828
|
-
blocklist?: string[];
|
|
1829
|
-
safelist?: string[];
|
|
1830
|
-
};
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
type UsersCreateResponse = DataResponse$1<{
|
|
1834
|
-
email: string;
|
|
1835
|
-
roles: string[];
|
|
1836
|
-
filter?: boolean;
|
|
1837
|
-
listEntries: {
|
|
1838
|
-
item: string;
|
|
1839
|
-
type: "domain" | "email_address" | "ip_address";
|
|
1840
|
-
action: "safelist" | "blocklist";
|
|
1841
|
-
}[];
|
|
1842
|
-
}>;
|
|
1843
|
-
|
|
1844
|
-
declare class Users {
|
|
1845
|
-
protected mailchannels: MailChannelsClient;
|
|
1846
|
-
constructor(mailchannels: MailChannelsClient);
|
|
1847
|
-
/**
|
|
1848
|
-
* Create a recipient user.
|
|
1849
|
-
* @param email - The email address of the user to create.
|
|
1850
|
-
* @param options - The options for the user to create.
|
|
1851
|
-
* @example
|
|
1852
|
-
* ```ts
|
|
1853
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1854
|
-
* const { data, error } = await mailchannels.users.create("name@example.com", {
|
|
1855
|
-
* admin: true
|
|
1856
|
-
* })
|
|
1857
|
-
* ```
|
|
1858
|
-
*/
|
|
1859
|
-
create(email: string, options?: UsersCreateOptions): Promise<UsersCreateResponse>;
|
|
1860
|
-
/**
|
|
1861
|
-
* Add item to recipient user list
|
|
1862
|
-
* @param email - The email address of the recipient whose list will be modified.
|
|
1863
|
-
* @param options - The options for the list entry to add.
|
|
1864
|
-
* @example
|
|
1865
|
-
* ```ts
|
|
1866
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1867
|
-
* const { data, error } = await mailchannels.users.addListEntry('name@example.com', {
|
|
1868
|
-
* listName: 'safelist',
|
|
1869
|
-
* item: 'name@domain.com'
|
|
1870
|
-
* })
|
|
1871
|
-
* ```
|
|
1872
|
-
*/
|
|
1873
|
-
addListEntry(email: string, options: ListEntryOptions): Promise<ListEntryResponse>;
|
|
1874
|
-
/**
|
|
1875
|
-
* Get recipient list entries.
|
|
1876
|
-
* @param email - The email address of the recipient whose list will be fetched.
|
|
1877
|
-
* @param listName - The name of the list to fetch. This can be a `blocklist`, `safelist`, `blacklist`, or `whitelist`.
|
|
1878
|
-
* @example
|
|
1879
|
-
* ```ts
|
|
1880
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1881
|
-
* const { data, error } = await mailchannels.users.listEntries('name@example.com', 'safelist')
|
|
1882
|
-
* ```
|
|
1883
|
-
*/
|
|
1884
|
-
listEntries(email: string, listName: ListNames): Promise<ListEntriesResponse>;
|
|
1885
|
-
/**
|
|
1886
|
-
* Delete item from recipient list.
|
|
1887
|
-
* @param email - The email address of the recipient whose list will be modified.
|
|
1888
|
-
* @param options - The options for the list entry to delete.
|
|
1889
|
-
* @example
|
|
1890
|
-
* ```ts
|
|
1891
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1892
|
-
* const { success, error } = await mailchannels.users.deleteListEntry('name@example.com', {
|
|
1893
|
-
* listName: 'safelist',
|
|
1894
|
-
* item: 'name@domain.com'
|
|
1895
|
-
* })
|
|
1896
|
-
* ```
|
|
1897
|
-
*/
|
|
1898
|
-
deleteListEntry(email: string, options: ListEntryOptions): Promise<SuccessResponse>;
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
type ServiceSubscriptionsResponse = DataResponse$1<{
|
|
1902
|
-
active: boolean;
|
|
1903
|
-
activeAccountsCount: number;
|
|
1904
|
-
handle: string;
|
|
1905
|
-
limits: {
|
|
1906
|
-
featureHandle: string;
|
|
1907
|
-
value: string;
|
|
1908
|
-
}[];
|
|
1909
|
-
plan: {
|
|
1910
|
-
handle: string;
|
|
1911
|
-
name: string;
|
|
1912
|
-
};
|
|
1913
|
-
}[]>;
|
|
1914
|
-
|
|
1915
|
-
interface ServiceReportOptions {
|
|
1916
|
-
/**
|
|
1917
|
-
* The report type. It can be either `false_negative` or `false_positive`.
|
|
1918
|
-
*/
|
|
1919
|
-
type: "false_negative" | "false_positive";
|
|
1920
|
-
/**
|
|
1921
|
-
* The full, unaltered message content in accordance with the RFC 2822 specifications without dot stuffing.
|
|
1922
|
-
*/
|
|
1923
|
-
messageContent: string;
|
|
1924
|
-
/**
|
|
1925
|
-
* The SMTP envelope information.
|
|
1926
|
-
*/
|
|
1927
|
-
smtpEnvelopeInformation?: {
|
|
1928
|
-
ehlo: string;
|
|
1929
|
-
mailFrom: string;
|
|
1930
|
-
rcptTo: string;
|
|
1931
|
-
};
|
|
1932
|
-
/**
|
|
1933
|
-
* The sending host information.
|
|
1934
|
-
*/
|
|
1935
|
-
sendingHostInformation?: {
|
|
1936
|
-
name: string;
|
|
1937
|
-
};
|
|
1938
|
-
}
|
|
1939
|
-
|
|
1940
|
-
declare class Service {
|
|
1941
|
-
protected mailchannels: MailChannelsClient;
|
|
1942
|
-
constructor(mailchannels: MailChannelsClient);
|
|
1943
|
-
/**
|
|
1944
|
-
* Retrieve the condition of the service
|
|
1945
|
-
* @example
|
|
1946
|
-
* ```ts
|
|
1947
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1948
|
-
* const { success, error } = await mailchannels.service.status()
|
|
1949
|
-
* ```
|
|
1950
|
-
*/
|
|
1951
|
-
status(): Promise<SuccessResponse>;
|
|
1952
|
-
/**
|
|
1953
|
-
* Get a list of your subscriptions to MailChannels Inbound
|
|
1954
|
-
* @example
|
|
1955
|
-
* ```ts
|
|
1956
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1957
|
-
* const { data, error } = await mailchannels.service.subscriptions()
|
|
1958
|
-
* ```
|
|
1959
|
-
*/
|
|
1960
|
-
subscriptions(): Promise<ServiceSubscriptionsResponse>;
|
|
1961
|
-
/**
|
|
1962
|
-
* Submit a false negative or false positive report.
|
|
1963
|
-
* @param options - The report options
|
|
1964
|
-
* @example
|
|
1965
|
-
* ```ts
|
|
1966
|
-
* const mailchannels = new MailChannels('your-api-key')
|
|
1967
|
-
* const { success, error } = await mailchannels.service.report({
|
|
1968
|
-
* // ...
|
|
1969
|
-
* })
|
|
1970
|
-
* ```
|
|
1971
|
-
*/
|
|
1972
|
-
report(options: ServiceReportOptions): Promise<SuccessResponse>;
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
declare class MailChannels extends MailChannelsClient {
|
|
1976
|
-
readonly emails: Emails;
|
|
1977
|
-
readonly webhooks: Webhooks;
|
|
1978
|
-
readonly subAccounts: SubAccounts;
|
|
1979
|
-
readonly metrics: Metrics;
|
|
1980
|
-
readonly suppressions: Suppressions;
|
|
1981
|
-
readonly domains: Domains;
|
|
1982
|
-
readonly lists: Lists;
|
|
1983
|
-
readonly users: Users;
|
|
1984
|
-
readonly service: Service;
|
|
1985
|
-
constructor(key: string);
|
|
1986
|
-
}
|
|
1987
|
-
|
|
1988
|
-
export { Domains, Emails, Lists, MailChannels, MailChannelsClient, Metrics, Service, SubAccounts, Suppressions, Users, Webhooks };
|
|
1989
|
-
export type { DataResponse$1 as DataResponse, DomainsBulkCreateLoginLinkResult, DomainsBulkCreateLoginLinks, DomainsBulkCreateLoginLinksResponse, DomainsBulkProvisionOptions, DomainsBulkProvisionResponse, DomainsCreateLoginLink, DomainsCreateLoginLinkResponse, DomainsData, DomainsDownstreamAddress, DomainsListDownstreamAddressesOptions, DomainsListDownstreamAddressesResponse, DomainsListOptions, DomainsListResponse, DomainsProvisionOptions, DomainsProvisionResponse, EmailsCheckDomainDkim, EmailsCheckDomainOptions, EmailsCheckDomainResponse, EmailsCheckDomainVerdict, EmailsCreateDkimKeyOptions, EmailsCreateDkimKeyResponse, EmailsDkimKey, EmailsDkimKeyStatus, EmailsGetDkimKeysOptions, EmailsGetDkimKeysResponse, EmailsRotateDkimKeyOptions, EmailsRotateDkimKeyResponse, EmailsSendAsyncResponse, EmailsSendAttachment, EmailsSendOptions, EmailsSendOptionsBase, EmailsSendRecipient, EmailsSendResponse, EmailsSendTracking, EmailsUpdateDkimKeyOptions, ErrorResponse, ListEntriesResponse, ListEntry, ListEntryOptions, ListEntryResponse, ListNames, MetricsBucket, MetricsEngagement, MetricsEngagementResponse, MetricsOptions, MetricsPerformance, MetricsPerformanceResponse, MetricsRecipientBehaviour, MetricsRecipientBehaviourResponse, MetricsSenders, MetricsSendersOptions, MetricsSendersResponse, MetricsSendersType, MetricsUsageResponse, MetricsVolume, MetricsVolumeResponse, Optional, ServiceReportOptions, ServiceSubscriptionsResponse, SubAccountsAccount, SubAccountsApiKey, SubAccountsCreateApiKeyResponse, SubAccountsCreateResponse, SubAccountsCreateSmtpPasswordResponse, SubAccountsLimit, SubAccountsLimitResponse, SubAccountsListApiKeyOptions, SubAccountsListApiKeyResponse, SubAccountsListOptions, SubAccountsListResponse, SubAccountsListSmtpPasswordResponse, SubAccountsSmtpPassword, SubAccountsUsage, SubAccountsUsageResponse, SuccessResponse, SuppressionsCreateOptions, SuppressionsListEntry, SuppressionsListOptions, SuppressionsListResponse, SuppressionsSource, SuppressionsTypes, UsersCreateOptions, UsersCreateResponse, WebhooksListResponse, WebhooksSigningKeyResponse, WebhooksValidateResponse };
|