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