@stack0/sdk 0.5.1 → 0.5.3
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/dist/cdn/index.d.mts +244 -1
- package/dist/cdn/index.d.ts +244 -1
- package/dist/cdn/index.js +218 -0
- package/dist/cdn/index.js.map +1 -1
- package/dist/cdn/index.mjs +218 -0
- package/dist/cdn/index.mjs.map +1 -1
- package/dist/extraction/index.d.mts +1 -1
- package/dist/extraction/index.d.ts +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +970 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +964 -14
- package/dist/index.mjs.map +1 -1
- package/dist/mail/index.d.mts +1261 -19
- package/dist/mail/index.d.ts +1261 -19
- package/dist/mail/index.js +752 -13
- package/dist/mail/index.js.map +1 -1
- package/dist/mail/index.mjs +746 -14
- package/dist/mail/index.mjs.map +1 -1
- package/dist/screenshots/index.d.mts +1 -1
- package/dist/screenshots/index.d.ts +1 -1
- package/dist/{shared-types-B0PyC7cF.d.mts → shared-types-CjKSP5Xc.d.mts} +15 -1
- package/dist/{shared-types-B0PyC7cF.d.ts → shared-types-CjKSP5Xc.d.ts} +15 -1
- package/package.json +1 -1
package/dist/mail/index.d.mts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { a as HttpClientConfig } from '../http-client-Cgie_Rv6.mjs';
|
|
1
|
+
import { H as HttpClient, a as HttpClientConfig } from '../http-client-Cgie_Rv6.mjs';
|
|
2
|
+
import { E as Environment, P as PaginatedRequest, a as PaginatedResponse } from '../shared-types-CjKSP5Xc.mjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
5
|
+
* Stack0 Mail SDK Types
|
|
6
|
+
* Complete type definitions for the Mail API
|
|
6
7
|
*/
|
|
8
|
+
|
|
7
9
|
interface EmailAddress {
|
|
8
10
|
email: string;
|
|
9
11
|
name?: string;
|
|
@@ -15,7 +17,10 @@ interface Attachment {
|
|
|
15
17
|
contentType?: string;
|
|
16
18
|
path?: string;
|
|
17
19
|
}
|
|
20
|
+
type EmailStatus = "pending" | "sent" | "delivered" | "bounced" | "failed" | "deferred" | "opened" | "clicked" | "complained" | "unsubscribed";
|
|
18
21
|
interface SendEmailRequest {
|
|
22
|
+
projectSlug?: string;
|
|
23
|
+
environment?: Environment;
|
|
19
24
|
from: EmailRecipient;
|
|
20
25
|
to: EmailRecipient | EmailRecipient[];
|
|
21
26
|
cc?: EmailRecipient | EmailRecipient[];
|
|
@@ -30,7 +35,7 @@ interface SendEmailRequest {
|
|
|
30
35
|
metadata?: Record<string, unknown>;
|
|
31
36
|
attachments?: Attachment[];
|
|
32
37
|
headers?: Record<string, string>;
|
|
33
|
-
scheduledAt?: Date;
|
|
38
|
+
scheduledAt?: Date | string;
|
|
34
39
|
}
|
|
35
40
|
interface SendEmailResponse {
|
|
36
41
|
id: string;
|
|
@@ -38,42 +43,1214 @@ interface SendEmailResponse {
|
|
|
38
43
|
to: string;
|
|
39
44
|
subject: string;
|
|
40
45
|
status: string;
|
|
41
|
-
createdAt: Date;
|
|
46
|
+
createdAt: Date | string;
|
|
47
|
+
}
|
|
48
|
+
interface SendBatchEmailRequest {
|
|
49
|
+
projectSlug?: string;
|
|
50
|
+
emails: SendEmailRequest[];
|
|
51
|
+
}
|
|
52
|
+
interface SendBatchEmailResponse {
|
|
53
|
+
success: boolean;
|
|
54
|
+
data: Array<{
|
|
55
|
+
id: string;
|
|
56
|
+
success: boolean;
|
|
57
|
+
error?: string;
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
60
|
+
interface SendBroadcastEmailRequest {
|
|
61
|
+
projectSlug?: string;
|
|
62
|
+
environment?: Environment;
|
|
63
|
+
from: EmailRecipient;
|
|
64
|
+
to: EmailRecipient[];
|
|
65
|
+
subject: string;
|
|
66
|
+
html?: string;
|
|
67
|
+
text?: string;
|
|
68
|
+
templateId?: string;
|
|
69
|
+
templateVariables?: Record<string, unknown>;
|
|
70
|
+
tags?: string[];
|
|
71
|
+
metadata?: Record<string, unknown>;
|
|
72
|
+
scheduledAt?: Date | string;
|
|
73
|
+
}
|
|
74
|
+
interface SendBroadcastEmailResponse {
|
|
75
|
+
success: boolean;
|
|
76
|
+
data: Array<{
|
|
77
|
+
id: string;
|
|
78
|
+
success: boolean;
|
|
79
|
+
error?: string;
|
|
80
|
+
}>;
|
|
81
|
+
count: number;
|
|
82
|
+
totalRequested?: number;
|
|
83
|
+
limitedByQuota?: boolean;
|
|
42
84
|
}
|
|
43
85
|
interface GetEmailResponse {
|
|
44
86
|
id: string;
|
|
45
87
|
from: string;
|
|
46
88
|
to: string;
|
|
47
89
|
subject: string;
|
|
48
|
-
status:
|
|
90
|
+
status: string;
|
|
49
91
|
html: string | null;
|
|
50
92
|
text: string | null;
|
|
51
93
|
tags: string[] | null;
|
|
52
94
|
metadata: Record<string, unknown> | null;
|
|
53
|
-
createdAt: Date;
|
|
54
|
-
sentAt
|
|
55
|
-
deliveredAt: Date | null;
|
|
56
|
-
openedAt: Date | null;
|
|
57
|
-
clickedAt: Date | null;
|
|
58
|
-
bouncedAt: Date | null;
|
|
95
|
+
createdAt: Date | string;
|
|
96
|
+
sentAt?: Date | string | null;
|
|
97
|
+
deliveredAt: Date | string | null;
|
|
98
|
+
openedAt: Date | string | null;
|
|
99
|
+
clickedAt: Date | string | null;
|
|
100
|
+
bouncedAt: Date | string | null;
|
|
59
101
|
providerMessageId: string | null;
|
|
60
102
|
}
|
|
61
|
-
interface
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
103
|
+
interface ListEmailsRequest extends PaginatedRequest {
|
|
104
|
+
projectSlug?: string;
|
|
105
|
+
environment?: Environment;
|
|
106
|
+
status?: EmailStatus;
|
|
107
|
+
from?: string;
|
|
108
|
+
to?: string;
|
|
109
|
+
subject?: string;
|
|
110
|
+
tag?: string;
|
|
111
|
+
startDate?: Date | string;
|
|
112
|
+
endDate?: Date | string;
|
|
113
|
+
sortBy?: "createdAt" | "deliveredAt" | "openedAt";
|
|
114
|
+
sortOrder?: "asc" | "desc";
|
|
115
|
+
}
|
|
116
|
+
interface Email {
|
|
117
|
+
id: string;
|
|
118
|
+
from: string;
|
|
119
|
+
to: string;
|
|
120
|
+
subject: string;
|
|
121
|
+
status: string;
|
|
122
|
+
cc: string | null;
|
|
123
|
+
replyTo: string | null;
|
|
124
|
+
messageId: string | null;
|
|
125
|
+
tags: string[] | null;
|
|
126
|
+
metadata: Record<string, unknown> | null;
|
|
127
|
+
createdAt: Date | string;
|
|
128
|
+
deliveredAt: Date | string | null;
|
|
129
|
+
openedAt: Date | string | null;
|
|
130
|
+
clickedAt: Date | string | null;
|
|
131
|
+
bouncedAt: Date | string | null;
|
|
132
|
+
providerMessageId: string | null;
|
|
133
|
+
}
|
|
134
|
+
interface ListEmailsResponse extends PaginatedResponse {
|
|
135
|
+
emails: Email[];
|
|
136
|
+
}
|
|
137
|
+
interface ResendEmailResponse {
|
|
138
|
+
success: boolean;
|
|
139
|
+
data: {
|
|
140
|
+
id: string;
|
|
141
|
+
success: boolean;
|
|
142
|
+
error?: string;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
interface CancelEmailResponse {
|
|
146
|
+
success: boolean;
|
|
147
|
+
}
|
|
148
|
+
interface EmailAnalyticsResponse {
|
|
149
|
+
total: number;
|
|
150
|
+
sent: number;
|
|
151
|
+
delivered: number;
|
|
152
|
+
bounced: number;
|
|
153
|
+
failed: number;
|
|
154
|
+
deliveryRate: number;
|
|
155
|
+
openRate: number;
|
|
156
|
+
clickRate: number;
|
|
157
|
+
}
|
|
158
|
+
interface TimeSeriesAnalyticsRequest {
|
|
159
|
+
days?: number;
|
|
160
|
+
}
|
|
161
|
+
interface TimeSeriesDataPoint {
|
|
162
|
+
date: string;
|
|
163
|
+
sent: number;
|
|
164
|
+
delivered: number;
|
|
165
|
+
opened: number;
|
|
166
|
+
clicked: number;
|
|
167
|
+
bounced: number;
|
|
168
|
+
failed: number;
|
|
169
|
+
}
|
|
170
|
+
interface TimeSeriesAnalyticsResponse {
|
|
171
|
+
data: TimeSeriesDataPoint[];
|
|
172
|
+
}
|
|
173
|
+
interface HourlyAnalyticsDataPoint {
|
|
174
|
+
hour: number;
|
|
175
|
+
sent: number;
|
|
176
|
+
delivered: number;
|
|
177
|
+
opened: number;
|
|
178
|
+
clicked: number;
|
|
179
|
+
}
|
|
180
|
+
interface HourlyAnalyticsResponse {
|
|
181
|
+
data: HourlyAnalyticsDataPoint[];
|
|
182
|
+
}
|
|
183
|
+
interface ListSendersRequest {
|
|
184
|
+
projectSlug?: string;
|
|
185
|
+
environment?: Environment;
|
|
186
|
+
search?: string;
|
|
187
|
+
}
|
|
188
|
+
interface Sender {
|
|
189
|
+
from: string;
|
|
190
|
+
total: number;
|
|
191
|
+
sent: number;
|
|
192
|
+
delivered: number;
|
|
193
|
+
bounced: number;
|
|
194
|
+
failed: number;
|
|
195
|
+
}
|
|
196
|
+
interface ListSendersResponse {
|
|
197
|
+
senders: Sender[];
|
|
198
|
+
}
|
|
199
|
+
type DomainStatus = "pending" | "verified" | "failed";
|
|
200
|
+
interface DnsRecord {
|
|
201
|
+
type: string;
|
|
202
|
+
name: string;
|
|
203
|
+
value: string;
|
|
204
|
+
priority?: number;
|
|
205
|
+
}
|
|
206
|
+
interface Domain {
|
|
207
|
+
id: string;
|
|
208
|
+
organizationId: string;
|
|
209
|
+
domain: string;
|
|
210
|
+
status: DomainStatus;
|
|
211
|
+
dkimRecord: DnsRecord[] | null;
|
|
212
|
+
spfRecord: DnsRecord | null;
|
|
213
|
+
dmarcRecord: DnsRecord | null;
|
|
214
|
+
verificationToken: string | null;
|
|
215
|
+
sesVerificationRecord: DnsRecord | null;
|
|
216
|
+
isDefault: boolean;
|
|
217
|
+
verifiedAt: Date | string | null;
|
|
218
|
+
lastCheckedAt: Date | string | null;
|
|
219
|
+
createdAt: Date | string;
|
|
220
|
+
updatedAt: Date | string | null;
|
|
221
|
+
}
|
|
222
|
+
interface ListDomainsRequest {
|
|
223
|
+
projectSlug: string;
|
|
224
|
+
environment?: Environment;
|
|
225
|
+
}
|
|
226
|
+
type ListDomainsResponse = Domain[];
|
|
227
|
+
interface AddDomainRequest {
|
|
228
|
+
domain: string;
|
|
229
|
+
}
|
|
230
|
+
interface AddDomainResponse {
|
|
231
|
+
domain?: Domain;
|
|
232
|
+
dnsRecords: {
|
|
233
|
+
domain: string;
|
|
234
|
+
dkimRecords: DnsRecord[];
|
|
235
|
+
spfRecord: DnsRecord;
|
|
236
|
+
dmarcRecord: DnsRecord;
|
|
237
|
+
verificationToken: string;
|
|
238
|
+
sesVerificationRecord?: DnsRecord;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
interface GetDnsRecordsResponse {
|
|
242
|
+
domain: string;
|
|
243
|
+
dkimRecords: DnsRecord[] | null;
|
|
244
|
+
spfRecord: DnsRecord | null;
|
|
245
|
+
dmarcRecord: DnsRecord | null;
|
|
246
|
+
sesVerificationRecord: DnsRecord | null;
|
|
247
|
+
status: DomainStatus;
|
|
248
|
+
verifiedAt: Date | string | null;
|
|
249
|
+
verificationDetails?: {
|
|
250
|
+
domainVerified: boolean;
|
|
251
|
+
dkimVerified: boolean;
|
|
252
|
+
verificationStatus: string;
|
|
253
|
+
dkimStatus: string;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
interface VerifyDomainResponse {
|
|
257
|
+
verified: boolean;
|
|
258
|
+
message: string;
|
|
259
|
+
}
|
|
260
|
+
interface DeleteDomainResponse {
|
|
261
|
+
success: boolean;
|
|
262
|
+
}
|
|
263
|
+
type SetDefaultDomainResponse = Domain;
|
|
264
|
+
interface Template {
|
|
265
|
+
id: string;
|
|
266
|
+
organizationId: string;
|
|
267
|
+
environment: Environment;
|
|
268
|
+
createdByUserId: string | null;
|
|
269
|
+
name: string;
|
|
270
|
+
slug: string;
|
|
271
|
+
description: string | null;
|
|
272
|
+
subject: string;
|
|
273
|
+
previewText: string | null;
|
|
274
|
+
html: string;
|
|
275
|
+
text: string | null;
|
|
276
|
+
mailyJson: Record<string, unknown> | null;
|
|
277
|
+
variablesSchema: Record<string, unknown> | null;
|
|
278
|
+
isActive: boolean;
|
|
279
|
+
createdAt: Date | string;
|
|
280
|
+
updatedAt: Date | string | null;
|
|
281
|
+
}
|
|
282
|
+
interface CreateTemplateRequest {
|
|
283
|
+
environment?: Environment;
|
|
284
|
+
name: string;
|
|
285
|
+
slug: string;
|
|
286
|
+
description?: string;
|
|
287
|
+
subject: string;
|
|
288
|
+
previewText?: string;
|
|
289
|
+
html: string;
|
|
290
|
+
text?: string;
|
|
291
|
+
mailyJson?: Record<string, unknown>;
|
|
292
|
+
variablesSchema?: Record<string, unknown>;
|
|
293
|
+
isActive?: boolean;
|
|
294
|
+
}
|
|
295
|
+
interface UpdateTemplateRequest {
|
|
296
|
+
id: string;
|
|
297
|
+
name?: string;
|
|
298
|
+
slug?: string;
|
|
299
|
+
description?: string;
|
|
300
|
+
subject?: string;
|
|
301
|
+
previewText?: string;
|
|
302
|
+
html?: string;
|
|
303
|
+
text?: string;
|
|
304
|
+
mailyJson?: Record<string, unknown>;
|
|
305
|
+
variablesSchema?: Record<string, unknown>;
|
|
306
|
+
isActive?: boolean;
|
|
307
|
+
}
|
|
308
|
+
interface ListTemplatesRequest extends PaginatedRequest {
|
|
309
|
+
environment?: Environment;
|
|
310
|
+
isActive?: boolean;
|
|
311
|
+
search?: string;
|
|
312
|
+
}
|
|
313
|
+
interface ListTemplatesResponse extends PaginatedResponse {
|
|
314
|
+
templates: Template[];
|
|
315
|
+
}
|
|
316
|
+
interface DeleteTemplateResponse {
|
|
317
|
+
success: boolean;
|
|
318
|
+
}
|
|
319
|
+
interface PreviewTemplateRequest {
|
|
320
|
+
id: string;
|
|
321
|
+
variables: Record<string, unknown>;
|
|
322
|
+
}
|
|
323
|
+
interface PreviewTemplateResponse {
|
|
324
|
+
subject: string;
|
|
325
|
+
html: string;
|
|
326
|
+
text: string | null;
|
|
327
|
+
}
|
|
328
|
+
interface Audience {
|
|
329
|
+
id: string;
|
|
330
|
+
organizationId: string;
|
|
331
|
+
projectId: string | null;
|
|
332
|
+
environment: string;
|
|
333
|
+
name: string;
|
|
334
|
+
description: string | null;
|
|
335
|
+
totalContacts: number;
|
|
336
|
+
subscribedContacts: number;
|
|
337
|
+
unsubscribedContacts: number;
|
|
338
|
+
createdByUserId: string | null;
|
|
339
|
+
createdAt: Date | string;
|
|
340
|
+
updatedAt: Date | string | null;
|
|
341
|
+
}
|
|
342
|
+
interface CreateAudienceRequest {
|
|
343
|
+
environment?: Environment;
|
|
344
|
+
name: string;
|
|
345
|
+
description?: string;
|
|
346
|
+
}
|
|
347
|
+
interface UpdateAudienceRequest {
|
|
348
|
+
id: string;
|
|
349
|
+
name?: string;
|
|
350
|
+
description?: string;
|
|
351
|
+
}
|
|
352
|
+
interface ListAudiencesRequest extends PaginatedRequest {
|
|
353
|
+
environment?: Environment;
|
|
354
|
+
search?: string;
|
|
355
|
+
}
|
|
356
|
+
interface ListAudiencesResponse extends PaginatedResponse {
|
|
357
|
+
audiences: Audience[];
|
|
358
|
+
}
|
|
359
|
+
interface DeleteAudienceResponse {
|
|
360
|
+
success: boolean;
|
|
361
|
+
}
|
|
362
|
+
interface AddContactsToAudienceRequest {
|
|
363
|
+
id: string;
|
|
364
|
+
contactIds: string[];
|
|
365
|
+
}
|
|
366
|
+
interface AddContactsToAudienceResponse {
|
|
367
|
+
success: boolean;
|
|
368
|
+
added: number;
|
|
369
|
+
}
|
|
370
|
+
interface RemoveContactsFromAudienceRequest {
|
|
371
|
+
id: string;
|
|
372
|
+
contactIds: string[];
|
|
373
|
+
}
|
|
374
|
+
interface RemoveContactsFromAudienceResponse {
|
|
375
|
+
success: boolean;
|
|
376
|
+
removed: number;
|
|
377
|
+
}
|
|
378
|
+
type ContactStatus = "subscribed" | "unsubscribed" | "bounced" | "complained";
|
|
379
|
+
interface MailContact {
|
|
380
|
+
id: string;
|
|
381
|
+
organizationId: string;
|
|
382
|
+
projectId: string | null;
|
|
383
|
+
environment: string;
|
|
384
|
+
email: string;
|
|
385
|
+
firstName: string | null;
|
|
386
|
+
lastName: string | null;
|
|
387
|
+
metadata: Record<string, unknown> | null;
|
|
388
|
+
status: string;
|
|
389
|
+
subscribedAt: Date | string | null;
|
|
390
|
+
unsubscribedAt: Date | string | null;
|
|
391
|
+
createdAt: Date | string;
|
|
392
|
+
updatedAt: Date | string | null;
|
|
393
|
+
}
|
|
394
|
+
interface AudienceContact extends MailContact {
|
|
395
|
+
addedAt: Date | string | null;
|
|
396
|
+
}
|
|
397
|
+
interface CreateContactRequest {
|
|
398
|
+
environment?: Environment;
|
|
399
|
+
email: string;
|
|
400
|
+
firstName?: string;
|
|
401
|
+
lastName?: string;
|
|
402
|
+
metadata?: Record<string, unknown>;
|
|
403
|
+
}
|
|
404
|
+
interface UpdateContactRequest {
|
|
405
|
+
id: string;
|
|
406
|
+
email?: string;
|
|
407
|
+
firstName?: string;
|
|
408
|
+
lastName?: string;
|
|
409
|
+
metadata?: Record<string, unknown>;
|
|
410
|
+
status?: ContactStatus;
|
|
411
|
+
}
|
|
412
|
+
interface ListContactsRequest extends PaginatedRequest {
|
|
413
|
+
environment?: Environment;
|
|
414
|
+
search?: string;
|
|
415
|
+
status?: ContactStatus;
|
|
416
|
+
}
|
|
417
|
+
interface ListContactsResponse extends PaginatedResponse {
|
|
418
|
+
contacts: MailContact[];
|
|
419
|
+
}
|
|
420
|
+
interface ListAudienceContactsRequest extends PaginatedRequest {
|
|
421
|
+
id: string;
|
|
422
|
+
environment?: Environment;
|
|
423
|
+
search?: string;
|
|
424
|
+
status?: ContactStatus;
|
|
425
|
+
}
|
|
426
|
+
interface ListAudienceContactsResponse extends PaginatedResponse {
|
|
427
|
+
contacts: AudienceContact[];
|
|
428
|
+
}
|
|
429
|
+
interface DeleteContactResponse {
|
|
430
|
+
success: boolean;
|
|
431
|
+
}
|
|
432
|
+
interface ImportContactsRequest {
|
|
433
|
+
environment?: Environment;
|
|
434
|
+
audienceId?: string;
|
|
435
|
+
contacts: Array<{
|
|
436
|
+
email: string;
|
|
437
|
+
firstName?: string;
|
|
438
|
+
lastName?: string;
|
|
439
|
+
metadata?: Record<string, unknown>;
|
|
440
|
+
}>;
|
|
441
|
+
}
|
|
442
|
+
interface ImportContactsResponse {
|
|
443
|
+
success: boolean;
|
|
444
|
+
imported: number;
|
|
445
|
+
skipped: number;
|
|
446
|
+
errors: Array<{
|
|
447
|
+
email: string;
|
|
448
|
+
error: string;
|
|
449
|
+
}>;
|
|
450
|
+
}
|
|
451
|
+
type CampaignStatus = "draft" | "scheduled" | "sending" | "sent" | "paused" | "cancelled" | "failed";
|
|
452
|
+
interface Campaign {
|
|
453
|
+
id: string;
|
|
454
|
+
organizationId: string;
|
|
455
|
+
projectId: string | null;
|
|
456
|
+
environment: string;
|
|
457
|
+
name: string;
|
|
458
|
+
subject: string;
|
|
459
|
+
previewText: string | null;
|
|
460
|
+
fromEmail: string;
|
|
461
|
+
fromName: string | null;
|
|
462
|
+
replyTo: string | null;
|
|
463
|
+
templateId: string | null;
|
|
464
|
+
html: string | null;
|
|
465
|
+
text: string | null;
|
|
466
|
+
audienceId: string | null;
|
|
467
|
+
status: string;
|
|
468
|
+
scheduledAt: Date | string | null;
|
|
469
|
+
sentAt: Date | string | null;
|
|
470
|
+
completedAt: Date | string | null;
|
|
471
|
+
totalRecipients: number;
|
|
472
|
+
sentCount: number;
|
|
473
|
+
deliveredCount: number;
|
|
474
|
+
openedCount: number;
|
|
475
|
+
clickedCount: number;
|
|
476
|
+
bouncedCount: number;
|
|
477
|
+
failedCount: number;
|
|
478
|
+
tags: string[] | null;
|
|
479
|
+
metadata: Record<string, unknown> | null;
|
|
480
|
+
createdByUserId: string | null;
|
|
481
|
+
createdAt: Date | string;
|
|
482
|
+
updatedAt: Date | string | null;
|
|
483
|
+
}
|
|
484
|
+
interface CreateCampaignRequest {
|
|
485
|
+
environment?: Environment;
|
|
486
|
+
name: string;
|
|
487
|
+
subject: string;
|
|
488
|
+
previewText?: string;
|
|
489
|
+
fromEmail: string;
|
|
490
|
+
fromName?: string;
|
|
491
|
+
replyTo?: string;
|
|
492
|
+
templateId?: string;
|
|
493
|
+
html?: string;
|
|
494
|
+
text?: string;
|
|
495
|
+
audienceId?: string;
|
|
496
|
+
scheduledAt?: Date | string;
|
|
497
|
+
tags?: string[];
|
|
498
|
+
}
|
|
499
|
+
interface UpdateCampaignRequest {
|
|
500
|
+
id: string;
|
|
501
|
+
name?: string;
|
|
502
|
+
subject?: string;
|
|
503
|
+
previewText?: string;
|
|
504
|
+
fromEmail?: string;
|
|
505
|
+
fromName?: string;
|
|
506
|
+
replyTo?: string;
|
|
507
|
+
templateId?: string;
|
|
508
|
+
html?: string;
|
|
509
|
+
text?: string;
|
|
510
|
+
audienceId?: string;
|
|
511
|
+
scheduledAt?: Date | string;
|
|
512
|
+
tags?: string[];
|
|
513
|
+
}
|
|
514
|
+
interface ListCampaignsRequest extends PaginatedRequest {
|
|
515
|
+
environment?: Environment;
|
|
516
|
+
search?: string;
|
|
517
|
+
status?: CampaignStatus;
|
|
518
|
+
}
|
|
519
|
+
interface ListCampaignsResponse extends PaginatedResponse {
|
|
520
|
+
campaigns: Campaign[];
|
|
521
|
+
}
|
|
522
|
+
interface DeleteCampaignResponse {
|
|
523
|
+
success: boolean;
|
|
524
|
+
}
|
|
525
|
+
interface SendCampaignRequest {
|
|
526
|
+
id: string;
|
|
527
|
+
sendNow?: boolean;
|
|
528
|
+
scheduledAt?: Date | string;
|
|
529
|
+
}
|
|
530
|
+
interface SendCampaignResponse {
|
|
531
|
+
success: boolean;
|
|
532
|
+
sentCount: number;
|
|
533
|
+
failedCount: number;
|
|
534
|
+
totalRecipients: number;
|
|
535
|
+
}
|
|
536
|
+
interface PauseCampaignResponse {
|
|
537
|
+
success: boolean;
|
|
538
|
+
}
|
|
539
|
+
interface CancelCampaignResponse {
|
|
540
|
+
success: boolean;
|
|
541
|
+
}
|
|
542
|
+
interface CampaignStatsResponse {
|
|
543
|
+
total: number;
|
|
544
|
+
sent: number;
|
|
545
|
+
delivered: number;
|
|
546
|
+
opened: number;
|
|
547
|
+
clicked: number;
|
|
548
|
+
bounced: number;
|
|
549
|
+
failed: number;
|
|
550
|
+
deliveryRate: number;
|
|
551
|
+
openRate: number;
|
|
552
|
+
clickRate: number;
|
|
553
|
+
bounceRate: number;
|
|
554
|
+
}
|
|
555
|
+
type SequenceStatus = "draft" | "active" | "paused" | "archived";
|
|
556
|
+
type SequenceTriggerType = "manual" | "event_received" | "contact_added" | "api" | "scheduled";
|
|
557
|
+
type SequenceTriggerFrequency = "once" | "always";
|
|
558
|
+
type SequenceNodeType = "trigger" | "email" | "timer" | "filter" | "branch" | "experiment" | "exit" | "add_to_list" | "update_contact";
|
|
559
|
+
type ConnectionType = "default" | "yes" | "no" | "branch" | "variant";
|
|
560
|
+
interface Sequence {
|
|
561
|
+
id: string;
|
|
562
|
+
organizationId: string;
|
|
563
|
+
environment: string;
|
|
564
|
+
name: string;
|
|
565
|
+
description: string | null;
|
|
566
|
+
triggerType: SequenceTriggerType;
|
|
567
|
+
triggerFrequency: SequenceTriggerFrequency;
|
|
568
|
+
triggerConfig: Record<string, unknown> | null;
|
|
569
|
+
audienceFilterId: string | null;
|
|
570
|
+
status: SequenceStatus;
|
|
571
|
+
totalEntered: number;
|
|
572
|
+
totalCompleted: number;
|
|
573
|
+
totalActive: number;
|
|
574
|
+
publishedAt: Date | string | null;
|
|
575
|
+
pausedAt: Date | string | null;
|
|
576
|
+
archivedAt: Date | string | null;
|
|
577
|
+
createdByUserId: string | null;
|
|
578
|
+
createdAt: Date | string;
|
|
579
|
+
updatedAt: Date | string | null;
|
|
580
|
+
}
|
|
581
|
+
interface SequenceNode {
|
|
582
|
+
id: string;
|
|
583
|
+
loopId: string;
|
|
584
|
+
nodeType: SequenceNodeType;
|
|
585
|
+
name: string;
|
|
586
|
+
positionX: number;
|
|
587
|
+
positionY: number;
|
|
588
|
+
sortOrder: number;
|
|
589
|
+
config: Record<string, unknown> | null;
|
|
590
|
+
createdAt: Date | string;
|
|
591
|
+
updatedAt: Date | string | null;
|
|
592
|
+
}
|
|
593
|
+
interface SequenceConnection {
|
|
594
|
+
id: string;
|
|
595
|
+
loopId: string;
|
|
596
|
+
sourceNodeId: string;
|
|
597
|
+
targetNodeId: string;
|
|
598
|
+
connectionType: ConnectionType;
|
|
599
|
+
label: string | null;
|
|
600
|
+
createdAt: Date | string;
|
|
601
|
+
}
|
|
602
|
+
interface SequenceWithNodes extends Sequence {
|
|
603
|
+
nodes: SequenceNode[];
|
|
604
|
+
connections: SequenceConnection[];
|
|
605
|
+
}
|
|
606
|
+
interface CreateSequenceRequest {
|
|
607
|
+
environment?: Environment;
|
|
608
|
+
name: string;
|
|
609
|
+
description?: string;
|
|
610
|
+
triggerType: SequenceTriggerType;
|
|
611
|
+
triggerFrequency?: SequenceTriggerFrequency;
|
|
612
|
+
triggerConfig?: Record<string, unknown>;
|
|
613
|
+
audienceFilterId?: string;
|
|
614
|
+
}
|
|
615
|
+
interface UpdateSequenceRequest {
|
|
616
|
+
id: string;
|
|
617
|
+
name?: string;
|
|
618
|
+
description?: string;
|
|
619
|
+
triggerType?: SequenceTriggerType;
|
|
620
|
+
triggerFrequency?: SequenceTriggerFrequency;
|
|
621
|
+
triggerConfig?: Record<string, unknown>;
|
|
622
|
+
audienceFilterId?: string;
|
|
623
|
+
}
|
|
624
|
+
interface ListSequencesRequest extends PaginatedRequest {
|
|
625
|
+
environment?: Environment;
|
|
626
|
+
search?: string;
|
|
627
|
+
status?: SequenceStatus;
|
|
628
|
+
triggerType?: SequenceTriggerType;
|
|
629
|
+
}
|
|
630
|
+
interface ListSequencesResponse extends PaginatedResponse {
|
|
631
|
+
sequences: Sequence[];
|
|
632
|
+
}
|
|
633
|
+
interface DeleteSequenceResponse {
|
|
634
|
+
success: boolean;
|
|
635
|
+
}
|
|
636
|
+
interface PublishSequenceResponse {
|
|
637
|
+
success: boolean;
|
|
638
|
+
}
|
|
639
|
+
interface PauseSequenceResponse {
|
|
640
|
+
success: boolean;
|
|
641
|
+
}
|
|
642
|
+
interface ResumeSequenceResponse {
|
|
643
|
+
success: boolean;
|
|
644
|
+
}
|
|
645
|
+
interface ArchiveSequenceResponse {
|
|
646
|
+
success: boolean;
|
|
647
|
+
}
|
|
648
|
+
interface CreateNodeRequest {
|
|
649
|
+
id: string;
|
|
650
|
+
nodeType: SequenceNodeType;
|
|
651
|
+
name: string;
|
|
652
|
+
positionX: number;
|
|
653
|
+
positionY: number;
|
|
654
|
+
sortOrder?: number;
|
|
655
|
+
config?: Record<string, unknown>;
|
|
656
|
+
}
|
|
657
|
+
interface UpdateNodeRequest {
|
|
658
|
+
id: string;
|
|
659
|
+
nodeId: string;
|
|
660
|
+
name?: string;
|
|
661
|
+
positionX?: number;
|
|
662
|
+
positionY?: number;
|
|
663
|
+
sortOrder?: number;
|
|
664
|
+
config?: Record<string, unknown>;
|
|
665
|
+
}
|
|
666
|
+
interface UpdateNodePositionRequest {
|
|
667
|
+
id: string;
|
|
668
|
+
nodeId: string;
|
|
669
|
+
positionX: number;
|
|
670
|
+
positionY: number;
|
|
671
|
+
}
|
|
672
|
+
interface DeleteNodeResponse {
|
|
673
|
+
success: boolean;
|
|
674
|
+
}
|
|
675
|
+
interface SetNodeEmailRequest {
|
|
676
|
+
nodeId: string;
|
|
677
|
+
subject?: string;
|
|
678
|
+
previewText?: string;
|
|
679
|
+
html?: string;
|
|
680
|
+
text?: string;
|
|
681
|
+
templateId?: string;
|
|
682
|
+
mailyJson?: Record<string, unknown>;
|
|
683
|
+
fromEmail?: string;
|
|
684
|
+
fromName?: string;
|
|
685
|
+
replyTo?: string;
|
|
686
|
+
}
|
|
687
|
+
interface SetNodeTimerRequest {
|
|
688
|
+
nodeId: string;
|
|
689
|
+
delayAmount: number;
|
|
690
|
+
delayUnit: "minutes" | "hours" | "days" | "weeks";
|
|
691
|
+
waitUntilTime?: string;
|
|
692
|
+
waitUntilTimezone?: string;
|
|
693
|
+
}
|
|
694
|
+
interface SetNodeFilterRequest {
|
|
695
|
+
nodeId: string;
|
|
696
|
+
conditions: Record<string, unknown>;
|
|
697
|
+
nonMatchAction?: "stop" | "continue";
|
|
698
|
+
}
|
|
699
|
+
interface SetNodeBranchRequest {
|
|
700
|
+
nodeId: string;
|
|
701
|
+
branches: Array<{
|
|
702
|
+
name: string;
|
|
703
|
+
conditions: Record<string, unknown>;
|
|
704
|
+
}>;
|
|
705
|
+
hasDefaultBranch?: boolean;
|
|
706
|
+
}
|
|
707
|
+
interface SetNodeExperimentRequest {
|
|
708
|
+
nodeId: string;
|
|
709
|
+
sampleSize?: number;
|
|
710
|
+
variants: Array<{
|
|
711
|
+
name: string;
|
|
712
|
+
weight: number;
|
|
713
|
+
}>;
|
|
714
|
+
}
|
|
715
|
+
interface CreateConnectionRequest {
|
|
716
|
+
id: string;
|
|
717
|
+
sourceNodeId: string;
|
|
718
|
+
targetNodeId: string;
|
|
719
|
+
connectionType?: ConnectionType;
|
|
720
|
+
label?: string;
|
|
721
|
+
}
|
|
722
|
+
interface DeleteConnectionResponse {
|
|
723
|
+
success: boolean;
|
|
724
|
+
}
|
|
725
|
+
type SequenceEntryStatus = "active" | "paused" | "completed" | "stopped" | "failed";
|
|
726
|
+
interface SequenceEntry {
|
|
727
|
+
id: string;
|
|
728
|
+
loopId: string;
|
|
729
|
+
contactId: string;
|
|
730
|
+
currentNodeId: string | null;
|
|
731
|
+
status: SequenceEntryStatus;
|
|
732
|
+
enteredAt: Date | string;
|
|
733
|
+
exitedAt: Date | string | null;
|
|
734
|
+
exitReason: string | null;
|
|
735
|
+
contact?: MailContact;
|
|
736
|
+
}
|
|
737
|
+
interface ListSequenceEntriesRequest extends PaginatedRequest {
|
|
738
|
+
id: string;
|
|
739
|
+
status?: SequenceEntryStatus;
|
|
740
|
+
}
|
|
741
|
+
interface ListSequenceEntriesResponse extends PaginatedResponse {
|
|
742
|
+
entries: SequenceEntry[];
|
|
743
|
+
}
|
|
744
|
+
interface AddContactToSequenceRequest {
|
|
745
|
+
id: string;
|
|
746
|
+
contactId: string;
|
|
747
|
+
}
|
|
748
|
+
interface RemoveContactFromSequenceRequest {
|
|
749
|
+
id: string;
|
|
750
|
+
entryId: string;
|
|
751
|
+
reason?: string;
|
|
752
|
+
}
|
|
753
|
+
interface RemoveContactFromSequenceResponse {
|
|
754
|
+
success: boolean;
|
|
755
|
+
}
|
|
756
|
+
interface SequenceAnalyticsResponse {
|
|
757
|
+
sequence: {
|
|
758
|
+
totalEntered: number;
|
|
759
|
+
totalCompleted: number;
|
|
760
|
+
totalActive: number;
|
|
761
|
+
};
|
|
762
|
+
statusBreakdown: Record<string, number>;
|
|
763
|
+
nodeAnalytics: Array<{
|
|
764
|
+
nodeId: string;
|
|
765
|
+
entered: number;
|
|
766
|
+
exited: number;
|
|
767
|
+
emailsSent: number;
|
|
768
|
+
emailsDelivered: number;
|
|
769
|
+
emailsOpened: number;
|
|
770
|
+
emailsClicked: number;
|
|
771
|
+
emailsBounced: number;
|
|
772
|
+
passed: number;
|
|
773
|
+
filtered: number;
|
|
774
|
+
}>;
|
|
775
|
+
}
|
|
776
|
+
interface EventProperty {
|
|
777
|
+
name: string;
|
|
778
|
+
type: "string" | "number" | "boolean" | "date" | "object" | "array";
|
|
779
|
+
description?: string;
|
|
780
|
+
required?: boolean;
|
|
781
|
+
}
|
|
782
|
+
interface EventPropertiesSchema {
|
|
783
|
+
properties: EventProperty[];
|
|
784
|
+
}
|
|
785
|
+
interface MailEvent {
|
|
786
|
+
id: string;
|
|
787
|
+
organizationId: string;
|
|
788
|
+
projectId: string | null;
|
|
789
|
+
environment: string;
|
|
790
|
+
name: string;
|
|
791
|
+
description: string | null;
|
|
792
|
+
propertiesSchema: EventPropertiesSchema | null;
|
|
793
|
+
totalReceived: number;
|
|
794
|
+
lastReceivedAt: Date | string | null;
|
|
795
|
+
createdAt: Date | string;
|
|
796
|
+
updatedAt: Date | string | null;
|
|
797
|
+
}
|
|
798
|
+
interface CreateEventRequest {
|
|
799
|
+
projectSlug?: string;
|
|
800
|
+
environment?: Environment;
|
|
801
|
+
name: string;
|
|
802
|
+
description?: string;
|
|
803
|
+
propertiesSchema?: EventPropertiesSchema;
|
|
804
|
+
}
|
|
805
|
+
interface UpdateEventRequest {
|
|
806
|
+
id: string;
|
|
807
|
+
name?: string;
|
|
808
|
+
description?: string;
|
|
809
|
+
propertiesSchema?: EventPropertiesSchema;
|
|
810
|
+
}
|
|
811
|
+
interface ListEventsRequest extends PaginatedRequest {
|
|
812
|
+
projectSlug?: string;
|
|
813
|
+
environment?: Environment;
|
|
814
|
+
search?: string;
|
|
815
|
+
}
|
|
816
|
+
interface ListEventsResponse extends PaginatedResponse {
|
|
817
|
+
events: MailEvent[];
|
|
818
|
+
}
|
|
819
|
+
interface DeleteEventResponse {
|
|
820
|
+
success: boolean;
|
|
821
|
+
}
|
|
822
|
+
interface TrackEventRequest {
|
|
823
|
+
environment?: Environment;
|
|
824
|
+
eventName: string;
|
|
825
|
+
contactId?: string;
|
|
826
|
+
contactEmail?: string;
|
|
827
|
+
properties?: Record<string, unknown>;
|
|
828
|
+
}
|
|
829
|
+
interface TrackEventResponse {
|
|
830
|
+
success: boolean;
|
|
831
|
+
eventOccurrenceId?: string;
|
|
832
|
+
error?: string;
|
|
833
|
+
}
|
|
834
|
+
interface BatchTrackEventsRequest {
|
|
835
|
+
environment?: Environment;
|
|
836
|
+
events: Array<{
|
|
837
|
+
eventName: string;
|
|
838
|
+
contactId?: string;
|
|
839
|
+
contactEmail?: string;
|
|
840
|
+
properties?: Record<string, unknown>;
|
|
841
|
+
timestamp?: Date | string;
|
|
842
|
+
}>;
|
|
843
|
+
}
|
|
844
|
+
interface BatchTrackEventsResponse {
|
|
845
|
+
success: boolean;
|
|
846
|
+
results: Array<{
|
|
847
|
+
success: boolean;
|
|
848
|
+
eventOccurrenceId?: string;
|
|
849
|
+
error?: string;
|
|
850
|
+
}>;
|
|
851
|
+
totalProcessed: number;
|
|
852
|
+
totalFailed: number;
|
|
853
|
+
}
|
|
854
|
+
interface EventOccurrence {
|
|
855
|
+
id: string;
|
|
856
|
+
eventId: string;
|
|
857
|
+
contactId: string;
|
|
858
|
+
properties: Record<string, unknown> | null;
|
|
859
|
+
processed: boolean;
|
|
860
|
+
processedAt: Date | string | null;
|
|
861
|
+
createdAt: Date | string;
|
|
862
|
+
}
|
|
863
|
+
interface ListEventOccurrencesRequest extends PaginatedRequest {
|
|
864
|
+
eventId?: string;
|
|
865
|
+
contactId?: string;
|
|
866
|
+
startDate?: Date | string;
|
|
867
|
+
endDate?: Date | string;
|
|
868
|
+
}
|
|
869
|
+
interface ListEventOccurrencesResponse extends PaginatedResponse {
|
|
870
|
+
occurrences: EventOccurrence[];
|
|
871
|
+
}
|
|
872
|
+
interface EventAnalyticsResponse {
|
|
873
|
+
totalReceived: number;
|
|
874
|
+
lastReceivedAt: Date | string | null;
|
|
875
|
+
uniqueContacts: number;
|
|
876
|
+
dailyCounts: Array<{
|
|
877
|
+
date: string;
|
|
878
|
+
count: number;
|
|
879
|
+
}>;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Audiences client for Stack0 Mail API
|
|
884
|
+
*/
|
|
885
|
+
|
|
886
|
+
declare class Audiences {
|
|
887
|
+
private http;
|
|
888
|
+
constructor(http: HttpClient);
|
|
889
|
+
/**
|
|
890
|
+
* List all audiences
|
|
891
|
+
*/
|
|
892
|
+
list(request?: ListAudiencesRequest): Promise<ListAudiencesResponse>;
|
|
893
|
+
/**
|
|
894
|
+
* Get an audience by ID
|
|
895
|
+
*/
|
|
896
|
+
get(id: string): Promise<Audience>;
|
|
897
|
+
/**
|
|
898
|
+
* Create a new audience
|
|
899
|
+
*/
|
|
900
|
+
create(request: CreateAudienceRequest): Promise<Audience>;
|
|
901
|
+
/**
|
|
902
|
+
* Update an audience
|
|
903
|
+
*/
|
|
904
|
+
update(request: UpdateAudienceRequest): Promise<Audience>;
|
|
905
|
+
/**
|
|
906
|
+
* Delete an audience
|
|
907
|
+
*/
|
|
908
|
+
delete(id: string): Promise<DeleteAudienceResponse>;
|
|
909
|
+
/**
|
|
910
|
+
* List contacts in an audience
|
|
911
|
+
*/
|
|
912
|
+
listContacts(request: ListAudienceContactsRequest): Promise<ListAudienceContactsResponse>;
|
|
913
|
+
/**
|
|
914
|
+
* Add contacts to an audience
|
|
915
|
+
*/
|
|
916
|
+
addContacts(request: AddContactsToAudienceRequest): Promise<AddContactsToAudienceResponse>;
|
|
917
|
+
/**
|
|
918
|
+
* Remove contacts from an audience
|
|
919
|
+
*/
|
|
920
|
+
removeContacts(request: RemoveContactsFromAudienceRequest): Promise<RemoveContactsFromAudienceResponse>;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Campaigns client for Stack0 Mail API
|
|
925
|
+
*/
|
|
926
|
+
|
|
927
|
+
declare class Campaigns {
|
|
928
|
+
private http;
|
|
929
|
+
constructor(http: HttpClient);
|
|
930
|
+
/**
|
|
931
|
+
* List all campaigns
|
|
932
|
+
*/
|
|
933
|
+
list(request?: ListCampaignsRequest): Promise<ListCampaignsResponse>;
|
|
934
|
+
/**
|
|
935
|
+
* Get a campaign by ID
|
|
936
|
+
*/
|
|
937
|
+
get(id: string): Promise<Campaign>;
|
|
938
|
+
/**
|
|
939
|
+
* Create a new campaign
|
|
940
|
+
*/
|
|
941
|
+
create(request: CreateCampaignRequest): Promise<Campaign>;
|
|
942
|
+
/**
|
|
943
|
+
* Update a campaign
|
|
944
|
+
*/
|
|
945
|
+
update(request: UpdateCampaignRequest): Promise<Campaign>;
|
|
946
|
+
/**
|
|
947
|
+
* Delete a campaign
|
|
948
|
+
*/
|
|
949
|
+
delete(id: string): Promise<DeleteCampaignResponse>;
|
|
950
|
+
/**
|
|
951
|
+
* Send a campaign
|
|
952
|
+
*/
|
|
953
|
+
send(request: SendCampaignRequest): Promise<SendCampaignResponse>;
|
|
954
|
+
/**
|
|
955
|
+
* Pause a sending campaign
|
|
956
|
+
*/
|
|
957
|
+
pause(id: string): Promise<PauseCampaignResponse>;
|
|
958
|
+
/**
|
|
959
|
+
* Cancel a campaign
|
|
960
|
+
*/
|
|
961
|
+
cancel(id: string): Promise<CancelCampaignResponse>;
|
|
962
|
+
/**
|
|
963
|
+
* Duplicate a campaign
|
|
964
|
+
*/
|
|
965
|
+
duplicate(id: string): Promise<Campaign>;
|
|
966
|
+
/**
|
|
967
|
+
* Get campaign statistics
|
|
968
|
+
*/
|
|
969
|
+
getStats(id: string): Promise<CampaignStatsResponse>;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* Contacts client for Stack0 Mail API
|
|
974
|
+
*/
|
|
975
|
+
|
|
976
|
+
declare class Contacts {
|
|
977
|
+
private http;
|
|
978
|
+
constructor(http: HttpClient);
|
|
979
|
+
/**
|
|
980
|
+
* List all contacts
|
|
981
|
+
*/
|
|
982
|
+
list(request?: ListContactsRequest): Promise<ListContactsResponse>;
|
|
983
|
+
/**
|
|
984
|
+
* Get a contact by ID
|
|
985
|
+
*/
|
|
986
|
+
get(id: string): Promise<MailContact>;
|
|
987
|
+
/**
|
|
988
|
+
* Create a new contact
|
|
989
|
+
*/
|
|
990
|
+
create(request: CreateContactRequest): Promise<MailContact>;
|
|
991
|
+
/**
|
|
992
|
+
* Update a contact
|
|
993
|
+
*/
|
|
994
|
+
update(request: UpdateContactRequest): Promise<MailContact>;
|
|
995
|
+
/**
|
|
996
|
+
* Delete a contact
|
|
997
|
+
*/
|
|
998
|
+
delete(id: string): Promise<DeleteContactResponse>;
|
|
999
|
+
/**
|
|
1000
|
+
* Import contacts in bulk
|
|
1001
|
+
*/
|
|
1002
|
+
import(request: ImportContactsRequest): Promise<ImportContactsResponse>;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Domains client for Stack0 Mail API
|
|
1007
|
+
*/
|
|
1008
|
+
|
|
1009
|
+
declare class Domains {
|
|
1010
|
+
private http;
|
|
1011
|
+
constructor(http: HttpClient);
|
|
1012
|
+
/**
|
|
1013
|
+
* List all domains for the organization
|
|
1014
|
+
*/
|
|
1015
|
+
list(request: ListDomainsRequest): Promise<ListDomainsResponse>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Add a new domain
|
|
1018
|
+
*/
|
|
1019
|
+
add(request: AddDomainRequest): Promise<AddDomainResponse>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Get DNS records for a domain
|
|
1022
|
+
*/
|
|
1023
|
+
getDnsRecords(domainId: string): Promise<GetDnsRecordsResponse>;
|
|
1024
|
+
/**
|
|
1025
|
+
* Verify a domain
|
|
1026
|
+
*/
|
|
1027
|
+
verify(domainId: string): Promise<VerifyDomainResponse>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Delete a domain
|
|
1030
|
+
*/
|
|
1031
|
+
delete(domainId: string): Promise<DeleteDomainResponse>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Set a domain as the default
|
|
1034
|
+
*/
|
|
1035
|
+
setDefault(domainId: string): Promise<SetDefaultDomainResponse>;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Events client for Stack0 Mail API
|
|
1040
|
+
*/
|
|
1041
|
+
|
|
1042
|
+
declare class Events {
|
|
1043
|
+
private http;
|
|
1044
|
+
constructor(http: HttpClient);
|
|
1045
|
+
/**
|
|
1046
|
+
* List all event definitions
|
|
1047
|
+
*/
|
|
1048
|
+
list(request?: ListEventsRequest): Promise<ListEventsResponse>;
|
|
1049
|
+
/**
|
|
1050
|
+
* Get an event definition by ID
|
|
1051
|
+
*/
|
|
1052
|
+
get(id: string): Promise<MailEvent>;
|
|
1053
|
+
/**
|
|
1054
|
+
* Create a new event definition
|
|
1055
|
+
*/
|
|
1056
|
+
create(request: CreateEventRequest): Promise<MailEvent>;
|
|
1057
|
+
/**
|
|
1058
|
+
* Update an event definition
|
|
1059
|
+
*/
|
|
1060
|
+
update(request: UpdateEventRequest): Promise<MailEvent>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Delete an event definition
|
|
1063
|
+
*/
|
|
1064
|
+
delete(id: string): Promise<DeleteEventResponse>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Track a single event
|
|
1067
|
+
* This can trigger email sequences configured to listen for this event
|
|
1068
|
+
*/
|
|
1069
|
+
track(request: TrackEventRequest): Promise<TrackEventResponse>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Track multiple events in a batch (max 100)
|
|
1072
|
+
*/
|
|
1073
|
+
trackBatch(request: BatchTrackEventsRequest): Promise<BatchTrackEventsResponse>;
|
|
1074
|
+
/**
|
|
1075
|
+
* List event occurrences
|
|
1076
|
+
*/
|
|
1077
|
+
listOccurrences(request?: ListEventOccurrencesRequest): Promise<ListEventOccurrencesResponse>;
|
|
1078
|
+
/**
|
|
1079
|
+
* Get analytics for an event
|
|
1080
|
+
*/
|
|
1081
|
+
getAnalytics(id: string): Promise<EventAnalyticsResponse>;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Sequences client for Stack0 Mail API
|
|
1086
|
+
*/
|
|
1087
|
+
|
|
1088
|
+
declare class Sequences {
|
|
1089
|
+
private http;
|
|
1090
|
+
constructor(http: HttpClient);
|
|
1091
|
+
/**
|
|
1092
|
+
* List all sequences
|
|
1093
|
+
*/
|
|
1094
|
+
list(request?: ListSequencesRequest): Promise<ListSequencesResponse>;
|
|
1095
|
+
/**
|
|
1096
|
+
* Get a sequence by ID with all nodes and connections
|
|
1097
|
+
*/
|
|
1098
|
+
get(id: string): Promise<SequenceWithNodes>;
|
|
1099
|
+
/**
|
|
1100
|
+
* Create a new sequence
|
|
1101
|
+
*/
|
|
1102
|
+
create(request: CreateSequenceRequest): Promise<Sequence>;
|
|
1103
|
+
/**
|
|
1104
|
+
* Update a sequence
|
|
1105
|
+
*/
|
|
1106
|
+
update(request: UpdateSequenceRequest): Promise<Sequence>;
|
|
1107
|
+
/**
|
|
1108
|
+
* Delete a sequence
|
|
1109
|
+
*/
|
|
1110
|
+
delete(id: string): Promise<DeleteSequenceResponse>;
|
|
1111
|
+
/**
|
|
1112
|
+
* Publish (activate) a sequence
|
|
1113
|
+
*/
|
|
1114
|
+
publish(id: string): Promise<PublishSequenceResponse>;
|
|
1115
|
+
/**
|
|
1116
|
+
* Pause an active sequence
|
|
1117
|
+
*/
|
|
1118
|
+
pause(id: string): Promise<PauseSequenceResponse>;
|
|
1119
|
+
/**
|
|
1120
|
+
* Resume a paused sequence
|
|
1121
|
+
*/
|
|
1122
|
+
resume(id: string): Promise<ResumeSequenceResponse>;
|
|
1123
|
+
/**
|
|
1124
|
+
* Archive a sequence
|
|
1125
|
+
*/
|
|
1126
|
+
archive(id: string): Promise<ArchiveSequenceResponse>;
|
|
1127
|
+
/**
|
|
1128
|
+
* Duplicate a sequence
|
|
1129
|
+
*/
|
|
1130
|
+
duplicate(id: string, name?: string): Promise<Sequence>;
|
|
1131
|
+
/**
|
|
1132
|
+
* Create a new node in a sequence
|
|
1133
|
+
*/
|
|
1134
|
+
createNode(request: CreateNodeRequest): Promise<SequenceNode>;
|
|
1135
|
+
/**
|
|
1136
|
+
* Update a node
|
|
1137
|
+
*/
|
|
1138
|
+
updateNode(request: UpdateNodeRequest): Promise<SequenceNode>;
|
|
1139
|
+
/**
|
|
1140
|
+
* Update node position (for visual editor)
|
|
1141
|
+
*/
|
|
1142
|
+
updateNodePosition(request: UpdateNodePositionRequest): Promise<SequenceNode>;
|
|
1143
|
+
/**
|
|
1144
|
+
* Delete a node
|
|
1145
|
+
*/
|
|
1146
|
+
deleteNode(sequenceId: string, nodeId: string): Promise<DeleteNodeResponse>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Set email node content
|
|
1149
|
+
*/
|
|
1150
|
+
setNodeEmail(sequenceId: string, request: SetNodeEmailRequest): Promise<SequenceNode>;
|
|
1151
|
+
/**
|
|
1152
|
+
* Set timer node configuration
|
|
1153
|
+
*/
|
|
1154
|
+
setNodeTimer(sequenceId: string, request: SetNodeTimerRequest): Promise<SequenceNode>;
|
|
1155
|
+
/**
|
|
1156
|
+
* Set filter node configuration
|
|
1157
|
+
*/
|
|
1158
|
+
setNodeFilter(sequenceId: string, request: SetNodeFilterRequest): Promise<SequenceNode>;
|
|
1159
|
+
/**
|
|
1160
|
+
* Set branch node configuration
|
|
1161
|
+
*/
|
|
1162
|
+
setNodeBranch(sequenceId: string, request: SetNodeBranchRequest): Promise<SequenceNode>;
|
|
1163
|
+
/**
|
|
1164
|
+
* Set experiment node configuration
|
|
1165
|
+
*/
|
|
1166
|
+
setNodeExperiment(sequenceId: string, request: SetNodeExperimentRequest): Promise<SequenceNode>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Create a connection between nodes
|
|
1169
|
+
*/
|
|
1170
|
+
createConnection(request: CreateConnectionRequest): Promise<SequenceConnection>;
|
|
1171
|
+
/**
|
|
1172
|
+
* Delete a connection
|
|
1173
|
+
*/
|
|
1174
|
+
deleteConnection(sequenceId: string, connectionId: string): Promise<DeleteConnectionResponse>;
|
|
1175
|
+
/**
|
|
1176
|
+
* List contacts in a sequence
|
|
1177
|
+
*/
|
|
1178
|
+
listEntries(request: ListSequenceEntriesRequest): Promise<ListSequenceEntriesResponse>;
|
|
1179
|
+
/**
|
|
1180
|
+
* Add a contact to a sequence
|
|
1181
|
+
*/
|
|
1182
|
+
addContact(request: AddContactToSequenceRequest): Promise<SequenceEntry>;
|
|
1183
|
+
/**
|
|
1184
|
+
* Remove a contact from a sequence
|
|
1185
|
+
*/
|
|
1186
|
+
removeContact(request: RemoveContactFromSequenceRequest): Promise<RemoveContactFromSequenceResponse>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Get sequence analytics
|
|
1189
|
+
*/
|
|
1190
|
+
getAnalytics(id: string): Promise<SequenceAnalyticsResponse>;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* Templates client for Stack0 Mail API
|
|
1195
|
+
*/
|
|
1196
|
+
|
|
1197
|
+
declare class Templates {
|
|
1198
|
+
private http;
|
|
1199
|
+
constructor(http: HttpClient);
|
|
1200
|
+
/**
|
|
1201
|
+
* List all templates
|
|
1202
|
+
*/
|
|
1203
|
+
list(request?: ListTemplatesRequest): Promise<ListTemplatesResponse>;
|
|
1204
|
+
/**
|
|
1205
|
+
* Get a template by ID
|
|
1206
|
+
*/
|
|
1207
|
+
get(id: string): Promise<Template>;
|
|
1208
|
+
/**
|
|
1209
|
+
* Get a template by slug
|
|
1210
|
+
*/
|
|
1211
|
+
getBySlug(slug: string): Promise<Template>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Create a new template
|
|
1214
|
+
*/
|
|
1215
|
+
create(request: CreateTemplateRequest): Promise<Template>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Update a template
|
|
1218
|
+
*/
|
|
1219
|
+
update(request: UpdateTemplateRequest): Promise<Template>;
|
|
1220
|
+
/**
|
|
1221
|
+
* Delete a template
|
|
1222
|
+
*/
|
|
1223
|
+
delete(id: string): Promise<DeleteTemplateResponse>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Preview a template with variables
|
|
1226
|
+
*/
|
|
1227
|
+
preview(request: PreviewTemplateRequest): Promise<PreviewTemplateResponse>;
|
|
65
1228
|
}
|
|
66
1229
|
|
|
67
1230
|
/**
|
|
68
1231
|
* Stack0 Mail Client
|
|
69
|
-
* API
|
|
1232
|
+
* Complete email API with support for transactional emails, campaigns, sequences, and more
|
|
70
1233
|
*/
|
|
71
1234
|
|
|
72
1235
|
declare class Mail {
|
|
73
1236
|
private http;
|
|
1237
|
+
/** Manage sending domains */
|
|
1238
|
+
readonly domains: Domains;
|
|
1239
|
+
/** Manage email templates */
|
|
1240
|
+
readonly templates: Templates;
|
|
1241
|
+
/** Manage contact audiences/lists */
|
|
1242
|
+
readonly audiences: Audiences;
|
|
1243
|
+
/** Manage contacts */
|
|
1244
|
+
readonly contacts: Contacts;
|
|
1245
|
+
/** Manage email campaigns */
|
|
1246
|
+
readonly campaigns: Campaigns;
|
|
1247
|
+
/** Manage automated email sequences */
|
|
1248
|
+
readonly sequences: Sequences;
|
|
1249
|
+
/** Track and manage custom events */
|
|
1250
|
+
readonly events: Events;
|
|
74
1251
|
constructor(config: HttpClientConfig);
|
|
75
1252
|
/**
|
|
76
|
-
* Send
|
|
1253
|
+
* Send a single email
|
|
77
1254
|
*
|
|
78
1255
|
* @example
|
|
79
1256
|
* ```typescript
|
|
@@ -86,6 +1263,35 @@ declare class Mail {
|
|
|
86
1263
|
* ```
|
|
87
1264
|
*/
|
|
88
1265
|
send(request: SendEmailRequest): Promise<SendEmailResponse>;
|
|
1266
|
+
/**
|
|
1267
|
+
* Send multiple emails in a batch (up to 100)
|
|
1268
|
+
* Each email can have different content and recipients
|
|
1269
|
+
*
|
|
1270
|
+
* @example
|
|
1271
|
+
* ```typescript
|
|
1272
|
+
* const result = await mail.sendBatch({
|
|
1273
|
+
* emails: [
|
|
1274
|
+
* { from: 'noreply@example.com', to: 'user1@example.com', subject: 'Hello', html: '<p>Hi User 1</p>' },
|
|
1275
|
+
* { from: 'noreply@example.com', to: 'user2@example.com', subject: 'Hello', html: '<p>Hi User 2</p>' },
|
|
1276
|
+
* ]
|
|
1277
|
+
* });
|
|
1278
|
+
* ```
|
|
1279
|
+
*/
|
|
1280
|
+
sendBatch(request: SendBatchEmailRequest): Promise<SendBatchEmailResponse>;
|
|
1281
|
+
/**
|
|
1282
|
+
* Send a broadcast email (same content to multiple recipients, up to 1000)
|
|
1283
|
+
*
|
|
1284
|
+
* @example
|
|
1285
|
+
* ```typescript
|
|
1286
|
+
* const result = await mail.sendBroadcast({
|
|
1287
|
+
* from: 'noreply@example.com',
|
|
1288
|
+
* to: ['user1@example.com', 'user2@example.com', 'user3@example.com'],
|
|
1289
|
+
* subject: 'Newsletter',
|
|
1290
|
+
* html: '<p>Our latest updates...</p>',
|
|
1291
|
+
* });
|
|
1292
|
+
* ```
|
|
1293
|
+
*/
|
|
1294
|
+
sendBroadcast(request: SendBroadcastEmailRequest): Promise<SendBroadcastEmailResponse>;
|
|
89
1295
|
/**
|
|
90
1296
|
* Get email details by ID
|
|
91
1297
|
*
|
|
@@ -96,6 +1302,42 @@ declare class Mail {
|
|
|
96
1302
|
* ```
|
|
97
1303
|
*/
|
|
98
1304
|
get(id: string): Promise<GetEmailResponse>;
|
|
1305
|
+
/**
|
|
1306
|
+
* List emails with optional filters
|
|
1307
|
+
*
|
|
1308
|
+
* @example
|
|
1309
|
+
* ```typescript
|
|
1310
|
+
* const result = await mail.list({
|
|
1311
|
+
* status: 'delivered',
|
|
1312
|
+
* limit: 50,
|
|
1313
|
+
* });
|
|
1314
|
+
* ```
|
|
1315
|
+
*/
|
|
1316
|
+
list(request?: ListEmailsRequest): Promise<ListEmailsResponse>;
|
|
1317
|
+
/**
|
|
1318
|
+
* Resend a previously sent email
|
|
1319
|
+
*/
|
|
1320
|
+
resend(id: string): Promise<ResendEmailResponse>;
|
|
1321
|
+
/**
|
|
1322
|
+
* Cancel a scheduled email
|
|
1323
|
+
*/
|
|
1324
|
+
cancel(id: string): Promise<CancelEmailResponse>;
|
|
1325
|
+
/**
|
|
1326
|
+
* Get overall email analytics
|
|
1327
|
+
*/
|
|
1328
|
+
getAnalytics(): Promise<EmailAnalyticsResponse>;
|
|
1329
|
+
/**
|
|
1330
|
+
* Get time series analytics (daily breakdown)
|
|
1331
|
+
*/
|
|
1332
|
+
getTimeSeriesAnalytics(request?: TimeSeriesAnalyticsRequest): Promise<TimeSeriesAnalyticsResponse>;
|
|
1333
|
+
/**
|
|
1334
|
+
* Get hourly analytics
|
|
1335
|
+
*/
|
|
1336
|
+
getHourlyAnalytics(): Promise<HourlyAnalyticsResponse>;
|
|
1337
|
+
/**
|
|
1338
|
+
* List unique senders with their statistics
|
|
1339
|
+
*/
|
|
1340
|
+
listSenders(request?: ListSendersRequest): Promise<ListSendersResponse>;
|
|
99
1341
|
}
|
|
100
1342
|
|
|
101
|
-
export { type Attachment, type EmailAddress, type EmailRecipient, type GetEmailResponse, Mail, type SendEmailRequest, type SendEmailResponse, type
|
|
1343
|
+
export { type AddContactToSequenceRequest, type AddContactsToAudienceRequest, type AddContactsToAudienceResponse, type AddDomainRequest, type AddDomainResponse, type ArchiveSequenceResponse, type Attachment, type Audience, type AudienceContact, Audiences, type BatchTrackEventsRequest, type BatchTrackEventsResponse, type Campaign, type CampaignStatsResponse, type CampaignStatus, Campaigns, type CancelCampaignResponse, type CancelEmailResponse, type ConnectionType, type ContactStatus, Contacts, type CreateAudienceRequest, type CreateCampaignRequest, type CreateConnectionRequest, type CreateContactRequest, type CreateEventRequest, type CreateNodeRequest, type CreateSequenceRequest, type CreateTemplateRequest, type DeleteAudienceResponse, type DeleteCampaignResponse, type DeleteConnectionResponse, type DeleteContactResponse, type DeleteDomainResponse, type DeleteEventResponse, type DeleteNodeResponse, type DeleteSequenceResponse, type DeleteTemplateResponse, type DnsRecord, type Domain, type DomainStatus, Domains, type Email, type EmailAddress, type EmailAnalyticsResponse, type EmailRecipient, type EmailStatus, type EventAnalyticsResponse, type EventOccurrence, type EventPropertiesSchema, type EventProperty, Events, type GetDnsRecordsResponse, type GetEmailResponse, type HourlyAnalyticsDataPoint, type HourlyAnalyticsResponse, type ImportContactsRequest, type ImportContactsResponse, type ListAudienceContactsRequest, type ListAudienceContactsResponse, type ListAudiencesRequest, type ListAudiencesResponse, type ListCampaignsRequest, type ListCampaignsResponse, type ListContactsRequest, type ListContactsResponse, type ListDomainsRequest, type ListDomainsResponse, type ListEmailsRequest, type ListEmailsResponse, type ListEventOccurrencesRequest, type ListEventOccurrencesResponse, type ListEventsRequest, type ListEventsResponse, type ListSendersRequest, type ListSendersResponse, type ListSequenceEntriesRequest, type ListSequenceEntriesResponse, type ListSequencesRequest, type ListSequencesResponse, type ListTemplatesRequest, type ListTemplatesResponse, Mail, type MailContact, type MailEvent, type PauseCampaignResponse, type PauseSequenceResponse, type PreviewTemplateRequest, type PreviewTemplateResponse, type PublishSequenceResponse, type RemoveContactFromSequenceRequest, type RemoveContactFromSequenceResponse, type RemoveContactsFromAudienceRequest, type RemoveContactsFromAudienceResponse, type ResendEmailResponse, type ResumeSequenceResponse, type SendBatchEmailRequest, type SendBatchEmailResponse, type SendBroadcastEmailRequest, type SendBroadcastEmailResponse, type SendCampaignRequest, type SendCampaignResponse, type SendEmailRequest, type SendEmailResponse, type Sender, type Sequence, type SequenceAnalyticsResponse, type SequenceConnection, type SequenceEntry, type SequenceEntryStatus, type SequenceNode, type SequenceNodeType, type SequenceStatus, type SequenceTriggerFrequency, type SequenceTriggerType, type SequenceWithNodes, Sequences, type SetDefaultDomainResponse, type SetNodeBranchRequest, type SetNodeEmailRequest, type SetNodeExperimentRequest, type SetNodeFilterRequest, type SetNodeTimerRequest, type Template, Templates, type TimeSeriesAnalyticsRequest, type TimeSeriesAnalyticsResponse, type TimeSeriesDataPoint, type TrackEventRequest, type TrackEventResponse, type UpdateAudienceRequest, type UpdateCampaignRequest, type UpdateContactRequest, type UpdateEventRequest, type UpdateNodePositionRequest, type UpdateNodeRequest, type UpdateSequenceRequest, type UpdateTemplateRequest, type VerifyDomainResponse };
|