@earendil-works/mailhook 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.
@@ -0,0 +1,1862 @@
1
+ /**
2
+ * This file is auto-generated. Do not edit manually.
3
+ */
4
+ export class DNSRecord {
5
+ type;
6
+ name;
7
+ value;
8
+ ttl;
9
+ priority;
10
+ purpose;
11
+ required;
12
+ description;
13
+ constructor(data) {
14
+ this.type = data.type;
15
+ this.name = data.name;
16
+ this.value = data.value;
17
+ this.ttl = data.ttl;
18
+ this.priority = data.priority;
19
+ this.purpose = data.purpose;
20
+ this.required = data.required;
21
+ this.description = data.description;
22
+ }
23
+ static fromApiDict(data) {
24
+ const obj = new DNSRecord({});
25
+ obj.type = data.type;
26
+ obj.name = data.name;
27
+ obj.value = data.value;
28
+ obj.ttl = data.ttl;
29
+ obj.priority = data.priority;
30
+ obj.purpose = data.purpose;
31
+ obj.required = data.required;
32
+ obj.description = data.description;
33
+ return obj;
34
+ }
35
+ toApiDict() {
36
+ return {
37
+ type: this.type,
38
+ name: this.name,
39
+ value: this.value,
40
+ ttl: this.ttl,
41
+ priority: this.priority,
42
+ purpose: this.purpose,
43
+ required: this.required,
44
+ description: this.description,
45
+ };
46
+ }
47
+ }
48
+ export class ErrorResponse {
49
+ error;
50
+ constructor(data) {
51
+ this.error = data.error;
52
+ }
53
+ static fromApiDict(data) {
54
+ const obj = new ErrorResponse({});
55
+ obj.error = data.error;
56
+ return obj;
57
+ }
58
+ toApiDict() {
59
+ return {
60
+ error: this.error,
61
+ };
62
+ }
63
+ }
64
+ export class Tenant {
65
+ id;
66
+ name;
67
+ createdAt;
68
+ updatedAt;
69
+ constructor(data) {
70
+ this.id = data.id;
71
+ this.name = data.name;
72
+ this.createdAt = data.createdAt;
73
+ this.updatedAt = data.updatedAt;
74
+ }
75
+ static fromApiDict(data) {
76
+ const obj = new Tenant({});
77
+ obj.id = data.id;
78
+ obj.name = data.name;
79
+ obj.createdAt = new Date(data.created_at);
80
+ obj.updatedAt = new Date(data.updated_at);
81
+ return obj;
82
+ }
83
+ toApiDict() {
84
+ return {
85
+ id: this.id,
86
+ name: this.name,
87
+ created_at: this.createdAt?.toISOString(),
88
+ updated_at: this.updatedAt?.toISOString(),
89
+ };
90
+ }
91
+ }
92
+ export class TenantCreateRequest {
93
+ name;
94
+ constructor(data) {
95
+ this.name = data.name;
96
+ }
97
+ static fromApiDict(data) {
98
+ const obj = new TenantCreateRequest({});
99
+ obj.name = data.name;
100
+ return obj;
101
+ }
102
+ toApiDict() {
103
+ return {
104
+ name: this.name,
105
+ };
106
+ }
107
+ }
108
+ export class TenantUpdateRequest {
109
+ name;
110
+ constructor(data) {
111
+ this.name = data.name;
112
+ }
113
+ static fromApiDict(data) {
114
+ const obj = new TenantUpdateRequest({});
115
+ obj.name = data.name;
116
+ return obj;
117
+ }
118
+ toApiDict() {
119
+ return {
120
+ name: this.name,
121
+ };
122
+ }
123
+ }
124
+ export class WebhookScheduledDelivery {
125
+ id;
126
+ webhookId;
127
+ tenantId;
128
+ emailId;
129
+ payload;
130
+ status;
131
+ attempts;
132
+ lastAttempt;
133
+ nextRetry;
134
+ createdAt;
135
+ constructor(data) {
136
+ this.id = data.id;
137
+ this.webhookId = data.webhookId;
138
+ this.tenantId = data.tenantId;
139
+ this.emailId = data.emailId;
140
+ this.payload = data.payload;
141
+ this.status = data.status;
142
+ this.attempts = data.attempts;
143
+ this.lastAttempt = data.lastAttempt;
144
+ this.nextRetry = data.nextRetry;
145
+ this.createdAt = data.createdAt;
146
+ }
147
+ static fromApiDict(data) {
148
+ const obj = new WebhookScheduledDelivery({});
149
+ obj.id = data.id;
150
+ obj.webhookId = data.webhook_id;
151
+ obj.tenantId = data.tenant_id;
152
+ obj.emailId = data.email_id;
153
+ obj.payload = data.payload;
154
+ obj.status = data.status;
155
+ obj.attempts = data.attempts;
156
+ obj.lastAttempt = data.last_attempt ? new Date(data.last_attempt) : undefined;
157
+ obj.nextRetry = new Date(data.next_retry);
158
+ obj.createdAt = new Date(data.created_at);
159
+ return obj;
160
+ }
161
+ toApiDict() {
162
+ return {
163
+ id: this.id,
164
+ webhook_id: this.webhookId,
165
+ tenant_id: this.tenantId,
166
+ email_id: this.emailId,
167
+ payload: this.payload,
168
+ status: this.status,
169
+ attempts: this.attempts,
170
+ last_attempt: this.lastAttempt?.toISOString(),
171
+ next_retry: this.nextRetry?.toISOString(),
172
+ created_at: this.createdAt?.toISOString(),
173
+ };
174
+ }
175
+ }
176
+ export class WebhookDeliveryAttempt {
177
+ id;
178
+ deliveryId;
179
+ webhookId;
180
+ tenantId;
181
+ attemptNumber;
182
+ status;
183
+ responseStatus;
184
+ responseBody;
185
+ payload;
186
+ responseTruncated;
187
+ errorMessage;
188
+ durationMs;
189
+ createdAt;
190
+ constructor(data) {
191
+ this.id = data.id;
192
+ this.deliveryId = data.deliveryId;
193
+ this.webhookId = data.webhookId;
194
+ this.tenantId = data.tenantId;
195
+ this.attemptNumber = data.attemptNumber;
196
+ this.status = data.status;
197
+ this.responseStatus = data.responseStatus;
198
+ this.responseBody = data.responseBody;
199
+ this.payload = data.payload;
200
+ this.responseTruncated = data.responseTruncated;
201
+ this.errorMessage = data.errorMessage;
202
+ this.durationMs = data.durationMs;
203
+ this.createdAt = data.createdAt;
204
+ }
205
+ static fromApiDict(data) {
206
+ const obj = new WebhookDeliveryAttempt({});
207
+ obj.id = data.id;
208
+ obj.deliveryId = data.delivery_id;
209
+ obj.webhookId = data.webhook_id;
210
+ obj.tenantId = data.tenant_id;
211
+ obj.attemptNumber = data.attempt_number;
212
+ obj.status = data.status;
213
+ obj.responseStatus = data.response_status;
214
+ obj.responseBody = data.response_body;
215
+ obj.payload = data.payload;
216
+ obj.responseTruncated = data.response_truncated;
217
+ obj.errorMessage = data.error_message;
218
+ obj.durationMs = data.duration_ms;
219
+ obj.createdAt = new Date(data.created_at);
220
+ return obj;
221
+ }
222
+ toApiDict() {
223
+ return {
224
+ id: this.id,
225
+ delivery_id: this.deliveryId,
226
+ webhook_id: this.webhookId,
227
+ tenant_id: this.tenantId,
228
+ attempt_number: this.attemptNumber,
229
+ status: this.status,
230
+ response_status: this.responseStatus,
231
+ response_body: this.responseBody,
232
+ payload: this.payload,
233
+ response_truncated: this.responseTruncated,
234
+ error_message: this.errorMessage,
235
+ duration_ms: this.durationMs,
236
+ created_at: this.createdAt?.toISOString(),
237
+ };
238
+ }
239
+ }
240
+ export class WebhookRedeliverRequest {
241
+ webhookId;
242
+ constructor(data) {
243
+ this.webhookId = data.webhookId;
244
+ }
245
+ static fromApiDict(data) {
246
+ const obj = new WebhookRedeliverRequest({});
247
+ obj.webhookId = data.webhook_id;
248
+ return obj;
249
+ }
250
+ toApiDict() {
251
+ return {
252
+ webhook_id: this.webhookId,
253
+ };
254
+ }
255
+ }
256
+ export class DeliveryEvent {
257
+ id;
258
+ createdAt;
259
+ type;
260
+ timestamp;
261
+ constructor(data) {
262
+ this.id = data.id;
263
+ this.createdAt = data.createdAt;
264
+ this.type = data.type;
265
+ this.timestamp = data.timestamp;
266
+ }
267
+ static fromApiDict(data) {
268
+ const obj = new DeliveryEvent({});
269
+ obj.id = data.id;
270
+ obj.createdAt = new Date(data.created_at);
271
+ obj.type = data.type;
272
+ obj.timestamp = data.timestamp ? new Date(data.timestamp) : undefined;
273
+ return obj;
274
+ }
275
+ toApiDict() {
276
+ return {
277
+ id: this.id,
278
+ created_at: this.createdAt?.toISOString(),
279
+ type: this.type,
280
+ timestamp: this.timestamp?.toISOString(),
281
+ };
282
+ }
283
+ }
284
+ export class Domain {
285
+ id;
286
+ tenantId;
287
+ parentDomainId;
288
+ label;
289
+ domain;
290
+ unicodeDomain;
291
+ isWildcard;
292
+ active;
293
+ verificationStatus;
294
+ verificationMethod;
295
+ verifiedAt;
296
+ dnsRecords;
297
+ dmarcEnforcement;
298
+ subaddressing;
299
+ createdAt;
300
+ updatedAt;
301
+ constructor(data) {
302
+ this.id = data.id;
303
+ this.tenantId = data.tenantId;
304
+ this.parentDomainId = data.parentDomainId;
305
+ this.label = data.label;
306
+ this.domain = data.domain;
307
+ this.unicodeDomain = data.unicodeDomain;
308
+ this.isWildcard = data.isWildcard;
309
+ this.active = data.active;
310
+ this.verificationStatus = data.verificationStatus;
311
+ this.verificationMethod = data.verificationMethod;
312
+ this.verifiedAt = data.verifiedAt;
313
+ this.dnsRecords = data.dnsRecords || [];
314
+ this.dmarcEnforcement = data.dmarcEnforcement;
315
+ this.subaddressing = data.subaddressing;
316
+ this.createdAt = data.createdAt;
317
+ this.updatedAt = data.updatedAt;
318
+ }
319
+ static fromApiDict(data) {
320
+ const obj = new Domain({});
321
+ obj.id = data.id;
322
+ obj.tenantId = data.tenant_id;
323
+ obj.parentDomainId = data.parent_domain_id;
324
+ obj.label = data.label;
325
+ obj.domain = data.domain;
326
+ obj.unicodeDomain = data.unicode_domain;
327
+ obj.isWildcard = data.is_wildcard;
328
+ obj.active = data.active;
329
+ obj.verificationStatus = data.verification_status;
330
+ obj.verificationMethod = data.verification_method;
331
+ obj.verifiedAt = data.verified_at ? new Date(data.verified_at) : undefined;
332
+ obj.dnsRecords = data.dns_records
333
+ ? (data.dns_records || []).map((item) => DNSRecord.fromApiDict(item))
334
+ : undefined;
335
+ obj.dmarcEnforcement = data.dmarc_enforcement;
336
+ obj.subaddressing = data.subaddressing;
337
+ obj.createdAt = new Date(data.created_at);
338
+ obj.updatedAt = new Date(data.updated_at);
339
+ return obj;
340
+ }
341
+ toApiDict() {
342
+ return {
343
+ id: this.id,
344
+ tenant_id: this.tenantId,
345
+ parent_domain_id: this.parentDomainId,
346
+ label: this.label,
347
+ domain: this.domain,
348
+ unicode_domain: this.unicodeDomain,
349
+ is_wildcard: this.isWildcard,
350
+ active: this.active,
351
+ verification_status: this.verificationStatus,
352
+ verification_method: this.verificationMethod,
353
+ verified_at: this.verifiedAt?.toISOString(),
354
+ dns_records: (this.dnsRecords || []).map((item) => item.toApiDict()),
355
+ dmarc_enforcement: this.dmarcEnforcement,
356
+ subaddressing: this.subaddressing,
357
+ created_at: this.createdAt?.toISOString(),
358
+ updated_at: this.updatedAt?.toISOString(),
359
+ };
360
+ }
361
+ }
362
+ export class DomainInput {
363
+ domain;
364
+ parent;
365
+ label;
366
+ isWildcard;
367
+ active;
368
+ dmarcEnforcement;
369
+ subaddressing;
370
+ constructor(data) {
371
+ this.domain = data.domain;
372
+ this.parent = data.parent;
373
+ this.label = data.label;
374
+ this.isWildcard = data.isWildcard;
375
+ this.active = data.active;
376
+ this.dmarcEnforcement = data.dmarcEnforcement;
377
+ this.subaddressing = data.subaddressing;
378
+ }
379
+ static fromApiDict(data) {
380
+ const obj = new DomainInput({});
381
+ obj.domain = data.domain;
382
+ obj.parent = data.parent;
383
+ obj.label = data.label;
384
+ obj.isWildcard = data.is_wildcard;
385
+ obj.active = data.active;
386
+ obj.dmarcEnforcement = data.dmarc_enforcement;
387
+ obj.subaddressing = data.subaddressing;
388
+ return obj;
389
+ }
390
+ toApiDict() {
391
+ return {
392
+ domain: this.domain,
393
+ parent: this.parent,
394
+ label: this.label,
395
+ is_wildcard: this.isWildcard,
396
+ active: this.active,
397
+ dmarc_enforcement: this.dmarcEnforcement,
398
+ subaddressing: this.subaddressing,
399
+ };
400
+ }
401
+ }
402
+ export class MailboxInput {
403
+ localPart;
404
+ extraAliases;
405
+ active;
406
+ senderName;
407
+ spamPolicy;
408
+ inboundPolicy;
409
+ dmarcEnforcement;
410
+ subaddressing;
411
+ setAllow;
412
+ addAllow;
413
+ removeAllow;
414
+ setDeny;
415
+ addDeny;
416
+ removeDeny;
417
+ constructor(data) {
418
+ this.localPart = data.localPart;
419
+ this.extraAliases = data.extraAliases || [];
420
+ this.active = data.active;
421
+ this.senderName = data.senderName;
422
+ this.spamPolicy = data.spamPolicy;
423
+ this.inboundPolicy = data.inboundPolicy;
424
+ this.dmarcEnforcement = data.dmarcEnforcement;
425
+ this.subaddressing = data.subaddressing;
426
+ this.setAllow = data.setAllow || [];
427
+ this.addAllow = data.addAllow || [];
428
+ this.removeAllow = data.removeAllow || [];
429
+ this.setDeny = data.setDeny || [];
430
+ this.addDeny = data.addDeny || [];
431
+ this.removeDeny = data.removeDeny || [];
432
+ }
433
+ static fromApiDict(data) {
434
+ const obj = new MailboxInput({});
435
+ obj.localPart = data.local_part;
436
+ obj.extraAliases = data.extra_aliases || [];
437
+ obj.active = data.active;
438
+ obj.senderName = data.sender_name;
439
+ obj.spamPolicy = data.spam_policy;
440
+ obj.inboundPolicy = data.inbound_policy;
441
+ obj.dmarcEnforcement = data.dmarc_enforcement;
442
+ obj.subaddressing = data.subaddressing;
443
+ obj.setAllow = data.set_allow || [];
444
+ obj.addAllow = data.add_allow || [];
445
+ obj.removeAllow = data.remove_allow || [];
446
+ obj.setDeny = data.set_deny || [];
447
+ obj.addDeny = data.add_deny || [];
448
+ obj.removeDeny = data.remove_deny || [];
449
+ return obj;
450
+ }
451
+ toApiDict() {
452
+ return {
453
+ local_part: this.localPart,
454
+ extra_aliases: this.extraAliases || [],
455
+ active: this.active,
456
+ sender_name: this.senderName,
457
+ spam_policy: this.spamPolicy,
458
+ inbound_policy: this.inboundPolicy,
459
+ dmarc_enforcement: this.dmarcEnforcement,
460
+ subaddressing: this.subaddressing,
461
+ set_allow: this.setAllow || [],
462
+ add_allow: this.addAllow || [],
463
+ remove_allow: this.removeAllow || [],
464
+ set_deny: this.setDeny || [],
465
+ add_deny: this.addDeny || [],
466
+ remove_deny: this.removeDeny || [],
467
+ };
468
+ }
469
+ }
470
+ export class MailboxMoveInput {
471
+ targetDomainOrId;
472
+ newLocalPart;
473
+ constructor(data) {
474
+ this.targetDomainOrId = data.targetDomainOrId;
475
+ this.newLocalPart = data.newLocalPart;
476
+ }
477
+ static fromApiDict(data) {
478
+ const obj = new MailboxMoveInput({});
479
+ obj.targetDomainOrId = data.target_domain_or_id;
480
+ obj.newLocalPart = data.new_local_part;
481
+ return obj;
482
+ }
483
+ toApiDict() {
484
+ return {
485
+ target_domain_or_id: this.targetDomainOrId,
486
+ new_local_part: this.newLocalPart,
487
+ };
488
+ }
489
+ }
490
+ export class APIKey {
491
+ id;
492
+ tenantId;
493
+ secret;
494
+ truncatedSecret;
495
+ keyType;
496
+ note;
497
+ expiresAt;
498
+ createdAt;
499
+ constructor(data) {
500
+ this.id = data.id;
501
+ this.tenantId = data.tenantId;
502
+ this.secret = data.secret;
503
+ this.truncatedSecret = data.truncatedSecret;
504
+ this.keyType = data.keyType;
505
+ this.note = data.note;
506
+ this.expiresAt = data.expiresAt;
507
+ this.createdAt = data.createdAt;
508
+ }
509
+ static fromApiDict(data) {
510
+ const obj = new APIKey({});
511
+ obj.id = data.id;
512
+ obj.tenantId = data.tenant_id;
513
+ obj.secret = data.secret;
514
+ obj.truncatedSecret = data.truncated_secret;
515
+ obj.keyType = data.key_type;
516
+ obj.note = data.note;
517
+ obj.expiresAt = data.expires_at ? new Date(data.expires_at) : undefined;
518
+ obj.createdAt = new Date(data.created_at);
519
+ return obj;
520
+ }
521
+ toApiDict() {
522
+ return {
523
+ id: this.id,
524
+ tenant_id: this.tenantId,
525
+ secret: this.secret,
526
+ truncated_secret: this.truncatedSecret,
527
+ key_type: this.keyType,
528
+ note: this.note,
529
+ expires_at: this.expiresAt?.toISOString(),
530
+ created_at: this.createdAt?.toISOString(),
531
+ };
532
+ }
533
+ }
534
+ export class APIKeyInput {
535
+ note;
536
+ expiresAt;
537
+ constructor(data) {
538
+ this.note = data.note;
539
+ this.expiresAt = data.expiresAt;
540
+ }
541
+ static fromApiDict(data) {
542
+ const obj = new APIKeyInput({});
543
+ obj.note = data.note;
544
+ obj.expiresAt = data.expires_at ? new Date(data.expires_at) : undefined;
545
+ return obj;
546
+ }
547
+ toApiDict() {
548
+ return {
549
+ note: this.note,
550
+ expires_at: this.expiresAt?.toISOString(),
551
+ };
552
+ }
553
+ }
554
+ export class WebhookFilters {
555
+ eventTypes;
556
+ mailboxes;
557
+ domains;
558
+ includeSubdomains;
559
+ constructor(data) {
560
+ this.eventTypes = data.eventTypes || [];
561
+ this.mailboxes = data.mailboxes || [];
562
+ this.domains = data.domains || [];
563
+ this.includeSubdomains = data.includeSubdomains;
564
+ }
565
+ static fromApiDict(data) {
566
+ const obj = new WebhookFilters({});
567
+ obj.eventTypes = data.event_types || [];
568
+ obj.mailboxes = data.mailboxes || [];
569
+ obj.domains = data.domains || [];
570
+ obj.includeSubdomains = data.include_subdomains;
571
+ return obj;
572
+ }
573
+ toApiDict() {
574
+ return {
575
+ event_types: this.eventTypes || [],
576
+ mailboxes: this.mailboxes || [],
577
+ domains: this.domains || [],
578
+ include_subdomains: this.includeSubdomains,
579
+ };
580
+ }
581
+ }
582
+ export class WebhookInput {
583
+ id;
584
+ url;
585
+ secret;
586
+ active;
587
+ ephemeral;
588
+ filters;
589
+ constructor(data) {
590
+ this.id = data.id;
591
+ this.url = data.url;
592
+ this.secret = data.secret;
593
+ this.active = data.active;
594
+ this.ephemeral = data.ephemeral;
595
+ this.filters = data.filters;
596
+ }
597
+ static fromApiDict(data) {
598
+ const obj = new WebhookInput({});
599
+ obj.id = data.id;
600
+ obj.url = data.url;
601
+ obj.secret = data.secret;
602
+ obj.active = data.active;
603
+ obj.ephemeral = data.ephemeral;
604
+ obj.filters = data.filters ? WebhookFilters.fromApiDict(data.filters) : undefined;
605
+ return obj;
606
+ }
607
+ toApiDict() {
608
+ return {
609
+ id: this.id,
610
+ url: this.url,
611
+ secret: this.secret,
612
+ active: this.active,
613
+ ephemeral: this.ephemeral,
614
+ filters: this.filters?.toApiDict(),
615
+ };
616
+ }
617
+ }
618
+ export class IncludedLabels {
619
+ labels;
620
+ constructor(data) {
621
+ this.labels = data.labels;
622
+ }
623
+ static fromApiDict(data) {
624
+ const obj = new IncludedLabels({});
625
+ obj.labels = data.labels;
626
+ return obj;
627
+ }
628
+ toApiDict() {
629
+ return {
630
+ labels: this.labels,
631
+ };
632
+ }
633
+ }
634
+ export class Webhook {
635
+ id;
636
+ tenantId;
637
+ url;
638
+ secret;
639
+ active;
640
+ ephemeral;
641
+ filters;
642
+ included;
643
+ createdAt;
644
+ lastActivityAt;
645
+ constructor(data) {
646
+ this.id = data.id;
647
+ this.tenantId = data.tenantId;
648
+ this.url = data.url;
649
+ this.secret = data.secret;
650
+ this.active = data.active;
651
+ this.ephemeral = data.ephemeral;
652
+ this.filters = data.filters;
653
+ this.included = data.included;
654
+ this.createdAt = data.createdAt;
655
+ this.lastActivityAt = data.lastActivityAt;
656
+ }
657
+ static fromApiDict(data) {
658
+ const obj = new Webhook({});
659
+ obj.id = data.id;
660
+ obj.tenantId = data.tenant_id;
661
+ obj.url = data.url;
662
+ obj.secret = data.secret;
663
+ obj.active = data.active;
664
+ obj.ephemeral = data.ephemeral;
665
+ obj.filters = data.filters ? WebhookFilters.fromApiDict(data.filters) : undefined;
666
+ obj.included = data.included ? IncludedLabels.fromApiDict(data.included) : undefined;
667
+ obj.createdAt = new Date(data.created_at);
668
+ obj.lastActivityAt = data.last_activity_at ? new Date(data.last_activity_at) : undefined;
669
+ return obj;
670
+ }
671
+ toApiDict() {
672
+ return {
673
+ id: this.id,
674
+ tenant_id: this.tenantId,
675
+ url: this.url,
676
+ secret: this.secret,
677
+ active: this.active,
678
+ ephemeral: this.ephemeral,
679
+ filters: this.filters?.toApiDict(),
680
+ included: this.included?.toApiDict(),
681
+ created_at: this.createdAt?.toISOString(),
682
+ last_activity_at: this.lastActivityAt?.toISOString(),
683
+ };
684
+ }
685
+ }
686
+ export class SuppressedRecipient {
687
+ tenantId;
688
+ email;
689
+ reason;
690
+ status;
691
+ bounceType;
692
+ complaintFeedbackType;
693
+ details;
694
+ firstSeenAt;
695
+ lastSeenAt;
696
+ constructor(data) {
697
+ this.tenantId = data.tenantId;
698
+ this.email = data.email;
699
+ this.reason = data.reason;
700
+ this.status = data.status;
701
+ this.bounceType = data.bounceType;
702
+ this.complaintFeedbackType = data.complaintFeedbackType;
703
+ this.details = data.details;
704
+ this.firstSeenAt = data.firstSeenAt;
705
+ this.lastSeenAt = data.lastSeenAt;
706
+ }
707
+ static fromApiDict(data) {
708
+ const obj = new SuppressedRecipient({});
709
+ obj.tenantId = data.tenant_id;
710
+ obj.email = data.email;
711
+ obj.reason = data.reason;
712
+ obj.status = data.status;
713
+ obj.bounceType = data.bounce_type;
714
+ obj.complaintFeedbackType = data.complaint_feedback_type;
715
+ obj.details = data.details;
716
+ obj.firstSeenAt = new Date(data.first_seen_at);
717
+ obj.lastSeenAt = new Date(data.last_seen_at);
718
+ return obj;
719
+ }
720
+ toApiDict() {
721
+ return {
722
+ tenant_id: this.tenantId,
723
+ email: this.email,
724
+ reason: this.reason,
725
+ status: this.status,
726
+ bounce_type: this.bounceType,
727
+ complaint_feedback_type: this.complaintFeedbackType,
728
+ details: this.details,
729
+ first_seen_at: this.firstSeenAt?.toISOString(),
730
+ last_seen_at: this.lastSeenAt?.toISOString(),
731
+ };
732
+ }
733
+ }
734
+ export class SuppressionsUpdateInput {
735
+ set;
736
+ add;
737
+ remove;
738
+ constructor(data) {
739
+ this.set = data.set || [];
740
+ this.add = data.add || [];
741
+ this.remove = data.remove || [];
742
+ }
743
+ static fromApiDict(data) {
744
+ const obj = new SuppressionsUpdateInput({});
745
+ obj.set = data.set || [];
746
+ obj.add = data.add || [];
747
+ obj.remove = data.remove || [];
748
+ return obj;
749
+ }
750
+ toApiDict() {
751
+ return {
752
+ set: this.set || [],
753
+ add: this.add || [],
754
+ remove: this.remove || [],
755
+ };
756
+ }
757
+ }
758
+ export class PaginatedSuppressionsResponse {
759
+ items;
760
+ next;
761
+ prev;
762
+ constructor(data) {
763
+ this.items = data.items;
764
+ this.next = data.next;
765
+ this.prev = data.prev;
766
+ }
767
+ static fromApiDict(data) {
768
+ const obj = new PaginatedSuppressionsResponse({});
769
+ obj.items = (data.items || []).map((item) => SuppressedRecipient.fromApiDict(item));
770
+ obj.next = data.next;
771
+ obj.prev = data.prev;
772
+ return obj;
773
+ }
774
+ toApiDict() {
775
+ return {
776
+ items: (this.items || []).map((item) => item.toApiDict()),
777
+ next: this.next,
778
+ prev: this.prev,
779
+ };
780
+ }
781
+ }
782
+ export class EmailAddress {
783
+ addr;
784
+ name;
785
+ constructor(data) {
786
+ this.addr = data.addr;
787
+ this.name = data.name;
788
+ }
789
+ static fromApiDict(data) {
790
+ const obj = new EmailAddress({});
791
+ obj.addr = data.addr;
792
+ obj.name = data.name;
793
+ return obj;
794
+ }
795
+ toApiDict() {
796
+ return {
797
+ addr: this.addr,
798
+ name: this.name,
799
+ };
800
+ }
801
+ }
802
+ export class Attachment {
803
+ id;
804
+ filename;
805
+ contentType;
806
+ charset;
807
+ size;
808
+ url;
809
+ contentId;
810
+ inline;
811
+ customSummary;
812
+ constructor(data) {
813
+ this.id = data.id;
814
+ this.filename = data.filename;
815
+ this.contentType = data.contentType;
816
+ this.charset = data.charset;
817
+ this.size = data.size;
818
+ this.url = data.url;
819
+ this.contentId = data.contentId;
820
+ this.inline = data.inline;
821
+ this.customSummary = data.customSummary;
822
+ }
823
+ static fromApiDict(data) {
824
+ const obj = new Attachment({});
825
+ obj.id = data.id;
826
+ obj.filename = data.filename;
827
+ obj.contentType = data.content_type;
828
+ obj.charset = data.charset;
829
+ obj.size = data.size;
830
+ obj.url = data.url;
831
+ obj.contentId = data.content_id;
832
+ obj.inline = data.inline;
833
+ obj.customSummary = data.custom_summary;
834
+ return obj;
835
+ }
836
+ toApiDict() {
837
+ return {
838
+ id: this.id,
839
+ filename: this.filename,
840
+ content_type: this.contentType,
841
+ charset: this.charset,
842
+ size: this.size,
843
+ url: this.url,
844
+ content_id: this.contentId,
845
+ inline: this.inline,
846
+ custom_summary: this.customSummary,
847
+ };
848
+ }
849
+ }
850
+ export class EmailVerdicts {
851
+ junk;
852
+ virus;
853
+ spf;
854
+ dkim;
855
+ dmarc;
856
+ tls;
857
+ constructor(data) {
858
+ this.junk = data.junk;
859
+ this.virus = data.virus;
860
+ this.spf = data.spf;
861
+ this.dkim = data.dkim;
862
+ this.dmarc = data.dmarc;
863
+ this.tls = data.tls;
864
+ }
865
+ static fromApiDict(data) {
866
+ const obj = new EmailVerdicts({});
867
+ obj.junk = data.junk;
868
+ obj.virus = data.virus;
869
+ obj.spf = data.spf;
870
+ obj.dkim = data.dkim;
871
+ obj.dmarc = data.dmarc;
872
+ obj.tls = data.tls;
873
+ return obj;
874
+ }
875
+ toApiDict() {
876
+ return {
877
+ junk: this.junk,
878
+ virus: this.virus,
879
+ spf: this.spf,
880
+ dkim: this.dkim,
881
+ dmarc: this.dmarc,
882
+ tls: this.tls,
883
+ };
884
+ }
885
+ }
886
+ export class UserData {
887
+ constructor(_data) { }
888
+ static fromApiDict(_data) {
889
+ const obj = new UserData({});
890
+ return obj;
891
+ }
892
+ toApiDict() {
893
+ return {};
894
+ }
895
+ }
896
+ export class Email {
897
+ id;
898
+ mailboxId;
899
+ threadId;
900
+ messageId;
901
+ from;
902
+ to;
903
+ cc;
904
+ bcc;
905
+ subject;
906
+ text;
907
+ html;
908
+ originalText;
909
+ originalHtml;
910
+ headers;
911
+ attachments;
912
+ customSummary;
913
+ labels;
914
+ verdicts;
915
+ userData;
916
+ receivedAt;
917
+ constructor(data) {
918
+ this.id = data.id;
919
+ this.mailboxId = data.mailboxId;
920
+ this.threadId = data.threadId;
921
+ this.messageId = data.messageId;
922
+ this.from = data.from;
923
+ this.to = data.to || [];
924
+ this.cc = data.cc || [];
925
+ this.bcc = data.bcc || [];
926
+ this.subject = data.subject;
927
+ this.text = data.text;
928
+ this.html = data.html;
929
+ this.originalText = data.originalText;
930
+ this.originalHtml = data.originalHtml;
931
+ this.headers = data.headers || [];
932
+ this.attachments = data.attachments || [];
933
+ this.customSummary = data.customSummary;
934
+ this.labels = data.labels || [];
935
+ this.verdicts = data.verdicts;
936
+ this.userData = data.userData;
937
+ this.receivedAt = data.receivedAt;
938
+ }
939
+ static fromApiDict(data) {
940
+ const obj = new Email({});
941
+ obj.id = data.id;
942
+ obj.mailboxId = data.mailbox_id;
943
+ obj.threadId = data.thread_id;
944
+ obj.messageId = data.message_id;
945
+ obj.from = EmailAddress.fromApiDict(data.from);
946
+ obj.to = data.to
947
+ ? (data.to || []).map((item) => EmailAddress.fromApiDict(item))
948
+ : undefined;
949
+ obj.cc = data.cc
950
+ ? (data.cc || []).map((item) => EmailAddress.fromApiDict(item))
951
+ : undefined;
952
+ obj.bcc = data.bcc
953
+ ? (data.bcc || []).map((item) => EmailAddress.fromApiDict(item))
954
+ : undefined;
955
+ obj.subject = data.subject;
956
+ obj.text = data.text;
957
+ obj.html = data.html;
958
+ obj.originalText = data.original_text;
959
+ obj.originalHtml = data.original_html;
960
+ obj.headers = data.headers || [];
961
+ obj.attachments = data.attachments
962
+ ? (data.attachments || []).map((item) => Attachment.fromApiDict(item))
963
+ : undefined;
964
+ obj.customSummary = data.custom_summary;
965
+ obj.labels = data.labels || [];
966
+ obj.verdicts = data.verdicts ? EmailVerdicts.fromApiDict(data.verdicts) : undefined;
967
+ obj.userData = data.user_data ? UserData.fromApiDict(data.user_data) : undefined;
968
+ obj.receivedAt = new Date(data.received_at);
969
+ return obj;
970
+ }
971
+ toApiDict() {
972
+ return {
973
+ id: this.id,
974
+ mailbox_id: this.mailboxId,
975
+ thread_id: this.threadId,
976
+ message_id: this.messageId,
977
+ from: this.from?.toApiDict(),
978
+ to: (this.to || []).map((item) => item.toApiDict()),
979
+ cc: (this.cc || []).map((item) => item.toApiDict()),
980
+ bcc: (this.bcc || []).map((item) => item.toApiDict()),
981
+ subject: this.subject,
982
+ text: this.text,
983
+ html: this.html,
984
+ original_text: this.originalText,
985
+ original_html: this.originalHtml,
986
+ headers: this.headers || [],
987
+ attachments: (this.attachments || []).map((item) => item.toApiDict()),
988
+ custom_summary: this.customSummary,
989
+ labels: this.labels || [],
990
+ verdicts: this.verdicts?.toApiDict(),
991
+ user_data: this.userData?.toApiDict(),
992
+ received_at: this.receivedAt?.toISOString(),
993
+ };
994
+ }
995
+ }
996
+ export class Thread {
997
+ id;
998
+ mailboxId;
999
+ subject;
1000
+ messageCount;
1001
+ firstMessageAt;
1002
+ lastMessageAt;
1003
+ participants;
1004
+ preview;
1005
+ customSummary;
1006
+ hasAttachments;
1007
+ hasHiddenMessages;
1008
+ userData;
1009
+ labels;
1010
+ constructor(data) {
1011
+ this.id = data.id;
1012
+ this.mailboxId = data.mailboxId;
1013
+ this.subject = data.subject;
1014
+ this.messageCount = data.messageCount;
1015
+ this.firstMessageAt = data.firstMessageAt;
1016
+ this.lastMessageAt = data.lastMessageAt;
1017
+ this.participants = data.participants || [];
1018
+ this.preview = data.preview;
1019
+ this.customSummary = data.customSummary;
1020
+ this.hasAttachments = data.hasAttachments;
1021
+ this.hasHiddenMessages = data.hasHiddenMessages;
1022
+ this.userData = data.userData;
1023
+ this.labels = data.labels || [];
1024
+ }
1025
+ static fromApiDict(data) {
1026
+ const obj = new Thread({});
1027
+ obj.id = data.id;
1028
+ obj.mailboxId = data.mailbox_id;
1029
+ obj.subject = data.subject;
1030
+ obj.messageCount = data.message_count;
1031
+ obj.firstMessageAt = new Date(data.first_message_at);
1032
+ obj.lastMessageAt = new Date(data.last_message_at);
1033
+ obj.participants = data.participants
1034
+ ? (data.participants || []).map((item) => EmailAddress.fromApiDict(item))
1035
+ : undefined;
1036
+ obj.preview = data.preview;
1037
+ obj.customSummary = data.custom_summary;
1038
+ obj.hasAttachments = data.has_attachments;
1039
+ obj.hasHiddenMessages = data.has_hidden_messages;
1040
+ obj.userData = data.user_data ? UserData.fromApiDict(data.user_data) : undefined;
1041
+ obj.labels = data.labels || [];
1042
+ return obj;
1043
+ }
1044
+ toApiDict() {
1045
+ return {
1046
+ id: this.id,
1047
+ mailbox_id: this.mailboxId,
1048
+ subject: this.subject,
1049
+ message_count: this.messageCount,
1050
+ first_message_at: this.firstMessageAt?.toISOString(),
1051
+ last_message_at: this.lastMessageAt?.toISOString(),
1052
+ participants: (this.participants || []).map((item) => item.toApiDict()),
1053
+ preview: this.preview,
1054
+ custom_summary: this.customSummary,
1055
+ has_attachments: this.hasAttachments,
1056
+ has_hidden_messages: this.hasHiddenMessages,
1057
+ user_data: this.userData?.toApiDict(),
1058
+ labels: this.labels || [],
1059
+ };
1060
+ }
1061
+ }
1062
+ export class ThreadWithMessages {
1063
+ id;
1064
+ mailboxId;
1065
+ subject;
1066
+ messageCount;
1067
+ firstMessageAt;
1068
+ lastMessageAt;
1069
+ participants;
1070
+ preview;
1071
+ customSummary;
1072
+ hasAttachments;
1073
+ hasHiddenMessages;
1074
+ userData;
1075
+ labels;
1076
+ messages;
1077
+ constructor(data) {
1078
+ this.id = data.id;
1079
+ this.mailboxId = data.mailboxId;
1080
+ this.subject = data.subject;
1081
+ this.messageCount = data.messageCount;
1082
+ this.firstMessageAt = data.firstMessageAt;
1083
+ this.lastMessageAt = data.lastMessageAt;
1084
+ this.participants = data.participants || [];
1085
+ this.preview = data.preview;
1086
+ this.customSummary = data.customSummary;
1087
+ this.hasAttachments = data.hasAttachments;
1088
+ this.hasHiddenMessages = data.hasHiddenMessages;
1089
+ this.userData = data.userData;
1090
+ this.labels = data.labels || [];
1091
+ this.messages = data.messages;
1092
+ }
1093
+ static fromApiDict(data) {
1094
+ const obj = new ThreadWithMessages({});
1095
+ obj.id = data.id;
1096
+ obj.mailboxId = data.mailbox_id;
1097
+ obj.subject = data.subject;
1098
+ obj.messageCount = data.message_count;
1099
+ obj.firstMessageAt = new Date(data.first_message_at);
1100
+ obj.lastMessageAt = new Date(data.last_message_at);
1101
+ obj.participants = data.participants
1102
+ ? (data.participants || []).map((item) => EmailAddress.fromApiDict(item))
1103
+ : undefined;
1104
+ obj.preview = data.preview;
1105
+ obj.customSummary = data.custom_summary;
1106
+ obj.hasAttachments = data.has_attachments;
1107
+ obj.hasHiddenMessages = data.has_hidden_messages;
1108
+ obj.userData = data.user_data ? UserData.fromApiDict(data.user_data) : undefined;
1109
+ obj.labels = data.labels || [];
1110
+ obj.messages = (data.messages || []).map((item) => Email.fromApiDict(item));
1111
+ return obj;
1112
+ }
1113
+ toApiDict() {
1114
+ return {
1115
+ id: this.id,
1116
+ mailbox_id: this.mailboxId,
1117
+ subject: this.subject,
1118
+ message_count: this.messageCount,
1119
+ first_message_at: this.firstMessageAt?.toISOString(),
1120
+ last_message_at: this.lastMessageAt?.toISOString(),
1121
+ participants: (this.participants || []).map((item) => item.toApiDict()),
1122
+ preview: this.preview,
1123
+ custom_summary: this.customSummary,
1124
+ has_attachments: this.hasAttachments,
1125
+ has_hidden_messages: this.hasHiddenMessages,
1126
+ user_data: this.userData?.toApiDict(),
1127
+ labels: this.labels || [],
1128
+ messages: (this.messages || []).map((item) => item.toApiDict()),
1129
+ };
1130
+ }
1131
+ }
1132
+ export class ThreadUpdateRequest {
1133
+ userData;
1134
+ customSummary;
1135
+ setLabels;
1136
+ addLabels;
1137
+ removeLabels;
1138
+ constructor(data) {
1139
+ this.userData = data.userData;
1140
+ this.customSummary = data.customSummary;
1141
+ this.setLabels = data.setLabels || [];
1142
+ this.addLabels = data.addLabels || [];
1143
+ this.removeLabels = data.removeLabels || [];
1144
+ }
1145
+ static fromApiDict(data) {
1146
+ const obj = new ThreadUpdateRequest({});
1147
+ obj.userData = data.user_data ? UserData.fromApiDict(data.user_data) : undefined;
1148
+ obj.customSummary = data.custom_summary;
1149
+ obj.setLabels = data.set_labels || [];
1150
+ obj.addLabels = data.add_labels || [];
1151
+ obj.removeLabels = data.remove_labels || [];
1152
+ return obj;
1153
+ }
1154
+ toApiDict() {
1155
+ return {
1156
+ user_data: this.userData?.toApiDict(),
1157
+ custom_summary: this.customSummary,
1158
+ set_labels: this.setLabels || [],
1159
+ add_labels: this.addLabels || [],
1160
+ remove_labels: this.removeLabels || [],
1161
+ };
1162
+ }
1163
+ }
1164
+ export class ThreadMoveInput {
1165
+ targetMailboxAliasOrId;
1166
+ targetDomainOrId;
1167
+ all;
1168
+ threadIds;
1169
+ q;
1170
+ labels;
1171
+ includeHidden;
1172
+ constructor(data) {
1173
+ this.targetMailboxAliasOrId = data.targetMailboxAliasOrId;
1174
+ this.targetDomainOrId = data.targetDomainOrId;
1175
+ this.all = data.all;
1176
+ this.threadIds = data.threadIds || [];
1177
+ this.q = data.q;
1178
+ this.labels = data.labels || [];
1179
+ this.includeHidden = data.includeHidden;
1180
+ }
1181
+ static fromApiDict(data) {
1182
+ const obj = new ThreadMoveInput({});
1183
+ obj.targetMailboxAliasOrId = data.target_mailbox_alias_or_id;
1184
+ obj.targetDomainOrId = data.target_domain_or_id;
1185
+ obj.all = data.all;
1186
+ obj.threadIds = data.thread_ids || [];
1187
+ obj.q = data.q;
1188
+ obj.labels = data.labels || [];
1189
+ obj.includeHidden = data.include_hidden;
1190
+ return obj;
1191
+ }
1192
+ toApiDict() {
1193
+ return {
1194
+ target_mailbox_alias_or_id: this.targetMailboxAliasOrId,
1195
+ target_domain_or_id: this.targetDomainOrId,
1196
+ all: this.all,
1197
+ thread_ids: this.threadIds || [],
1198
+ q: this.q,
1199
+ labels: this.labels || [],
1200
+ include_hidden: this.includeHidden,
1201
+ };
1202
+ }
1203
+ }
1204
+ export class ThreadMoveResult {
1205
+ status;
1206
+ threadCount;
1207
+ emailCount;
1208
+ constructor(data) {
1209
+ this.status = data.status;
1210
+ this.threadCount = data.threadCount;
1211
+ this.emailCount = data.emailCount;
1212
+ }
1213
+ static fromApiDict(data) {
1214
+ const obj = new ThreadMoveResult({});
1215
+ obj.status = data.status;
1216
+ obj.threadCount = data.thread_count;
1217
+ obj.emailCount = data.email_count;
1218
+ return obj;
1219
+ }
1220
+ toApiDict() {
1221
+ return {
1222
+ status: this.status,
1223
+ thread_count: this.threadCount,
1224
+ email_count: this.emailCount,
1225
+ };
1226
+ }
1227
+ }
1228
+ export class EmailUpdateRequest {
1229
+ userData;
1230
+ customSummary;
1231
+ setLabels;
1232
+ addLabels;
1233
+ removeLabels;
1234
+ constructor(data) {
1235
+ this.userData = data.userData;
1236
+ this.customSummary = data.customSummary;
1237
+ this.setLabels = data.setLabels || [];
1238
+ this.addLabels = data.addLabels || [];
1239
+ this.removeLabels = data.removeLabels || [];
1240
+ }
1241
+ static fromApiDict(data) {
1242
+ const obj = new EmailUpdateRequest({});
1243
+ obj.userData = data.user_data ? UserData.fromApiDict(data.user_data) : undefined;
1244
+ obj.customSummary = data.custom_summary;
1245
+ obj.setLabels = data.set_labels || [];
1246
+ obj.addLabels = data.add_labels || [];
1247
+ obj.removeLabels = data.remove_labels || [];
1248
+ return obj;
1249
+ }
1250
+ toApiDict() {
1251
+ return {
1252
+ user_data: this.userData?.toApiDict(),
1253
+ custom_summary: this.customSummary,
1254
+ set_labels: this.setLabels || [],
1255
+ add_labels: this.addLabels || [],
1256
+ remove_labels: this.removeLabels || [],
1257
+ };
1258
+ }
1259
+ }
1260
+ export class AttachmentUpdateRequest {
1261
+ filename;
1262
+ contentType;
1263
+ charset;
1264
+ customSummary;
1265
+ constructor(data) {
1266
+ this.filename = data.filename;
1267
+ this.contentType = data.contentType;
1268
+ this.charset = data.charset;
1269
+ this.customSummary = data.customSummary;
1270
+ }
1271
+ static fromApiDict(data) {
1272
+ const obj = new AttachmentUpdateRequest({});
1273
+ obj.filename = data.filename;
1274
+ obj.contentType = data.content_type;
1275
+ obj.charset = data.charset;
1276
+ obj.customSummary = data.custom_summary;
1277
+ return obj;
1278
+ }
1279
+ toApiDict() {
1280
+ return {
1281
+ filename: this.filename,
1282
+ content_type: this.contentType,
1283
+ charset: this.charset,
1284
+ custom_summary: this.customSummary,
1285
+ };
1286
+ }
1287
+ }
1288
+ export class ThreadReplyAttachment {
1289
+ filename;
1290
+ contentType;
1291
+ data;
1292
+ url;
1293
+ inline;
1294
+ contentId;
1295
+ constructor(data) {
1296
+ this.filename = data.filename;
1297
+ this.contentType = data.contentType;
1298
+ this.data = data.data;
1299
+ this.url = data.url;
1300
+ this.inline = data.inline;
1301
+ this.contentId = data.contentId;
1302
+ }
1303
+ static fromApiDict(data) {
1304
+ const obj = new ThreadReplyAttachment({});
1305
+ obj.filename = data.filename;
1306
+ obj.contentType = data.content_type;
1307
+ obj.data = data.data;
1308
+ obj.url = data.url;
1309
+ obj.inline = data.inline;
1310
+ obj.contentId = data.content_id;
1311
+ return obj;
1312
+ }
1313
+ toApiDict() {
1314
+ return {
1315
+ filename: this.filename,
1316
+ content_type: this.contentType,
1317
+ data: this.data,
1318
+ url: this.url,
1319
+ inline: this.inline,
1320
+ content_id: this.contentId,
1321
+ };
1322
+ }
1323
+ }
1324
+ export class NewThreadRequest {
1325
+ to;
1326
+ cc;
1327
+ bcc;
1328
+ subject;
1329
+ from;
1330
+ text;
1331
+ html;
1332
+ markdown;
1333
+ replyTo;
1334
+ senderName;
1335
+ attachments;
1336
+ headers;
1337
+ addAutoReplyHeaders;
1338
+ processHtml;
1339
+ css;
1340
+ constructor(data) {
1341
+ this.to = data.to;
1342
+ this.cc = data.cc || [];
1343
+ this.bcc = data.bcc || [];
1344
+ this.subject = data.subject;
1345
+ this.from = data.from;
1346
+ this.text = data.text;
1347
+ this.html = data.html;
1348
+ this.markdown = data.markdown;
1349
+ this.replyTo = data.replyTo;
1350
+ this.senderName = data.senderName;
1351
+ this.attachments = data.attachments || [];
1352
+ this.headers = data.headers || [];
1353
+ this.addAutoReplyHeaders = data.addAutoReplyHeaders;
1354
+ this.processHtml = data.processHtml;
1355
+ this.css = data.css;
1356
+ }
1357
+ static fromApiDict(data) {
1358
+ const obj = new NewThreadRequest({});
1359
+ obj.to = data.to || [];
1360
+ obj.cc = data.cc || [];
1361
+ obj.bcc = data.bcc || [];
1362
+ obj.subject = data.subject;
1363
+ obj.from = data.from;
1364
+ obj.text = data.text;
1365
+ obj.html = data.html;
1366
+ obj.markdown = data.markdown;
1367
+ obj.replyTo = data.reply_to;
1368
+ obj.senderName = data.sender_name;
1369
+ obj.attachments = data.attachments
1370
+ ? (data.attachments || []).map((item) => ThreadReplyAttachment.fromApiDict(item))
1371
+ : undefined;
1372
+ obj.headers = data.headers || [];
1373
+ obj.addAutoReplyHeaders = data.add_auto_reply_headers;
1374
+ obj.processHtml = data.process_html;
1375
+ obj.css = data.css;
1376
+ return obj;
1377
+ }
1378
+ toApiDict() {
1379
+ return {
1380
+ to: this.to || [],
1381
+ cc: this.cc || [],
1382
+ bcc: this.bcc || [],
1383
+ subject: this.subject,
1384
+ from: this.from,
1385
+ text: this.text,
1386
+ html: this.html,
1387
+ markdown: this.markdown,
1388
+ reply_to: this.replyTo,
1389
+ sender_name: this.senderName,
1390
+ attachments: (this.attachments || []).map((item) => item.toApiDict()),
1391
+ headers: this.headers || [],
1392
+ add_auto_reply_headers: this.addAutoReplyHeaders,
1393
+ process_html: this.processHtml,
1394
+ css: this.css,
1395
+ };
1396
+ }
1397
+ }
1398
+ export class ThreadReplyRequest {
1399
+ emailId;
1400
+ replyPolicy;
1401
+ replyTo;
1402
+ to;
1403
+ cc;
1404
+ bcc;
1405
+ subject;
1406
+ from;
1407
+ text;
1408
+ html;
1409
+ markdown;
1410
+ senderName;
1411
+ attachments;
1412
+ headers;
1413
+ addAutoReplyHeaders;
1414
+ processHtml;
1415
+ css;
1416
+ quoteReply;
1417
+ constructor(data) {
1418
+ this.emailId = data.emailId;
1419
+ this.replyPolicy = data.replyPolicy;
1420
+ this.replyTo = data.replyTo;
1421
+ this.to = data.to || [];
1422
+ this.cc = data.cc || [];
1423
+ this.bcc = data.bcc || [];
1424
+ this.subject = data.subject;
1425
+ this.from = data.from;
1426
+ this.text = data.text;
1427
+ this.html = data.html;
1428
+ this.markdown = data.markdown;
1429
+ this.senderName = data.senderName;
1430
+ this.attachments = data.attachments || [];
1431
+ this.headers = data.headers || [];
1432
+ this.addAutoReplyHeaders = data.addAutoReplyHeaders;
1433
+ this.processHtml = data.processHtml;
1434
+ this.css = data.css;
1435
+ this.quoteReply = data.quoteReply;
1436
+ }
1437
+ static fromApiDict(data) {
1438
+ const obj = new ThreadReplyRequest({});
1439
+ obj.emailId = data.email_id;
1440
+ obj.replyPolicy = data.reply_policy;
1441
+ obj.replyTo = data.reply_to;
1442
+ obj.to = data.to || [];
1443
+ obj.cc = data.cc || [];
1444
+ obj.bcc = data.bcc || [];
1445
+ obj.subject = data.subject;
1446
+ obj.from = data.from;
1447
+ obj.text = data.text;
1448
+ obj.html = data.html;
1449
+ obj.markdown = data.markdown;
1450
+ obj.senderName = data.sender_name;
1451
+ obj.attachments = data.attachments
1452
+ ? (data.attachments || []).map((item) => ThreadReplyAttachment.fromApiDict(item))
1453
+ : undefined;
1454
+ obj.headers = data.headers || [];
1455
+ obj.addAutoReplyHeaders = data.add_auto_reply_headers;
1456
+ obj.processHtml = data.process_html;
1457
+ obj.css = data.css;
1458
+ obj.quoteReply = data.quote_reply;
1459
+ return obj;
1460
+ }
1461
+ toApiDict() {
1462
+ return {
1463
+ email_id: this.emailId,
1464
+ reply_policy: this.replyPolicy,
1465
+ reply_to: this.replyTo,
1466
+ to: this.to || [],
1467
+ cc: this.cc || [],
1468
+ bcc: this.bcc || [],
1469
+ subject: this.subject,
1470
+ from: this.from,
1471
+ text: this.text,
1472
+ html: this.html,
1473
+ markdown: this.markdown,
1474
+ sender_name: this.senderName,
1475
+ attachments: (this.attachments || []).map((item) => item.toApiDict()),
1476
+ headers: this.headers || [],
1477
+ add_auto_reply_headers: this.addAutoReplyHeaders,
1478
+ process_html: this.processHtml,
1479
+ css: this.css,
1480
+ quote_reply: this.quoteReply,
1481
+ };
1482
+ }
1483
+ }
1484
+ export class InjectInboundRequest {
1485
+ from;
1486
+ to;
1487
+ cc;
1488
+ bcc;
1489
+ subject;
1490
+ text;
1491
+ html;
1492
+ markdown;
1493
+ replyTo;
1494
+ date;
1495
+ attachments;
1496
+ headers;
1497
+ userData;
1498
+ triggerWebhook;
1499
+ constructor(data) {
1500
+ this.from = data.from;
1501
+ this.to = data.to || [];
1502
+ this.cc = data.cc || [];
1503
+ this.bcc = data.bcc || [];
1504
+ this.subject = data.subject;
1505
+ this.text = data.text;
1506
+ this.html = data.html;
1507
+ this.markdown = data.markdown;
1508
+ this.replyTo = data.replyTo;
1509
+ this.date = data.date;
1510
+ this.attachments = data.attachments || [];
1511
+ this.headers = data.headers || [];
1512
+ this.userData = data.userData;
1513
+ this.triggerWebhook = data.triggerWebhook;
1514
+ }
1515
+ static fromApiDict(data) {
1516
+ const obj = new InjectInboundRequest({});
1517
+ obj.from = data.from;
1518
+ obj.to = data.to || [];
1519
+ obj.cc = data.cc || [];
1520
+ obj.bcc = data.bcc || [];
1521
+ obj.subject = data.subject;
1522
+ obj.text = data.text;
1523
+ obj.html = data.html;
1524
+ obj.markdown = data.markdown;
1525
+ obj.replyTo = data.reply_to;
1526
+ obj.date = data.date ? new Date(data.date) : undefined;
1527
+ obj.attachments = data.attachments
1528
+ ? (data.attachments || []).map((item) => ThreadReplyAttachment.fromApiDict(item))
1529
+ : undefined;
1530
+ obj.headers = data.headers || [];
1531
+ obj.userData = data.user_data ? UserData.fromApiDict(data.user_data) : undefined;
1532
+ obj.triggerWebhook = data.trigger_webhook;
1533
+ return obj;
1534
+ }
1535
+ toApiDict() {
1536
+ return {
1537
+ from: this.from,
1538
+ to: this.to || [],
1539
+ cc: this.cc || [],
1540
+ bcc: this.bcc || [],
1541
+ subject: this.subject,
1542
+ text: this.text,
1543
+ html: this.html,
1544
+ markdown: this.markdown,
1545
+ reply_to: this.replyTo,
1546
+ date: this.date?.toISOString(),
1547
+ attachments: (this.attachments || []).map((item) => item.toApiDict()),
1548
+ headers: this.headers || [],
1549
+ user_data: this.userData?.toApiDict(),
1550
+ trigger_webhook: this.triggerWebhook,
1551
+ };
1552
+ }
1553
+ }
1554
+ export class ThreadReplyResponse {
1555
+ status;
1556
+ emailId;
1557
+ messageId;
1558
+ constructor(data) {
1559
+ this.status = data.status;
1560
+ this.emailId = data.emailId;
1561
+ this.messageId = data.messageId;
1562
+ }
1563
+ static fromApiDict(data) {
1564
+ const obj = new ThreadReplyResponse({});
1565
+ obj.status = data.status;
1566
+ obj.emailId = data.email_id;
1567
+ obj.messageId = data.message_id;
1568
+ return obj;
1569
+ }
1570
+ toApiDict() {
1571
+ return {
1572
+ status: this.status,
1573
+ email_id: this.emailId,
1574
+ message_id: this.messageId,
1575
+ };
1576
+ }
1577
+ }
1578
+ export class MailboxFilters {
1579
+ allow;
1580
+ deny;
1581
+ constructor(data) {
1582
+ this.allow = data.allow;
1583
+ this.deny = data.deny;
1584
+ }
1585
+ static fromApiDict(data) {
1586
+ const obj = new MailboxFilters({});
1587
+ obj.allow = data.allow || [];
1588
+ obj.deny = data.deny || [];
1589
+ return obj;
1590
+ }
1591
+ toApiDict() {
1592
+ return {
1593
+ allow: this.allow || [],
1594
+ deny: this.deny || [],
1595
+ };
1596
+ }
1597
+ }
1598
+ export class Mailbox {
1599
+ id;
1600
+ tenantId;
1601
+ domainId;
1602
+ localPart;
1603
+ extraAliases;
1604
+ email;
1605
+ active;
1606
+ senderName;
1607
+ spamPolicy;
1608
+ inboundPolicy;
1609
+ dmarcEnforcement;
1610
+ subaddressing;
1611
+ filters;
1612
+ createdAt;
1613
+ updatedAt;
1614
+ constructor(data) {
1615
+ this.id = data.id;
1616
+ this.tenantId = data.tenantId;
1617
+ this.domainId = data.domainId;
1618
+ this.localPart = data.localPart;
1619
+ this.extraAliases = data.extraAliases || [];
1620
+ this.email = data.email;
1621
+ this.active = data.active;
1622
+ this.senderName = data.senderName;
1623
+ this.spamPolicy = data.spamPolicy;
1624
+ this.inboundPolicy = data.inboundPolicy;
1625
+ this.dmarcEnforcement = data.dmarcEnforcement;
1626
+ this.subaddressing = data.subaddressing;
1627
+ this.filters = data.filters;
1628
+ this.createdAt = data.createdAt;
1629
+ this.updatedAt = data.updatedAt;
1630
+ }
1631
+ static fromApiDict(data) {
1632
+ const obj = new Mailbox({});
1633
+ obj.id = data.id;
1634
+ obj.tenantId = data.tenant_id;
1635
+ obj.domainId = data.domain_id;
1636
+ obj.localPart = data.local_part;
1637
+ obj.extraAliases = data.extra_aliases || [];
1638
+ obj.email = data.email;
1639
+ obj.active = data.active;
1640
+ obj.senderName = data.sender_name;
1641
+ obj.spamPolicy = data.spam_policy;
1642
+ obj.inboundPolicy = data.inbound_policy;
1643
+ obj.dmarcEnforcement = data.dmarc_enforcement;
1644
+ obj.subaddressing = data.subaddressing;
1645
+ obj.filters = data.filters ? MailboxFilters.fromApiDict(data.filters) : undefined;
1646
+ obj.createdAt = new Date(data.created_at);
1647
+ obj.updatedAt = new Date(data.updated_at);
1648
+ return obj;
1649
+ }
1650
+ toApiDict() {
1651
+ return {
1652
+ id: this.id,
1653
+ tenant_id: this.tenantId,
1654
+ domain_id: this.domainId,
1655
+ local_part: this.localPart,
1656
+ extra_aliases: this.extraAliases || [],
1657
+ email: this.email,
1658
+ active: this.active,
1659
+ sender_name: this.senderName,
1660
+ spam_policy: this.spamPolicy,
1661
+ inbound_policy: this.inboundPolicy,
1662
+ dmarc_enforcement: this.dmarcEnforcement,
1663
+ subaddressing: this.subaddressing,
1664
+ filters: this.filters?.toApiDict(),
1665
+ created_at: this.createdAt?.toISOString(),
1666
+ updated_at: this.updatedAt?.toISOString(),
1667
+ };
1668
+ }
1669
+ }
1670
+ export class WebhookEvent {
1671
+ type;
1672
+ timestamp;
1673
+ data;
1674
+ constructor(data) {
1675
+ this.type = data.type;
1676
+ this.timestamp = data.timestamp;
1677
+ this.data = data.data;
1678
+ }
1679
+ static fromApiDict(data) {
1680
+ const obj = new WebhookEvent({});
1681
+ obj.type = data.type;
1682
+ obj.timestamp = new Date(data.timestamp);
1683
+ obj.data = data.data;
1684
+ return obj;
1685
+ }
1686
+ toApiDict() {
1687
+ return {
1688
+ type: this.type,
1689
+ timestamp: this.timestamp?.toISOString(),
1690
+ data: this.data,
1691
+ };
1692
+ }
1693
+ }
1694
+ export class EmailReceivedEventData {
1695
+ emailId;
1696
+ mailboxId;
1697
+ domainId;
1698
+ from;
1699
+ to;
1700
+ subject;
1701
+ receivedAt;
1702
+ messageId;
1703
+ threadId;
1704
+ text;
1705
+ cc;
1706
+ labels;
1707
+ constructor(data) {
1708
+ this.emailId = data.emailId;
1709
+ this.mailboxId = data.mailboxId;
1710
+ this.domainId = data.domainId;
1711
+ this.from = data.from;
1712
+ this.to = data.to;
1713
+ this.subject = data.subject;
1714
+ this.receivedAt = data.receivedAt;
1715
+ this.messageId = data.messageId;
1716
+ this.threadId = data.threadId;
1717
+ this.text = data.text;
1718
+ this.cc = data.cc || [];
1719
+ this.labels = data.labels;
1720
+ }
1721
+ static fromApiDict(data) {
1722
+ const obj = new EmailReceivedEventData({});
1723
+ obj.emailId = data.email_id;
1724
+ obj.mailboxId = data.mailbox_id;
1725
+ obj.domainId = data.domain_id;
1726
+ obj.from = data.from;
1727
+ obj.to = data.to || [];
1728
+ obj.subject = data.subject;
1729
+ obj.receivedAt = new Date(data.received_at);
1730
+ obj.messageId = data.message_id;
1731
+ obj.threadId = data.thread_id;
1732
+ obj.text = data.text;
1733
+ obj.cc = data.cc || [];
1734
+ obj.labels = data.labels || [];
1735
+ return obj;
1736
+ }
1737
+ toApiDict() {
1738
+ return {
1739
+ email_id: this.emailId,
1740
+ mailbox_id: this.mailboxId,
1741
+ domain_id: this.domainId,
1742
+ from: this.from,
1743
+ to: this.to || [],
1744
+ subject: this.subject,
1745
+ received_at: this.receivedAt?.toISOString(),
1746
+ message_id: this.messageId,
1747
+ thread_id: this.threadId,
1748
+ text: this.text,
1749
+ cc: this.cc || [],
1750
+ labels: this.labels || [],
1751
+ };
1752
+ }
1753
+ }
1754
+ export class DeliverySuccessEventData {
1755
+ messageId;
1756
+ recipient;
1757
+ from;
1758
+ provider;
1759
+ emailId;
1760
+ mailboxId;
1761
+ domainId;
1762
+ deliveredAt;
1763
+ reportingMta;
1764
+ smtpResponse;
1765
+ constructor(data) {
1766
+ this.messageId = data.messageId;
1767
+ this.recipient = data.recipient;
1768
+ this.from = data.from;
1769
+ this.provider = data.provider;
1770
+ this.emailId = data.emailId;
1771
+ this.mailboxId = data.mailboxId;
1772
+ this.domainId = data.domainId;
1773
+ this.deliveredAt = data.deliveredAt;
1774
+ this.reportingMta = data.reportingMta;
1775
+ this.smtpResponse = data.smtpResponse;
1776
+ }
1777
+ static fromApiDict(data) {
1778
+ const obj = new DeliverySuccessEventData({});
1779
+ obj.messageId = data.message_id;
1780
+ obj.recipient = data.recipient;
1781
+ obj.from = data.from;
1782
+ obj.provider = data.provider;
1783
+ obj.emailId = data.email_id;
1784
+ obj.mailboxId = data.mailbox_id;
1785
+ obj.domainId = data.domain_id;
1786
+ obj.deliveredAt = data.delivered_at ? new Date(data.delivered_at) : undefined;
1787
+ obj.reportingMta = data.reporting_mta;
1788
+ obj.smtpResponse = data.smtp_response;
1789
+ return obj;
1790
+ }
1791
+ toApiDict() {
1792
+ return {
1793
+ message_id: this.messageId,
1794
+ recipient: this.recipient,
1795
+ from: this.from,
1796
+ provider: this.provider,
1797
+ email_id: this.emailId,
1798
+ mailbox_id: this.mailboxId,
1799
+ domain_id: this.domainId,
1800
+ delivered_at: this.deliveredAt?.toISOString(),
1801
+ reporting_mta: this.reportingMta,
1802
+ smtp_response: this.smtpResponse,
1803
+ };
1804
+ }
1805
+ }
1806
+ export class DeliveryFailedEventData {
1807
+ messageId;
1808
+ recipient;
1809
+ from;
1810
+ provider;
1811
+ failureType;
1812
+ severity;
1813
+ emailId;
1814
+ mailboxId;
1815
+ domainId;
1816
+ failedAt;
1817
+ bounce;
1818
+ constructor(data) {
1819
+ this.messageId = data.messageId;
1820
+ this.recipient = data.recipient;
1821
+ this.from = data.from;
1822
+ this.provider = data.provider;
1823
+ this.failureType = data.failureType;
1824
+ this.severity = data.severity;
1825
+ this.emailId = data.emailId;
1826
+ this.mailboxId = data.mailboxId;
1827
+ this.domainId = data.domainId;
1828
+ this.failedAt = data.failedAt;
1829
+ this.bounce = data.bounce;
1830
+ }
1831
+ static fromApiDict(data) {
1832
+ const obj = new DeliveryFailedEventData({});
1833
+ obj.messageId = data.message_id;
1834
+ obj.recipient = data.recipient;
1835
+ obj.from = data.from;
1836
+ obj.provider = data.provider;
1837
+ obj.failureType = data.failure_type;
1838
+ obj.severity = data.severity;
1839
+ obj.emailId = data.email_id;
1840
+ obj.mailboxId = data.mailbox_id;
1841
+ obj.domainId = data.domain_id;
1842
+ obj.failedAt = data.failed_at ? new Date(data.failed_at) : undefined;
1843
+ obj.bounce = data.bounce;
1844
+ return obj;
1845
+ }
1846
+ toApiDict() {
1847
+ return {
1848
+ message_id: this.messageId,
1849
+ recipient: this.recipient,
1850
+ from: this.from,
1851
+ provider: this.provider,
1852
+ failure_type: this.failureType,
1853
+ severity: this.severity,
1854
+ email_id: this.emailId,
1855
+ mailbox_id: this.mailboxId,
1856
+ domain_id: this.domainId,
1857
+ failed_at: this.failedAt?.toISOString(),
1858
+ bounce: this.bounce,
1859
+ };
1860
+ }
1861
+ }
1862
+ //# sourceMappingURL=types.js.map