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.
- package/README.md +1 -1
- package/dist/mailchannels.d.mts +1776 -1731
- package/dist/mailchannels.mjs +2037 -2309
- package/package.json +12 -16
- package/dist/mailchannels.d.ts +0 -1934
package/dist/mailchannels.d.mts
CHANGED
|
@@ -1,1934 +1,1979 @@
|
|
|
1
|
-
import { FetchOptions } from
|
|
1
|
+
import { FetchOptions } from "ofetch";
|
|
2
2
|
|
|
3
|
+
//#region src/client.d.ts
|
|
3
4
|
declare class MailChannelsClient {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
+
message: string;
|
|
19
|
+
statusCode: number | null;
|
|
18
20
|
}
|
|
19
21
|
interface SuccessResponse {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
138
|
+
domain: string;
|
|
214
139
|
/**
|
|
215
|
-
*
|
|
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
|
-
|
|
142
|
+
privateKey?: string;
|
|
225
143
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* List-Unsubscribe headers will be added.
|
|
229
|
-
* @default true
|
|
144
|
+
* DKIM selector in the domain DNS records.
|
|
230
145
|
*/
|
|
231
|
-
|
|
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
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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
|
-
*
|
|
274
|
+
* The index of the personalization in the request. Starts at 0.
|
|
263
275
|
*/
|
|
264
|
-
|
|
276
|
+
index?: number;
|
|
265
277
|
/**
|
|
266
|
-
* The
|
|
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
|
-
|
|
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
|
-
*
|
|
282
|
+
* A human-readable explanation of the status.
|
|
292
283
|
*/
|
|
293
|
-
|
|
284
|
+
reason?: string;
|
|
294
285
|
/**
|
|
295
|
-
*
|
|
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
|
-
|
|
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
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
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
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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
|
-
|
|
403
|
-
|
|
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
|
-
*
|
|
411
|
+
* The human readable status of the DKIM key used for verification.
|
|
424
412
|
*/
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
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
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
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
|
-
*
|
|
447
|
+
* Overall verdict. Passed if either A or MX record check passed.
|
|
462
448
|
*/
|
|
463
|
-
|
|
449
|
+
verdict: Extract<EmailsCheckDomainVerdict, "passed" | "failed">;
|
|
450
|
+
};
|
|
451
|
+
spf: {
|
|
464
452
|
/**
|
|
465
|
-
*
|
|
466
|
-
* @default 0
|
|
453
|
+
* A human-readable explanation of SPF check.
|
|
467
454
|
*/
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
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
|
|
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
|
-
|
|
507
|
-
|
|
515
|
+
new: EmailsDkimKey;
|
|
516
|
+
rotated: EmailsDkimKey;
|
|
508
517
|
}>;
|
|
509
|
-
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/modules/emails.d.ts
|
|
510
520
|
declare class Emails {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
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
|
-
|
|
640
|
+
key: string;
|
|
629
641
|
}>;
|
|
630
|
-
|
|
642
|
+
//#endregion
|
|
643
|
+
//#region src/types/webhooks/validate.d.ts
|
|
631
644
|
type WebhooksValidateResponse = DataResponse<{
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
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
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
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
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
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
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
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
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
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
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
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
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
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
|
-
|
|
809
|
+
sends: number;
|
|
791
810
|
}
|
|
792
811
|
type SubAccountsLimitResponse = DataResponse<SubAccountsLimit>;
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
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
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
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
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
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
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
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
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
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
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
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
|
-
*
|
|
1164
|
+
* Maximum character length: 255
|
|
1145
1165
|
*/
|
|
1146
|
-
|
|
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
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
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
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
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
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
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
|
-
*
|
|
1251
|
-
* @default false
|
|
1293
|
+
* The email address to suppress. Must be a valid email address format and less than `255` characters.
|
|
1252
1294
|
*/
|
|
1253
|
-
|
|
1295
|
+
recipient: string;
|
|
1254
1296
|
/**
|
|
1255
|
-
*
|
|
1297
|
+
* An array of types of suppression to apply to the recipient.
|
|
1298
|
+
* @default ["non-transactional"]
|
|
1256
1299
|
*/
|
|
1257
|
-
|
|
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
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
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
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
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
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
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
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
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
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
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
|
|
1416
|
+
* The abuse policy.
|
|
1375
1417
|
*/
|
|
1376
|
-
|
|
1418
|
+
abusePolicy: "block" | "flag" | "quarantine";
|
|
1377
1419
|
/**
|
|
1378
|
-
*
|
|
1420
|
+
* If `true`, this abuse policy overrides the recipient abuse policy.
|
|
1379
1421
|
*/
|
|
1380
|
-
|
|
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
|
-
*
|
|
1424
|
+
* The spam header name to use if the abuse policy is set to `flag`.
|
|
1400
1425
|
*/
|
|
1401
|
-
|
|
1426
|
+
spamHeaderName: string;
|
|
1402
1427
|
/**
|
|
1403
|
-
* The
|
|
1428
|
+
* The spam header value to use if the abuse policy is set to `flag`.
|
|
1404
1429
|
*/
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
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
|
-
*
|
|
1441
|
+
* The priority of the downstream address. Only addresses with the highest priority (the lowest numerical value) are selected.
|
|
1425
1442
|
*/
|
|
1426
|
-
|
|
1443
|
+
priority: number;
|
|
1427
1444
|
/**
|
|
1428
|
-
*
|
|
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
|
-
|
|
1431
|
-
}
|
|
1432
|
-
interface DomainsProvisionOptions extends DomainsData {
|
|
1447
|
+
weight: number;
|
|
1433
1448
|
/**
|
|
1434
|
-
*
|
|
1449
|
+
* TCP port on which the downstream mail server is listening.
|
|
1435
1450
|
*/
|
|
1436
|
-
|
|
1451
|
+
port: number;
|
|
1437
1452
|
/**
|
|
1438
|
-
*
|
|
1453
|
+
* The canonical hostname of the host providing the service, ending in a dot.
|
|
1439
1454
|
*/
|
|
1440
|
-
|
|
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
|
-
*
|
|
1484
|
+
* The provisioned domain data.
|
|
1447
1485
|
*/
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
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
|
-
*
|
|
1495
|
+
* The failed to provision domain data.
|
|
1458
1496
|
*/
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
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
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
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
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
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
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
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
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
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
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
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
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
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
|
-
|
|
1553
|
-
|
|
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
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
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
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
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
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
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
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
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
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
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
|
-
|
|
1848
|
-
|
|
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
|
-
|
|
1851
|
-
|
|
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
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
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
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
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
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
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 };
|