@topmail/sdk 0.1.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/dist/index.d.mts +640 -0
- package/dist/index.d.ts +640 -0
- package/dist/index.js +614 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +565 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +50 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
interface ClientOptions {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
apiKey: string;
|
|
4
|
+
maxRetries?: number;
|
|
5
|
+
}
|
|
6
|
+
declare class HttpClient {
|
|
7
|
+
private readonly baseUrl;
|
|
8
|
+
private readonly apiKey;
|
|
9
|
+
private readonly maxRetries;
|
|
10
|
+
constructor(options: ClientOptions);
|
|
11
|
+
get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
|
|
12
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
13
|
+
put<T>(path: string, body?: unknown): Promise<T>;
|
|
14
|
+
patch<T>(path: string, body?: unknown): Promise<T>;
|
|
15
|
+
delete<T>(path: string, body?: unknown): Promise<T>;
|
|
16
|
+
private buildUrl;
|
|
17
|
+
private request;
|
|
18
|
+
private createError;
|
|
19
|
+
private getRetryDelay;
|
|
20
|
+
private parseRetryAfter;
|
|
21
|
+
private sleep;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface PaginationParams {
|
|
25
|
+
limit?: number;
|
|
26
|
+
offset?: number;
|
|
27
|
+
}
|
|
28
|
+
interface Pagination {
|
|
29
|
+
total: number;
|
|
30
|
+
limit: number;
|
|
31
|
+
offset: number;
|
|
32
|
+
has_more: boolean;
|
|
33
|
+
}
|
|
34
|
+
interface ListResponse<T> {
|
|
35
|
+
data: T[];
|
|
36
|
+
pagination: Pagination;
|
|
37
|
+
}
|
|
38
|
+
interface SingleResponse<T> {
|
|
39
|
+
data: T;
|
|
40
|
+
}
|
|
41
|
+
interface ErrorResponse {
|
|
42
|
+
error: {
|
|
43
|
+
code: string;
|
|
44
|
+
message: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
interface Contact {
|
|
48
|
+
id: string;
|
|
49
|
+
email: string;
|
|
50
|
+
first_name: string | null;
|
|
51
|
+
last_name: string | null;
|
|
52
|
+
attributes: Record<string, unknown> | null;
|
|
53
|
+
subscribed: boolean;
|
|
54
|
+
engagement_score: number | null;
|
|
55
|
+
churn_risk_score: number | null;
|
|
56
|
+
revenue_potential_score: number | null;
|
|
57
|
+
created_at: string;
|
|
58
|
+
updated_at: string;
|
|
59
|
+
}
|
|
60
|
+
interface ContactListParams extends PaginationParams {
|
|
61
|
+
search?: string;
|
|
62
|
+
subscribed?: boolean;
|
|
63
|
+
}
|
|
64
|
+
interface ContactCreateParams {
|
|
65
|
+
email: string;
|
|
66
|
+
first_name?: string;
|
|
67
|
+
last_name?: string;
|
|
68
|
+
attributes?: Record<string, unknown>;
|
|
69
|
+
subscribed?: boolean;
|
|
70
|
+
list_id?: string;
|
|
71
|
+
}
|
|
72
|
+
interface ContactUpdateParams {
|
|
73
|
+
email?: string;
|
|
74
|
+
first_name?: string;
|
|
75
|
+
last_name?: string;
|
|
76
|
+
attributes?: Record<string, unknown>;
|
|
77
|
+
subscribed?: boolean;
|
|
78
|
+
}
|
|
79
|
+
interface ContactList {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
description: string | null;
|
|
83
|
+
type: 'static' | 'dynamic';
|
|
84
|
+
conditions: unknown | null;
|
|
85
|
+
member_count: number;
|
|
86
|
+
created_at: string;
|
|
87
|
+
updated_at: string;
|
|
88
|
+
}
|
|
89
|
+
interface ListCreateParams {
|
|
90
|
+
name: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
type?: 'static' | 'dynamic';
|
|
93
|
+
conditions?: unknown;
|
|
94
|
+
}
|
|
95
|
+
interface ListUpdateParams {
|
|
96
|
+
name?: string;
|
|
97
|
+
description?: string;
|
|
98
|
+
type?: 'static' | 'dynamic';
|
|
99
|
+
conditions?: unknown;
|
|
100
|
+
}
|
|
101
|
+
interface ListMember {
|
|
102
|
+
id: string;
|
|
103
|
+
contact_id: string;
|
|
104
|
+
email: string;
|
|
105
|
+
first_name: string | null;
|
|
106
|
+
last_name: string | null;
|
|
107
|
+
added_at: string;
|
|
108
|
+
}
|
|
109
|
+
interface ListMembersParams extends PaginationParams {
|
|
110
|
+
}
|
|
111
|
+
type CampaignStatus = 'draft' | 'scheduled' | 'sending' | 'sent' | 'paused';
|
|
112
|
+
interface Campaign {
|
|
113
|
+
id: string;
|
|
114
|
+
name: string;
|
|
115
|
+
subject: string | null;
|
|
116
|
+
status: CampaignStatus;
|
|
117
|
+
sent_count: number | null;
|
|
118
|
+
open_count: number | null;
|
|
119
|
+
click_count: number | null;
|
|
120
|
+
created_at: string;
|
|
121
|
+
updated_at: string;
|
|
122
|
+
}
|
|
123
|
+
interface CampaignListParams extends PaginationParams {
|
|
124
|
+
status?: CampaignStatus;
|
|
125
|
+
}
|
|
126
|
+
interface Template {
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
subject: string | null;
|
|
130
|
+
html: string | null;
|
|
131
|
+
text: string | null;
|
|
132
|
+
created_at: string;
|
|
133
|
+
updated_at: string;
|
|
134
|
+
}
|
|
135
|
+
interface TemplateListParams extends PaginationParams {
|
|
136
|
+
search?: string;
|
|
137
|
+
}
|
|
138
|
+
interface TemplateCreateParams {
|
|
139
|
+
name: string;
|
|
140
|
+
html: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
}
|
|
143
|
+
interface EmailSendParams {
|
|
144
|
+
to: string | string[];
|
|
145
|
+
subject: string;
|
|
146
|
+
html?: string;
|
|
147
|
+
text?: string;
|
|
148
|
+
template_id?: string;
|
|
149
|
+
template_data?: Record<string, unknown>;
|
|
150
|
+
from_email?: string;
|
|
151
|
+
from_name?: string;
|
|
152
|
+
reply_to?: string;
|
|
153
|
+
track_opens?: boolean;
|
|
154
|
+
track_clicks?: boolean;
|
|
155
|
+
send_at?: string;
|
|
156
|
+
}
|
|
157
|
+
interface EmailSendResponse {
|
|
158
|
+
id: string;
|
|
159
|
+
status: string;
|
|
160
|
+
}
|
|
161
|
+
interface EmailBatchParams {
|
|
162
|
+
messages: EmailSendParams[];
|
|
163
|
+
from_email?: string;
|
|
164
|
+
from_name?: string;
|
|
165
|
+
}
|
|
166
|
+
interface EmailBatchResponse {
|
|
167
|
+
batch_id: string;
|
|
168
|
+
total: number;
|
|
169
|
+
status: string;
|
|
170
|
+
}
|
|
171
|
+
interface EmailBatchStatus {
|
|
172
|
+
batch_id: string;
|
|
173
|
+
total: number;
|
|
174
|
+
sent: number;
|
|
175
|
+
failed: number;
|
|
176
|
+
status: string;
|
|
177
|
+
}
|
|
178
|
+
interface EmailMessageStatus {
|
|
179
|
+
id: string;
|
|
180
|
+
status: string;
|
|
181
|
+
to: string;
|
|
182
|
+
subject: string;
|
|
183
|
+
sent_at: string | null;
|
|
184
|
+
opened_at: string | null;
|
|
185
|
+
clicked_at: string | null;
|
|
186
|
+
}
|
|
187
|
+
type SuppressionType = 'bounce' | 'complaint' | 'manual' | 'unsubscribe';
|
|
188
|
+
interface Suppression {
|
|
189
|
+
id: string;
|
|
190
|
+
email: string;
|
|
191
|
+
type: SuppressionType;
|
|
192
|
+
reason: string | null;
|
|
193
|
+
created_at: string;
|
|
194
|
+
}
|
|
195
|
+
interface SuppressionListParams extends PaginationParams {
|
|
196
|
+
type?: SuppressionType;
|
|
197
|
+
}
|
|
198
|
+
interface SuppressionAddParams {
|
|
199
|
+
email: string;
|
|
200
|
+
type?: SuppressionType;
|
|
201
|
+
reason?: string;
|
|
202
|
+
}
|
|
203
|
+
interface Webhook {
|
|
204
|
+
id: string;
|
|
205
|
+
targetUrl: string;
|
|
206
|
+
event: string;
|
|
207
|
+
createdAt: string;
|
|
208
|
+
}
|
|
209
|
+
interface WebhookSubscribeParams {
|
|
210
|
+
targetUrl: string;
|
|
211
|
+
event: string;
|
|
212
|
+
}
|
|
213
|
+
interface WebhookTestResponse {
|
|
214
|
+
success: boolean;
|
|
215
|
+
status_code: number;
|
|
216
|
+
}
|
|
217
|
+
interface ProductViewParams {
|
|
218
|
+
email?: string;
|
|
219
|
+
contact_id?: string;
|
|
220
|
+
product_id: string;
|
|
221
|
+
product_name?: string;
|
|
222
|
+
product_url?: string;
|
|
223
|
+
product_image_url?: string;
|
|
224
|
+
product_price?: number;
|
|
225
|
+
product_currency?: string;
|
|
226
|
+
category?: string;
|
|
227
|
+
}
|
|
228
|
+
interface ProductViewResponse {
|
|
229
|
+
success: boolean;
|
|
230
|
+
}
|
|
231
|
+
interface Conversion {
|
|
232
|
+
id: string;
|
|
233
|
+
email: string | null;
|
|
234
|
+
contact_id: string | null;
|
|
235
|
+
type: string | null;
|
|
236
|
+
revenue: number | null;
|
|
237
|
+
currency: string | null;
|
|
238
|
+
order_id: string | null;
|
|
239
|
+
campaign_id: string | null;
|
|
240
|
+
flow_id: string | null;
|
|
241
|
+
attribution_model: string | null;
|
|
242
|
+
attribution_window: string | null;
|
|
243
|
+
metadata: Record<string, unknown> | null;
|
|
244
|
+
created_at: string;
|
|
245
|
+
}
|
|
246
|
+
interface ConversionCreateParams {
|
|
247
|
+
email?: string;
|
|
248
|
+
contact_id?: string;
|
|
249
|
+
type?: string;
|
|
250
|
+
revenue?: number;
|
|
251
|
+
currency?: string;
|
|
252
|
+
order_id?: string;
|
|
253
|
+
campaign_id?: string;
|
|
254
|
+
flow_id?: string;
|
|
255
|
+
attribution_model?: string;
|
|
256
|
+
attribution_window?: string;
|
|
257
|
+
metadata?: Record<string, unknown>;
|
|
258
|
+
}
|
|
259
|
+
interface ConversionListParams extends PaginationParams {
|
|
260
|
+
}
|
|
261
|
+
interface Segment {
|
|
262
|
+
id: string;
|
|
263
|
+
name: string;
|
|
264
|
+
conditions: SegmentCondition[] | SegmentConditions | null;
|
|
265
|
+
created_at: string;
|
|
266
|
+
updated_at: string;
|
|
267
|
+
}
|
|
268
|
+
interface SegmentCondition {
|
|
269
|
+
field: string;
|
|
270
|
+
operator: string;
|
|
271
|
+
value?: string | number | boolean;
|
|
272
|
+
}
|
|
273
|
+
interface SegmentConditionGroup {
|
|
274
|
+
logic: 'and' | 'or';
|
|
275
|
+
conditions: SegmentCondition[];
|
|
276
|
+
}
|
|
277
|
+
interface SegmentConditions {
|
|
278
|
+
logic: 'and' | 'or';
|
|
279
|
+
groups: SegmentConditionGroup[];
|
|
280
|
+
}
|
|
281
|
+
interface SegmentListParams extends PaginationParams {
|
|
282
|
+
search?: string;
|
|
283
|
+
}
|
|
284
|
+
interface SegmentCreateParams {
|
|
285
|
+
name: string;
|
|
286
|
+
description?: string;
|
|
287
|
+
conditions?: SegmentCondition[] | SegmentConditions;
|
|
288
|
+
}
|
|
289
|
+
interface SegmentUpdateParams {
|
|
290
|
+
name?: string;
|
|
291
|
+
conditions?: SegmentCondition[] | SegmentConditions;
|
|
292
|
+
}
|
|
293
|
+
interface SegmentEstimate {
|
|
294
|
+
estimated_count: number;
|
|
295
|
+
}
|
|
296
|
+
interface Tag {
|
|
297
|
+
id: string;
|
|
298
|
+
name: string;
|
|
299
|
+
color: string;
|
|
300
|
+
description: string | null;
|
|
301
|
+
contact_count: number;
|
|
302
|
+
created_at: string;
|
|
303
|
+
updated_at: string;
|
|
304
|
+
}
|
|
305
|
+
interface TagListParams extends PaginationParams {
|
|
306
|
+
search?: string;
|
|
307
|
+
}
|
|
308
|
+
interface TagCreateParams {
|
|
309
|
+
name: string;
|
|
310
|
+
color?: string;
|
|
311
|
+
description?: string;
|
|
312
|
+
}
|
|
313
|
+
interface TagUpdateParams {
|
|
314
|
+
name?: string;
|
|
315
|
+
color?: string;
|
|
316
|
+
description?: string;
|
|
317
|
+
}
|
|
318
|
+
interface TagAssignResult {
|
|
319
|
+
assigned: number;
|
|
320
|
+
already_assigned?: number;
|
|
321
|
+
invalid_ids?: string[];
|
|
322
|
+
}
|
|
323
|
+
interface TagRemoveResult {
|
|
324
|
+
removed: number;
|
|
325
|
+
}
|
|
326
|
+
type AutomationStatus = 'draft' | 'active' | 'paused';
|
|
327
|
+
type AutomationRunStatus = 'active' | 'completed' | 'failed' | 'paused' | 'cancelled';
|
|
328
|
+
interface Automation {
|
|
329
|
+
id: string;
|
|
330
|
+
name: string;
|
|
331
|
+
trigger_type: string;
|
|
332
|
+
status: AutomationStatus;
|
|
333
|
+
version: number;
|
|
334
|
+
created_at: string;
|
|
335
|
+
updated_at: string;
|
|
336
|
+
}
|
|
337
|
+
interface AutomationStep {
|
|
338
|
+
id: string;
|
|
339
|
+
step_type: string;
|
|
340
|
+
config: Record<string, unknown>;
|
|
341
|
+
position: number;
|
|
342
|
+
created_at: string;
|
|
343
|
+
}
|
|
344
|
+
interface AutomationWithSteps extends Automation {
|
|
345
|
+
trigger_config: Record<string, unknown>;
|
|
346
|
+
steps: AutomationStep[];
|
|
347
|
+
run_count: number;
|
|
348
|
+
}
|
|
349
|
+
type AutomationStepType = 'email' | 'sms' | 'push' | 'delay' | 'condition' | 'action' | 'tag' | 'trigger_split' | 'add_to_list' | 'remove_from_list' | 'update_attribute' | 'webhook' | 'wait_for_event' | 'move_to_flow';
|
|
350
|
+
interface AutomationListParams extends PaginationParams {
|
|
351
|
+
status?: AutomationStatus;
|
|
352
|
+
}
|
|
353
|
+
interface AutomationCreateParams {
|
|
354
|
+
name: string;
|
|
355
|
+
trigger_type: string;
|
|
356
|
+
trigger_config?: Record<string, unknown>;
|
|
357
|
+
steps?: Array<{
|
|
358
|
+
step_type: AutomationStepType;
|
|
359
|
+
config?: Record<string, unknown>;
|
|
360
|
+
position?: number;
|
|
361
|
+
}>;
|
|
362
|
+
}
|
|
363
|
+
interface AutomationUpdateParams {
|
|
364
|
+
name?: string;
|
|
365
|
+
status?: AutomationStatus;
|
|
366
|
+
}
|
|
367
|
+
interface AutomationAddStepParams {
|
|
368
|
+
step_type: AutomationStepType;
|
|
369
|
+
config?: Record<string, unknown>;
|
|
370
|
+
position?: number;
|
|
371
|
+
}
|
|
372
|
+
interface AutomationUpdateStepParams {
|
|
373
|
+
step_type?: AutomationStepType;
|
|
374
|
+
config?: Record<string, unknown>;
|
|
375
|
+
}
|
|
376
|
+
interface AutomationBatchUpdateStepsParams {
|
|
377
|
+
steps: Array<{
|
|
378
|
+
id: string;
|
|
379
|
+
position?: number;
|
|
380
|
+
config?: Record<string, unknown>;
|
|
381
|
+
}>;
|
|
382
|
+
}
|
|
383
|
+
interface AutomationTriggerParams {
|
|
384
|
+
contact_id?: string;
|
|
385
|
+
email?: string;
|
|
386
|
+
trigger_data?: Record<string, unknown>;
|
|
387
|
+
}
|
|
388
|
+
interface AutomationTriggerResult {
|
|
389
|
+
success: boolean;
|
|
390
|
+
flow_run_id?: string;
|
|
391
|
+
error?: string;
|
|
392
|
+
}
|
|
393
|
+
interface AutomationRun {
|
|
394
|
+
id: string;
|
|
395
|
+
contact_id: string;
|
|
396
|
+
contact_email: string;
|
|
397
|
+
status: AutomationRunStatus;
|
|
398
|
+
trigger_data: Record<string, unknown>;
|
|
399
|
+
current_step_position: number;
|
|
400
|
+
started_at: string;
|
|
401
|
+
completed_at: string | null;
|
|
402
|
+
created_at: string;
|
|
403
|
+
}
|
|
404
|
+
interface AutomationRunListParams extends PaginationParams {
|
|
405
|
+
status?: AutomationRunStatus;
|
|
406
|
+
}
|
|
407
|
+
interface Domain {
|
|
408
|
+
id: string;
|
|
409
|
+
domain: string;
|
|
410
|
+
status: string;
|
|
411
|
+
verified: boolean;
|
|
412
|
+
created_at: string;
|
|
413
|
+
updated_at: string;
|
|
414
|
+
}
|
|
415
|
+
interface DnsRecord {
|
|
416
|
+
type: string;
|
|
417
|
+
name: string;
|
|
418
|
+
value: string;
|
|
419
|
+
ttl: number;
|
|
420
|
+
priority?: number;
|
|
421
|
+
}
|
|
422
|
+
interface DomainWithDnsRecords extends Domain {
|
|
423
|
+
dns_records: DnsRecord[];
|
|
424
|
+
}
|
|
425
|
+
interface DomainCreateParams {
|
|
426
|
+
domain: string;
|
|
427
|
+
}
|
|
428
|
+
interface DomainVerifyResult {
|
|
429
|
+
verified: boolean;
|
|
430
|
+
dns_records: DnsRecord[];
|
|
431
|
+
}
|
|
432
|
+
interface HealthResponse {
|
|
433
|
+
status: string;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
declare class Contacts {
|
|
437
|
+
private readonly client;
|
|
438
|
+
constructor(client: HttpClient);
|
|
439
|
+
list(params?: ContactListParams): Promise<ListResponse<Contact>>;
|
|
440
|
+
get(id: string): Promise<SingleResponse<Contact>>;
|
|
441
|
+
create(data: ContactCreateParams): Promise<SingleResponse<Contact>>;
|
|
442
|
+
update(id: string, data: ContactUpdateParams): Promise<SingleResponse<Contact>>;
|
|
443
|
+
delete(id: string): Promise<void>;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
declare class ListMembers {
|
|
447
|
+
private readonly client;
|
|
448
|
+
constructor(client: HttpClient);
|
|
449
|
+
list(listId: string, params?: ListMembersParams): Promise<ListResponse<ListMember>>;
|
|
450
|
+
add(listId: string, contactIds: string[]): Promise<SingleResponse<{
|
|
451
|
+
added: number;
|
|
452
|
+
}>>;
|
|
453
|
+
remove(listId: string, contactIds: string[]): Promise<void>;
|
|
454
|
+
}
|
|
455
|
+
declare class Lists {
|
|
456
|
+
private readonly client;
|
|
457
|
+
readonly members: ListMembers;
|
|
458
|
+
constructor(client: HttpClient);
|
|
459
|
+
list(params?: PaginationParams): Promise<ListResponse<ContactList>>;
|
|
460
|
+
get(id: string): Promise<SingleResponse<ContactList>>;
|
|
461
|
+
create(data: ListCreateParams): Promise<SingleResponse<ContactList>>;
|
|
462
|
+
update(id: string, data: ListUpdateParams): Promise<SingleResponse<ContactList>>;
|
|
463
|
+
delete(id: string): Promise<void>;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
declare class Campaigns {
|
|
467
|
+
private readonly client;
|
|
468
|
+
constructor(client: HttpClient);
|
|
469
|
+
list(params?: CampaignListParams): Promise<ListResponse<Campaign>>;
|
|
470
|
+
get(id: string): Promise<SingleResponse<Campaign>>;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
declare class Templates {
|
|
474
|
+
private readonly client;
|
|
475
|
+
constructor(client: HttpClient);
|
|
476
|
+
list(params?: TemplateListParams): Promise<ListResponse<Template>>;
|
|
477
|
+
get(id: string): Promise<SingleResponse<Template>>;
|
|
478
|
+
create(data: TemplateCreateParams): Promise<SingleResponse<Template>>;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
declare class Email {
|
|
482
|
+
private readonly client;
|
|
483
|
+
constructor(client: HttpClient);
|
|
484
|
+
send(data: EmailSendParams): Promise<SingleResponse<EmailSendResponse>>;
|
|
485
|
+
batch(data: EmailBatchParams): Promise<SingleResponse<EmailBatchResponse>>;
|
|
486
|
+
batchStatus(batchId: string): Promise<SingleResponse<EmailBatchStatus>>;
|
|
487
|
+
messageStatus(messageId: string): Promise<SingleResponse<EmailMessageStatus>>;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
declare class Suppressions {
|
|
491
|
+
private readonly client;
|
|
492
|
+
constructor(client: HttpClient);
|
|
493
|
+
list(params?: SuppressionListParams): Promise<ListResponse<Suppression>>;
|
|
494
|
+
add(data: SuppressionAddParams): Promise<SingleResponse<Suppression>>;
|
|
495
|
+
remove(email: string): Promise<void>;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
declare class Webhooks {
|
|
499
|
+
private readonly client;
|
|
500
|
+
constructor(client: HttpClient);
|
|
501
|
+
subscribe(data: WebhookSubscribeParams): Promise<SingleResponse<Webhook>>;
|
|
502
|
+
unsubscribe(id: string): Promise<void>;
|
|
503
|
+
test(id: string): Promise<SingleResponse<WebhookTestResponse>>;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
declare class Tracking {
|
|
507
|
+
private readonly client;
|
|
508
|
+
constructor(client: HttpClient);
|
|
509
|
+
productView(data: ProductViewParams): Promise<SingleResponse<ProductViewResponse>>;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
declare class Conversions {
|
|
513
|
+
private readonly client;
|
|
514
|
+
constructor(client: HttpClient);
|
|
515
|
+
list(params?: ConversionListParams): Promise<ListResponse<Conversion>>;
|
|
516
|
+
create(data: ConversionCreateParams): Promise<SingleResponse<Conversion>>;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
declare class Segments {
|
|
520
|
+
private readonly client;
|
|
521
|
+
constructor(client: HttpClient);
|
|
522
|
+
list(params?: SegmentListParams): Promise<ListResponse<Segment>>;
|
|
523
|
+
get(id: string): Promise<SingleResponse<Segment>>;
|
|
524
|
+
create(data: SegmentCreateParams): Promise<SingleResponse<Segment>>;
|
|
525
|
+
update(id: string, data: SegmentUpdateParams): Promise<SingleResponse<Segment>>;
|
|
526
|
+
delete(id: string): Promise<void>;
|
|
527
|
+
estimateCount(id: string): Promise<SingleResponse<SegmentEstimate>>;
|
|
528
|
+
listContacts(id: string, params?: PaginationParams): Promise<ListResponse<Contact>>;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
declare class TagContacts {
|
|
532
|
+
private readonly client;
|
|
533
|
+
constructor(client: HttpClient);
|
|
534
|
+
list(tagId: string, params?: PaginationParams): Promise<ListResponse<Contact>>;
|
|
535
|
+
assign(tagId: string, contactIds: string[]): Promise<SingleResponse<TagAssignResult>>;
|
|
536
|
+
remove(tagId: string, contactIds: string[]): Promise<SingleResponse<TagRemoveResult>>;
|
|
537
|
+
}
|
|
538
|
+
declare class Tags {
|
|
539
|
+
private readonly client;
|
|
540
|
+
readonly contacts: TagContacts;
|
|
541
|
+
constructor(client: HttpClient);
|
|
542
|
+
list(params?: TagListParams): Promise<ListResponse<Tag>>;
|
|
543
|
+
get(id: string): Promise<SingleResponse<Tag>>;
|
|
544
|
+
create(data: TagCreateParams): Promise<SingleResponse<Tag>>;
|
|
545
|
+
update(id: string, data: TagUpdateParams): Promise<SingleResponse<Tag>>;
|
|
546
|
+
delete(id: string): Promise<void>;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
declare class Automations {
|
|
550
|
+
private readonly client;
|
|
551
|
+
constructor(client: HttpClient);
|
|
552
|
+
create(data: AutomationCreateParams): Promise<SingleResponse<AutomationWithSteps>>;
|
|
553
|
+
list(params?: AutomationListParams): Promise<ListResponse<Automation>>;
|
|
554
|
+
get(id: string): Promise<SingleResponse<AutomationWithSteps>>;
|
|
555
|
+
update(id: string, data: AutomationUpdateParams): Promise<SingleResponse<Automation>>;
|
|
556
|
+
activate(id: string): Promise<SingleResponse<Automation>>;
|
|
557
|
+
pause(id: string): Promise<SingleResponse<Automation>>;
|
|
558
|
+
delete(id: string): Promise<void>;
|
|
559
|
+
addStep(id: string, data: AutomationAddStepParams): Promise<SingleResponse<AutomationStep>>;
|
|
560
|
+
updateStep(automationId: string, stepId: string, data: AutomationUpdateStepParams): Promise<SingleResponse<AutomationStep>>;
|
|
561
|
+
deleteStep(automationId: string, stepId: string): Promise<void>;
|
|
562
|
+
batchUpdateSteps(id: string, data: AutomationBatchUpdateStepsParams): Promise<SingleResponse<{
|
|
563
|
+
success: boolean;
|
|
564
|
+
}>>;
|
|
565
|
+
trigger(id: string, data: AutomationTriggerParams): Promise<SingleResponse<AutomationTriggerResult>>;
|
|
566
|
+
listRuns(id: string, params?: AutomationRunListParams): Promise<ListResponse<AutomationRun>>;
|
|
567
|
+
cancelRun(automationId: string, runId: string): Promise<SingleResponse<{
|
|
568
|
+
id: string;
|
|
569
|
+
status: string;
|
|
570
|
+
completed_at: string | null;
|
|
571
|
+
}>>;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
declare class Domains {
|
|
575
|
+
private readonly client;
|
|
576
|
+
constructor(client: HttpClient);
|
|
577
|
+
list(): Promise<ListResponse<Domain>>;
|
|
578
|
+
get(id: string): Promise<SingleResponse<DomainWithDnsRecords>>;
|
|
579
|
+
create(data: DomainCreateParams): Promise<SingleResponse<DomainWithDnsRecords>>;
|
|
580
|
+
delete(id: string): Promise<void>;
|
|
581
|
+
verify(id: string): Promise<SingleResponse<DomainVerifyResult>>;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
declare class Health {
|
|
585
|
+
private readonly client;
|
|
586
|
+
constructor(client: HttpClient);
|
|
587
|
+
check(): Promise<HealthResponse>;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
declare class TopMailError extends Error {
|
|
591
|
+
readonly code: string;
|
|
592
|
+
readonly statusCode: number;
|
|
593
|
+
constructor(message: string, code: string, statusCode: number);
|
|
594
|
+
}
|
|
595
|
+
declare class ValidationError extends TopMailError {
|
|
596
|
+
constructor(message: string, code?: string);
|
|
597
|
+
}
|
|
598
|
+
declare class AuthenticationError extends TopMailError {
|
|
599
|
+
constructor(message: string, code?: string);
|
|
600
|
+
}
|
|
601
|
+
declare class ForbiddenError extends TopMailError {
|
|
602
|
+
constructor(message: string, code?: string);
|
|
603
|
+
}
|
|
604
|
+
declare class NotFoundError extends TopMailError {
|
|
605
|
+
constructor(message: string, code?: string);
|
|
606
|
+
}
|
|
607
|
+
declare class RateLimitError extends TopMailError {
|
|
608
|
+
readonly retryAfter: number | null;
|
|
609
|
+
constructor(message: string, retryAfter?: number | null, code?: string);
|
|
610
|
+
}
|
|
611
|
+
declare class ServerError extends TopMailError {
|
|
612
|
+
constructor(message: string, statusCode?: number, code?: string);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
interface TopMailOptions {
|
|
616
|
+
baseUrl?: string;
|
|
617
|
+
}
|
|
618
|
+
declare class TopMail {
|
|
619
|
+
readonly contacts: Contacts;
|
|
620
|
+
readonly lists: Lists;
|
|
621
|
+
readonly campaigns: Campaigns;
|
|
622
|
+
readonly templates: Templates;
|
|
623
|
+
readonly email: Email;
|
|
624
|
+
readonly suppressions: Suppressions;
|
|
625
|
+
readonly webhooks: Webhooks;
|
|
626
|
+
readonly tracking: Tracking;
|
|
627
|
+
readonly conversions: Conversions;
|
|
628
|
+
readonly segments: Segments;
|
|
629
|
+
readonly tags: Tags;
|
|
630
|
+
readonly automations: Automations;
|
|
631
|
+
readonly domains: Domains;
|
|
632
|
+
readonly health: Health;
|
|
633
|
+
/**
|
|
634
|
+
* True if the API key starts with `tm_test_`, indicating sandbox mode.
|
|
635
|
+
*/
|
|
636
|
+
readonly isSandbox: boolean;
|
|
637
|
+
constructor(apiKey: string, options?: TopMailOptions);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export { AuthenticationError, type Automation, type AutomationAddStepParams, type AutomationBatchUpdateStepsParams, type AutomationCreateParams, type AutomationListParams, type AutomationRun, type AutomationRunListParams, type AutomationRunStatus, type AutomationStatus, type AutomationStep, type AutomationStepType, type AutomationTriggerParams, type AutomationTriggerResult, type AutomationUpdateParams, type AutomationUpdateStepParams, type AutomationWithSteps, Automations, type Campaign, type CampaignListParams, type CampaignStatus, Campaigns, type ClientOptions, type Contact, type ContactCreateParams, type ContactList, type ContactListParams, type ContactUpdateParams, Contacts, type Conversion, type ConversionCreateParams, type ConversionListParams, Conversions, type DnsRecord, type Domain, type DomainCreateParams, type DomainVerifyResult, type DomainWithDnsRecords, Domains, Email, type EmailBatchParams, type EmailBatchResponse, type EmailBatchStatus, type EmailMessageStatus, type EmailSendParams, type EmailSendResponse, type ErrorResponse, ForbiddenError, Health, type HealthResponse, HttpClient, type ListCreateParams, type ListMember, type ListMembersParams, type ListResponse, type ListUpdateParams, Lists, NotFoundError, type Pagination, type PaginationParams, type ProductViewParams, type ProductViewResponse, RateLimitError, type Segment, type SegmentCondition, type SegmentConditionGroup, type SegmentConditions, type SegmentCreateParams, type SegmentEstimate, type SegmentListParams, type SegmentUpdateParams, Segments, ServerError, type SingleResponse, type Suppression, type SuppressionAddParams, type SuppressionListParams, type SuppressionType, Suppressions, type Tag, type TagAssignResult, type TagCreateParams, type TagListParams, type TagRemoveResult, type TagUpdateParams, Tags, type Template, type TemplateCreateParams, type TemplateListParams, Templates, TopMail, TopMailError, type TopMailOptions, Tracking, ValidationError, type Webhook, type WebhookSubscribeParams, type WebhookTestResponse, Webhooks };
|