@mailermine/node 1.0.0
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/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/README.md +383 -0
- package/dist/index.cjs +9843 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1951 -0
- package/dist/index.d.ts +1951 -0
- package/dist/index.js +9809 -0
- package/dist/index.js.map +1 -0
- package/package.json +81 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1951 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options accepted when creating a {@link Configuration}.
|
|
3
|
+
*/
|
|
4
|
+
interface ConfigurationOptions {
|
|
5
|
+
/**
|
|
6
|
+
* MailerMine API key (Bearer token). Required and must be non-empty.
|
|
7
|
+
*/
|
|
8
|
+
apiKey: string;
|
|
9
|
+
/**
|
|
10
|
+
* API base URL. Defaults to the production endpoint.
|
|
11
|
+
* Trailing slashes are stripped.
|
|
12
|
+
*/
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Request timeout in milliseconds. Must be a positive number.
|
|
16
|
+
* Defaults to 30_000 (30 seconds).
|
|
17
|
+
*/
|
|
18
|
+
timeout?: number;
|
|
19
|
+
/**
|
|
20
|
+
* User-Agent header value sent with every request.
|
|
21
|
+
*/
|
|
22
|
+
userAgent?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Optional fetch implementation. Useful for tests and custom transports.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
fetchApi?: typeof fetch;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Immutable, validated SDK configuration.
|
|
31
|
+
*/
|
|
32
|
+
interface ResolvedConfiguration {
|
|
33
|
+
readonly apiKey: string;
|
|
34
|
+
readonly baseUrl: string;
|
|
35
|
+
readonly timeout: number;
|
|
36
|
+
readonly userAgent: string;
|
|
37
|
+
readonly fetchApi?: typeof fetch;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Immutable configuration for the MailerMine Node.js SDK.
|
|
42
|
+
*
|
|
43
|
+
* Validates inputs once and exposes read-only getters used by the HTTP client.
|
|
44
|
+
*/
|
|
45
|
+
declare class Configuration implements ResolvedConfiguration {
|
|
46
|
+
readonly apiKey: string;
|
|
47
|
+
readonly baseUrl: string;
|
|
48
|
+
readonly timeout: number;
|
|
49
|
+
readonly userAgent: string;
|
|
50
|
+
readonly fetchApi?: typeof fetch;
|
|
51
|
+
constructor(options: ConfigurationOptions);
|
|
52
|
+
/**
|
|
53
|
+
* Create a Configuration from an API key string or a full options object.
|
|
54
|
+
*/
|
|
55
|
+
static create(apiKeyOrOptions: string | ConfigurationOptions): Configuration;
|
|
56
|
+
/**
|
|
57
|
+
* Return a plain object snapshot of the resolved configuration.
|
|
58
|
+
*/
|
|
59
|
+
toJSON(): ResolvedConfiguration;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface InternalAnalyticsApi {
|
|
63
|
+
overview(query: object): Promise<unknown>;
|
|
64
|
+
messages(query: object): Promise<unknown>;
|
|
65
|
+
engagement(query: object): Promise<unknown>;
|
|
66
|
+
campaigns(query: object): Promise<unknown>;
|
|
67
|
+
domains(query: object): Promise<unknown>;
|
|
68
|
+
projects(query: object): Promise<unknown>;
|
|
69
|
+
providers(query: object): Promise<unknown>;
|
|
70
|
+
}
|
|
71
|
+
interface InternalEventsApi {
|
|
72
|
+
list(query: object): Promise<unknown>;
|
|
73
|
+
get(eventId: string): Promise<unknown>;
|
|
74
|
+
timeline(messageId: string): Promise<unknown>;
|
|
75
|
+
message(messageId: string): Promise<unknown>;
|
|
76
|
+
}
|
|
77
|
+
interface InternalMessagesApi {
|
|
78
|
+
list(query: object): Promise<unknown>;
|
|
79
|
+
get(messageId: string): Promise<unknown>;
|
|
80
|
+
events(messageId: string): Promise<unknown>;
|
|
81
|
+
}
|
|
82
|
+
interface InternalWebhooksApi {
|
|
83
|
+
create(body: object): Promise<unknown>;
|
|
84
|
+
list(query: object): Promise<unknown>;
|
|
85
|
+
get(webhookId: string): Promise<unknown>;
|
|
86
|
+
update(webhookId: string, body?: object): Promise<unknown>;
|
|
87
|
+
delete(webhookId: string): Promise<unknown>;
|
|
88
|
+
test(webhookId: string, body?: object): Promise<unknown>;
|
|
89
|
+
rotateSecret(webhookId: string): Promise<unknown>;
|
|
90
|
+
enable(webhookId: string): Promise<unknown>;
|
|
91
|
+
disable(webhookId: string): Promise<unknown>;
|
|
92
|
+
deliveries(webhookId: string, query: object): Promise<unknown>;
|
|
93
|
+
delivery(deliveryId: string): Promise<unknown>;
|
|
94
|
+
replay(webhookId: string, body?: object): Promise<unknown>;
|
|
95
|
+
retry(deliveryId: string): Promise<unknown>;
|
|
96
|
+
}
|
|
97
|
+
interface InternalSuppressionsApi {
|
|
98
|
+
list(query: object): Promise<unknown>;
|
|
99
|
+
get(suppressionId: string): Promise<unknown>;
|
|
100
|
+
create(body: object): Promise<unknown>;
|
|
101
|
+
delete(suppressionId: string): Promise<unknown>;
|
|
102
|
+
restore(suppressionId: string): Promise<unknown>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface InternalContactsApi {
|
|
106
|
+
create(body: object): Promise<unknown>;
|
|
107
|
+
list(query: object): Promise<unknown>;
|
|
108
|
+
get(contactId: string): Promise<unknown>;
|
|
109
|
+
update(contactId: string, body: object): Promise<unknown>;
|
|
110
|
+
delete(contactId: string): Promise<unknown>;
|
|
111
|
+
}
|
|
112
|
+
interface InternalListsApi {
|
|
113
|
+
create(body: object): Promise<unknown>;
|
|
114
|
+
list(query: object): Promise<unknown>;
|
|
115
|
+
get(listId: string): Promise<unknown>;
|
|
116
|
+
update(listId: string, body: object): Promise<unknown>;
|
|
117
|
+
delete(listId: string): Promise<unknown>;
|
|
118
|
+
addContacts(listId: string, body: object): Promise<unknown>;
|
|
119
|
+
removeContacts(listId: string, body: object): Promise<unknown>;
|
|
120
|
+
}
|
|
121
|
+
interface InternalSegmentsApi {
|
|
122
|
+
create(body: object): Promise<unknown>;
|
|
123
|
+
list(query: object): Promise<unknown>;
|
|
124
|
+
get(segmentId: string): Promise<unknown>;
|
|
125
|
+
update(segmentId: string, body: object): Promise<unknown>;
|
|
126
|
+
delete(segmentId: string): Promise<unknown>;
|
|
127
|
+
preview(segmentId: string): Promise<unknown>;
|
|
128
|
+
previewRules(body: object): Promise<unknown>;
|
|
129
|
+
}
|
|
130
|
+
interface InternalTagsApi {
|
|
131
|
+
create(body: object): Promise<unknown>;
|
|
132
|
+
list(query: object): Promise<unknown>;
|
|
133
|
+
get(tagId: string): Promise<unknown>;
|
|
134
|
+
update(tagId: string, body: object): Promise<unknown>;
|
|
135
|
+
delete(tagId: string): Promise<unknown>;
|
|
136
|
+
assign(body: object): Promise<unknown>;
|
|
137
|
+
remove(body: object): Promise<unknown>;
|
|
138
|
+
}
|
|
139
|
+
interface InternalAudiencesApi {
|
|
140
|
+
list(query: object): Promise<unknown>;
|
|
141
|
+
get(source: string, audienceId: string): Promise<unknown>;
|
|
142
|
+
addContacts(audienceId: string, body: object): Promise<unknown>;
|
|
143
|
+
removeContacts(audienceId: string, contactIds: readonly string[]): Promise<unknown>;
|
|
144
|
+
}
|
|
145
|
+
interface InternalCampaignsApi {
|
|
146
|
+
create(body: object): Promise<unknown>;
|
|
147
|
+
list(query: object): Promise<unknown>;
|
|
148
|
+
get(campaignId: string): Promise<unknown>;
|
|
149
|
+
update(campaignId: string, body: object): Promise<unknown>;
|
|
150
|
+
delete(campaignId: string): Promise<unknown>;
|
|
151
|
+
preview(campaignId: string): Promise<unknown>;
|
|
152
|
+
previewRecipients(campaignId: string): Promise<unknown>;
|
|
153
|
+
validate(campaignId: string): Promise<unknown>;
|
|
154
|
+
duplicate(campaignId: string, body?: object): Promise<unknown>;
|
|
155
|
+
archive(campaignId: string): Promise<unknown>;
|
|
156
|
+
restore(campaignId: string): Promise<unknown>;
|
|
157
|
+
progress(campaignId: string): Promise<unknown>;
|
|
158
|
+
analytics(campaignId: string): Promise<unknown>;
|
|
159
|
+
links(campaignId: string): Promise<unknown>;
|
|
160
|
+
events(campaignId: string): Promise<unknown>;
|
|
161
|
+
activity(campaignId: string): Promise<unknown>;
|
|
162
|
+
timeline(campaignId: string): Promise<unknown>;
|
|
163
|
+
recipients(campaignId: string, query: object): Promise<unknown>;
|
|
164
|
+
ready(campaignId: string): Promise<unknown>;
|
|
165
|
+
send(campaignId: string): Promise<unknown>;
|
|
166
|
+
schedule(campaignId: string, body: object): Promise<unknown>;
|
|
167
|
+
pause(campaignId: string): Promise<unknown>;
|
|
168
|
+
resume(campaignId: string): Promise<unknown>;
|
|
169
|
+
cancel(campaignId: string): Promise<unknown>;
|
|
170
|
+
}
|
|
171
|
+
interface InternalImportsApi {
|
|
172
|
+
list(): Promise<unknown>;
|
|
173
|
+
create(body: object): Promise<unknown>;
|
|
174
|
+
get(importId: string): Promise<unknown>;
|
|
175
|
+
configure(importId: string, body: object): Promise<unknown>;
|
|
176
|
+
start(importId: string): Promise<unknown>;
|
|
177
|
+
}
|
|
178
|
+
interface InternalExportsApi {
|
|
179
|
+
create(body?: object): Promise<unknown>;
|
|
180
|
+
get(exportId: string): Promise<unknown>;
|
|
181
|
+
download(exportId: string): Promise<string>;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
interface InternalEmailsApi {
|
|
185
|
+
send(body: object): Promise<unknown>;
|
|
186
|
+
list(query: object): Promise<unknown>;
|
|
187
|
+
get(messageId: string): Promise<unknown>;
|
|
188
|
+
events(messageId: string): Promise<unknown>;
|
|
189
|
+
}
|
|
190
|
+
interface InternalProjectsApi {
|
|
191
|
+
create(body: object): Promise<unknown>;
|
|
192
|
+
list(query: object): Promise<unknown>;
|
|
193
|
+
get(projectId: string): Promise<unknown>;
|
|
194
|
+
update(projectId: string, body: object): Promise<unknown>;
|
|
195
|
+
delete(projectId: string): Promise<unknown>;
|
|
196
|
+
}
|
|
197
|
+
interface InternalApiKeysApi {
|
|
198
|
+
create(projectId: string, body: object): Promise<unknown>;
|
|
199
|
+
list(projectId: string, query: object): Promise<unknown>;
|
|
200
|
+
get(projectId: string, apiKeyId: string): Promise<unknown>;
|
|
201
|
+
update(projectId: string, apiKeyId: string, body: object): Promise<unknown>;
|
|
202
|
+
delete(projectId: string, apiKeyId: string): Promise<unknown>;
|
|
203
|
+
rotate(projectId: string, apiKeyId: string): Promise<unknown>;
|
|
204
|
+
reveal(projectId: string, apiKeyId: string): Promise<unknown>;
|
|
205
|
+
}
|
|
206
|
+
interface InternalDomainsApi {
|
|
207
|
+
create(body: object): Promise<unknown>;
|
|
208
|
+
list(query: object): Promise<unknown>;
|
|
209
|
+
get(domainId: string): Promise<unknown>;
|
|
210
|
+
verify(domainId: string): Promise<unknown>;
|
|
211
|
+
delete(domainId: string): Promise<unknown>;
|
|
212
|
+
}
|
|
213
|
+
interface InternalTemplatesApi {
|
|
214
|
+
create(body: object): Promise<unknown>;
|
|
215
|
+
list(query: object): Promise<unknown>;
|
|
216
|
+
get(templateId: string): Promise<unknown>;
|
|
217
|
+
update(templateId: string, body: object): Promise<unknown>;
|
|
218
|
+
preview(templateId: string, body: object): Promise<unknown>;
|
|
219
|
+
duplicate(templateId: string, body: object): Promise<unknown>;
|
|
220
|
+
test(templateId: string, body: object): Promise<unknown>;
|
|
221
|
+
delete(templateId: string): Promise<unknown>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** JSON-compatible primitive value. */
|
|
225
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
226
|
+
/** JSON-compatible value accepted by MailerMine metadata fields. */
|
|
227
|
+
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
228
|
+
[key: string]: JsonValue;
|
|
229
|
+
};
|
|
230
|
+
/** JSON-compatible object accepted by MailerMine metadata and variables. */
|
|
231
|
+
type JsonObject = {
|
|
232
|
+
[key: string]: JsonValue;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Pagination metadata returned by list endpoints.
|
|
237
|
+
*/
|
|
238
|
+
declare class Pagination {
|
|
239
|
+
readonly currentPage: number;
|
|
240
|
+
readonly perPage: number;
|
|
241
|
+
readonly total: number;
|
|
242
|
+
readonly lastPage: number;
|
|
243
|
+
constructor(values: {
|
|
244
|
+
currentPage: number;
|
|
245
|
+
perPage: number;
|
|
246
|
+
total: number;
|
|
247
|
+
lastPage: number;
|
|
248
|
+
});
|
|
249
|
+
/** Whether another page is available. */
|
|
250
|
+
get hasNextPage(): boolean;
|
|
251
|
+
/** Whether a previous page is available. */
|
|
252
|
+
get hasPreviousPage(): boolean;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Successful single-object API response.
|
|
256
|
+
*/
|
|
257
|
+
declare class Response<T> {
|
|
258
|
+
readonly data: T;
|
|
259
|
+
readonly message: string;
|
|
260
|
+
readonly success: boolean;
|
|
261
|
+
constructor(data: T, message: string, success?: boolean);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Successful list response with pagination metadata.
|
|
265
|
+
*/
|
|
266
|
+
declare class Collection<T> extends Response<readonly T[]> implements Iterable<T> {
|
|
267
|
+
readonly pagination: Pagination;
|
|
268
|
+
readonly [index: number]: T;
|
|
269
|
+
readonly items: readonly T[];
|
|
270
|
+
constructor(items: readonly T[], pagination: Pagination, message: string, success?: boolean);
|
|
271
|
+
get length(): number;
|
|
272
|
+
[Symbol.iterator](): Iterator<T>;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
declare abstract class BaseResource {
|
|
276
|
+
protected execute<T>(operation: () => Promise<T>): Promise<T>;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
type SortDirection = 'asc' | 'desc';
|
|
280
|
+
interface PaginationOptions {
|
|
281
|
+
page?: number;
|
|
282
|
+
perPage?: number;
|
|
283
|
+
}
|
|
284
|
+
interface ListOptions extends PaginationOptions {
|
|
285
|
+
search?: string;
|
|
286
|
+
status?: string;
|
|
287
|
+
sort?: string;
|
|
288
|
+
direction?: SortDirection;
|
|
289
|
+
}
|
|
290
|
+
interface EmailAttachmentInput {
|
|
291
|
+
filename: string;
|
|
292
|
+
/** Base64-encoded attachment content. */
|
|
293
|
+
content: string;
|
|
294
|
+
contentType?: string;
|
|
295
|
+
}
|
|
296
|
+
interface SendEmailInput {
|
|
297
|
+
from: string;
|
|
298
|
+
to: string | readonly string[];
|
|
299
|
+
cc?: readonly string[];
|
|
300
|
+
bcc?: readonly string[];
|
|
301
|
+
templateId?: string;
|
|
302
|
+
variables?: JsonObject;
|
|
303
|
+
subject?: string;
|
|
304
|
+
html?: string;
|
|
305
|
+
text?: string;
|
|
306
|
+
replyTo?: string;
|
|
307
|
+
metadata?: JsonObject;
|
|
308
|
+
tags?: readonly string[];
|
|
309
|
+
headers?: Readonly<Record<string, string>>;
|
|
310
|
+
attachments?: readonly EmailAttachmentInput[];
|
|
311
|
+
/** ISO-8601 delivery time. Passed through when supported by the API account. */
|
|
312
|
+
scheduledAt?: string;
|
|
313
|
+
}
|
|
314
|
+
interface EmailListOptions extends PaginationOptions {
|
|
315
|
+
search?: string;
|
|
316
|
+
status?: string;
|
|
317
|
+
provider?: string;
|
|
318
|
+
from?: string;
|
|
319
|
+
to?: string;
|
|
320
|
+
}
|
|
321
|
+
interface EmailMessage {
|
|
322
|
+
id: string;
|
|
323
|
+
fromEmail?: string;
|
|
324
|
+
fromName?: string | null;
|
|
325
|
+
toEmail?: string;
|
|
326
|
+
to?: readonly string[];
|
|
327
|
+
subject?: string;
|
|
328
|
+
status: string;
|
|
329
|
+
provider?: string;
|
|
330
|
+
providerMessageId?: string | null;
|
|
331
|
+
errorMessage?: string | null;
|
|
332
|
+
metadata?: JsonObject;
|
|
333
|
+
tags?: readonly string[];
|
|
334
|
+
scheduledAt?: string | null;
|
|
335
|
+
sentAt?: string | null;
|
|
336
|
+
createdAt?: string | null;
|
|
337
|
+
updatedAt?: string | null;
|
|
338
|
+
timeline?: readonly EmailEvent[];
|
|
339
|
+
}
|
|
340
|
+
interface EmailEvent {
|
|
341
|
+
id?: string;
|
|
342
|
+
type?: string;
|
|
343
|
+
event?: string;
|
|
344
|
+
status?: string;
|
|
345
|
+
occurredAt?: string | null;
|
|
346
|
+
createdAt?: string | null;
|
|
347
|
+
metadata?: JsonObject;
|
|
348
|
+
[key: string]: JsonValue | undefined;
|
|
349
|
+
}
|
|
350
|
+
type ProjectEnvironment = 'production' | 'staging' | 'development' | 'test';
|
|
351
|
+
interface CreateProjectInput {
|
|
352
|
+
name: string;
|
|
353
|
+
slug?: string | null;
|
|
354
|
+
description?: string | null;
|
|
355
|
+
environment?: ProjectEnvironment | null;
|
|
356
|
+
timezone?: string | null;
|
|
357
|
+
defaultSender?: string | null;
|
|
358
|
+
settings?: JsonObject;
|
|
359
|
+
}
|
|
360
|
+
interface UpdateProjectInput {
|
|
361
|
+
name?: string;
|
|
362
|
+
slug?: string | null;
|
|
363
|
+
description?: string | null;
|
|
364
|
+
environment?: ProjectEnvironment | null;
|
|
365
|
+
timezone?: string | null;
|
|
366
|
+
defaultSender?: string | null;
|
|
367
|
+
status?: 'active' | 'archived';
|
|
368
|
+
settings?: JsonObject;
|
|
369
|
+
}
|
|
370
|
+
interface Project {
|
|
371
|
+
id: string;
|
|
372
|
+
name: string;
|
|
373
|
+
slug: string;
|
|
374
|
+
description: string | null;
|
|
375
|
+
environment: string;
|
|
376
|
+
timezone: string;
|
|
377
|
+
defaultSender: string | null;
|
|
378
|
+
status: string;
|
|
379
|
+
settings: JsonObject;
|
|
380
|
+
emailCount: number;
|
|
381
|
+
domainCount: number;
|
|
382
|
+
apiKeyCount: number;
|
|
383
|
+
createdAt: string | null;
|
|
384
|
+
updatedAt: string | null;
|
|
385
|
+
}
|
|
386
|
+
type ApiKeyScope = 'emails.send' | 'emails.read' | 'templates.read' | 'templates.write' | 'domains.read' | 'domains.write' | 'contacts.read' | 'contacts.write' | 'campaigns.read' | 'campaigns.write' | 'analytics.read' | 'billing.read' | 'projects.read' | 'projects.write' | 'api_keys.read' | 'api_keys.write' | 'admin';
|
|
387
|
+
interface CreateApiKeyInput {
|
|
388
|
+
name: string;
|
|
389
|
+
expiresAt?: string | null;
|
|
390
|
+
scopes?: readonly ApiKeyScope[];
|
|
391
|
+
}
|
|
392
|
+
interface UpdateApiKeyInput {
|
|
393
|
+
name?: string;
|
|
394
|
+
expiresAt?: string | null;
|
|
395
|
+
scopes?: readonly ApiKeyScope[];
|
|
396
|
+
status?: 'active' | 'disabled';
|
|
397
|
+
}
|
|
398
|
+
interface ApiKey {
|
|
399
|
+
id: string;
|
|
400
|
+
name: string;
|
|
401
|
+
prefix: string;
|
|
402
|
+
maskedKey: string;
|
|
403
|
+
status: string;
|
|
404
|
+
scopes: readonly string[] | null;
|
|
405
|
+
permissions: readonly string[] | null;
|
|
406
|
+
environment: string | null;
|
|
407
|
+
lastUsedAt: string | null;
|
|
408
|
+
expiresAt: string | null;
|
|
409
|
+
createdAt: string | null;
|
|
410
|
+
updatedAt: string | null;
|
|
411
|
+
/** One-time plaintext secret returned only on create or rotation. */
|
|
412
|
+
secret: string | null;
|
|
413
|
+
key: string | null;
|
|
414
|
+
}
|
|
415
|
+
interface CreateDomainInput {
|
|
416
|
+
domain: string;
|
|
417
|
+
}
|
|
418
|
+
interface DnsRecord {
|
|
419
|
+
type: string;
|
|
420
|
+
name: string;
|
|
421
|
+
value: string;
|
|
422
|
+
status?: string;
|
|
423
|
+
verified?: boolean;
|
|
424
|
+
purpose?: string;
|
|
425
|
+
priority?: number | null;
|
|
426
|
+
}
|
|
427
|
+
interface Domain {
|
|
428
|
+
id: string;
|
|
429
|
+
domain: string;
|
|
430
|
+
status: string;
|
|
431
|
+
verified: boolean;
|
|
432
|
+
verificationStatus: string;
|
|
433
|
+
provider: string | null;
|
|
434
|
+
createdAt: string | null;
|
|
435
|
+
verifiedAt: string | null;
|
|
436
|
+
lastCheckedAt: string | null;
|
|
437
|
+
dnsStatus: string;
|
|
438
|
+
dkimStatus: string;
|
|
439
|
+
spfStatus: string;
|
|
440
|
+
trackingStatus: string;
|
|
441
|
+
mailFrom: string | null;
|
|
442
|
+
verificationError: string | null;
|
|
443
|
+
verificationToken: string | null;
|
|
444
|
+
dnsRecords: readonly DnsRecord[];
|
|
445
|
+
}
|
|
446
|
+
interface DomainStatus {
|
|
447
|
+
status: string;
|
|
448
|
+
verified: boolean;
|
|
449
|
+
verificationStatus: string;
|
|
450
|
+
dnsStatus: string;
|
|
451
|
+
dkimStatus: string;
|
|
452
|
+
spfStatus: string;
|
|
453
|
+
trackingStatus: string;
|
|
454
|
+
lastCheckedAt: string | null;
|
|
455
|
+
verificationError: string | null;
|
|
456
|
+
}
|
|
457
|
+
type TemplateStatus = 'draft' | 'published' | 'archived';
|
|
458
|
+
type TemplateVariableType = 'string' | 'number' | 'boolean' | 'date';
|
|
459
|
+
interface TemplateVariableInput {
|
|
460
|
+
name: string;
|
|
461
|
+
type: TemplateVariableType;
|
|
462
|
+
required?: boolean;
|
|
463
|
+
defaultValue?: string | null;
|
|
464
|
+
}
|
|
465
|
+
interface TemplateBrandingInput {
|
|
466
|
+
layout?: string | null;
|
|
467
|
+
logoUrl?: string | null;
|
|
468
|
+
logoAlt?: string | null;
|
|
469
|
+
companyName?: string | null;
|
|
470
|
+
primaryColor?: string | null;
|
|
471
|
+
backgroundColor?: string | null;
|
|
472
|
+
contentBackgroundColor?: string | null;
|
|
473
|
+
textColor?: string | null;
|
|
474
|
+
mutedTextColor?: string | null;
|
|
475
|
+
buttonTextColor?: string | null;
|
|
476
|
+
fontFamily?: string | null;
|
|
477
|
+
footerText?: string | null;
|
|
478
|
+
supportEmail?: string | null;
|
|
479
|
+
websiteUrl?: string | null;
|
|
480
|
+
}
|
|
481
|
+
interface CreateTemplateInput {
|
|
482
|
+
name: string;
|
|
483
|
+
description?: string | null;
|
|
484
|
+
subject: string;
|
|
485
|
+
html?: string | null;
|
|
486
|
+
text?: string | null;
|
|
487
|
+
status?: TemplateStatus | null;
|
|
488
|
+
editorType?: string | null;
|
|
489
|
+
category?: string | null;
|
|
490
|
+
tags?: readonly string[];
|
|
491
|
+
variables?: readonly TemplateVariableInput[];
|
|
492
|
+
branding?: TemplateBrandingInput;
|
|
493
|
+
}
|
|
494
|
+
type UpdateTemplateInput = Partial<CreateTemplateInput>;
|
|
495
|
+
interface PreviewTemplateInput {
|
|
496
|
+
variables?: JsonObject;
|
|
497
|
+
}
|
|
498
|
+
interface DuplicateTemplateInput {
|
|
499
|
+
name?: string | null;
|
|
500
|
+
}
|
|
501
|
+
interface TestTemplateInput {
|
|
502
|
+
to?: string;
|
|
503
|
+
/** Backward-compatible alias for `to`. */
|
|
504
|
+
email?: string;
|
|
505
|
+
variables?: JsonObject;
|
|
506
|
+
subject?: string | null;
|
|
507
|
+
}
|
|
508
|
+
interface TemplateTestResult {
|
|
509
|
+
queued?: boolean;
|
|
510
|
+
messageId?: string | null;
|
|
511
|
+
[key: string]: JsonValue | undefined;
|
|
512
|
+
}
|
|
513
|
+
interface Template {
|
|
514
|
+
id: string;
|
|
515
|
+
name: string;
|
|
516
|
+
slug: string;
|
|
517
|
+
description: string | null;
|
|
518
|
+
subject: string;
|
|
519
|
+
status: string;
|
|
520
|
+
editorType: string;
|
|
521
|
+
category: string | null;
|
|
522
|
+
tags: readonly string[];
|
|
523
|
+
createdAt: string | null;
|
|
524
|
+
updatedAt: string | null;
|
|
525
|
+
html: string | null;
|
|
526
|
+
text: string | null;
|
|
527
|
+
htmlContent: string | null;
|
|
528
|
+
textContent: string | null;
|
|
529
|
+
branding: JsonObject | null;
|
|
530
|
+
metadata: JsonObject | null;
|
|
531
|
+
variables: readonly JsonObject[];
|
|
532
|
+
}
|
|
533
|
+
interface TemplatePreview {
|
|
534
|
+
subject: string;
|
|
535
|
+
html: string | null;
|
|
536
|
+
text: string | null;
|
|
537
|
+
[key: string]: JsonValue | undefined;
|
|
538
|
+
}
|
|
539
|
+
interface DeleteResult {
|
|
540
|
+
deleted: true;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
interface AnalyticsFilters {
|
|
544
|
+
from?: string | Date;
|
|
545
|
+
to?: string | Date;
|
|
546
|
+
campaign?: string;
|
|
547
|
+
campaignId?: string;
|
|
548
|
+
project?: string;
|
|
549
|
+
projectId?: string;
|
|
550
|
+
domain?: string;
|
|
551
|
+
domainId?: string;
|
|
552
|
+
perPage?: number;
|
|
553
|
+
}
|
|
554
|
+
interface EventListOptions {
|
|
555
|
+
eventType?: string;
|
|
556
|
+
source?: string;
|
|
557
|
+
campaign?: string;
|
|
558
|
+
campaignId?: string;
|
|
559
|
+
message?: string;
|
|
560
|
+
messageId?: string;
|
|
561
|
+
search?: string;
|
|
562
|
+
from?: string | Date;
|
|
563
|
+
to?: string | Date;
|
|
564
|
+
perPage?: number;
|
|
565
|
+
}
|
|
566
|
+
interface Event {
|
|
567
|
+
id: string;
|
|
568
|
+
eventType: string;
|
|
569
|
+
eventLabel?: string;
|
|
570
|
+
source?: string;
|
|
571
|
+
payload?: JsonValue;
|
|
572
|
+
occurredAt?: string | null;
|
|
573
|
+
messageId?: string | null;
|
|
574
|
+
recipient?: string | null;
|
|
575
|
+
metadata?: JsonObject;
|
|
576
|
+
tags?: readonly string[];
|
|
577
|
+
}
|
|
578
|
+
interface MessageListOptions extends PaginationOptions {
|
|
579
|
+
search?: string;
|
|
580
|
+
status?: string;
|
|
581
|
+
provider?: string;
|
|
582
|
+
from?: string | Date;
|
|
583
|
+
to?: string | Date;
|
|
584
|
+
}
|
|
585
|
+
type WebhookEventType = 'email.sent' | 'email.delivered' | 'email.failed' | 'email.bounced' | 'email.complained' | 'email.opened' | 'email.clicked' | 'email.queued' | 'email.delivery_delayed' | 'email.suppressed' | 'email.unsubscribed' | 'campaign.created' | 'campaign.scheduled' | 'campaign.started' | 'campaign.completed' | 'contact.created' | 'contact.updated' | 'contact.deleted' | 'domain.verified' | 'project.created' | 'api_key.created';
|
|
586
|
+
interface CreateWebhookInput {
|
|
587
|
+
name: string;
|
|
588
|
+
url: string;
|
|
589
|
+
subscribedEvents: readonly WebhookEventType[];
|
|
590
|
+
isActive?: boolean;
|
|
591
|
+
}
|
|
592
|
+
type UpdateWebhookInput = Partial<CreateWebhookInput>;
|
|
593
|
+
interface TestWebhookInput {
|
|
594
|
+
eventType?: WebhookEventType | 'test.webhook' | null;
|
|
595
|
+
}
|
|
596
|
+
interface ReplayWebhookInput {
|
|
597
|
+
failedOnly?: boolean;
|
|
598
|
+
from?: string | Date | null;
|
|
599
|
+
to?: string | Date | null;
|
|
600
|
+
eventTypes?: readonly (WebhookEventType | 'test.webhook')[];
|
|
601
|
+
deliveryIds?: readonly string[];
|
|
602
|
+
}
|
|
603
|
+
interface WebhookListOptions extends PaginationOptions {
|
|
604
|
+
search?: string;
|
|
605
|
+
status?: string;
|
|
606
|
+
sort?: string;
|
|
607
|
+
direction?: string;
|
|
608
|
+
}
|
|
609
|
+
interface WebhookDeliveryListOptions {
|
|
610
|
+
status?: string;
|
|
611
|
+
eventType?: string;
|
|
612
|
+
search?: string;
|
|
613
|
+
httpStatus?: number;
|
|
614
|
+
from?: string | Date;
|
|
615
|
+
to?: string | Date;
|
|
616
|
+
perPage?: number;
|
|
617
|
+
}
|
|
618
|
+
interface Webhook {
|
|
619
|
+
id: string;
|
|
620
|
+
name: string;
|
|
621
|
+
url: string;
|
|
622
|
+
subscribedEvents: readonly string[];
|
|
623
|
+
isActive: boolean;
|
|
624
|
+
signingSecret?: string | null;
|
|
625
|
+
createdAt?: string | null;
|
|
626
|
+
updatedAt?: string | null;
|
|
627
|
+
}
|
|
628
|
+
interface WebhookDelivery {
|
|
629
|
+
id: string;
|
|
630
|
+
status: string;
|
|
631
|
+
eventType?: string;
|
|
632
|
+
httpStatus?: number | null;
|
|
633
|
+
attemptCount?: number;
|
|
634
|
+
request?: JsonObject | null;
|
|
635
|
+
response?: JsonObject | null;
|
|
636
|
+
createdAt?: string | null;
|
|
637
|
+
[key: string]: JsonValue | undefined;
|
|
638
|
+
}
|
|
639
|
+
type SuppressionReason = 'bounce' | 'complaint' | 'manual' | 'unsubscribe';
|
|
640
|
+
interface CreateSuppressionInput {
|
|
641
|
+
email: string;
|
|
642
|
+
reason: SuppressionReason;
|
|
643
|
+
notes?: string | null;
|
|
644
|
+
}
|
|
645
|
+
interface SuppressionListOptions {
|
|
646
|
+
search?: string;
|
|
647
|
+
reason?: string;
|
|
648
|
+
perPage?: number;
|
|
649
|
+
}
|
|
650
|
+
interface Suppression {
|
|
651
|
+
id: string;
|
|
652
|
+
email: string;
|
|
653
|
+
reason: string;
|
|
654
|
+
notes?: string | null;
|
|
655
|
+
createdAt?: string | null;
|
|
656
|
+
updatedAt?: string | null;
|
|
657
|
+
[key: string]: JsonValue | undefined;
|
|
658
|
+
}
|
|
659
|
+
interface SuppressionCheck {
|
|
660
|
+
email: string;
|
|
661
|
+
suppressed: boolean;
|
|
662
|
+
suppression: Suppression | null;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
type ContactStatus = 'active' | 'unsubscribed' | 'suppressed' | 'bounced' | 'complained' | 'archived';
|
|
666
|
+
interface CreateContactInput {
|
|
667
|
+
email: string;
|
|
668
|
+
firstName?: string | null;
|
|
669
|
+
lastName?: string | null;
|
|
670
|
+
status?: ContactStatus | null;
|
|
671
|
+
subscribed?: boolean | null;
|
|
672
|
+
source?: string | null;
|
|
673
|
+
metadata?: JsonObject;
|
|
674
|
+
listIds?: readonly string[] | null;
|
|
675
|
+
tagIds?: readonly string[] | null;
|
|
676
|
+
tagNames?: readonly string[] | null;
|
|
677
|
+
customFields?: JsonObject;
|
|
678
|
+
}
|
|
679
|
+
type UpdateContactInput = Partial<CreateContactInput>;
|
|
680
|
+
interface ContactListOptions extends PaginationOptions {
|
|
681
|
+
search?: string;
|
|
682
|
+
q?: string;
|
|
683
|
+
status?: string;
|
|
684
|
+
subscribed?: boolean;
|
|
685
|
+
list?: string;
|
|
686
|
+
tag?: string;
|
|
687
|
+
tagName?: string;
|
|
688
|
+
source?: string;
|
|
689
|
+
createdFrom?: string;
|
|
690
|
+
createdTo?: string;
|
|
691
|
+
updatedFrom?: string;
|
|
692
|
+
updatedTo?: string;
|
|
693
|
+
segment?: string;
|
|
694
|
+
sort?: string;
|
|
695
|
+
direction?: 'asc' | 'desc';
|
|
696
|
+
}
|
|
697
|
+
interface Contact {
|
|
698
|
+
id: string;
|
|
699
|
+
email: string;
|
|
700
|
+
firstName: string | null;
|
|
701
|
+
lastName: string | null;
|
|
702
|
+
status: string;
|
|
703
|
+
subscribed: boolean;
|
|
704
|
+
source: string;
|
|
705
|
+
metadata: JsonObject;
|
|
706
|
+
tags: readonly JsonObject[];
|
|
707
|
+
lists: readonly JsonObject[];
|
|
708
|
+
customFields: JsonObject;
|
|
709
|
+
createdAt: string | null;
|
|
710
|
+
updatedAt: string | null;
|
|
711
|
+
}
|
|
712
|
+
interface CreateContactListInput {
|
|
713
|
+
name: string;
|
|
714
|
+
description?: string | null;
|
|
715
|
+
color?: string | null;
|
|
716
|
+
}
|
|
717
|
+
type UpdateContactListInput = Partial<CreateContactListInput>;
|
|
718
|
+
interface ContactList {
|
|
719
|
+
id: string;
|
|
720
|
+
name: string;
|
|
721
|
+
description: string | null;
|
|
722
|
+
color: string;
|
|
723
|
+
subscriberCount: number;
|
|
724
|
+
createdAt: string | null;
|
|
725
|
+
updatedAt: string | null;
|
|
726
|
+
}
|
|
727
|
+
interface ListMembershipResult {
|
|
728
|
+
added?: number;
|
|
729
|
+
removed?: number;
|
|
730
|
+
}
|
|
731
|
+
type SegmentLogic = 'and' | 'or';
|
|
732
|
+
interface SegmentRuleCondition {
|
|
733
|
+
field: string;
|
|
734
|
+
operator: string;
|
|
735
|
+
value?: JsonValue;
|
|
736
|
+
[key: string]: JsonValue | undefined;
|
|
737
|
+
}
|
|
738
|
+
interface SegmentRules {
|
|
739
|
+
logic: SegmentLogic;
|
|
740
|
+
rules: readonly (SegmentRuleCondition | SegmentRules)[];
|
|
741
|
+
}
|
|
742
|
+
interface CreateSegmentInput {
|
|
743
|
+
name: string;
|
|
744
|
+
description?: string | null;
|
|
745
|
+
rules: SegmentRules;
|
|
746
|
+
}
|
|
747
|
+
interface UpdateSegmentInput {
|
|
748
|
+
name?: string;
|
|
749
|
+
description?: string | null;
|
|
750
|
+
rules?: SegmentRules;
|
|
751
|
+
}
|
|
752
|
+
type SegmentListOptions = ListOptions;
|
|
753
|
+
interface Segment {
|
|
754
|
+
id: string;
|
|
755
|
+
name: string;
|
|
756
|
+
description: string | null;
|
|
757
|
+
rules: SegmentRules | JsonObject;
|
|
758
|
+
contactCount: number;
|
|
759
|
+
createdAt: string | null;
|
|
760
|
+
updatedAt: string | null;
|
|
761
|
+
}
|
|
762
|
+
interface SegmentPreview {
|
|
763
|
+
count?: number;
|
|
764
|
+
estimatedCount?: number;
|
|
765
|
+
sampleContacts?: readonly JsonObject[];
|
|
766
|
+
}
|
|
767
|
+
interface CreateTagInput {
|
|
768
|
+
name: string;
|
|
769
|
+
color?: string | null;
|
|
770
|
+
}
|
|
771
|
+
type UpdateTagInput = Partial<CreateTagInput>;
|
|
772
|
+
type TagListOptions = ListOptions;
|
|
773
|
+
interface Tag {
|
|
774
|
+
id: string;
|
|
775
|
+
name: string;
|
|
776
|
+
color: string;
|
|
777
|
+
usageCount: number;
|
|
778
|
+
createdAt: string | null;
|
|
779
|
+
updatedAt: string | null;
|
|
780
|
+
}
|
|
781
|
+
interface TagAssignmentInput {
|
|
782
|
+
contactIds: string | readonly string[];
|
|
783
|
+
tagIds: string | readonly string[];
|
|
784
|
+
}
|
|
785
|
+
interface TagAssignmentResult {
|
|
786
|
+
assigned?: number;
|
|
787
|
+
removed?: number;
|
|
788
|
+
}
|
|
789
|
+
type AudienceSource = 'list' | 'segment';
|
|
790
|
+
type AudienceListOptions = PaginationOptions;
|
|
791
|
+
interface Audience {
|
|
792
|
+
type: string;
|
|
793
|
+
id: string;
|
|
794
|
+
name: string;
|
|
795
|
+
description: string | null;
|
|
796
|
+
memberCount: number;
|
|
797
|
+
source: string;
|
|
798
|
+
}
|
|
799
|
+
interface CreateAudienceInput {
|
|
800
|
+
source?: AudienceSource;
|
|
801
|
+
name: string;
|
|
802
|
+
description?: string | null;
|
|
803
|
+
color?: string | null;
|
|
804
|
+
rules?: SegmentRules;
|
|
805
|
+
}
|
|
806
|
+
interface UpdateAudienceInput {
|
|
807
|
+
name?: string;
|
|
808
|
+
description?: string | null;
|
|
809
|
+
color?: string | null;
|
|
810
|
+
rules?: SegmentRules;
|
|
811
|
+
}
|
|
812
|
+
interface CreateCampaignInput {
|
|
813
|
+
name: string;
|
|
814
|
+
subject?: string | null;
|
|
815
|
+
previewText?: string | null;
|
|
816
|
+
preheader?: string | null;
|
|
817
|
+
fromName?: string | null;
|
|
818
|
+
fromEmail?: string | null;
|
|
819
|
+
replyTo?: string | null;
|
|
820
|
+
templateUuid?: string | null;
|
|
821
|
+
templateId?: string | null;
|
|
822
|
+
segmentUuid?: string | null;
|
|
823
|
+
segmentId?: string | null;
|
|
824
|
+
audienceId?: string | null;
|
|
825
|
+
sendImmediately?: boolean;
|
|
826
|
+
scheduledAt?: string | null;
|
|
827
|
+
timezone?: string | null;
|
|
828
|
+
builderStep?: number;
|
|
829
|
+
}
|
|
830
|
+
type UpdateCampaignInput = Partial<CreateCampaignInput>;
|
|
831
|
+
interface CampaignListOptions extends PaginationOptions {
|
|
832
|
+
search?: string;
|
|
833
|
+
status?: string;
|
|
834
|
+
}
|
|
835
|
+
interface DuplicateCampaignInput {
|
|
836
|
+
includeSchedule?: boolean;
|
|
837
|
+
}
|
|
838
|
+
interface ScheduleCampaignInput {
|
|
839
|
+
sendImmediately?: boolean;
|
|
840
|
+
scheduledAt?: string | Date | null;
|
|
841
|
+
timezone?: string | null;
|
|
842
|
+
}
|
|
843
|
+
interface CampaignSenderInput {
|
|
844
|
+
fromName?: string | null;
|
|
845
|
+
fromEmail?: string | null;
|
|
846
|
+
}
|
|
847
|
+
interface CampaignRecipientListOptions extends PaginationOptions {
|
|
848
|
+
search?: string;
|
|
849
|
+
status?: string;
|
|
850
|
+
}
|
|
851
|
+
interface Campaign {
|
|
852
|
+
uuid: string;
|
|
853
|
+
name: string;
|
|
854
|
+
subject: string | null;
|
|
855
|
+
previewText: string | null;
|
|
856
|
+
fromName: string | null;
|
|
857
|
+
fromEmail: string | null;
|
|
858
|
+
replyTo: string | null;
|
|
859
|
+
status: string;
|
|
860
|
+
statusLabel: string;
|
|
861
|
+
sendImmediately: boolean;
|
|
862
|
+
scheduledAt: string | null;
|
|
863
|
+
timezone: string;
|
|
864
|
+
sentAt: string | null;
|
|
865
|
+
estimatedRecipients: number;
|
|
866
|
+
totalRecipients: number;
|
|
867
|
+
queuedCount: number;
|
|
868
|
+
sendingCount: number;
|
|
869
|
+
sentCount: number;
|
|
870
|
+
failedCount: number;
|
|
871
|
+
completedCount: number;
|
|
872
|
+
completionPercentage: number;
|
|
873
|
+
startedAt: string | null;
|
|
874
|
+
completedAt: string | null;
|
|
875
|
+
lastProcessedAt: string | null;
|
|
876
|
+
builderStep: number;
|
|
877
|
+
createdAt: string | null;
|
|
878
|
+
updatedAt: string | null;
|
|
879
|
+
project: JsonObject | null;
|
|
880
|
+
template: JsonObject | null;
|
|
881
|
+
segment: JsonObject | null;
|
|
882
|
+
}
|
|
883
|
+
interface CampaignStatusSummary {
|
|
884
|
+
uuid?: string;
|
|
885
|
+
status?: string;
|
|
886
|
+
statusLabel?: string;
|
|
887
|
+
sendImmediately?: boolean;
|
|
888
|
+
scheduledAt?: string | null;
|
|
889
|
+
timezone?: string;
|
|
890
|
+
sentAt?: string | null;
|
|
891
|
+
startedAt?: string | null;
|
|
892
|
+
completedAt?: string | null;
|
|
893
|
+
lastProcessedAt?: string | null;
|
|
894
|
+
}
|
|
895
|
+
interface CampaignPreview {
|
|
896
|
+
subject: string;
|
|
897
|
+
html: string;
|
|
898
|
+
text: string | null;
|
|
899
|
+
previewText: string | null;
|
|
900
|
+
}
|
|
901
|
+
interface CampaignValidation {
|
|
902
|
+
valid?: boolean;
|
|
903
|
+
errors?: readonly string[];
|
|
904
|
+
warnings?: readonly string[];
|
|
905
|
+
}
|
|
906
|
+
interface CampaignRecipientPreview {
|
|
907
|
+
estimatedCount: number;
|
|
908
|
+
subscribedCount: number;
|
|
909
|
+
unsubscribedCount: number;
|
|
910
|
+
suppressedCount: number;
|
|
911
|
+
sampleContacts?: readonly JsonObject[];
|
|
912
|
+
warnings?: readonly string[];
|
|
913
|
+
}
|
|
914
|
+
interface CampaignRecipientCount {
|
|
915
|
+
count: number;
|
|
916
|
+
estimatedCount: number | null;
|
|
917
|
+
subscribedCount: number | null;
|
|
918
|
+
unsubscribedCount: number | null;
|
|
919
|
+
suppressedCount: number | null;
|
|
920
|
+
}
|
|
921
|
+
interface CampaignAnalytics {
|
|
922
|
+
recipients: number;
|
|
923
|
+
queued: number;
|
|
924
|
+
sent: number;
|
|
925
|
+
delivered: number;
|
|
926
|
+
opened: number;
|
|
927
|
+
uniqueOpens: number;
|
|
928
|
+
clicked: number;
|
|
929
|
+
uniqueClicks: number;
|
|
930
|
+
bounced: number;
|
|
931
|
+
complained: number;
|
|
932
|
+
failed: number;
|
|
933
|
+
unsubscribed: number;
|
|
934
|
+
deliveryRate: number;
|
|
935
|
+
openRate: number;
|
|
936
|
+
clickRate: number;
|
|
937
|
+
bounceRate: number;
|
|
938
|
+
complaintRate: number;
|
|
939
|
+
failureRate: number;
|
|
940
|
+
unsubscribeRate: number;
|
|
941
|
+
averageDeliveryTimeSeconds: number | null;
|
|
942
|
+
}
|
|
943
|
+
interface CampaignProgress {
|
|
944
|
+
totalRecipients?: number;
|
|
945
|
+
sentCount?: number;
|
|
946
|
+
completionPercentage?: number;
|
|
947
|
+
[key: string]: JsonValue | undefined;
|
|
948
|
+
}
|
|
949
|
+
interface CampaignLink {
|
|
950
|
+
destinationUrl: string;
|
|
951
|
+
clicks: number;
|
|
952
|
+
uniqueClicks: number;
|
|
953
|
+
ctr: number;
|
|
954
|
+
lastClickedAt: string | null;
|
|
955
|
+
}
|
|
956
|
+
interface CampaignEventEntry {
|
|
957
|
+
[key: string]: JsonValue | undefined;
|
|
958
|
+
}
|
|
959
|
+
interface CampaignActivityEntry {
|
|
960
|
+
[key: string]: JsonValue | undefined;
|
|
961
|
+
}
|
|
962
|
+
interface CampaignTimelineEntry {
|
|
963
|
+
[key: string]: JsonValue | undefined;
|
|
964
|
+
}
|
|
965
|
+
interface CampaignRecipient {
|
|
966
|
+
[key: string]: JsonValue | undefined;
|
|
967
|
+
}
|
|
968
|
+
type ImportFileInput = Blob | Buffer | Uint8Array | ArrayBuffer;
|
|
969
|
+
interface CreateImportInput {
|
|
970
|
+
file: ImportFileInput;
|
|
971
|
+
/** Multipart filename; defaults to `contacts.csv`. */
|
|
972
|
+
filename?: string;
|
|
973
|
+
}
|
|
974
|
+
interface ConfigureImportInput {
|
|
975
|
+
fieldMappings: JsonObject | readonly string[];
|
|
976
|
+
duplicateStrategy?: string | null;
|
|
977
|
+
defaultStatus?: string | null;
|
|
978
|
+
importSource?: string | null;
|
|
979
|
+
timezone?: string | null;
|
|
980
|
+
country?: string | null;
|
|
981
|
+
doubleOptIn?: boolean | null;
|
|
982
|
+
tagSeparator?: string | null;
|
|
983
|
+
createMissingTags?: boolean | null;
|
|
984
|
+
audienceMode?: string | null;
|
|
985
|
+
audienceUuid?: string | null;
|
|
986
|
+
createMissingAudiences?: boolean | null;
|
|
987
|
+
newProperties?: JsonObject | readonly string[] | null;
|
|
988
|
+
}
|
|
989
|
+
interface ImportJob {
|
|
990
|
+
id: string;
|
|
991
|
+
status: string;
|
|
992
|
+
progress: number;
|
|
993
|
+
originalFilename: string;
|
|
994
|
+
summary: string | null;
|
|
995
|
+
metadata: JsonObject;
|
|
996
|
+
counters: JsonObject;
|
|
997
|
+
hasFailures: boolean;
|
|
998
|
+
startedAt: string | null;
|
|
999
|
+
completedAt: string | null;
|
|
1000
|
+
createdAt: string | null;
|
|
1001
|
+
updatedAt: string | null;
|
|
1002
|
+
}
|
|
1003
|
+
interface CreateExportInput {
|
|
1004
|
+
search?: string | null;
|
|
1005
|
+
status?: string | null;
|
|
1006
|
+
subscribed?: boolean | null;
|
|
1007
|
+
list?: string | null;
|
|
1008
|
+
tagName?: string | null;
|
|
1009
|
+
ids?: readonly string[] | null;
|
|
1010
|
+
}
|
|
1011
|
+
interface ExportJob {
|
|
1012
|
+
id: string;
|
|
1013
|
+
status: string;
|
|
1014
|
+
contactCount: number;
|
|
1015
|
+
filters: JsonObject;
|
|
1016
|
+
downloadUrl: string | null;
|
|
1017
|
+
completedAt: string | null;
|
|
1018
|
+
createdAt: string | null;
|
|
1019
|
+
updatedAt: string | null;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Campaign operations.
|
|
1024
|
+
*
|
|
1025
|
+
* Provides a cohesive campaign API over the generated campaigns, lifecycle,
|
|
1026
|
+
* analytics, and events clients.
|
|
1027
|
+
*/
|
|
1028
|
+
declare class Campaigns extends BaseResource {
|
|
1029
|
+
private readonly api;
|
|
1030
|
+
/** @internal */
|
|
1031
|
+
constructor(api: InternalCampaignsApi);
|
|
1032
|
+
/**
|
|
1033
|
+
* Create a campaign.
|
|
1034
|
+
*
|
|
1035
|
+
* The create endpoint accepts only a name. Extra configuration fields are
|
|
1036
|
+
* applied immediately through a follow-up update so callers can create a
|
|
1037
|
+
* fully configured draft in one SDK call.
|
|
1038
|
+
*/
|
|
1039
|
+
create(input: CreateCampaignInput): Promise<Response<Campaign>>;
|
|
1040
|
+
/**
|
|
1041
|
+
* List campaigns with filters and pagination.
|
|
1042
|
+
*/
|
|
1043
|
+
list(options?: CampaignListOptions): Promise<Collection<Campaign>>;
|
|
1044
|
+
/**
|
|
1045
|
+
* Retrieve a campaign by UUID.
|
|
1046
|
+
*/
|
|
1047
|
+
get(campaignId: string): Promise<Response<Campaign>>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Partially update an editable campaign.
|
|
1050
|
+
*/
|
|
1051
|
+
update(campaignId: string, input: UpdateCampaignInput): Promise<Response<Campaign>>;
|
|
1052
|
+
/**
|
|
1053
|
+
* Soft-delete a campaign.
|
|
1054
|
+
*/
|
|
1055
|
+
delete(campaignId: string): Promise<Response<DeleteResult>>;
|
|
1056
|
+
/**
|
|
1057
|
+
* Duplicate a campaign.
|
|
1058
|
+
*/
|
|
1059
|
+
duplicate(campaignId: string, input?: DuplicateCampaignInput): Promise<Response<Campaign>>;
|
|
1060
|
+
/**
|
|
1061
|
+
* Archive a campaign.
|
|
1062
|
+
*/
|
|
1063
|
+
archive(campaignId: string): Promise<Response<Campaign>>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Restore an archived or soft-deleted campaign.
|
|
1066
|
+
*/
|
|
1067
|
+
restore(campaignId: string): Promise<Response<Campaign>>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Set the campaign subject.
|
|
1070
|
+
*/
|
|
1071
|
+
setSubject(campaignId: string, subject: string): Promise<Response<Campaign>>;
|
|
1072
|
+
/**
|
|
1073
|
+
* Set the campaign sender.
|
|
1074
|
+
*
|
|
1075
|
+
* Accepts an email string (with optional `fromName`) or an object with
|
|
1076
|
+
* `fromEmail` / `fromName`.
|
|
1077
|
+
*/
|
|
1078
|
+
setSender(campaignId: string, sender: string | CampaignSenderInput, fromName?: string | null): Promise<Response<Campaign>>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Set the campaign reply-to address.
|
|
1081
|
+
*/
|
|
1082
|
+
setReplyTo(campaignId: string, replyTo: string | null): Promise<Response<Campaign>>;
|
|
1083
|
+
/**
|
|
1084
|
+
* Set the campaign preheader / preview text.
|
|
1085
|
+
*/
|
|
1086
|
+
setPreheader(campaignId: string, preheader: string | null): Promise<Response<Campaign>>;
|
|
1087
|
+
/**
|
|
1088
|
+
* Set the campaign template.
|
|
1089
|
+
*/
|
|
1090
|
+
setTemplate(campaignId: string, templateId: string): Promise<Response<Campaign>>;
|
|
1091
|
+
/**
|
|
1092
|
+
* Estimate recipient counts for a campaign.
|
|
1093
|
+
*/
|
|
1094
|
+
recipientCount(campaignId: string): Promise<Response<CampaignRecipientCount>>;
|
|
1095
|
+
/**
|
|
1096
|
+
* Preview estimated recipients for a campaign.
|
|
1097
|
+
*/
|
|
1098
|
+
previewRecipients(campaignId: string): Promise<Response<CampaignRecipientPreview>>;
|
|
1099
|
+
/**
|
|
1100
|
+
* Validate campaign readiness.
|
|
1101
|
+
*/
|
|
1102
|
+
validate(campaignId: string): Promise<Response<CampaignValidation>>;
|
|
1103
|
+
/** Mark a campaign as ready to send or schedule. */
|
|
1104
|
+
markReady(campaignId: string): Promise<Response<Campaign>>;
|
|
1105
|
+
/** Send a ready campaign immediately. */
|
|
1106
|
+
send(campaignId: string): Promise<Response<Campaign>>;
|
|
1107
|
+
/** Schedule a campaign for later delivery. */
|
|
1108
|
+
schedule(campaignId: string, input?: ScheduleCampaignInput): Promise<Response<Campaign>>;
|
|
1109
|
+
/** Reschedule an already scheduled campaign. */
|
|
1110
|
+
reschedule(campaignId: string, input?: ScheduleCampaignInput): Promise<Response<Campaign>>;
|
|
1111
|
+
/** Clear a pending campaign schedule. */
|
|
1112
|
+
unschedule(campaignId: string, input?: Pick<ScheduleCampaignInput, 'timezone'>): Promise<Response<Campaign>>;
|
|
1113
|
+
/** Queue a campaign for immediate delivery through the schedule endpoint. */
|
|
1114
|
+
sendNow(campaignId: string, input?: Pick<ScheduleCampaignInput, 'timezone'>): Promise<Response<Campaign>>;
|
|
1115
|
+
/** Cancel a pending schedule. */
|
|
1116
|
+
cancelSchedule(campaignId: string): Promise<Response<Campaign>>;
|
|
1117
|
+
/** Pause a sending campaign. */
|
|
1118
|
+
pause(campaignId: string): Promise<Response<Campaign>>;
|
|
1119
|
+
/** Resume a paused campaign. */
|
|
1120
|
+
resume(campaignId: string): Promise<Response<Campaign>>;
|
|
1121
|
+
/** Cancel a scheduled or sending campaign. */
|
|
1122
|
+
cancel(campaignId: string): Promise<Response<Campaign>>;
|
|
1123
|
+
/**
|
|
1124
|
+
* Preview rendered campaign content.
|
|
1125
|
+
*/
|
|
1126
|
+
preview(campaignId: string): Promise<Response<CampaignPreview>>;
|
|
1127
|
+
/**
|
|
1128
|
+
* Render campaign content.
|
|
1129
|
+
*
|
|
1130
|
+
* Alias of {@link Campaigns.preview} for content workflows.
|
|
1131
|
+
*/
|
|
1132
|
+
render(campaignId: string): Promise<Response<CampaignPreview>>;
|
|
1133
|
+
/**
|
|
1134
|
+
* Retrieve a status summary for a campaign.
|
|
1135
|
+
*/
|
|
1136
|
+
status(campaignId: string): Promise<Response<CampaignStatusSummary>>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Retrieve campaign send progress.
|
|
1139
|
+
*/
|
|
1140
|
+
progress(campaignId: string): Promise<Response<CampaignProgress>>;
|
|
1141
|
+
/**
|
|
1142
|
+
* Retrieve campaign analytics.
|
|
1143
|
+
*/
|
|
1144
|
+
analytics(campaignId: string): Promise<Response<CampaignAnalytics>>;
|
|
1145
|
+
/**
|
|
1146
|
+
* Retrieve open metrics for a campaign.
|
|
1147
|
+
*/
|
|
1148
|
+
opens(campaignId: string): Promise<Response<JsonObject>>;
|
|
1149
|
+
/**
|
|
1150
|
+
* Retrieve click metrics for a campaign.
|
|
1151
|
+
*/
|
|
1152
|
+
clicks(campaignId: string): Promise<Response<JsonObject>>;
|
|
1153
|
+
/**
|
|
1154
|
+
* Retrieve bounce metrics for a campaign.
|
|
1155
|
+
*/
|
|
1156
|
+
bounces(campaignId: string): Promise<Response<JsonObject>>;
|
|
1157
|
+
/**
|
|
1158
|
+
* Retrieve complaint metrics for a campaign.
|
|
1159
|
+
*/
|
|
1160
|
+
complaints(campaignId: string): Promise<Response<JsonObject>>;
|
|
1161
|
+
/**
|
|
1162
|
+
* Retrieve unsubscribe metrics for a campaign.
|
|
1163
|
+
*/
|
|
1164
|
+
unsubscribes(campaignId: string): Promise<Response<JsonObject>>;
|
|
1165
|
+
/**
|
|
1166
|
+
* Retrieve delivery count metrics for a campaign.
|
|
1167
|
+
*/
|
|
1168
|
+
deliveries(campaignId: string): Promise<Response<JsonObject>>;
|
|
1169
|
+
/**
|
|
1170
|
+
* Retrieve delivery-focused analytics for a campaign.
|
|
1171
|
+
*/
|
|
1172
|
+
delivery(campaignId: string): Promise<Response<JsonObject>>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Retrieve tracked campaign links.
|
|
1175
|
+
*/
|
|
1176
|
+
links(campaignId: string): Promise<Collection<CampaignLink>>;
|
|
1177
|
+
/**
|
|
1178
|
+
* Retrieve campaign events.
|
|
1179
|
+
*/
|
|
1180
|
+
events(campaignId: string): Promise<Collection<CampaignEventEntry>>;
|
|
1181
|
+
/**
|
|
1182
|
+
* Retrieve campaign activity entries.
|
|
1183
|
+
*/
|
|
1184
|
+
activity(campaignId: string): Promise<Collection<CampaignActivityEntry>>;
|
|
1185
|
+
/**
|
|
1186
|
+
* Retrieve the campaign timeline.
|
|
1187
|
+
*/
|
|
1188
|
+
timeline(campaignId: string): Promise<Collection<CampaignTimelineEntry>>;
|
|
1189
|
+
/**
|
|
1190
|
+
* List campaign recipients with optional filters.
|
|
1191
|
+
*/
|
|
1192
|
+
recipients(campaignId: string, options?: CampaignRecipientListOptions): Promise<Collection<CampaignRecipient>>;
|
|
1193
|
+
/**
|
|
1194
|
+
* Attach a segment to a campaign.
|
|
1195
|
+
*/
|
|
1196
|
+
addSegment(campaignId: string, segmentId: string): Promise<Response<Campaign>>;
|
|
1197
|
+
/** Attach an audience (segment) to a campaign. */
|
|
1198
|
+
addAudience(campaignId: string, audienceId: string): Promise<Response<Campaign>>;
|
|
1199
|
+
/** Remove the attached audience from a campaign. */
|
|
1200
|
+
removeAudience(campaignId: string): Promise<Response<Campaign>>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Remove the attached segment from a campaign.
|
|
1203
|
+
*/
|
|
1204
|
+
removeSegment(campaignId: string): Promise<Response<Campaign>>;
|
|
1205
|
+
private analyticsSlice;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
/** Global event querying and message timeline helpers. */
|
|
1209
|
+
declare class Events extends BaseResource {
|
|
1210
|
+
private readonly api;
|
|
1211
|
+
/** @internal */
|
|
1212
|
+
constructor(api: InternalEventsApi);
|
|
1213
|
+
/** List message events with filters. */
|
|
1214
|
+
list(options?: EventListOptions): Promise<Collection<Event>>;
|
|
1215
|
+
/** Retrieve a single event by UUID. */
|
|
1216
|
+
get(eventId: string): Promise<Response<Event>>;
|
|
1217
|
+
/** Retrieve the event timeline for a message. */
|
|
1218
|
+
timeline(messageId: string): Promise<Collection<Event>>;
|
|
1219
|
+
/** Alias of {@link Events.timeline}. */
|
|
1220
|
+
history(messageId: string): Promise<Collection<Event>>;
|
|
1221
|
+
/** Retrieve delivery-log detail for a message. */
|
|
1222
|
+
message(messageId: string): Promise<Response<EmailMessage>>;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
/** Account-wide delivery and engagement analytics. */
|
|
1226
|
+
declare class Analytics extends BaseResource {
|
|
1227
|
+
private readonly api;
|
|
1228
|
+
private readonly campaignResource;
|
|
1229
|
+
private readonly eventResource;
|
|
1230
|
+
/** @internal */
|
|
1231
|
+
constructor(api: InternalAnalyticsApi, campaignResource: Campaigns, eventResource: Events);
|
|
1232
|
+
/** Retrieve the analytics overview for a date range. */
|
|
1233
|
+
overview(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1234
|
+
/** Retrieve delivery metrics. */
|
|
1235
|
+
deliveries(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1236
|
+
/** Retrieve open metrics. */
|
|
1237
|
+
opens(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1238
|
+
/** Retrieve click metrics. */
|
|
1239
|
+
clicks(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1240
|
+
/** Retrieve bounce metrics. */
|
|
1241
|
+
bounces(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1242
|
+
/** Retrieve complaint metrics. */
|
|
1243
|
+
complaints(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1244
|
+
/** Retrieve unsubscribe metrics or event summary. */
|
|
1245
|
+
unsubscribes(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1246
|
+
/** Retrieve usage-oriented message totals. */
|
|
1247
|
+
usage(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1248
|
+
/** Retrieve recent analytics activity. */
|
|
1249
|
+
activity(filters?: AnalyticsFilters): Promise<Collection<Event>>;
|
|
1250
|
+
/** Retrieve message analytics. */
|
|
1251
|
+
messages(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1252
|
+
/** Retrieve engagement analytics. */
|
|
1253
|
+
engagement(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1254
|
+
/** Retrieve campaign ranking analytics. */
|
|
1255
|
+
campaigns(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1256
|
+
/** Retrieve domain analytics. */
|
|
1257
|
+
domains(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1258
|
+
/** Retrieve project analytics. */
|
|
1259
|
+
projects(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1260
|
+
/** Retrieve provider analytics. */
|
|
1261
|
+
providers(filters?: AnalyticsFilters): Promise<Response<JsonObject>>;
|
|
1262
|
+
private request;
|
|
1263
|
+
private messageSlice;
|
|
1264
|
+
private engagementSlice;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* Project API key operations.
|
|
1269
|
+
*
|
|
1270
|
+
* Wraps the generated APIKeysApi.
|
|
1271
|
+
*/
|
|
1272
|
+
declare class ApiKeys extends BaseResource {
|
|
1273
|
+
private readonly api;
|
|
1274
|
+
/** @internal */
|
|
1275
|
+
constructor(api: InternalApiKeysApi);
|
|
1276
|
+
/**
|
|
1277
|
+
* Create an API key. The plaintext secret is returned once.
|
|
1278
|
+
*/
|
|
1279
|
+
create(projectId: string, input: CreateApiKeyInput): Promise<Response<ApiKey>>;
|
|
1280
|
+
/**
|
|
1281
|
+
* List masked API keys for a project. Secrets are never returned.
|
|
1282
|
+
*/
|
|
1283
|
+
list(projectId: string, options?: ListOptions): Promise<Collection<ApiKey>>;
|
|
1284
|
+
/**
|
|
1285
|
+
* Retrieve API key metadata without the secret.
|
|
1286
|
+
*/
|
|
1287
|
+
get(projectId: string, apiKeyId: string): Promise<Response<ApiKey>>;
|
|
1288
|
+
/**
|
|
1289
|
+
* Update API key name, expiry, status, or scopes.
|
|
1290
|
+
*/
|
|
1291
|
+
update(projectId: string, apiKeyId: string, input: UpdateApiKeyInput): Promise<Response<ApiKey>>;
|
|
1292
|
+
/**
|
|
1293
|
+
* Soft-delete and revoke an API key.
|
|
1294
|
+
*/
|
|
1295
|
+
delete(projectId: string, apiKeyId: string): Promise<Response<DeleteResult>>;
|
|
1296
|
+
/** Rotate an API key and return its new one-time plaintext secret. */
|
|
1297
|
+
rotate(projectId: string, apiKeyId: string): Promise<Response<ApiKey>>;
|
|
1298
|
+
/**
|
|
1299
|
+
* Attempt to reveal an API key.
|
|
1300
|
+
*
|
|
1301
|
+
* MailerMine normally rejects this operation because secrets are irreversibly
|
|
1302
|
+
* hashed; the API error is mapped to the public SDK exception hierarchy.
|
|
1303
|
+
*/
|
|
1304
|
+
reveal(projectId: string, apiKeyId: string): Promise<Response<ApiKey>>;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* Contact operations.
|
|
1309
|
+
*
|
|
1310
|
+
* Wraps the generated ContactsApi.
|
|
1311
|
+
*/
|
|
1312
|
+
declare class Contacts extends BaseResource {
|
|
1313
|
+
private readonly api;
|
|
1314
|
+
/** @internal */
|
|
1315
|
+
constructor(api: InternalContactsApi);
|
|
1316
|
+
/**
|
|
1317
|
+
* Create a contact with optional lists, tags, metadata, and custom fields.
|
|
1318
|
+
*
|
|
1319
|
+
* @example
|
|
1320
|
+
* ```ts
|
|
1321
|
+
* const contact = await mm.contacts.create({
|
|
1322
|
+
* email: 'john@example.com',
|
|
1323
|
+
* firstName: 'John',
|
|
1324
|
+
* subscribed: true,
|
|
1325
|
+
* });
|
|
1326
|
+
* ```
|
|
1327
|
+
*/
|
|
1328
|
+
create(input: CreateContactInput): Promise<Response<Contact>>;
|
|
1329
|
+
/**
|
|
1330
|
+
* Create a contact or update the existing contact with the same email.
|
|
1331
|
+
*/
|
|
1332
|
+
upsert(input: CreateContactInput): Promise<Response<Contact>>;
|
|
1333
|
+
/**
|
|
1334
|
+
* List contacts with filters and pagination.
|
|
1335
|
+
*/
|
|
1336
|
+
list(options?: ContactListOptions): Promise<Collection<Contact>>;
|
|
1337
|
+
/**
|
|
1338
|
+
* Retrieve a contact by UUID.
|
|
1339
|
+
*/
|
|
1340
|
+
get(contactId: string): Promise<Response<Contact>>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Partially update a contact.
|
|
1343
|
+
*/
|
|
1344
|
+
update(contactId: string, input: UpdateContactInput): Promise<Response<Contact>>;
|
|
1345
|
+
/**
|
|
1346
|
+
* Soft-delete a contact.
|
|
1347
|
+
*/
|
|
1348
|
+
delete(contactId: string): Promise<Response<DeleteResult>>;
|
|
1349
|
+
/**
|
|
1350
|
+
* Search contacts by free-text query across email and name fields.
|
|
1351
|
+
*/
|
|
1352
|
+
search(query: string, options?: ContactListOptions): Promise<Collection<Contact>>;
|
|
1353
|
+
/**
|
|
1354
|
+
* Identify an existing contact by exact email match (case-insensitive).
|
|
1355
|
+
*
|
|
1356
|
+
* @throws {NotFoundError} When no contact matches the email.
|
|
1357
|
+
*/
|
|
1358
|
+
identify(email: string): Promise<Response<Contact>>;
|
|
1359
|
+
/**
|
|
1360
|
+
* Mark a contact as subscribed.
|
|
1361
|
+
*/
|
|
1362
|
+
subscribe(contactId: string): Promise<Response<Contact>>;
|
|
1363
|
+
/**
|
|
1364
|
+
* Mark a contact as unsubscribed.
|
|
1365
|
+
*/
|
|
1366
|
+
unsubscribe(contactId: string): Promise<Response<Contact>>;
|
|
1367
|
+
private findByEmail;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* Static mailing list operations.
|
|
1372
|
+
*
|
|
1373
|
+
* Wraps the generated ListsApi.
|
|
1374
|
+
*/
|
|
1375
|
+
declare class Lists extends BaseResource {
|
|
1376
|
+
private readonly api;
|
|
1377
|
+
/** @internal */
|
|
1378
|
+
constructor(api: InternalListsApi);
|
|
1379
|
+
/**
|
|
1380
|
+
* Create a static contact list.
|
|
1381
|
+
*/
|
|
1382
|
+
create(input: CreateContactListInput): Promise<Response<ContactList>>;
|
|
1383
|
+
/**
|
|
1384
|
+
* List contact lists with filters and pagination.
|
|
1385
|
+
*/
|
|
1386
|
+
list(options?: ListOptions): Promise<Collection<ContactList>>;
|
|
1387
|
+
/**
|
|
1388
|
+
* Retrieve a list by UUID.
|
|
1389
|
+
*/
|
|
1390
|
+
get(listId: string): Promise<Response<ContactList>>;
|
|
1391
|
+
/**
|
|
1392
|
+
* Partially update a list.
|
|
1393
|
+
*/
|
|
1394
|
+
update(listId: string, input: UpdateContactListInput): Promise<Response<ContactList>>;
|
|
1395
|
+
/**
|
|
1396
|
+
* Delete a list.
|
|
1397
|
+
*/
|
|
1398
|
+
delete(listId: string): Promise<Response<DeleteResult>>;
|
|
1399
|
+
/**
|
|
1400
|
+
* Add one or more contacts to a list.
|
|
1401
|
+
*/
|
|
1402
|
+
addContact(listId: string, contactIds: string | readonly string[]): Promise<Response<ListMembershipResult>>;
|
|
1403
|
+
/**
|
|
1404
|
+
* Remove one or more contacts from a list.
|
|
1405
|
+
*/
|
|
1406
|
+
removeContact(listId: string, contactIds: string | readonly string[]): Promise<Response<ListMembershipResult>>;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
/**
|
|
1410
|
+
* Dynamic segment operations.
|
|
1411
|
+
*
|
|
1412
|
+
* Wraps the generated SegmentsApi.
|
|
1413
|
+
*/
|
|
1414
|
+
declare class Segments extends BaseResource {
|
|
1415
|
+
private readonly api;
|
|
1416
|
+
/** @internal */
|
|
1417
|
+
constructor(api: InternalSegmentsApi);
|
|
1418
|
+
/**
|
|
1419
|
+
* Create a dynamic segment.
|
|
1420
|
+
*
|
|
1421
|
+
* @example
|
|
1422
|
+
* ```ts
|
|
1423
|
+
* const segment = await mm.segments.create({
|
|
1424
|
+
* name: 'Active subscribers',
|
|
1425
|
+
* rules: {
|
|
1426
|
+
* logic: 'and',
|
|
1427
|
+
* rules: [{ field: 'subscribed', operator: 'equals', value: true }],
|
|
1428
|
+
* },
|
|
1429
|
+
* });
|
|
1430
|
+
* ```
|
|
1431
|
+
*/
|
|
1432
|
+
create(input: CreateSegmentInput): Promise<Response<Segment>>;
|
|
1433
|
+
/**
|
|
1434
|
+
* List segments with filters and pagination.
|
|
1435
|
+
*/
|
|
1436
|
+
list(options?: SegmentListOptions): Promise<Collection<Segment>>;
|
|
1437
|
+
/**
|
|
1438
|
+
* Retrieve a segment by UUID.
|
|
1439
|
+
*/
|
|
1440
|
+
get(segmentId: string): Promise<Response<Segment>>;
|
|
1441
|
+
/**
|
|
1442
|
+
* Partially update a segment.
|
|
1443
|
+
*/
|
|
1444
|
+
update(segmentId: string, input: UpdateSegmentInput): Promise<Response<Segment>>;
|
|
1445
|
+
/**
|
|
1446
|
+
* Delete a segment.
|
|
1447
|
+
*/
|
|
1448
|
+
delete(segmentId: string): Promise<Response<DeleteResult>>;
|
|
1449
|
+
/**
|
|
1450
|
+
* Preview a saved segment or unsaved segment rules.
|
|
1451
|
+
*
|
|
1452
|
+
* Provide `segmentId` to preview a saved segment, or `rules` to preview
|
|
1453
|
+
* unsaved rule trees.
|
|
1454
|
+
*/
|
|
1455
|
+
preview(segmentId?: string | null, rules?: SegmentRules | null): Promise<Response<SegmentPreview>>;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
/**
|
|
1459
|
+
* Unified audience catalog (lists and segments).
|
|
1460
|
+
*
|
|
1461
|
+
* Wraps the generated AudiencesApi. Creation and mutation are handled via
|
|
1462
|
+
* {@link Lists} or {@link Segments} based on source.
|
|
1463
|
+
*/
|
|
1464
|
+
declare class Audiences extends BaseResource {
|
|
1465
|
+
private readonly api;
|
|
1466
|
+
private readonly listResource;
|
|
1467
|
+
private readonly segmentResource;
|
|
1468
|
+
private readonly contactResource;
|
|
1469
|
+
/** @internal */
|
|
1470
|
+
constructor(api: InternalAudiencesApi, listResource: Lists, segmentResource: Segments, contactResource: Contacts);
|
|
1471
|
+
/** Create a list- or segment-backed audience. */
|
|
1472
|
+
create(input: CreateAudienceInput): Promise<Response<ContactList | Segment>>;
|
|
1473
|
+
/**
|
|
1474
|
+
* List audiences with pagination.
|
|
1475
|
+
*/
|
|
1476
|
+
list(options?: AudienceListOptions): Promise<Collection<Audience>>;
|
|
1477
|
+
/**
|
|
1478
|
+
* Retrieve an audience by source and UUID.
|
|
1479
|
+
*
|
|
1480
|
+
* @param source Audience backing type (`list` or `segment`).
|
|
1481
|
+
* @param audienceId List or segment UUID.
|
|
1482
|
+
*/
|
|
1483
|
+
get(source: AudienceSource, audienceId: string): Promise<Response<Audience>>;
|
|
1484
|
+
/** Update a list- or segment-backed audience. */
|
|
1485
|
+
update(source: AudienceSource, audienceId: string, input: UpdateAudienceInput): Promise<Response<ContactList | Segment>>;
|
|
1486
|
+
/** Delete a list- or segment-backed audience. */
|
|
1487
|
+
delete(source: AudienceSource, audienceId: string): Promise<Response<DeleteResult>>;
|
|
1488
|
+
/** List contacts belonging to an audience. */
|
|
1489
|
+
contacts(source: AudienceSource, audienceId: string, options?: ContactListOptions): Promise<Collection<Contact>>;
|
|
1490
|
+
/** Add contacts to a list-backed audience. */
|
|
1491
|
+
addContacts(audienceId: string, contactIds: string | readonly string[]): Promise<Response<ListMembershipResult>>;
|
|
1492
|
+
/** Remove contacts from a list-backed audience. */
|
|
1493
|
+
removeContacts(audienceId: string, contactIds: string | readonly string[]): Promise<Response<ListMembershipResult>>;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
/**
|
|
1497
|
+
* Sending domain operations.
|
|
1498
|
+
*
|
|
1499
|
+
* Wraps the generated DomainsApi.
|
|
1500
|
+
*/
|
|
1501
|
+
declare class Domains extends BaseResource {
|
|
1502
|
+
private readonly api;
|
|
1503
|
+
/** @internal */
|
|
1504
|
+
constructor(api: InternalDomainsApi);
|
|
1505
|
+
/**
|
|
1506
|
+
* Create a sending domain and return required DNS records.
|
|
1507
|
+
*/
|
|
1508
|
+
create(input: CreateDomainInput): Promise<Response<Domain>>;
|
|
1509
|
+
/**
|
|
1510
|
+
* List sending domains for the authenticated project.
|
|
1511
|
+
*/
|
|
1512
|
+
list(options?: ListOptions): Promise<Collection<Domain>>;
|
|
1513
|
+
/**
|
|
1514
|
+
* Retrieve domain details, DNS records, and verification status.
|
|
1515
|
+
*/
|
|
1516
|
+
get(domainId: string): Promise<Response<Domain>>;
|
|
1517
|
+
/**
|
|
1518
|
+
* Check DNS and provider verification state.
|
|
1519
|
+
*/
|
|
1520
|
+
verify(domainId: string): Promise<Response<Domain>>;
|
|
1521
|
+
/**
|
|
1522
|
+
* Return DNS records required for domain verification.
|
|
1523
|
+
*
|
|
1524
|
+
* Convenience helper over {@link Domains.get}.
|
|
1525
|
+
*/
|
|
1526
|
+
dnsRecords(domainId: string): Promise<Response<readonly DnsRecord[]>>;
|
|
1527
|
+
/**
|
|
1528
|
+
* Return a compact verification status view.
|
|
1529
|
+
*
|
|
1530
|
+
* Convenience helper over {@link Domains.get}.
|
|
1531
|
+
*/
|
|
1532
|
+
status(domainId: string): Promise<Response<DomainStatus>>;
|
|
1533
|
+
/**
|
|
1534
|
+
* Soft-delete a sending domain.
|
|
1535
|
+
*/
|
|
1536
|
+
delete(domainId: string): Promise<Response<DeleteResult>>;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Transactional email operations.
|
|
1541
|
+
*
|
|
1542
|
+
* Wraps the generated EmailsApi for sending and MessagesApi for list/get/events.
|
|
1543
|
+
*/
|
|
1544
|
+
declare class Emails extends BaseResource {
|
|
1545
|
+
private readonly api;
|
|
1546
|
+
/** @internal */
|
|
1547
|
+
constructor(api: InternalEmailsApi);
|
|
1548
|
+
/**
|
|
1549
|
+
* Queue a transactional email for delivery.
|
|
1550
|
+
*
|
|
1551
|
+
* Supports attachments, CC/BCC, reply-to, headers, tags, metadata, and an
|
|
1552
|
+
* optional `scheduledAt` delivery time.
|
|
1553
|
+
*
|
|
1554
|
+
* @example
|
|
1555
|
+
* ```ts
|
|
1556
|
+
* const result = await mm.emails.send({
|
|
1557
|
+
* from: 'MailerMine <hello@example.com>',
|
|
1558
|
+
* to: 'user@example.com',
|
|
1559
|
+
* subject: 'Welcome',
|
|
1560
|
+
* html: '<p>Hello</p>',
|
|
1561
|
+
* text: 'Hello',
|
|
1562
|
+
* });
|
|
1563
|
+
* ```
|
|
1564
|
+
*/
|
|
1565
|
+
send(input: SendEmailInput): Promise<Response<EmailMessage>>;
|
|
1566
|
+
/**
|
|
1567
|
+
* List recently sent and queued messages for the authenticated project.
|
|
1568
|
+
*/
|
|
1569
|
+
list(options?: EmailListOptions): Promise<Collection<EmailMessage>>;
|
|
1570
|
+
/**
|
|
1571
|
+
* Retrieve a single message by UUID.
|
|
1572
|
+
*/
|
|
1573
|
+
get(messageId: string): Promise<Response<EmailMessage>>;
|
|
1574
|
+
/**
|
|
1575
|
+
* Retrieve lifecycle events for a single message.
|
|
1576
|
+
*/
|
|
1577
|
+
events(messageId: string): Promise<Collection<EmailEvent>>;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* Contact export job operations.
|
|
1582
|
+
*
|
|
1583
|
+
* Wraps the generated ExportsApi.
|
|
1584
|
+
*/
|
|
1585
|
+
declare class Exports extends BaseResource {
|
|
1586
|
+
private readonly api;
|
|
1587
|
+
/** @internal */
|
|
1588
|
+
constructor(api: InternalExportsApi);
|
|
1589
|
+
/**
|
|
1590
|
+
* Queue an asynchronous CSV contact export.
|
|
1591
|
+
*/
|
|
1592
|
+
create(options?: CreateExportInput): Promise<Response<ExportJob>>;
|
|
1593
|
+
/**
|
|
1594
|
+
* Retrieve export job status and download metadata.
|
|
1595
|
+
*/
|
|
1596
|
+
status(exportId: string): Promise<Response<ExportJob>>;
|
|
1597
|
+
/**
|
|
1598
|
+
* Download a completed export as CSV content.
|
|
1599
|
+
*
|
|
1600
|
+
* The CSV payload is available from `response.data`.
|
|
1601
|
+
*/
|
|
1602
|
+
download(exportId: string): Promise<Response<string>>;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
/**
|
|
1606
|
+
* Contact import job operations.
|
|
1607
|
+
*
|
|
1608
|
+
* Wraps the generated ImportsApi.
|
|
1609
|
+
*/
|
|
1610
|
+
declare class Imports extends BaseResource {
|
|
1611
|
+
private readonly api;
|
|
1612
|
+
/** @internal */
|
|
1613
|
+
constructor(api: InternalImportsApi);
|
|
1614
|
+
/**
|
|
1615
|
+
* List recent contact import jobs.
|
|
1616
|
+
*/
|
|
1617
|
+
list(): Promise<Collection<ImportJob>>;
|
|
1618
|
+
/**
|
|
1619
|
+
* Upload a contact import file (CSV, TSV, XLSX, or XLS).
|
|
1620
|
+
*
|
|
1621
|
+
* Accepts `Blob`, `Buffer`, `Uint8Array`, or `ArrayBuffer`.
|
|
1622
|
+
*/
|
|
1623
|
+
create(input: CreateImportInput): Promise<Response<ImportJob>>;
|
|
1624
|
+
/**
|
|
1625
|
+
* Retrieve import job status and progress.
|
|
1626
|
+
*/
|
|
1627
|
+
status(importId: string): Promise<Response<ImportJob>>;
|
|
1628
|
+
/** Configure field mappings and import options. */
|
|
1629
|
+
configure(importId: string, input: ConfigureImportInput): Promise<Response<ImportJob>>;
|
|
1630
|
+
/** Start processing a configured import. */
|
|
1631
|
+
start(importId: string): Promise<Response<ImportJob>>;
|
|
1632
|
+
/** Import cancellation is not supported by the MailerMine API. */
|
|
1633
|
+
cancel(importId: string): Promise<Response<ImportJob>>;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
/** Delivery-log and outbound message history operations. */
|
|
1637
|
+
declare class Messages extends BaseResource {
|
|
1638
|
+
private readonly api;
|
|
1639
|
+
/** @internal */
|
|
1640
|
+
constructor(api: InternalMessagesApi);
|
|
1641
|
+
/** List delivery logs with filters and pagination. */
|
|
1642
|
+
list(options?: MessageListOptions): Promise<Collection<EmailMessage>>;
|
|
1643
|
+
/** Retrieve a delivery log by message UUID. */
|
|
1644
|
+
get(messageId: string): Promise<Response<EmailMessage>>;
|
|
1645
|
+
/** Search delivery logs. */
|
|
1646
|
+
search(query: string, options?: Omit<MessageListOptions, 'search'>): Promise<Collection<EmailMessage>>;
|
|
1647
|
+
/** Alias of {@link Messages.list}. */
|
|
1648
|
+
filter(options?: MessageListOptions): Promise<Collection<EmailMessage>>;
|
|
1649
|
+
/** Retrieve lifecycle events for a message. */
|
|
1650
|
+
events(messageId: string): Promise<Collection<Event>>;
|
|
1651
|
+
/** Alias of {@link Messages.events}. */
|
|
1652
|
+
timeline(messageId: string): Promise<Collection<Event>>;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
/**
|
|
1656
|
+
* Workspace project operations.
|
|
1657
|
+
*
|
|
1658
|
+
* Wraps the generated ProjectsApi.
|
|
1659
|
+
*/
|
|
1660
|
+
declare class Projects extends BaseResource {
|
|
1661
|
+
private readonly api;
|
|
1662
|
+
/** @internal */
|
|
1663
|
+
constructor(api: InternalProjectsApi);
|
|
1664
|
+
/**
|
|
1665
|
+
* Create a project for the authenticated workspace owner.
|
|
1666
|
+
*/
|
|
1667
|
+
create(input: CreateProjectInput): Promise<Response<Project>>;
|
|
1668
|
+
/**
|
|
1669
|
+
* List projects owned by the authenticated workspace owner.
|
|
1670
|
+
*/
|
|
1671
|
+
list(options?: ListOptions): Promise<Collection<Project>>;
|
|
1672
|
+
/**
|
|
1673
|
+
* Retrieve a project by UUID.
|
|
1674
|
+
*/
|
|
1675
|
+
get(projectId: string): Promise<Response<Project>>;
|
|
1676
|
+
/**
|
|
1677
|
+
* Partially update a project.
|
|
1678
|
+
*/
|
|
1679
|
+
update(projectId: string, input: UpdateProjectInput): Promise<Response<Project>>;
|
|
1680
|
+
/**
|
|
1681
|
+
* Soft-delete a project.
|
|
1682
|
+
*/
|
|
1683
|
+
delete(projectId: string): Promise<Response<DeleteResult>>;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
* Contact tag operations.
|
|
1688
|
+
*
|
|
1689
|
+
* Wraps the generated TagsApi.
|
|
1690
|
+
*/
|
|
1691
|
+
declare class Tags extends BaseResource {
|
|
1692
|
+
private readonly api;
|
|
1693
|
+
/** @internal */
|
|
1694
|
+
constructor(api: InternalTagsApi);
|
|
1695
|
+
/**
|
|
1696
|
+
* Create a tag.
|
|
1697
|
+
*/
|
|
1698
|
+
create(input: CreateTagInput): Promise<Response<Tag>>;
|
|
1699
|
+
/**
|
|
1700
|
+
* List tags with filters and pagination.
|
|
1701
|
+
*/
|
|
1702
|
+
list(options?: TagListOptions): Promise<Collection<Tag>>;
|
|
1703
|
+
/**
|
|
1704
|
+
* Retrieve a tag by UUID.
|
|
1705
|
+
*/
|
|
1706
|
+
get(tagId: string): Promise<Response<Tag>>;
|
|
1707
|
+
/**
|
|
1708
|
+
* Partially update a tag.
|
|
1709
|
+
*/
|
|
1710
|
+
update(tagId: string, input: UpdateTagInput): Promise<Response<Tag>>;
|
|
1711
|
+
/**
|
|
1712
|
+
* Delete a tag.
|
|
1713
|
+
*/
|
|
1714
|
+
delete(tagId: string): Promise<Response<DeleteResult>>;
|
|
1715
|
+
/**
|
|
1716
|
+
* Assign one or more tags to one or more contacts.
|
|
1717
|
+
*/
|
|
1718
|
+
assign(input: TagAssignmentInput): Promise<Response<TagAssignmentResult>>;
|
|
1719
|
+
/**
|
|
1720
|
+
* Remove one or more tags from one or more contacts.
|
|
1721
|
+
*/
|
|
1722
|
+
remove(input: TagAssignmentInput): Promise<Response<TagAssignmentResult>>;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* Email template operations.
|
|
1727
|
+
*
|
|
1728
|
+
* Wraps the generated TemplatesApi.
|
|
1729
|
+
*/
|
|
1730
|
+
declare class Templates extends BaseResource {
|
|
1731
|
+
private readonly api;
|
|
1732
|
+
/** @internal */
|
|
1733
|
+
constructor(api: InternalTemplatesApi);
|
|
1734
|
+
/**
|
|
1735
|
+
* Create a reusable email template.
|
|
1736
|
+
*/
|
|
1737
|
+
create(input: CreateTemplateInput): Promise<Response<Template>>;
|
|
1738
|
+
/**
|
|
1739
|
+
* List templates for the authenticated project.
|
|
1740
|
+
*/
|
|
1741
|
+
list(options?: ListOptions): Promise<Collection<Template>>;
|
|
1742
|
+
/**
|
|
1743
|
+
* Retrieve full template content, variables, and branding.
|
|
1744
|
+
*/
|
|
1745
|
+
get(templateId: string): Promise<Response<Template>>;
|
|
1746
|
+
/**
|
|
1747
|
+
* Partially update template content, variables, status, or branding.
|
|
1748
|
+
*/
|
|
1749
|
+
update(templateId: string, input: UpdateTemplateInput): Promise<Response<Template>>;
|
|
1750
|
+
/**
|
|
1751
|
+
* Render a template with runtime variables without saving or sending.
|
|
1752
|
+
*/
|
|
1753
|
+
preview(templateId: string, input?: PreviewTemplateInput): Promise<Response<TemplatePreview>>;
|
|
1754
|
+
/**
|
|
1755
|
+
* Duplicate a template into a new draft.
|
|
1756
|
+
*/
|
|
1757
|
+
duplicate(templateId: string, input?: DuplicateTemplateInput): Promise<Response<Template>>;
|
|
1758
|
+
/** Send a test rendering of a template. */
|
|
1759
|
+
test(templateId: string, input: TestTemplateInput): Promise<Response<TemplateTestResult>>;
|
|
1760
|
+
/**
|
|
1761
|
+
* Soft-delete a template.
|
|
1762
|
+
*/
|
|
1763
|
+
delete(templateId: string): Promise<Response<DeleteResult>>;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
/** Account suppression-list operations. */
|
|
1767
|
+
declare class Suppressions extends BaseResource {
|
|
1768
|
+
private readonly api;
|
|
1769
|
+
/** @internal */
|
|
1770
|
+
constructor(api: InternalSuppressionsApi);
|
|
1771
|
+
/** List suppressions with filters. */
|
|
1772
|
+
list(options?: SuppressionListOptions): Promise<Collection<Suppression>>;
|
|
1773
|
+
/** Retrieve a suppression by UUID. */
|
|
1774
|
+
get(suppressionId: string): Promise<Response<Suppression>>;
|
|
1775
|
+
/** Add an email address to the suppression list. */
|
|
1776
|
+
add(input: CreateSuppressionInput): Promise<Response<Suppression>>;
|
|
1777
|
+
/** Remove a suppression by UUID. */
|
|
1778
|
+
remove(suppressionId: string): Promise<Response<DeleteResult>>;
|
|
1779
|
+
/** Restore a removed or soft-deleted suppression. */
|
|
1780
|
+
restore(suppressionId: string): Promise<Response<Suppression>>;
|
|
1781
|
+
/** Check whether an exact email address is suppressed. */
|
|
1782
|
+
check(email: string): Promise<Response<SuppressionCheck>>;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
/** Webhook endpoints, deliveries, replay, and signature verification. */
|
|
1786
|
+
declare class Webhooks extends BaseResource {
|
|
1787
|
+
private readonly api;
|
|
1788
|
+
/** @internal */
|
|
1789
|
+
constructor(api: InternalWebhooksApi);
|
|
1790
|
+
/** Create a webhook. Its signing secret is returned only once. */
|
|
1791
|
+
create(input: CreateWebhookInput): Promise<Response<Webhook>>;
|
|
1792
|
+
/** List webhook endpoints. */
|
|
1793
|
+
list(options?: WebhookListOptions): Promise<Collection<Webhook>>;
|
|
1794
|
+
/** Retrieve a webhook by UUID. */
|
|
1795
|
+
get(webhookId: string): Promise<Response<Webhook>>;
|
|
1796
|
+
/** Update a webhook endpoint. */
|
|
1797
|
+
update(webhookId: string, input: UpdateWebhookInput): Promise<Response<Webhook>>;
|
|
1798
|
+
/** Delete a webhook endpoint. */
|
|
1799
|
+
delete(webhookId: string): Promise<Response<DeleteResult>>;
|
|
1800
|
+
/** Queue a test webhook delivery. */
|
|
1801
|
+
test(webhookId: string, input?: TestWebhookInput): Promise<Response<WebhookDelivery>>;
|
|
1802
|
+
/** Rotate the signing secret. The new secret is returned only once. */
|
|
1803
|
+
rotateSecret(webhookId: string): Promise<Response<Webhook>>;
|
|
1804
|
+
/** Enable a webhook endpoint. */
|
|
1805
|
+
enable(webhookId: string): Promise<Response<Webhook>>;
|
|
1806
|
+
/** Disable a webhook endpoint. */
|
|
1807
|
+
disable(webhookId: string): Promise<Response<Webhook>>;
|
|
1808
|
+
/** List deliveries for a webhook. */
|
|
1809
|
+
deliveries(webhookId: string, options?: WebhookDeliveryListOptions): Promise<Collection<WebhookDelivery>>;
|
|
1810
|
+
/** Retrieve one webhook delivery. */
|
|
1811
|
+
delivery(deliveryId: string): Promise<Response<WebhookDelivery>>;
|
|
1812
|
+
/** Alias of {@link Webhooks.deliveries}. */
|
|
1813
|
+
logs(webhookId: string, options?: WebhookDeliveryListOptions): Promise<Collection<WebhookDelivery>>;
|
|
1814
|
+
/** List failed deliveries for a webhook. */
|
|
1815
|
+
failures(webhookId: string, options?: Omit<WebhookDeliveryListOptions, 'status'>): Promise<Collection<WebhookDelivery>>;
|
|
1816
|
+
/** Replay webhook deliveries in bulk. */
|
|
1817
|
+
replay(webhookId: string, input?: ReplayWebhookInput): Promise<Response<Record<string, unknown>>>;
|
|
1818
|
+
/** Retry one webhook delivery. */
|
|
1819
|
+
retry(deliveryId: string): Promise<Response<WebhookDelivery>>;
|
|
1820
|
+
/** Verify a MailerMine HMAC-SHA256 webhook signature locally. */
|
|
1821
|
+
static verify(payload: string, signature: string, secret: string): boolean;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
/**
|
|
1825
|
+
* Official MailerMine Node.js SDK client.
|
|
1826
|
+
*
|
|
1827
|
+
* @example
|
|
1828
|
+
* ```ts
|
|
1829
|
+
* const mm = new MailerMine({
|
|
1830
|
+
* apiKey: process.env.MAILERMINE_API_KEY!,
|
|
1831
|
+
* });
|
|
1832
|
+
*
|
|
1833
|
+
* await mm.emails.send({
|
|
1834
|
+
* from: 'hello@example.com',
|
|
1835
|
+
* to: 'user@example.com',
|
|
1836
|
+
* subject: 'Welcome',
|
|
1837
|
+
* html: '<p>Hello</p>',
|
|
1838
|
+
* text: 'Hello',
|
|
1839
|
+
* });
|
|
1840
|
+
* ```
|
|
1841
|
+
*/
|
|
1842
|
+
declare class MailerMine {
|
|
1843
|
+
readonly configuration: Configuration;
|
|
1844
|
+
private readonly apis;
|
|
1845
|
+
private emailsResource?;
|
|
1846
|
+
private projectsResource?;
|
|
1847
|
+
private apiKeysResource?;
|
|
1848
|
+
private domainsResource?;
|
|
1849
|
+
private templatesResource?;
|
|
1850
|
+
private contactsResource?;
|
|
1851
|
+
private listsResource?;
|
|
1852
|
+
private segmentsResource?;
|
|
1853
|
+
private tagsResource?;
|
|
1854
|
+
private audiencesResource?;
|
|
1855
|
+
private campaignsResource?;
|
|
1856
|
+
private importsResource?;
|
|
1857
|
+
private exportsResource?;
|
|
1858
|
+
private analyticsResource?;
|
|
1859
|
+
private eventsResource?;
|
|
1860
|
+
private messagesResource?;
|
|
1861
|
+
private webhooksResource?;
|
|
1862
|
+
private suppressionsResource?;
|
|
1863
|
+
constructor(apiKeyOrOptions: string | ConfigurationOptions | Configuration);
|
|
1864
|
+
/** Transactional email operations. */
|
|
1865
|
+
get emails(): Emails;
|
|
1866
|
+
/** Workspace project operations. */
|
|
1867
|
+
get projects(): Projects;
|
|
1868
|
+
/** Project API key operations. */
|
|
1869
|
+
get apiKeys(): ApiKeys;
|
|
1870
|
+
/** Sending domain operations. */
|
|
1871
|
+
get domains(): Domains;
|
|
1872
|
+
/** Email template operations. */
|
|
1873
|
+
get templates(): Templates;
|
|
1874
|
+
/** Contact operations. */
|
|
1875
|
+
get contacts(): Contacts;
|
|
1876
|
+
/** Static mailing list operations. */
|
|
1877
|
+
get lists(): Lists;
|
|
1878
|
+
/** Dynamic segment operations. */
|
|
1879
|
+
get segments(): Segments;
|
|
1880
|
+
/** Contact tag operations. */
|
|
1881
|
+
get tags(): Tags;
|
|
1882
|
+
/** Unified audience catalog (lists and segments). */
|
|
1883
|
+
get audiences(): Audiences;
|
|
1884
|
+
/** Marketing campaign operations. */
|
|
1885
|
+
get campaigns(): Campaigns;
|
|
1886
|
+
/** Contact import job operations. */
|
|
1887
|
+
get imports(): Imports;
|
|
1888
|
+
/** Contact export job operations. */
|
|
1889
|
+
get exports(): Exports;
|
|
1890
|
+
/** Account-wide delivery and engagement analytics. */
|
|
1891
|
+
get analytics(): Analytics;
|
|
1892
|
+
/** Global message and delivery lifecycle events. */
|
|
1893
|
+
get events(): Events;
|
|
1894
|
+
/** Delivery logs and outbound message history. */
|
|
1895
|
+
get messages(): Messages;
|
|
1896
|
+
/** Webhook endpoint and delivery operations. */
|
|
1897
|
+
get webhooks(): Webhooks;
|
|
1898
|
+
/** Account suppression-list operations. */
|
|
1899
|
+
get suppressions(): Suppressions;
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
/**
|
|
1903
|
+
* SDK version. Keep in sync with package.json when releasing.
|
|
1904
|
+
*/
|
|
1905
|
+
declare const VERSION = "1.0.0";
|
|
1906
|
+
/**
|
|
1907
|
+
* Default MailerMine API base URL.
|
|
1908
|
+
*/
|
|
1909
|
+
declare const DEFAULT_BASE_URL = "https://mailermine.com/api/v1";
|
|
1910
|
+
/**
|
|
1911
|
+
* Default request timeout in milliseconds.
|
|
1912
|
+
*/
|
|
1913
|
+
declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
1914
|
+
/**
|
|
1915
|
+
* Default User-Agent header value.
|
|
1916
|
+
*/
|
|
1917
|
+
declare const DEFAULT_USER_AGENT = "mailermine-node/1.0.0";
|
|
1918
|
+
|
|
1919
|
+
/** Base error thrown for MailerMine API and transport failures. */
|
|
1920
|
+
declare class ApiError extends Error {
|
|
1921
|
+
readonly status: number;
|
|
1922
|
+
readonly body?: unknown | undefined;
|
|
1923
|
+
readonly name: string;
|
|
1924
|
+
constructor(message: string, status: number, body?: unknown | undefined, options?: ErrorOptions);
|
|
1925
|
+
}
|
|
1926
|
+
/** The API key is missing, invalid, expired, or revoked. */
|
|
1927
|
+
declare class AuthenticationError extends ApiError {
|
|
1928
|
+
readonly name = "AuthenticationError";
|
|
1929
|
+
}
|
|
1930
|
+
/** The account plan or API-key scope does not permit the operation. */
|
|
1931
|
+
declare class PlanError extends ApiError {
|
|
1932
|
+
readonly name = "PlanError";
|
|
1933
|
+
}
|
|
1934
|
+
/** The requested MailerMine object does not exist. */
|
|
1935
|
+
declare class NotFoundError extends ApiError {
|
|
1936
|
+
readonly name = "NotFoundError";
|
|
1937
|
+
}
|
|
1938
|
+
/** The request failed server-side validation. */
|
|
1939
|
+
declare class ValidationError extends ApiError {
|
|
1940
|
+
readonly errors: Readonly<Record<string, readonly string[]>>;
|
|
1941
|
+
readonly name = "ValidationError";
|
|
1942
|
+
constructor(message: string, status: number, errors: Readonly<Record<string, readonly string[]>>, body?: unknown, options?: ErrorOptions);
|
|
1943
|
+
}
|
|
1944
|
+
/** The API rate limit was exceeded. */
|
|
1945
|
+
declare class RateLimitError extends ApiError {
|
|
1946
|
+
readonly retryAfter: number | null;
|
|
1947
|
+
readonly name = "RateLimitError";
|
|
1948
|
+
constructor(message: string, status: number, retryAfter: number | null, body?: unknown, options?: ErrorOptions);
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
export { Analytics, type AnalyticsFilters, ApiError, type ApiKey, type ApiKeyScope, ApiKeys, type Audience, type AudienceListOptions, type AudienceSource, Audiences, AuthenticationError, type Campaign, type CampaignActivityEntry, type CampaignAnalytics, type CampaignEventEntry, type CampaignLink, type CampaignListOptions, type CampaignPreview, type CampaignProgress, type CampaignRecipient, type CampaignRecipientCount, type CampaignRecipientListOptions, type CampaignRecipientPreview, type CampaignSenderInput, type CampaignStatusSummary, type CampaignTimelineEntry, type CampaignValidation, Campaigns, Collection, Configuration, type ConfigurationOptions, type ConfigureImportInput, type Contact, type ContactList, type ContactListOptions, type ContactStatus, Contacts, type CreateApiKeyInput, type CreateAudienceInput, type CreateCampaignInput, type CreateContactInput, type CreateContactListInput, type CreateDomainInput, type CreateExportInput, type CreateImportInput, type CreateProjectInput, type CreateSegmentInput, type CreateSuppressionInput, type CreateTagInput, type CreateTemplateInput, type CreateWebhookInput, DEFAULT_BASE_URL, DEFAULT_TIMEOUT_MS, DEFAULT_USER_AGENT, type DeleteResult, type DnsRecord, type Domain, type DomainStatus, Domains, type DuplicateCampaignInput, type DuplicateTemplateInput, type EmailAttachmentInput, type EmailEvent, type EmailListOptions, type EmailMessage, Emails, type Event, type EventListOptions, Events, type ExportJob, Exports, type ImportFileInput, type ImportJob, Imports, type JsonObject, type JsonPrimitive, type JsonValue, type ListMembershipResult, type ListOptions, Lists, MailerMine, type MessageListOptions, Messages, NotFoundError, Pagination, type PaginationOptions, PlanError, type PreviewTemplateInput, type Project, type ProjectEnvironment, Projects, RateLimitError, type ReplayWebhookInput, type ResolvedConfiguration, Response, type ScheduleCampaignInput, type Segment, type SegmentListOptions, type SegmentLogic, type SegmentPreview, type SegmentRuleCondition, type SegmentRules, Segments, type SendEmailInput, type SortDirection, type Suppression, type SuppressionCheck, type SuppressionListOptions, type SuppressionReason, Suppressions, type Tag, type TagAssignmentInput, type TagAssignmentResult, type TagListOptions, Tags, type Template, type TemplateBrandingInput, type TemplatePreview, type TemplateStatus, type TemplateTestResult, type TemplateVariableInput, type TemplateVariableType, Templates, type TestTemplateInput, type TestWebhookInput, type UpdateApiKeyInput, type UpdateAudienceInput, type UpdateCampaignInput, type UpdateContactInput, type UpdateContactListInput, type UpdateProjectInput, type UpdateSegmentInput, type UpdateTagInput, type UpdateTemplateInput, type UpdateWebhookInput, VERSION, ValidationError, type Webhook, type WebhookDelivery, type WebhookDeliveryListOptions, type WebhookEventType, type WebhookListOptions, Webhooks };
|