@openemail/sdk 0.0.1 → 0.0.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.
Files changed (6) hide show
  1. package/README.md +4 -4
  2. package/index.cjs +1270 -208
  3. package/index.d.cts +2091 -132
  4. package/index.d.ts +2091 -132
  5. package/index.js +1256 -209
  6. package/package.json +3 -3
package/index.d.cts CHANGED
@@ -19,6 +19,376 @@ type AddressBookResource = {
19
19
  domains: Array<SendableDomainResource>;
20
20
  };
21
21
 
22
+ type AddressBookPage = AddressBookResource & {
23
+ hasMore: boolean;
24
+ nextCursor: string | null;
25
+ };
26
+
27
+ type AudienceBatchAddResource = {
28
+ object: 'audience_batch';
29
+ audienceId: string;
30
+ added: number;
31
+ unchanged: number;
32
+ missing: Array<string>;
33
+ };
34
+
35
+ type AudienceBatchRemoveResource = {
36
+ object: 'audience_batch';
37
+ audienceId: string;
38
+ removed: number;
39
+ notInAudience: Array<string>;
40
+ missing: Array<string>;
41
+ };
42
+
43
+ declare const AUDIENCE_BUILTINS: {
44
+ readonly DEFAULT: "default";
45
+ };
46
+ declare const AUDIENCE_MEMBER_SORTS: {
47
+ readonly LAST_HEARD_NEWEST: "last-heard-newest";
48
+ readonly LAST_HEARD_OLDEST: "last-heard-oldest";
49
+ readonly ADDED_NEWEST: "added-newest";
50
+ readonly ADDED_OLDEST: "added-oldest";
51
+ readonly NAME: "name";
52
+ };
53
+
54
+ type AudienceBuiltin = (typeof AUDIENCE_BUILTINS)[keyof typeof AUDIENCE_BUILTINS];
55
+
56
+ type AudienceContactAdd = {
57
+ email: string;
58
+ };
59
+
60
+ type AudienceMemberSort = (typeof AUDIENCE_MEMBER_SORTS)[keyof typeof AUDIENCE_MEMBER_SORTS];
61
+
62
+ declare const CONTACT_SOURCES: {
63
+ readonly MANUAL: "manual";
64
+ readonly AUTO: "auto";
65
+ };
66
+ declare const PEOPLE_SORTS: {
67
+ readonly RECENT: "recent";
68
+ readonly NAME: "name";
69
+ readonly THREADS: "threads";
70
+ };
71
+ declare const CONTACT_THREAD_SORTS: {
72
+ readonly NEWEST: "newest";
73
+ readonly OLDEST: "oldest";
74
+ readonly SENDER: "sender";
75
+ readonly SUBJECT: "subject";
76
+ };
77
+ declare const CONTACT_BLOCK_LISTS: {
78
+ readonly BLOCKED_SENDERS: "blockedSenders";
79
+ readonly BLOCKED_DOMAINS: "blockedDomains";
80
+ };
81
+ declare const CONTACT_PHOTO_TYPES: {
82
+ readonly PNG: "image/png";
83
+ readonly JPEG: "image/jpeg";
84
+ readonly WEBP: "image/webp";
85
+ readonly GIF: "image/gif";
86
+ };
87
+
88
+ type ContactSource = (typeof CONTACT_SOURCES)[keyof typeof CONTACT_SOURCES];
89
+
90
+ type RequestScope = {
91
+ signal?: AbortSignal;
92
+ apiKey?: string;
93
+ };
94
+
95
+ type ListOptions = RequestScope & {
96
+ limit?: number;
97
+ cursor?: string;
98
+ };
99
+
100
+ type AudienceContactListOptions = ListOptions & {
101
+ q?: string;
102
+ source?: ContactSource;
103
+ sort?: AudienceMemberSort;
104
+ };
105
+
106
+ type ContactResource = {
107
+ object: 'contact';
108
+ email: string;
109
+ name: string | null;
110
+ source: ContactSource | (string & {});
111
+ notes: string | null;
112
+ photoUrl: string | null;
113
+ lastSeenAt: string | null;
114
+ createdAt: string;
115
+ updatedAt: string;
116
+ };
117
+
118
+ type AudienceContactResource = ContactResource & {
119
+ addedAt: string;
120
+ unsubscribedAt: string | null;
121
+ };
122
+
123
+ type AudienceContactsBatch = {
124
+ emails: Array<string>;
125
+ };
126
+
127
+ type AudienceCreate = {
128
+ name: string;
129
+ description?: string | null;
130
+ };
131
+
132
+ type AudienceGrowthBucket = {
133
+ bucket: string;
134
+ added: number;
135
+ unsubscribed: number;
136
+ };
137
+
138
+ declare const HIT_KINDS: {
139
+ readonly HUMAN: "human";
140
+ readonly PROXY: "proxy";
141
+ readonly MACHINE: "machine";
142
+ };
143
+ declare const TRACKING_GRAINS: {
144
+ readonly MINUTE: "minute";
145
+ readonly HOUR: "hour";
146
+ readonly DAY: "day";
147
+ };
148
+
149
+ type TrackingGrain = (typeof TRACKING_GRAINS)[keyof typeof TRACKING_GRAINS];
150
+
151
+ type AudienceGrowthOptions = RequestScope & {
152
+ audienceIds?: Array<string>;
153
+ days?: number;
154
+ minutes?: number;
155
+ grain?: TrackingGrain;
156
+ offsetMinutes?: number;
157
+ };
158
+
159
+ type AudienceGrowthSeries = {
160
+ id: string;
161
+ name: string;
162
+ builtin: boolean;
163
+ total: number;
164
+ subscribed: number;
165
+ before: number;
166
+ added: number;
167
+ unsubscribed: number;
168
+ buckets: Array<AudienceGrowthBucket>;
169
+ };
170
+
171
+ type AudienceGrowthTotals = {
172
+ contacts: number;
173
+ subscribed: number;
174
+ memberships: number;
175
+ added: number;
176
+ unsubscribed: number;
177
+ lists: number;
178
+ busiest: string | null;
179
+ };
180
+
181
+ type AudienceGrowthResource = {
182
+ object: 'audience_growth';
183
+ since: string;
184
+ until: string;
185
+ grain: TrackingGrain;
186
+ offsetMinutes: number;
187
+ totals: AudienceGrowthTotals;
188
+ series: Array<AudienceGrowthSeries>;
189
+ };
190
+
191
+ type AudienceImportRow = {
192
+ email: string;
193
+ name?: string | null;
194
+ };
195
+
196
+ type AudienceImport = {
197
+ contacts: Array<AudienceImportRow>;
198
+ };
199
+
200
+ type AudienceImportResource = {
201
+ object: 'audience_import';
202
+ audienceId: string;
203
+ created: number;
204
+ added: number;
205
+ skipped: number;
206
+ invalid: Array<string>;
207
+ };
208
+
209
+ type AudienceListOptions = ListOptions;
210
+
211
+ type AudienceMemberResource = {
212
+ object: 'audience_member';
213
+ audienceId: string;
214
+ addedAt: string;
215
+ contact: ContactResource;
216
+ };
217
+
218
+ type AudiencePatch = {
219
+ name?: string;
220
+ description?: string | null;
221
+ };
222
+
223
+ type AudienceResource = {
224
+ object: 'audience';
225
+ id: string;
226
+ name: string;
227
+ description: string | null;
228
+ builtin: AudienceBuiltin | (string & {}) | null;
229
+ contactCount: number;
230
+ lastContactAt: string | null;
231
+ createdAt: string;
232
+ updatedAt: string;
233
+ };
234
+
235
+ type DeletedAudienceResource = {
236
+ object: 'audience';
237
+ id: string;
238
+ deleted: true;
239
+ };
240
+
241
+ type EmptiedAudienceResource = AudienceResource & {
242
+ removed: number;
243
+ };
244
+
245
+ type RemovedAudienceContactResource = {
246
+ object: 'audience_member';
247
+ audienceId: string;
248
+ email: string;
249
+ deleted: true;
250
+ };
251
+
252
+ type BroadcastCounts = {
253
+ recipients: number;
254
+ created: number;
255
+ skipped: number;
256
+ failedToQueue: number;
257
+ queued: number;
258
+ sending: number;
259
+ sent: number;
260
+ failed: number;
261
+ cancelled: number;
262
+ };
263
+
264
+ type RecipientInput = string | {
265
+ email: string;
266
+ name?: string;
267
+ };
268
+
269
+ type TrackingRequest = {
270
+ opens?: boolean;
271
+ clicks?: boolean;
272
+ };
273
+
274
+ type BroadcastCreate = {
275
+ audienceIds: Array<string>;
276
+ from: RecipientInput;
277
+ replyTo?: RecipientInput;
278
+ subject?: string;
279
+ html?: string;
280
+ text?: string;
281
+ template?: {
282
+ id: string;
283
+ version?: number;
284
+ props?: Record<string, unknown>;
285
+ slots?: Record<string, unknown>;
286
+ };
287
+ tracking?: TrackingRequest;
288
+ tags?: Record<string, string>;
289
+ scheduledAt?: Date | string;
290
+ };
291
+
292
+ type BroadcastListOptions = ListOptions & {
293
+ audienceId?: string;
294
+ };
295
+
296
+ type BroadcastPreviewInput = {
297
+ audienceIds: Array<string>;
298
+ };
299
+
300
+ type BroadcastPreviewResource = {
301
+ object: 'broadcast_preview';
302
+ audienceIds: Array<string>;
303
+ recipients: number;
304
+ unsubscribed: number;
305
+ suppressed: number;
306
+ };
307
+
308
+ declare const API_KEY_MODES: {
309
+ readonly LIVE: "live";
310
+ readonly TEST: "test";
311
+ };
312
+
313
+ type ApiKeyMode = (typeof API_KEY_MODES)[keyof typeof API_KEY_MODES];
314
+
315
+ declare const BROADCAST_STATUSES: {
316
+ readonly SCHEDULED: "scheduled";
317
+ readonly QUEUED: "queued";
318
+ readonly SENDING: "sending";
319
+ readonly SENT: "sent";
320
+ readonly CANCELLED: "cancelled";
321
+ readonly FAILED: "failed";
322
+ };
323
+
324
+ type BroadcastStatus = (typeof BROADCAST_STATUSES)[keyof typeof BROADCAST_STATUSES];
325
+
326
+ declare const EMAIL_SOURCES: {
327
+ readonly COMPOSER: "composer";
328
+ readonly API: "api";
329
+ readonly MCP: "mcp";
330
+ readonly AI: "ai";
331
+ };
332
+ declare const EMAIL_STATUSES: {
333
+ readonly QUEUED: "queued";
334
+ readonly SCHEDULED: "scheduled";
335
+ readonly SENDING: "sending";
336
+ readonly SENT: "sent";
337
+ readonly PARTIAL: "partial";
338
+ readonly CANCELLED: "cancelled";
339
+ readonly FAILED: "failed";
340
+ };
341
+ declare const EMAIL_TRANSPORTS: {
342
+ readonly SES: "ses";
343
+ readonly RESEND: "resend";
344
+ readonly DEV: "dev";
345
+ readonly TEST: "test";
346
+ };
347
+ declare const RECIPIENT_STATUSES: {
348
+ readonly PENDING: "pending";
349
+ readonly SUPPRESSED: "suppressed";
350
+ readonly DELIVERED: "delivered";
351
+ readonly FAILED: "failed";
352
+ readonly BOUNCED: "bounced";
353
+ readonly COMPLAINED: "complained";
354
+ readonly UNCERTAIN: "uncertain";
355
+ };
356
+ declare const RECIPIENT_KINDS: {
357
+ readonly TO: "to";
358
+ readonly CC: "cc";
359
+ readonly BCC: "bcc";
360
+ };
361
+ declare const ATTACHMENT_DELIVERY_MODES: {
362
+ readonly MIME: "mime";
363
+ readonly LINK: "link";
364
+ readonly AUTO: "auto";
365
+ };
366
+
367
+ type EmailSource = (typeof EMAIL_SOURCES)[keyof typeof EMAIL_SOURCES];
368
+
369
+ type BroadcastResource = {
370
+ object: 'broadcast';
371
+ id: string;
372
+ status: BroadcastStatus;
373
+ mode: ApiKeyMode;
374
+ source: EmailSource | (string & {});
375
+ audienceIds: Array<string>;
376
+ from: string;
377
+ subject: string;
378
+ counts: BroadcastCounts;
379
+ lastError: string | null;
380
+ scheduledAt: string | null;
381
+ startedAt: string | null;
382
+ completedAt: string | null;
383
+ cancelledAt: string | null;
384
+ createdAt: string;
385
+ updatedAt: string;
386
+ };
387
+
388
+ type SentBroadcastResource = BroadcastResource & {
389
+ replayed: boolean;
390
+ };
391
+
22
392
  type CalendarAttendeeResource = {
23
393
  object: 'calendar_attendee';
24
394
  email: string;
@@ -83,28 +453,65 @@ type CalendarOccurrenceResource = {
83
453
  attendeeCount: number;
84
454
  };
85
455
 
86
- type RequestScope = {
87
- signal?: AbortSignal;
88
- apiKey?: string;
89
- };
90
-
91
- type CalendarRangeOptions = RequestScope & {
456
+ type CalendarRangeOptions = ListOptions & {
92
457
  from: Date | string;
93
458
  to: Date | string;
94
459
  timezone?: string;
95
460
  };
96
461
 
97
- type ApiKeyMode = 'live' | 'test';
98
-
99
- declare const API_SCOPES: readonly ["emails:send", "emails:read", "drafts:read", "drafts:write", "threads:read", "threads:write", "labels:read", "labels:write", "contacts:read", "calendar:read", "calendar:write", "templates:read", "templates:write", "domains:read", "domains:write", "webhooks:read", "webhooks:write", "rules:read", "rules:write", "connections:read", "members:read", "members:write", "roles:read", "roles:write", "settings:read", "settings:write"];
100
-
101
- type ApiScope = (typeof API_SCOPES)[number];
102
-
103
- type AttachmentInput = {
462
+ declare const API_SCOPES: {
463
+ readonly EMAILS_SEND: "emails:send";
464
+ readonly EMAILS_READ: "emails:read";
465
+ readonly DRAFTS_READ: "drafts:read";
466
+ readonly DRAFTS_WRITE: "drafts:write";
467
+ readonly THREADS_READ: "threads:read";
468
+ readonly THREADS_WRITE: "threads:write";
469
+ readonly LABELS_READ: "labels:read";
470
+ readonly LABELS_WRITE: "labels:write";
471
+ readonly CONTACTS_READ: "contacts:read";
472
+ readonly CONTACTS_WRITE: "contacts:write";
473
+ readonly AUDIENCES_READ: "audiences:read";
474
+ readonly AUDIENCES_WRITE: "audiences:write";
475
+ readonly CALENDAR_READ: "calendar:read";
476
+ readonly CALENDAR_WRITE: "calendar:write";
477
+ readonly TEMPLATES_READ: "templates:read";
478
+ readonly TEMPLATES_WRITE: "templates:write";
479
+ readonly DOMAINS_READ: "domains:read";
480
+ readonly DOMAINS_WRITE: "domains:write";
481
+ readonly WEBHOOKS_READ: "webhooks:read";
482
+ readonly WEBHOOKS_WRITE: "webhooks:write";
483
+ readonly RULES_READ: "rules:read";
484
+ readonly RULES_WRITE: "rules:write";
485
+ readonly CONNECTIONS_READ: "connections:read";
486
+ readonly MEMBERS_READ: "members:read";
487
+ readonly MEMBERS_WRITE: "members:write";
488
+ readonly ROLES_READ: "roles:read";
489
+ readonly ROLES_WRITE: "roles:write";
490
+ readonly SETTINGS_READ: "settings:read";
491
+ readonly SETTINGS_WRITE: "settings:write";
492
+ readonly KEYS_WRITE: "keys:write";
493
+ readonly KEYS_READ: "keys:read";
494
+ readonly KEYS_MANAGE: "keys:manage";
495
+ };
496
+ declare const CONSOLE_PERMISSIONS: {
497
+ readonly API_KEYS_READ: "api-keys:read";
498
+ readonly API_KEYS_WRITE: "api-keys:write";
499
+ readonly BILLING_READ: "billing:read";
500
+ readonly BILLING_WRITE: "billing:write";
501
+ readonly WORKSPACE_MANAGE: "workspace:manage";
502
+ };
503
+
504
+ type ApiScope = (typeof API_SCOPES)[keyof typeof API_SCOPES];
505
+
506
+ type InlineAttachmentInput = {
104
507
  filename: string;
105
508
  content: string | Uint8Array | ArrayBuffer;
106
509
  contentType?: string;
107
510
  };
511
+ type StoredAttachmentInput = {
512
+ fileId: string;
513
+ };
514
+ type AttachmentInput = InlineAttachmentInput | StoredAttachmentInput;
108
515
 
109
516
  type AttachmentResource = {
110
517
  object: 'attachment';
@@ -115,13 +522,73 @@ type AttachmentResource = {
115
522
  content: string | null;
116
523
  };
117
524
 
118
- type BuiltinRole = 'owner' | 'admin' | 'member' | 'viewer' | 'developer' | 'billing';
525
+ declare const API_KEY_STATUSES: {
526
+ readonly ACTIVE: "active";
527
+ readonly INACTIVE: "inactive";
528
+ readonly EXPIRED: "expired";
529
+ readonly REVOKED: "revoked";
530
+ };
531
+ declare const API_KEY_EVENT_TYPES: {
532
+ readonly CREATED: "created";
533
+ readonly UPDATED: "updated";
534
+ readonly ROTATED: "rotated";
535
+ readonly REVOKED: "revoked";
536
+ readonly DEACTIVATED: "deactivated";
537
+ readonly REACTIVATED: "reactivated";
538
+ readonly AUTH_FAILED: "auth_failed";
539
+ readonly DELETED: "deleted";
540
+ };
541
+ declare const AUDIT_ACTOR_KINDS: {
542
+ readonly USER: "user";
543
+ readonly API_KEY: "apiKey";
544
+ };
545
+
546
+ type AuditActorKind = (typeof AUDIT_ACTOR_KINDS)[keyof typeof AUDIT_ACTOR_KINDS];
547
+
548
+ type AuditActorResource = {
549
+ kind: AuditActorKind;
550
+ id: string;
551
+ name: string;
552
+ username: string | null;
553
+ label: string;
554
+ };
555
+
556
+ declare const BUILTIN_ROLES: {
557
+ readonly OWNER: "owner";
558
+ readonly ADMIN: "admin";
559
+ readonly MEMBER: "member";
560
+ readonly VIEWER: "viewer";
561
+ readonly DEVELOPER: "developer";
562
+ readonly BILLING: "billing";
563
+ };
564
+
565
+ type BuiltinRole = (typeof BUILTIN_ROLES)[keyof typeof BUILTIN_ROLES];
566
+
567
+ type ConsolePermission = (typeof CONSOLE_PERMISSIONS)[keyof typeof CONSOLE_PERMISSIONS];
568
+
569
+ type HitKind = (typeof HIT_KINDS)[keyof typeof HIT_KINDS];
570
+
571
+ type LogWindow = {
572
+ since?: Date | string;
573
+ until?: Date | string;
574
+ };
119
575
 
120
- type HitKind = 'human' | 'proxy' | 'machine';
576
+ declare const MESSAGE_ENCRYPTION_FORMATS: {
577
+ readonly PGP_MIME: "pgp-mime";
578
+ readonly PGP_SIGNED: "pgp-signed";
579
+ readonly PGP_INLINE: "pgp-inline";
580
+ readonly SMIME_ENCRYPTED: "smime-encrypted";
581
+ readonly SMIME_SIGNED: "smime-signed";
582
+ };
583
+ declare const MESSAGE_ENCRYPTION_PART_ROLES: {
584
+ readonly VERSION: "version";
585
+ readonly CIPHERTEXT: "ciphertext";
586
+ readonly SIGNATURE: "signature";
587
+ };
121
588
 
122
- declare const MESSAGE_ENCRYPTION_FORMATS: readonly ["pgp-mime", "pgp-signed", "pgp-inline", "smime-encrypted", "smime-signed"];
589
+ type MessageEncryptionFormat = (typeof MESSAGE_ENCRYPTION_FORMATS)[keyof typeof MESSAGE_ENCRYPTION_FORMATS];
123
590
 
124
- type MessageEncryptionFormat = (typeof MESSAGE_ENCRYPTION_FORMATS)[number];
591
+ type MessageEncryptionPartRole = (typeof MESSAGE_ENCRYPTION_PART_ROLES)[keyof typeof MESSAGE_ENCRYPTION_PART_ROLES];
125
592
 
126
593
  type MessageEncryption = {
127
594
  format: MessageEncryptionFormat;
@@ -130,7 +597,7 @@ type MessageEncryption = {
130
597
  parts?: Array<{
131
598
  index: number;
132
599
  attachmentId: string;
133
- role: 'version' | 'ciphertext' | 'signature';
600
+ role: MessageEncryptionPartRole;
134
601
  }>;
135
602
  };
136
603
 
@@ -138,12 +605,7 @@ type MessageResource = Record<string, unknown> & {
138
605
  encryption?: MessageEncryption;
139
606
  };
140
607
 
141
- type Permission = ApiScope | 'api-keys:read' | 'api-keys:write' | 'billing:read' | 'billing:write' | 'workspace:manage' | (string & {});
142
-
143
- type RecipientInput = string | {
144
- email: string;
145
- name?: string;
146
- };
608
+ type Permission = ApiScope | ConsolePermission | (string & {});
147
609
 
148
610
  type TranslateOptions = {
149
611
  to: string;
@@ -155,22 +617,172 @@ type SendTranslateOptions = TranslateOptions & {
155
617
  subject?: boolean;
156
618
  };
157
619
 
158
- type TrackingRequest = {
159
- opens?: boolean;
160
- clicks?: boolean;
620
+ type ContactActivityBucket = {
621
+ bucket: string;
622
+ received: number;
623
+ sent: number;
161
624
  };
162
625
 
163
- type ContactListOptions = RequestScope & {
164
- limit?: number;
626
+ type ContactActivityOptions = RequestScope & {
627
+ minutes?: number;
628
+ grain?: TrackingGrain;
629
+ offsetMinutes?: number;
165
630
  };
166
631
 
167
- type ContactResource = {
632
+ type ContactActivityTotals = {
633
+ received: number;
634
+ sent: number;
635
+ threads: number;
636
+ waiting: number;
637
+ lastReceivedAt: string | null;
638
+ lastSentAt: string | null;
639
+ };
640
+
641
+ type ContactReplyTime = {
642
+ yours: number | null;
643
+ theirs: number | null;
644
+ };
645
+
646
+ type ContactActivityResource = {
647
+ object: 'contact_activity';
648
+ email: string;
649
+ since: string;
650
+ until: string;
651
+ grain: TrackingGrain | (string & {});
652
+ buckets: Array<ContactActivityBucket>;
653
+ totals: ContactActivityTotals;
654
+ replyTime: ContactReplyTime;
655
+ };
656
+
657
+ type ContactAudienceResource = {
658
+ id: string;
659
+ name: string;
660
+ builtin: AudienceBuiltin | null;
661
+ };
662
+
663
+ type ContactAudiencesSet = {
664
+ audienceIds: Array<string>;
665
+ };
666
+
667
+ type ContactBatchDeleteResource = {
668
+ object: 'contact_batch_delete';
669
+ deleted: number;
670
+ saved: number;
671
+ invalid: Array<string>;
672
+ };
673
+
674
+ type ContactBlockList = (typeof CONTACT_BLOCK_LISTS)[keyof typeof CONTACT_BLOCK_LISTS];
675
+
676
+ type ContactBlockRule = {
677
+ rule: string;
678
+ list: ContactBlockList | (string & {});
679
+ };
680
+
681
+ type ContactBlockResource = {
682
+ object: 'contact_block';
683
+ email: string;
684
+ blocked: boolean;
685
+ blockedBy?: ContactBlockRule;
686
+ created?: boolean;
687
+ removed?: Array<ContactBlockRule>;
688
+ };
689
+
690
+ type ContactCreate = {
691
+ email: string;
692
+ name?: string | null;
693
+ notes?: string | null;
694
+ audienceIds?: Array<string>;
695
+ };
696
+
697
+ type ContactDetailResource = ContactResource & {
698
+ audiences: Array<ContactAudienceResource>;
699
+ };
700
+
701
+ type ContactListOptions = ListOptions & {
702
+ source?: ContactSource;
703
+ q?: string;
704
+ };
705
+
706
+ type ContactPatch = {
707
+ name?: string | null;
708
+ notes?: string | null;
709
+ };
710
+
711
+ type ContactPhotoType = (typeof CONTACT_PHOTO_TYPES)[keyof typeof CONTACT_PHOTO_TYPES];
712
+
713
+ type ContactPhotoOptions = RequestScope & {
714
+ contentType?: ContactPhotoType;
715
+ };
716
+
717
+ type ContactSave = {
718
+ name?: string;
719
+ notes?: string | null;
720
+ };
721
+
722
+ type ContactThreadSort = (typeof CONTACT_THREAD_SORTS)[keyof typeof CONTACT_THREAD_SORTS];
723
+
724
+ type ContactThreadListOptions = ListOptions & {
725
+ q?: string;
726
+ sort?: ContactThreadSort;
727
+ };
728
+
729
+ type ContactThreadResource = {
730
+ object: 'thread';
731
+ id: string;
732
+ subject: string | null;
733
+ from: {
734
+ name: string | null;
735
+ email: string;
736
+ } | null;
737
+ receivedAt: string | null;
738
+ messageCount: number;
739
+ hasUnread: boolean;
740
+ labels: Array<{
741
+ id: string;
742
+ name: string;
743
+ }>;
744
+ };
745
+
746
+ type DeletedContactResource = {
168
747
  object: 'contact';
169
748
  email: string;
749
+ deleted: true;
750
+ wasSaved: boolean;
751
+ };
752
+
753
+ type Page<T> = {
754
+ items: Array<T>;
755
+ hasMore: boolean;
756
+ nextCursor: string | null;
757
+ };
758
+
759
+ type PersonResource = {
760
+ object: 'person';
761
+ email: string;
762
+ displayEmail: string;
170
763
  name: string | null;
171
- source: 'manual' | 'auto' | (string & {});
764
+ saved: boolean;
765
+ source: ContactSource | (string & {}) | null;
172
766
  notes: string | null;
173
- lastSeenAt: string | null;
767
+ photoUrl: string | null;
768
+ threads: number | null;
769
+ lastAt: string | null;
770
+ createdAt: string | null;
771
+ updatedAt: string | null;
772
+ blockedBy: ContactBlockRule | null;
773
+ };
774
+
775
+ type PeoplePage = Page<PersonResource> & {
776
+ seen: boolean;
777
+ };
778
+
779
+ type PeopleSort = (typeof PEOPLE_SORTS)[keyof typeof PEOPLE_SORTS];
780
+
781
+ type PersonListOptions = ListOptions & {
782
+ q?: string;
783
+ email?: string;
784
+ sort?: PeopleSort;
785
+ blocked?: boolean;
174
786
  };
175
787
 
176
788
  type ApiErrorPayload = {
@@ -182,9 +794,18 @@ type ApiErrorPayload = {
182
794
  requestId?: string;
183
795
  };
184
796
 
185
- declare const ERROR_TYPES: readonly ["invalid_request_error", "authentication_error", "permission_error", "not_found_error", "conflict_error", "validation_error", "rate_limit_error", "api_error"];
797
+ declare const ERROR_TYPES: {
798
+ readonly INVALID_REQUEST_ERROR: "invalid_request_error";
799
+ readonly AUTHENTICATION_ERROR: "authentication_error";
800
+ readonly PERMISSION_ERROR: "permission_error";
801
+ readonly NOT_FOUND_ERROR: "not_found_error";
802
+ readonly CONFLICT_ERROR: "conflict_error";
803
+ readonly VALIDATION_ERROR: "validation_error";
804
+ readonly RATE_LIMIT_ERROR: "rate_limit_error";
805
+ readonly API_ERROR: "api_error";
806
+ };
186
807
 
187
- type ErrorType = (typeof ERROR_TYPES)[number];
808
+ type ErrorType = (typeof ERROR_TYPES)[keyof typeof ERROR_TYPES];
188
809
 
189
810
  type ApiErrorProps = {
190
811
  message: string;
@@ -215,23 +836,79 @@ type ClientOptions = TransportOptions & {
215
836
  };
216
837
 
217
838
  declare const Addresses: (transport: Transport) => {
218
- list: (options?: RequestScope) => Promise<AddressBookResource>;
839
+ list: (options?: ListOptions) => Promise<AddressBookPage>;
840
+ listAll: (options?: ListOptions) => Promise<AddressBookResource>;
841
+ iterate: (options?: ListOptions) => AsyncGenerator<AddressResource, void, undefined>;
842
+ };
843
+
844
+ declare const Audiences: (transport: Transport) => {
845
+ list: (options?: AudienceListOptions) => Promise<Page<AudienceResource>>;
846
+ listAll: (options?: AudienceListOptions) => Promise<Array<AudienceResource>>;
847
+ iterate: (options?: AudienceListOptions) => AsyncGenerator<AudienceResource, void, undefined>;
848
+ growth: (options?: AudienceGrowthOptions) => Promise<AudienceGrowthResource>;
849
+ get: (id: string, options?: RequestScope) => Promise<AudienceResource>;
850
+ create: (body: AudienceCreate, options?: RequestScope) => Promise<AudienceResource>;
851
+ update: (id: string, patch: AudiencePatch, options?: RequestScope) => Promise<AudienceResource>;
852
+ delete: (id: string, options?: RequestScope) => Promise<DeletedAudienceResource>;
853
+ empty: (id: string, options?: RequestScope) => Promise<EmptiedAudienceResource>;
854
+ listContacts: (id: string, options?: AudienceContactListOptions) => Promise<Page<AudienceContactResource>>;
855
+ listAllContacts: (id: string, options?: AudienceContactListOptions) => Promise<Array<AudienceContactResource>>;
856
+ iterateContacts: (id: string, options?: AudienceContactListOptions) => AsyncGenerator<AudienceContactResource, void, undefined>;
857
+ addContact: (id: string, body: AudienceContactAdd, options?: RequestScope) => Promise<AudienceMemberResource>;
858
+ removeContact: (id: string, email: string, options?: RequestScope) => Promise<RemovedAudienceContactResource>;
859
+ addContacts: (id: string, body: AudienceContactsBatch, options?: RequestScope) => Promise<AudienceBatchAddResource>;
860
+ removeContacts: (id: string, body: AudienceContactsBatch, options?: RequestScope) => Promise<AudienceBatchRemoveResource>;
861
+ importContacts: (id: string, body: AudienceImport, options?: RequestScope) => Promise<AudienceImportResource>;
862
+ };
863
+
864
+ declare const Broadcasts: (transport: Transport) => {
865
+ preview: (body: BroadcastPreviewInput, options?: RequestScope) => Promise<BroadcastPreviewResource>;
866
+ send: (body: BroadcastCreate, options?: SendScope) => Promise<SentBroadcastResource>;
867
+ list: (options?: BroadcastListOptions) => Promise<Page<BroadcastResource>>;
868
+ listAll: (options?: BroadcastListOptions) => Promise<Array<BroadcastResource>>;
869
+ iterate: (options?: BroadcastListOptions) => AsyncGenerator<BroadcastResource, void, undefined>;
870
+ get: (id: string, options?: RequestScope) => Promise<BroadcastResource>;
871
+ cancel: (id: string, options?: RequestScope) => Promise<BroadcastResource>;
219
872
  };
220
873
 
221
874
  declare const Calendar: (transport: Transport) => {
222
- listEvents: (options: CalendarRangeOptions) => Promise<Array<CalendarOccurrenceResource>>;
875
+ listEvents: (options: CalendarRangeOptions) => Promise<Page<CalendarOccurrenceResource>>;
876
+ listAllEvents: (options: CalendarRangeOptions) => Promise<Array<CalendarOccurrenceResource>>;
877
+ iterateEvents: (options: CalendarRangeOptions) => AsyncGenerator<CalendarOccurrenceResource, void, undefined>;
223
878
  getEvent: (id: string, options?: RequestScope) => Promise<CalendarEventResource>;
224
879
  getEventIcs: (id: string, options?: RequestScope) => Promise<string>;
225
880
  };
226
881
 
227
882
  declare const Contacts: (transport: Transport) => {
228
- list: (options?: ContactListOptions) => Promise<Array<ContactResource>>;
229
- get: (email: string, options?: RequestScope) => Promise<ContactResource>;
883
+ list: (options?: ContactListOptions) => Promise<Page<ContactResource>>;
884
+ listAll: (options?: ContactListOptions) => Promise<Array<ContactResource>>;
885
+ iterate: (options?: ContactListOptions) => AsyncGenerator<ContactResource, void, undefined>;
886
+ get: (email: string, options?: RequestScope) => Promise<ContactDetailResource>;
887
+ create: (body: ContactCreate, options?: RequestScope) => Promise<ContactDetailResource>;
888
+ update: (email: string, patch: ContactPatch, options?: RequestScope) => Promise<ContactDetailResource>;
889
+ delete: (email: string, options?: RequestScope) => Promise<DeletedContactResource>;
890
+ setAudiences: (email: string, body: ContactAudiencesSet, options?: RequestScope) => Promise<ContactDetailResource>;
891
+ listPeople: (options?: PersonListOptions) => Promise<PeoplePage>;
892
+ listAllPeople: (options?: PersonListOptions) => Promise<Array<PersonResource>>;
893
+ iteratePeople: (options?: PersonListOptions) => AsyncGenerator<PersonResource, void, undefined>;
894
+ save: (email: string, body?: ContactSave, options?: RequestScope) => Promise<ContactDetailResource>;
895
+ deleteMany: (emails: Array<string>, options?: RequestScope) => Promise<ContactBatchDeleteResource>;
896
+ setPhoto: (email: string, data: RawBody, options?: ContactPhotoOptions) => Promise<ContactDetailResource>;
897
+ removePhoto: (email: string, options?: RequestScope) => Promise<ContactDetailResource>;
898
+ block: (email: string, options?: RequestScope) => Promise<ContactBlockResource>;
899
+ unblock: (email: string, options?: RequestScope) => Promise<ContactBlockResource>;
900
+ listThreads: (email: string, options?: ContactThreadListOptions) => Promise<Page<ContactThreadResource>>;
901
+ listAllThreads: (email: string, options?: ContactThreadListOptions) => Promise<Array<ContactThreadResource>>;
902
+ iterateThreads: (email: string, options?: ContactThreadListOptions) => AsyncGenerator<ContactThreadResource, void, undefined>;
903
+ activity: (email: string, options?: ContactActivityOptions) => Promise<ContactActivityResource>;
230
904
  };
231
905
 
232
906
  declare const Domains: (transport: Transport) => {
233
- list: (options?: RequestScope) => Promise<Array<DomainResource>>;
907
+ list: (options?: ListOptions) => Promise<Page<DomainResource>>;
908
+ listAll: (options?: ListOptions) => Promise<Array<DomainResource>>;
909
+ iterate: (options?: ListOptions) => AsyncGenerator<DomainResource, void, undefined>;
234
910
  get: (id: string, options?: RequestScope) => Promise<DomainDetailResource>;
911
+ update: (id: string, patch: DomainPatch, options?: RequestScope) => Promise<DomainDetailResource>;
235
912
  };
236
913
 
237
914
  declare const Drafts: (transport: Transport) => {
@@ -252,17 +929,86 @@ declare const Emails: (transport: Transport) => {
252
929
  listAll: (options?: EmailListOptions) => Promise<Array<EmailResource>>;
253
930
  iterate: (options?: EmailListOptions) => AsyncGenerator<EmailResource, void, undefined>;
254
931
  get: (id: string, options?: RequestScope) => Promise<EmailResource>;
255
- listEvents: (id: string, options?: RequestScope) => Promise<Array<EmailEventResource>>;
932
+ listEvents: (id: string, options?: ListOptions) => Promise<Page<EmailEventResource>>;
933
+ listAllEvents: (id: string, options?: ListOptions) => Promise<Array<EmailEventResource>>;
934
+ iterateEvents: (id: string, options?: ListOptions) => AsyncGenerator<EmailEventResource, void, undefined>;
256
935
  getTracking: (id: string, options?: RequestScope) => Promise<TrackingResource>;
257
936
  cancel: (id: string, options?: RequestScope) => Promise<EmailResource>;
258
937
  reschedule: (id: string, scheduledAt: Date | string, options?: RequestScope) => Promise<EmailResource>;
259
938
  };
260
939
 
940
+ declare const Files: (transport: Transport) => {
941
+ list: (options?: FileListOptions) => Promise<Page<FileResource>>;
942
+ listAll: (options?: FileListOptions) => Promise<Array<FileResource>>;
943
+ iterate: (options?: FileListOptions) => AsyncGenerator<FileResource, void, undefined>;
944
+ get: (id: string, options?: RequestScope) => Promise<FileResource>;
945
+ stats: (options?: RequestScope) => Promise<FileStatsResource>;
946
+ download: (id: string, options?: RequestScope) => Promise<Uint8Array>;
947
+ listLinks: (id: string, options?: ListOptions) => Promise<Page<FileLinkResource>>;
948
+ listAllLinks: (id: string, options?: ListOptions) => Promise<Array<FileLinkResource>>;
949
+ iterateLinks: (id: string, options?: ListOptions) => AsyncGenerator<FileLinkResource, void, undefined>;
950
+ upload: (data: RawBody, options: FileUploadOptions) => Promise<FileResource>;
951
+ delete: (id: string, options?: RequestScope) => Promise<DeletedFileResource>;
952
+ deleteMany: (ids: Array<string>, options?: RequestScope) => Promise<FileBatchDeleteResource>;
953
+ };
954
+
955
+ declare const Imports: (transport: Transport) => {
956
+ list: (options?: ImportListOptions) => Promise<Page<ImportResource>>;
957
+ listAll: (options?: ImportListOptions) => Promise<Array<ImportResource>>;
958
+ iterate: (options?: ImportListOptions) => AsyncGenerator<ImportResource, void, undefined>;
959
+ get: (id: string, options?: RequestScope) => Promise<ImportResource>;
960
+ create: (body: ImportCreate, options?: RequestScope) => Promise<ImportResource>;
961
+ uploadState: (id: string, options?: RequestScope) => Promise<ImportUploadResource>;
962
+ uploadChunk: (id: string, file: number, chunk: number, data: RawBody, options?: RequestScope) => Promise<ImportChunkResource>;
963
+ start: (id: string, options?: RequestScope) => Promise<ImportResource>;
964
+ cancel: (id: string, options?: RequestScope) => Promise<ImportResource>;
965
+ listFailures: (id: string, options?: ImportFailuresOptions) => Promise<ImportFailurePage>;
966
+ deleteUpload: (id: string, options?: RequestScope) => Promise<ImportResource>;
967
+ importFiles: (input: ImportFilesInput, options?: RequestScope) => Promise<ImportResource>;
968
+ };
969
+
970
+ declare const Keys: (transport: Transport) => {
971
+ list: (options?: ListOptions) => Promise<Page<ApiKeyResource>>;
972
+ listAll: (options?: ListOptions) => Promise<Array<ApiKeyResource>>;
973
+ iterate: (options?: ListOptions) => AsyncGenerator<ApiKeyResource, void, undefined>;
974
+ get: (id: string, options?: RequestScope) => Promise<ApiKeyResource>;
975
+ create: (body: ApiKeyCreate, options?: RequestScope) => Promise<CreatedApiKeyResource>;
976
+ update: (id: string, patch: ApiKeyPatch, options?: RequestScope) => Promise<ApiKeyResource>;
977
+ delete: (id: string, options?: RequestScope) => Promise<DeletedApiKeyResource>;
978
+ rotate: (id: string, options?: RequestScope) => Promise<RotatedApiKeyResource>;
979
+ revoke: (id: string, body?: ApiKeyRevoke, options?: RequestScope) => Promise<ApiKeyResource>;
980
+ listRequests: (id: string, options?: ApiKeyRequestListOptions) => Promise<Page<ApiKeyRequestResource>>;
981
+ listAllRequests: (id: string, options?: ApiKeyRequestListOptions) => Promise<Array<ApiKeyRequestResource>>;
982
+ iterateRequests: (id: string, options?: ApiKeyRequestListOptions) => AsyncGenerator<ApiKeyRequestResource, void, undefined>;
983
+ listActivity: (id: string, options?: ApiKeyActivityListOptions) => Promise<Page<ApiKeyActivityResource>>;
984
+ listAllActivity: (id: string, options?: ApiKeyActivityListOptions) => Promise<Array<ApiKeyActivityResource>>;
985
+ iterateActivity: (id: string, options?: ApiKeyActivityListOptions) => AsyncGenerator<ApiKeyActivityResource, void, undefined>;
986
+ listWorkspaceRequests: (options?: ApiKeyWorkspaceRequestListOptions) => Promise<Page<ApiKeyRequestResource>>;
987
+ listAllWorkspaceRequests: (options?: ApiKeyWorkspaceRequestListOptions) => Promise<Array<ApiKeyRequestResource>>;
988
+ iterateWorkspaceRequests: (options?: ApiKeyWorkspaceRequestListOptions) => AsyncGenerator<ApiKeyRequestResource, void, undefined>;
989
+ listWorkspaceActivity: (options?: ApiKeyWorkspaceActivityListOptions) => Promise<Page<ApiKeyActivityResource>>;
990
+ listAllWorkspaceActivity: (options?: ApiKeyWorkspaceActivityListOptions) => Promise<Array<ApiKeyActivityResource>>;
991
+ iterateWorkspaceActivity: (options?: ApiKeyWorkspaceActivityListOptions) => AsyncGenerator<ApiKeyActivityResource, void, undefined>;
992
+ };
993
+
994
+ declare const ProviderImports: (transport: Transport) => {
995
+ inspect: (apiKey: string, options?: RequestScope) => Promise<ProviderInventoryResource>;
996
+ create: (body: ProviderImportCreate, options?: RequestScope) => Promise<ProviderImportResource>;
997
+ list: (options?: ProviderImportListOptions) => Promise<Page<ProviderImportResource>>;
998
+ listAll: (options?: ProviderImportListOptions) => Promise<Array<ProviderImportResource>>;
999
+ iterate: (options?: ProviderImportListOptions) => AsyncGenerator<ProviderImportResource, void, undefined>;
1000
+ get: (id: string, options?: RequestScope) => Promise<ProviderImportResource>;
1001
+ cancel: (id: string, options?: RequestScope) => Promise<ProviderImportResource>;
1002
+ };
1003
+
261
1004
  declare const Labels: (transport: Transport) => {
262
- list: (options?: RequestScope) => Promise<Array<LabelResource>>;
1005
+ list: (options?: ListOptions) => Promise<Page<LabelResource>>;
1006
+ listAll: (options?: ListOptions) => Promise<Array<LabelResource>>;
1007
+ iterate: (options?: ListOptions) => AsyncGenerator<LabelResource, void, undefined>;
1008
+ listColors: (options?: RequestScope) => Promise<Array<LabelColorResource>>;
263
1009
  get: (id: string, options?: RequestScope) => Promise<LabelResource>;
264
- create: (body: LabelInput, options?: RequestScope) => Promise<SavedLabelResource>;
265
- update: (id: string, body: LabelInput, options?: RequestScope) => Promise<SavedLabelResource>;
1010
+ create: (body: LabelInput, options?: RequestScope) => Promise<LabelResource>;
1011
+ update: (id: string, patch: LabelPatch, options?: RequestScope) => Promise<LabelResource>;
266
1012
  delete: (id: string, options?: RequestScope) => Promise<DeletedLabelResource>;
267
1013
  };
268
1014
 
@@ -273,20 +1019,30 @@ declare const Languages: (transport: Transport) => {
273
1019
  declare const Me: (transport: Transport) => {
274
1020
  get: (options?: RequestScope) => Promise<KeyResource>;
275
1021
  ping: (options?: RequestScope) => Promise<PingResource>;
1022
+ rotate: (options?: RequestScope) => Promise<RotatedKeyResource>;
276
1023
  };
277
1024
 
278
1025
  declare const Members: (transport: Transport) => {
279
- list: (options?: RequestScope) => Promise<Array<MemberResource>>;
1026
+ list: (options?: ListOptions) => Promise<Page<MemberResource>>;
1027
+ listAll: (options?: ListOptions) => Promise<Array<MemberResource>>;
1028
+ iterate: (options?: ListOptions) => AsyncGenerator<MemberResource, void, undefined>;
280
1029
  get: (userId: string, options?: RequestScope) => Promise<MemberResource>;
281
- add: (body: MemberAdd, options?: RequestScope) => Promise<MemberResource>;
1030
+ add: (body: MemberAdd, options?: RequestScope) => Promise<InvitationResource>;
282
1031
  update: (userId: string, patch: MemberPatch, options?: RequestScope) => Promise<MemberResource>;
283
1032
  remove: (userId: string, options?: RequestScope) => Promise<RemovedMemberResource>;
284
1033
  grantAddress: (userId: string, body: MemberAddressGrant, options?: RequestScope) => Promise<MemberResource>;
285
1034
  revokeAddress: (userId: string, addressId: string, options?: RequestScope) => Promise<MemberResource>;
1035
+ listInvitations: (options?: ListOptions) => Promise<Page<InvitationResource>>;
1036
+ listAllInvitations: (options?: ListOptions) => Promise<Array<InvitationResource>>;
1037
+ iterateInvitations: (options?: ListOptions) => AsyncGenerator<InvitationResource, void, undefined>;
1038
+ revokeInvitation: (invitationId: string, options?: RequestScope) => Promise<RevokedInvitationResource>;
1039
+ resendInvitation: (invitationId: string, options?: RequestScope) => Promise<InvitationResource>;
286
1040
  };
287
1041
 
288
1042
  declare const Roles: (transport: Transport) => {
289
- list: (options?: RequestScope) => Promise<Array<RoleResource>>;
1043
+ list: (options?: ListOptions) => Promise<Page<RoleResource>>;
1044
+ listAll: (options?: ListOptions) => Promise<Array<RoleResource>>;
1045
+ iterate: (options?: ListOptions) => AsyncGenerator<RoleResource, void, undefined>;
290
1046
  get: (id: string, options?: RequestScope) => Promise<RoleResource>;
291
1047
  create: (body: RoleCreate, options?: RequestScope) => Promise<RoleResource>;
292
1048
  update: (id: string, patch: RolePatch, options?: RequestScope) => Promise<RoleResource>;
@@ -310,8 +1066,17 @@ declare const Rules: (transport: Transport) => {
310
1066
  };
311
1067
 
312
1068
  declare const Settings: (transport: Transport) => {
313
- get: (options?: RequestScope) => Promise<SettingsResource>;
314
- update: (patch: SettingsPatch, options?: RequestScope) => Promise<SettingsResource>;
1069
+ get: (options?: SettingsOptions) => Promise<SettingsResource>;
1070
+ update: (patch: SettingsPatch, options?: SettingsOptions) => Promise<SettingsResource>;
1071
+ };
1072
+
1073
+ declare const Suppressions: (transport: Transport) => {
1074
+ list: (options?: SuppressionListOptions) => Promise<Page<SuppressionResource>>;
1075
+ listAll: (options?: SuppressionListOptions) => Promise<Array<SuppressionResource>>;
1076
+ iterate: (options?: SuppressionListOptions) => AsyncGenerator<SuppressionResource, void, undefined>;
1077
+ get: (id: string, options?: RequestScope) => Promise<SuppressionResource>;
1078
+ add: (body: SuppressionAdd, options?: RequestScope) => Promise<SuppressionResource>;
1079
+ remove: (id: string, options?: RequestScope) => Promise<RemovedSuppressionResource>;
315
1080
  };
316
1081
 
317
1082
  declare const TempMail: (transport: Transport) => {
@@ -321,6 +1086,8 @@ declare const TempMail: (transport: Transport) => {
321
1086
  extend: (inboxId: string, options?: InboxScope) => Promise<TempInboxResource>;
322
1087
  delete: (inboxId: string, options?: InboxScope) => Promise<DeletedTempInboxResource>;
323
1088
  listMessages: (inboxId: string, options?: TempMessageListOptions) => Promise<TempMessagesResource>;
1089
+ listAllMessages: (inboxId: string, options?: TempMessageListOptions) => Promise<Array<TempMessageResource>>;
1090
+ iterateMessages: (inboxId: string, options?: TempMessageListOptions) => AsyncGenerator<TempMessageResource, void, undefined>;
324
1091
  getMessage: (inboxId: string, messageId: string, options?: InboxScope) => Promise<TempMessageDetailResource>;
325
1092
  deleteMessage: (inboxId: string, messageId: string, options?: InboxScope) => Promise<DeletedTempMessageResource>;
326
1093
  listAttachments: (inboxId: string, messageId: string, options?: InboxScope) => Promise<Array<AttachmentResource>>;
@@ -330,13 +1097,26 @@ declare const Templates: (transport: Transport) => {
330
1097
  list: (options?: TemplateListOptions) => Promise<Page<TemplateResource>>;
331
1098
  listAll: (options?: TemplateListOptions) => Promise<Array<TemplateResource>>;
332
1099
  iterate: (options?: TemplateListOptions) => AsyncGenerator<TemplateResource, void, undefined>;
1100
+ listStarters: (options?: RequestScope) => Promise<Array<TemplateStarterResource>>;
1101
+ listFonts: (options?: RequestScope) => Promise<Array<TemplateFontResource>>;
1102
+ getStarter: (slug: string, options?: RequestScope) => Promise<TemplateStarterDetailResource>;
1103
+ render: (body: TemplateRenderInput, options?: RequestScope) => Promise<TemplateRenderResource>;
333
1104
  get: (idOrSlug: string, options?: RequestScope) => Promise<TemplateDetailResource>;
334
1105
  create: (body: TemplateCreate, options?: RequestScope) => Promise<TemplateResource>;
335
1106
  update: (idOrSlug: string, patch: TemplatePatch, options?: RequestScope) => Promise<TemplateDetailResource>;
336
1107
  delete: (idOrSlug: string, options?: RequestScope) => Promise<DeletedTemplateResource>;
337
- listVersions: (idOrSlug: string, options?: RequestScope) => Promise<Array<TemplateVersionResource>>;
1108
+ duplicate: (idOrSlug: string, body?: TemplateDuplicate, options?: RequestScope) => Promise<TemplateDetailResource>;
1109
+ replaceContent: (idOrSlug: string, body: TemplateContentSource, options?: RequestScope) => Promise<TemplateDetailResource>;
1110
+ listVersions: (idOrSlug: string, options?: ListOptions) => Promise<Page<TemplateVersionResource>>;
1111
+ listAllVersions: (idOrSlug: string, options?: ListOptions) => Promise<Array<TemplateVersionResource>>;
1112
+ iterateVersions: (idOrSlug: string, options?: ListOptions) => AsyncGenerator<TemplateVersionResource, void, undefined>;
1113
+ getVersion: (idOrSlug: string, version: number, options?: RequestScope) => Promise<TemplateVersionResource>;
1114
+ deleteVersion: (idOrSlug: string, version: number, options?: RequestScope) => Promise<DeletedTemplateVersionResource>;
1115
+ restoreVersion: (idOrSlug: string, version: number, body?: TemplateRestoreInput, options?: RequestScope) => Promise<TemplateRestoredResource>;
338
1116
  publish: (idOrSlug: string, options?: RequestScope) => Promise<TemplateVersionResource>;
339
1117
  preview: (idOrSlug: string, body?: TemplatePreviewInput, options?: RequestScope) => Promise<TemplatePreviewResource>;
1118
+ getAnalytics: (idOrSlug: string, options?: TemplateAnalyticsOptions) => Promise<TemplateAnalyticsResource>;
1119
+ listSends: (idOrSlug: string, options?: TemplateSendListOptions) => Promise<TemplateSendsResource>;
340
1120
  send: (idOrSlug: string, body: TemplateSend, options?: SendScope) => Promise<SentTemplateEmailResource>;
341
1121
  };
342
1122
 
@@ -353,28 +1133,50 @@ declare const Threads: (transport: Transport) => {
353
1133
  };
354
1134
 
355
1135
  declare const Tracking: (transport: Transport) => {
356
- list: (options?: TrackingListOptions) => Promise<Array<TrackingResource>>;
1136
+ list: (options?: TrackingListOptions) => Promise<Page<TrackingResource>>;
1137
+ listAll: (options?: TrackingListOptions) => Promise<Array<TrackingResource>>;
1138
+ iterate: (options?: TrackingListOptions) => AsyncGenerator<TrackingResource, void, undefined>;
357
1139
  getStats: (options?: TrackingStatsOptions) => Promise<TrackingStatsResource>;
358
1140
  get: (id: string, options?: RequestScope) => Promise<TrackingResource>;
359
- listOpens: (id: string, options?: TrackingHitOptions) => Promise<Array<TrackingOpenResource>>;
360
- listClicks: (id: string, options?: TrackingHitOptions) => Promise<Array<TrackingClickResource>>;
1141
+ listOpens: (id: string, options?: TrackingHitOptions) => Promise<Page<TrackingOpenResource>>;
1142
+ listAllOpens: (id: string, options?: TrackingHitOptions) => Promise<Array<TrackingOpenResource>>;
1143
+ iterateOpens: (id: string, options?: TrackingHitOptions) => AsyncGenerator<TrackingOpenResource, void, undefined>;
1144
+ listClicks: (id: string, options?: TrackingHitOptions) => Promise<Page<TrackingClickResource>>;
1145
+ listAllClicks: (id: string, options?: TrackingHitOptions) => Promise<Array<TrackingClickResource>>;
1146
+ iterateClicks: (id: string, options?: TrackingHitOptions) => AsyncGenerator<TrackingClickResource, void, undefined>;
361
1147
  };
362
1148
 
363
1149
  declare const Webhooks: (transport: Transport) => {
364
- list: (options?: RequestScope) => Promise<Array<WebhookResource>>;
1150
+ list: (options?: ListOptions) => Promise<Page<WebhookResource>>;
1151
+ listAll: (options?: ListOptions) => Promise<Array<WebhookResource>>;
1152
+ iterate: (options?: ListOptions) => AsyncGenerator<WebhookResource, void, undefined>;
365
1153
  get: (id: string, options?: RequestScope) => Promise<WebhookResource>;
366
1154
  create: (body: WebhookCreate, options?: RequestScope) => Promise<CreatedWebhookResource>;
367
1155
  update: (id: string, patch: WebhookPatch, options?: RequestScope) => Promise<WebhookResource>;
368
1156
  delete: (id: string, options?: RequestScope) => Promise<DeletedWebhookResource>;
369
1157
  rotateSecret: (id: string, options?: RequestScope) => Promise<CreatedWebhookResource>;
370
1158
  test: (id: string, options?: RequestScope) => Promise<WebhookTestResource>;
371
- listDeliveries: (id: string, options?: RequestScope) => Promise<Array<WebhookDeliveryResource>>;
1159
+ listDeliveries: (id: string, options?: WebhookDeliveryListOptions) => Promise<Page<WebhookDeliveryResource>>;
1160
+ listAllDeliveries: (id: string, options?: WebhookDeliveryListOptions) => Promise<Array<WebhookDeliveryResource>>;
1161
+ iterateDeliveries: (id: string, options?: WebhookDeliveryListOptions) => AsyncGenerator<WebhookDeliveryResource, void, undefined>;
1162
+ listWorkspaceDeliveries: (options?: WebhookWorkspaceDeliveryListOptions) => Promise<Page<WebhookDeliveryResource>>;
1163
+ listAllWorkspaceDeliveries: (options?: WebhookWorkspaceDeliveryListOptions) => Promise<Array<WebhookDeliveryResource>>;
1164
+ iterateWorkspaceDeliveries: (options?: WebhookWorkspaceDeliveryListOptions) => AsyncGenerator<WebhookDeliveryResource, void, undefined>;
1165
+ listActivity: (id: string, options?: WebhookActivityListOptions) => Promise<Page<WebhookActivityResource>>;
1166
+ listAllActivity: (id: string, options?: WebhookActivityListOptions) => Promise<Array<WebhookActivityResource>>;
1167
+ iterateActivity: (id: string, options?: WebhookActivityListOptions) => AsyncGenerator<WebhookActivityResource, void, undefined>;
1168
+ listWorkspaceActivity: (options?: WebhookWorkspaceActivityListOptions) => Promise<Page<WebhookActivityResource>>;
1169
+ listAllWorkspaceActivity: (options?: WebhookWorkspaceActivityListOptions) => Promise<Array<WebhookActivityResource>>;
1170
+ iterateWorkspaceActivity: (options?: WebhookWorkspaceActivityListOptions) => AsyncGenerator<WebhookActivityResource, void, undefined>;
1171
+ getDelivery: (id: string, deliveryId: string, options?: RequestScope) => Promise<WebhookDeliveryDetailResource>;
1172
+ replayDelivery: (id: string, deliveryId: string, options?: RequestScope) => Promise<WebhookReplayResource>;
372
1173
  };
373
1174
 
374
1175
  declare class OpenEmail {
375
1176
  private readonly transport;
376
1177
  readonly mode: ApiKeyMode;
377
1178
  readonly me: ReturnType<typeof Me>;
1179
+ readonly keys: ReturnType<typeof Keys>;
378
1180
  readonly addresses: ReturnType<typeof Addresses>;
379
1181
  readonly languages: ReturnType<typeof Languages>;
380
1182
  readonly emails: ReturnType<typeof Emails>;
@@ -384,13 +1186,19 @@ declare class OpenEmail {
384
1186
  readonly drafts: ReturnType<typeof Drafts>;
385
1187
  readonly labels: ReturnType<typeof Labels>;
386
1188
  readonly contacts: ReturnType<typeof Contacts>;
1189
+ readonly audiences: ReturnType<typeof Audiences>;
1190
+ readonly broadcasts: ReturnType<typeof Broadcasts>;
387
1191
  readonly domains: ReturnType<typeof Domains>;
388
1192
  readonly rules: ReturnType<typeof Rules>;
389
1193
  readonly webhooks: ReturnType<typeof Webhooks>;
1194
+ readonly imports: ReturnType<typeof Imports>;
1195
+ readonly providerImports: ReturnType<typeof ProviderImports>;
390
1196
  readonly calendar: ReturnType<typeof Calendar>;
391
1197
  readonly settings: ReturnType<typeof Settings>;
392
1198
  readonly roles: ReturnType<typeof Roles>;
393
1199
  readonly members: ReturnType<typeof Members>;
1200
+ readonly suppressions: ReturnType<typeof Suppressions>;
1201
+ readonly files: ReturnType<typeof Files>;
394
1202
  readonly tempMail: ReturnType<typeof TempMail>;
395
1203
  constructor(configuration: ClientOptions | string);
396
1204
  get raw(): Transport;
@@ -401,23 +1209,16 @@ type InboxScope = {
401
1209
  inboxToken?: string;
402
1210
  };
403
1211
 
404
- type ListOptions = RequestScope & {
405
- limit?: number;
406
- cursor?: string;
407
- };
408
-
409
- type Page<T> = {
410
- items: Array<T>;
411
- hasMore: boolean;
412
- nextCursor: string | null;
413
- };
414
-
415
1212
  type QueryValues = Record<string, string | number | boolean | null | undefined>;
416
1213
 
1214
+ type RawBody = Blob | ArrayBuffer | Uint8Array;
1215
+
417
1216
  type RequestOptions = {
418
1217
  method?: string;
419
1218
  query?: QueryValues;
420
1219
  body?: unknown;
1220
+ raw?: RawBody;
1221
+ contentType?: string;
421
1222
  signal?: AbortSignal;
422
1223
  apiKey?: string;
423
1224
  inboxToken?: string;
@@ -426,6 +1227,8 @@ type RequestOptions = {
426
1227
  idempotencyKey?: string;
427
1228
  repeatable?: boolean;
428
1229
  accept?: string;
1230
+ binary?: boolean;
1231
+ timeoutMs?: number;
429
1232
  };
430
1233
 
431
1234
  type SendScope = RequestScope & {
@@ -436,7 +1239,61 @@ type TempMailOptions = Omit<TransportOptions, 'apiKey'> & {
436
1239
  inboxToken?: string;
437
1240
  };
438
1241
 
439
- type DomainSendingState = 'verified' | 'pending' | 'failed' | 'no_identity' | 'unknown';
1242
+ declare const DOMAIN_SENDING_STATES: {
1243
+ readonly VERIFIED: "verified";
1244
+ readonly PENDING: "pending";
1245
+ readonly FAILED: "failed";
1246
+ readonly NO_IDENTITY: "no_identity";
1247
+ readonly UNKNOWN: "unknown";
1248
+ };
1249
+ declare const DOMAIN_TRACKING_STATES: {
1250
+ readonly NONE: "none";
1251
+ readonly PENDING: "pending";
1252
+ readonly ACTIVE: "active";
1253
+ readonly FAILED: "failed";
1254
+ };
1255
+ declare const DOMAIN_STORAGE_STATES: {
1256
+ readonly NONE: "none";
1257
+ readonly PENDING: "pending";
1258
+ readonly ACTIVE: "active";
1259
+ readonly FAILED: "failed";
1260
+ };
1261
+
1262
+ type DomainSendingState = (typeof DOMAIN_SENDING_STATES)[keyof typeof DOMAIN_SENDING_STATES];
1263
+
1264
+ type DomainStorageState = (typeof DOMAIN_STORAGE_STATES)[keyof typeof DOMAIN_STORAGE_STATES];
1265
+
1266
+ type DomainStorage = {
1267
+ host: string | null;
1268
+ status: DomainStorageState;
1269
+ active: boolean;
1270
+ target: string;
1271
+ record: {
1272
+ type: 'CNAME';
1273
+ name: string;
1274
+ value: string;
1275
+ } | null;
1276
+ checkedAt: string | null;
1277
+ verifiedAt: string | null;
1278
+ error: string | null;
1279
+ };
1280
+
1281
+ type DomainTrackingState = (typeof DOMAIN_TRACKING_STATES)[keyof typeof DOMAIN_TRACKING_STATES];
1282
+
1283
+ type DomainTracking = {
1284
+ host: string | null;
1285
+ status: DomainTrackingState;
1286
+ active: boolean;
1287
+ target: string;
1288
+ record: {
1289
+ type: 'CNAME';
1290
+ name: string;
1291
+ value: string;
1292
+ } | null;
1293
+ checkedAt: string | null;
1294
+ verifiedAt: string | null;
1295
+ error: string | null;
1296
+ };
440
1297
 
441
1298
  type DomainResource = {
442
1299
  object: 'domain';
@@ -456,6 +1313,8 @@ type DomainResource = {
456
1313
  error: string | null;
457
1314
  note: string;
458
1315
  };
1316
+ tracking: DomainTracking;
1317
+ storage: DomainStorage;
459
1318
  createdAt: string;
460
1319
  };
461
1320
 
@@ -466,6 +1325,11 @@ type DomainDetailResource = DomainResource & {
466
1325
  }>;
467
1326
  };
468
1327
 
1328
+ type DomainPatch = {
1329
+ trackingHost?: string | null;
1330
+ storageHost?: string | null;
1331
+ };
1332
+
469
1333
  type DeletedDraftResource = {
470
1334
  object: 'draft';
471
1335
  id: string;
@@ -513,20 +1377,22 @@ type SavedDraftResource = {
513
1377
  id: string | null;
514
1378
  };
515
1379
 
516
- type RecipientStatus = 'pending' | 'suppressed' | 'delivered' | 'failed' | 'bounced' | 'complained' | 'uncertain';
1380
+ type AttachmentDeliveryMode = (typeof ATTACHMENT_DELIVERY_MODES)[keyof typeof ATTACHMENT_DELIVERY_MODES];
1381
+
1382
+ type RecipientKind = (typeof RECIPIENT_KINDS)[keyof typeof RECIPIENT_KINDS];
1383
+
1384
+ type RecipientStatus = (typeof RECIPIENT_STATUSES)[keyof typeof RECIPIENT_STATUSES];
517
1385
 
518
1386
  type EmailRecipientResource = {
519
1387
  email: string;
520
1388
  name: string | null;
521
- kind: 'to' | 'cc' | 'bcc';
1389
+ kind: RecipientKind;
522
1390
  status: RecipientStatus;
523
1391
  error: string | null;
524
1392
  deliveredAt: string | null;
525
1393
  };
526
1394
 
527
- type EmailSource = 'composer' | 'api' | 'mcp' | 'ai' | 'queue';
528
-
529
- type EmailStatus = 'queued' | 'scheduled' | 'sending' | 'sent' | 'partial' | 'cancelled' | 'failed';
1395
+ type EmailStatus = (typeof EMAIL_STATUSES)[keyof typeof EMAIL_STATUSES];
530
1396
 
531
1397
  type EmailTrackingSummary = {
532
1398
  opens: boolean;
@@ -546,7 +1412,7 @@ type EmailTranslationResource = {
546
1412
  includeOriginal: boolean;
547
1413
  };
548
1414
 
549
- type EmailTransport = 'ses' | 'resend' | 'dev' | 'test';
1415
+ type EmailTransport = (typeof EMAIL_TRANSPORTS)[keyof typeof EMAIL_TRANSPORTS];
550
1416
 
551
1417
  type TrackingLinkResource = {
552
1418
  id: string;
@@ -558,7 +1424,7 @@ type TrackingLinkResource = {
558
1424
 
559
1425
  type TrackingRecipientResource = {
560
1426
  email: string | null;
561
- kind: 'to' | 'cc' | 'bcc' | null;
1427
+ kind: RecipientKind | null;
562
1428
  attributed: boolean;
563
1429
  openCount: number;
564
1430
  clickCount: number;
@@ -610,6 +1476,7 @@ type EmailResource = {
610
1476
  cancellableUntil: string | null;
611
1477
  sentAt: string | null;
612
1478
  tags: Record<string, string>;
1479
+ broadcastId: string | null;
613
1480
  source: EmailSource | (string & {});
614
1481
  createdAt: string;
615
1482
  recipients?: Array<EmailRecipientResource>;
@@ -653,6 +1520,7 @@ type EmailEventResource = {
653
1520
  type EmailListOptions = ListOptions & {
654
1521
  status?: EmailStatus | Array<EmailStatus>;
655
1522
  from?: string;
1523
+ broadcastId?: string;
656
1524
  };
657
1525
 
658
1526
  type EmailSend = {
@@ -666,6 +1534,7 @@ type EmailSend = {
666
1534
  text?: string;
667
1535
  headers?: Record<string, string>;
668
1536
  attachments?: Array<AttachmentInput>;
1537
+ attachmentDelivery?: AttachmentDeliveryMode;
669
1538
  threadId?: string;
670
1539
  draftId?: string;
671
1540
  template?: {
@@ -688,22 +1557,516 @@ type EmailTranslate = TranslateOptions & {
688
1557
  subject?: string;
689
1558
  };
690
1559
 
691
- type LanguageResource = {
692
- code: string;
693
- label: string;
694
- native: string;
695
- flag: string;
696
- rtl: boolean;
1560
+ type LanguageResource = {
1561
+ code: string;
1562
+ label: string;
1563
+ native: string;
1564
+ flag: string;
1565
+ rtl: boolean;
1566
+ };
1567
+
1568
+ type TranslationResource = {
1569
+ object: 'translation';
1570
+ language: LanguageResource;
1571
+ detectedSourceLanguage: LanguageResource | null;
1572
+ subject: string | null;
1573
+ html: string | null;
1574
+ text: string | null;
1575
+ includeOriginal: boolean;
1576
+ };
1577
+
1578
+ type DeletedFileResource = {
1579
+ object: 'file';
1580
+ id: string;
1581
+ deleted: true;
1582
+ };
1583
+
1584
+ type FileAddressCount = {
1585
+ address: string;
1586
+ files: number;
1587
+ bytes: number;
1588
+ };
1589
+
1590
+ declare const FILE_SORTS: {
1591
+ readonly NEWEST: "newest";
1592
+ readonly OLDEST: "oldest";
1593
+ readonly LARGEST: "largest";
1594
+ readonly NAME: "name";
1595
+ };
1596
+ declare const FILE_KINDS: {
1597
+ readonly IMAGE: "image";
1598
+ readonly PDF: "pdf";
1599
+ readonly AUDIO: "audio";
1600
+ readonly VIDEO: "video";
1601
+ readonly TEXT: "text";
1602
+ };
1603
+ declare const FILE_DIRECTIONS: {
1604
+ readonly INBOUND: "inbound";
1605
+ readonly OUTBOUND: "outbound";
1606
+ readonly UPLOADED: "uploaded";
1607
+ };
1608
+ interface FileUsages {
1609
+ RECEIVED: 'received';
1610
+ SENT: 'sent';
1611
+ LINKED: 'linked';
1612
+ SCHEDULED: 'scheduled';
1613
+ }
1614
+ type FileUsage = FileUsages[keyof FileUsages];
1615
+ declare const FILE_USAGES: FileUsages;
1616
+
1617
+ type FileKept = {
1618
+ id: string;
1619
+ filename: string;
1620
+ usage: FileUsage;
1621
+ reason: string;
1622
+ };
1623
+
1624
+ type FileBatchDeleteResource = {
1625
+ object: 'file_batch_delete';
1626
+ deleted: Array<string>;
1627
+ kept: Array<FileKept>;
1628
+ missing: Array<string>;
1629
+ };
1630
+
1631
+ type FileCount = {
1632
+ files: number;
1633
+ bytes: number;
1634
+ };
1635
+
1636
+ type FileDayCount = {
1637
+ day: string;
1638
+ files: number;
1639
+ bytes: number;
1640
+ };
1641
+
1642
+ type FileDirection = (typeof FILE_DIRECTIONS)[keyof typeof FILE_DIRECTIONS];
1643
+
1644
+ type FileKind = (typeof FILE_KINDS)[keyof typeof FILE_KINDS];
1645
+
1646
+ type FileLinkCount = {
1647
+ shares: number;
1648
+ downloads: number;
1649
+ lastDownloadAt: string | null;
1650
+ };
1651
+
1652
+ type FileLinkResource = {
1653
+ object: 'file_link';
1654
+ id: string;
1655
+ fileId: string | null;
1656
+ filename: string;
1657
+ mimeType: string;
1658
+ sizeBytes: number;
1659
+ host: string | null;
1660
+ url: string;
1661
+ downloads: number;
1662
+ lastDownloadAt: string | null;
1663
+ revokedAt: string | null;
1664
+ createdAt: string;
1665
+ };
1666
+
1667
+ type FileSort = (typeof FILE_SORTS)[keyof typeof FILE_SORTS];
1668
+
1669
+ type FileListOptions = ListOptions & {
1670
+ q?: string;
1671
+ kind?: FileKind;
1672
+ sort?: FileSort;
1673
+ };
1674
+
1675
+ type FileResource = {
1676
+ object: 'file';
1677
+ id: string;
1678
+ filename: string;
1679
+ mimeType: string;
1680
+ sizeBytes: number;
1681
+ direction: FileDirection;
1682
+ threadId: string | null;
1683
+ messageId: string | null;
1684
+ deliveredTo: string | null;
1685
+ usage: FileUsage | null;
1686
+ deletable: boolean;
1687
+ createdAt: string;
1688
+ };
1689
+
1690
+ type FileTypeCount = {
1691
+ mimeType: string;
1692
+ files: number;
1693
+ bytes: number;
1694
+ };
1695
+
1696
+ type FileStatsResource = {
1697
+ object: 'file_stats';
1698
+ totals: FileCount;
1699
+ received: FileCount;
1700
+ sent: FileCount;
1701
+ uploaded: FileCount;
1702
+ types: Array<FileTypeCount>;
1703
+ byDay: Array<FileDayCount>;
1704
+ addresses: Array<FileAddressCount>;
1705
+ links: FileLinkCount;
1706
+ };
1707
+
1708
+ type FileUploadOptions = RequestScope & {
1709
+ filename: string;
1710
+ contentType?: string;
1711
+ timeoutMs?: number;
1712
+ };
1713
+
1714
+ type ImportChunkResource = {
1715
+ object: 'import_chunk';
1716
+ file: number;
1717
+ chunk: number;
1718
+ bytes: number;
1719
+ };
1720
+
1721
+ type ImportCounts = {
1722
+ seen: number;
1723
+ imported: number;
1724
+ duplicate: number;
1725
+ filtered: number;
1726
+ failed: number;
1727
+ threads: number;
1728
+ };
1729
+
1730
+ type ImportFileDescriptor = {
1731
+ name: string;
1732
+ bytes: number;
1733
+ };
1734
+
1735
+ type ImportOptions = {
1736
+ keepInbox?: boolean;
1737
+ includeSpam?: boolean;
1738
+ includeTrash?: boolean;
1739
+ };
1740
+
1741
+ type ImportCreate = {
1742
+ addressId: string;
1743
+ files: Array<ImportFileDescriptor>;
1744
+ options?: ImportOptions;
1745
+ };
1746
+
1747
+ declare const IMPORT_STATUSES: {
1748
+ readonly UPLOADING: "uploading";
1749
+ readonly QUEUED: "queued";
1750
+ readonly RUNNING: "running";
1751
+ readonly COMPLETED: "completed";
1752
+ readonly FAILED: "failed";
1753
+ readonly CANCELLED: "cancelled";
1754
+ };
1755
+ declare const IMPORT_FAILURE_REASONS: {
1756
+ readonly TOO_LARGE: "too-large";
1757
+ readonly UNPARSEABLE: "unparseable";
1758
+ readonly NO_DATE: "no-date";
1759
+ readonly STORAGE_ERROR: "storage-error";
1760
+ readonly UNREADABLE_ENTRY: "unreadable-entry";
1761
+ readonly ENCRYPTED_ENTRY: "encrypted-entry";
1762
+ readonly ARCHIVE_LIMIT: "archive-limit";
1763
+ };
1764
+ declare const IMPORT_FORMATS: {
1765
+ readonly GMAIL: "gmail";
1766
+ readonly OPENEMAIL: "openemail";
1767
+ readonly THUNDERBIRD: "thunderbird";
1768
+ readonly MBOX: "mbox";
1769
+ readonly EML: "eml";
1770
+ };
1771
+ declare const PROVIDER_IMPORT_RESOURCES: {
1772
+ readonly SUPPRESSIONS: "suppressions";
1773
+ readonly AUDIENCES: "audiences";
1774
+ readonly CONTACTS: "contacts";
1775
+ readonly TEMPLATES: "templates";
1776
+ readonly WEBHOOKS: "webhooks";
1777
+ readonly DOMAINS: "domains";
1778
+ readonly API_KEYS: "api-keys";
1779
+ };
1780
+ declare const PROVIDER_IMPORT_STATUSES: {
1781
+ readonly QUEUED: "queued";
1782
+ readonly RUNNING: "running";
1783
+ readonly COMPLETED: "completed";
1784
+ readonly FAILED: "failed";
1785
+ readonly CANCELLED: "cancelled";
1786
+ };
1787
+ declare const PROVIDER_IMPORT_DOMAIN_STATES: {
1788
+ readonly ABSENT: "absent";
1789
+ readonly ADDED: "added";
1790
+ readonly VERIFIED: "verified";
1791
+ };
1792
+
1793
+ type ImportFailureReason = (typeof IMPORT_FAILURE_REASONS)[keyof typeof IMPORT_FAILURE_REASONS];
1794
+
1795
+ type ImportFailureResource = {
1796
+ id: string;
1797
+ seq: number;
1798
+ reason: ImportFailureReason;
1799
+ subject: string | null;
1800
+ sender: string | null;
1801
+ messageId: string | null;
1802
+ source: string | null;
1803
+ bytes: number | null;
1804
+ detail: string | null;
1805
+ createdAt: string;
1806
+ };
1807
+
1808
+ type ImportFailurePage = {
1809
+ object: 'list';
1810
+ data: Array<ImportFailureResource>;
1811
+ nextCursor: number | null;
1812
+ };
1813
+
1814
+ type ImportFailuresOptions = RequestScope & {
1815
+ after?: number;
1816
+ limit?: number;
1817
+ };
1818
+
1819
+ type ImportFileInfo = {
1820
+ name: string;
1821
+ bytes: number;
1822
+ chunks: number;
1823
+ };
1824
+
1825
+ type ImportProgress = (uploadedBytes: number, totalBytes: number) => void;
1826
+
1827
+ type ImportSource = {
1828
+ name: string;
1829
+ data: RawBody;
1830
+ };
1831
+
1832
+ type ImportFilesInput = {
1833
+ addressId: string;
1834
+ files: Array<ImportSource>;
1835
+ options?: ImportOptions;
1836
+ onProgress?: ImportProgress;
1837
+ };
1838
+
1839
+ type ImportFormat = (typeof IMPORT_FORMATS)[keyof typeof IMPORT_FORMATS];
1840
+
1841
+ type ImportListOptions = ListOptions & {
1842
+ addressId?: string;
1843
+ };
1844
+
1845
+ type ImportStatus = (typeof IMPORT_STATUSES)[keyof typeof IMPORT_STATUSES];
1846
+
1847
+ type ImportResource = {
1848
+ object: 'import';
1849
+ id: string;
1850
+ addressId: string | null;
1851
+ address: string;
1852
+ status: ImportStatus;
1853
+ options: Required<ImportOptions>;
1854
+ files: Array<ImportFileInfo>;
1855
+ formats: Array<ImportFormat>;
1856
+ chunkBytes: number;
1857
+ totalBytes: number;
1858
+ processedBytes: number;
1859
+ counts: ImportCounts;
1860
+ labelsCreated: Array<string>;
1861
+ labelsSkipped: Array<string>;
1862
+ lastError: string | null;
1863
+ uploadDeleted: boolean;
1864
+ createdAt: string;
1865
+ startedAt: string | null;
1866
+ finishedAt: string | null;
1867
+ };
1868
+
1869
+ type ImportUploadResource = {
1870
+ object: 'import_upload';
1871
+ id: string;
1872
+ status: ImportStatus;
1873
+ received: Array<Array<number>>;
1874
+ };
1875
+
1876
+ type ProviderImportCount = {
1877
+ count: number;
1878
+ more: boolean;
1879
+ };
1880
+
1881
+ type ProviderImportResourceKind = (typeof PROVIDER_IMPORT_RESOURCES)[keyof typeof PROVIDER_IMPORT_RESOURCES];
1882
+
1883
+ type ProviderImportCreate = {
1884
+ apiKey: string;
1885
+ resources: Array<ProviderImportResourceKind>;
1886
+ };
1887
+
1888
+ type ProviderImportDomainState = (typeof PROVIDER_IMPORT_DOMAIN_STATES)[keyof typeof PROVIDER_IMPORT_DOMAIN_STATES];
1889
+
1890
+ type ProviderImportListOptions = ListOptions;
1891
+
1892
+ type ProviderImportReport = {
1893
+ suppressions: {
1894
+ added: number;
1895
+ skipped: number;
1896
+ };
1897
+ audiences: {
1898
+ created: number;
1899
+ reused: number;
1900
+ skipped: Array<string>;
1901
+ };
1902
+ contacts: {
1903
+ added: number;
1904
+ created: number;
1905
+ unsubscribed: number;
1906
+ };
1907
+ templates: {
1908
+ created: number;
1909
+ skipped: Array<{
1910
+ name: string;
1911
+ reason: string;
1912
+ }>;
1913
+ warnings: Array<string>;
1914
+ };
1915
+ webhooks: {
1916
+ created: number;
1917
+ skipped: Array<{
1918
+ name: string;
1919
+ reason: string;
1920
+ }>;
1921
+ droppedEvents: Array<string>;
1922
+ };
1923
+ domains: Array<{
1924
+ name: string;
1925
+ state: ProviderImportDomainState;
1926
+ records: Array<{
1927
+ type: string;
1928
+ name: string;
1929
+ value: string;
1930
+ }>;
1931
+ }>;
1932
+ apiKeys: Array<{
1933
+ name: string;
1934
+ createdAt: string | null;
1935
+ lastUsedAt: string | null;
1936
+ }>;
1937
+ };
1938
+
1939
+ type ProviderImportStatus = (typeof PROVIDER_IMPORT_STATUSES)[keyof typeof PROVIDER_IMPORT_STATUSES];
1940
+
1941
+ type ProviderImportResource = {
1942
+ object: 'provider_import';
1943
+ id: string;
1944
+ provider: 'resend';
1945
+ status: ProviderImportStatus;
1946
+ resources: Array<ProviderImportResourceKind>;
1947
+ step: ProviderImportResourceKind | null;
1948
+ report: ProviderImportReport;
1949
+ lastError: string | null;
1950
+ createdAt: string;
1951
+ startedAt: string | null;
1952
+ finishedAt: string | null;
1953
+ };
1954
+
1955
+ type ProviderInventoryResource = {
1956
+ object: 'provider_inventory';
1957
+ provider: 'resend';
1958
+ counts: Record<ProviderImportResourceKind, ProviderImportCount>;
1959
+ };
1960
+
1961
+ type ApiKeyActivityListOptions = ListOptions & LogWindow;
1962
+
1963
+ type ApiKeyEventType = (typeof API_KEY_EVENT_TYPES)[keyof typeof API_KEY_EVENT_TYPES];
1964
+
1965
+ type ApiKeyActivityResource = {
1966
+ object: 'api_key_event';
1967
+ id: string;
1968
+ keyId: string;
1969
+ keyName: string;
1970
+ type: ApiKeyEventType | (string & {});
1971
+ createdAt: string;
1972
+ actor: AuditActorResource | null;
1973
+ detail: Record<string, unknown>;
1974
+ };
1975
+
1976
+ type ApiKeyCreate = {
1977
+ name: string;
1978
+ scopes?: Array<ApiScope>;
1979
+ roleId?: string | null;
1980
+ addressAllowlist?: Array<string>;
1981
+ domainAllowlist?: Array<string>;
1982
+ expiresInMinutes?: number;
1983
+ };
1984
+
1985
+ type ApiKeyPatch = {
1986
+ name?: string;
1987
+ scopes?: Array<ApiScope>;
1988
+ addressAllowlist?: Array<string>;
1989
+ domainAllowlist?: Array<string>;
1990
+ enabled?: boolean;
1991
+ };
1992
+
1993
+ type ApiKeyRequestListOptions = ApiKeyActivityListOptions & {
1994
+ failedOnly?: boolean;
1995
+ };
1996
+
1997
+ type ApiKeyRequestResource = {
1998
+ object: 'api_key_request';
1999
+ id: string;
2000
+ keyId: string;
2001
+ keyName: string;
2002
+ requestId: string | null;
2003
+ method: string;
2004
+ path: string;
2005
+ status: number;
2006
+ errorCode: string | null;
2007
+ durationMs: number;
2008
+ ip: string | null;
2009
+ userAgent: string | null;
2010
+ createdAt: string;
2011
+ };
2012
+
2013
+ type ApiKeyStatus = (typeof API_KEY_STATUSES)[keyof typeof API_KEY_STATUSES];
2014
+
2015
+ type ApiKeyResource = {
2016
+ object: 'api_key';
2017
+ id: string;
2018
+ name: string;
2019
+ mode: ApiKeyMode;
2020
+ maskedKey: string;
2021
+ keyLast4: string;
2022
+ status: ApiKeyStatus;
2023
+ scopes: Array<ApiScope>;
2024
+ roleId: string | null;
2025
+ roleName: string | null;
2026
+ addressAllowlist: Array<string> | null;
2027
+ domainAllowlist: Array<string> | null;
2028
+ expiresAt: string | null;
2029
+ lastUsedAt: string | null;
2030
+ totalUses: number;
2031
+ rotatedAt: string | null;
2032
+ rotationCount: number;
2033
+ deactivatedAt: string | null;
2034
+ revokedAt: string | null;
2035
+ revokedReason: string | null;
2036
+ createdAt: string;
2037
+ createdBy: AuditActorResource | null;
2038
+ updatedAt: string;
2039
+ updatedBy: AuditActorResource | null;
2040
+ lastChangeAt: string | null;
2041
+ lastChangeType: ApiKeyEventType | (string & {}) | null;
2042
+ };
2043
+
2044
+ type ApiKeyRevoke = {
2045
+ reason?: string;
2046
+ };
2047
+
2048
+ type ApiKeyWorkspaceActivityListOptions = ApiKeyActivityListOptions & {
2049
+ keyIds?: Array<string>;
2050
+ };
2051
+
2052
+ type ApiKeyWorkspaceRequestListOptions = ApiKeyRequestListOptions & {
2053
+ keyIds?: Array<string>;
2054
+ };
2055
+
2056
+ type CreatedApiKeyResource = ApiKeyResource & {
2057
+ token: string;
697
2058
  };
698
2059
 
699
- type TranslationResource = {
700
- object: 'translation';
701
- language: LanguageResource;
702
- detectedSourceLanguage: LanguageResource | null;
703
- subject: string | null;
704
- html: string | null;
705
- text: string | null;
706
- includeOriginal: boolean;
2060
+ type DeletedApiKeyResource = {
2061
+ object: 'api_key';
2062
+ id: string;
2063
+ deleted: true;
2064
+ };
2065
+
2066
+ type RotatedApiKeyResource = ApiKeyResource & {
2067
+ token: string;
2068
+ rotationCount: number;
2069
+ rotatedAt: string;
707
2070
  };
708
2071
 
709
2072
  type DeletedLabelResource = {
@@ -717,9 +2080,37 @@ type LabelColor = {
717
2080
  textColor: string;
718
2081
  };
719
2082
 
2083
+ type LabelColorInput = {
2084
+ backgroundColor: string;
2085
+ textColor?: string;
2086
+ };
2087
+
2088
+ declare const LABEL_COLOR_KINDS: {
2089
+ readonly SOLID: "solid";
2090
+ readonly GRADIENT: "gradient";
2091
+ };
2092
+
2093
+ type LabelColorKind = (typeof LABEL_COLOR_KINDS)[keyof typeof LABEL_COLOR_KINDS];
2094
+
2095
+ type LabelColorResource = {
2096
+ object: 'label_color';
2097
+ kind: LabelColorKind;
2098
+ name: string;
2099
+ value: string;
2100
+ solid: string;
2101
+ from: string | null;
2102
+ to: string | null;
2103
+ textColor: string;
2104
+ };
2105
+
720
2106
  type LabelInput = {
721
2107
  name: string;
722
- color?: LabelColor;
2108
+ color?: LabelColorInput;
2109
+ };
2110
+
2111
+ type LabelPatch = {
2112
+ name?: string;
2113
+ color?: LabelColorInput | null;
723
2114
  };
724
2115
 
725
2116
  type LabelResource = {
@@ -728,12 +2119,9 @@ type LabelResource = {
728
2119
  name: string;
729
2120
  type: string;
730
2121
  color: LabelColor | null;
731
- };
732
-
733
- type SavedLabelResource = {
734
- object: 'label';
735
- id: string | null;
736
- name: string;
2122
+ threadCount: number;
2123
+ createdAt: string | null;
2124
+ updatedAt: string | null;
737
2125
  };
738
2126
 
739
2127
  type KeyResource = {
@@ -745,6 +2133,7 @@ type KeyResource = {
745
2133
  grantedScopes: Array<ApiScope>;
746
2134
  workspaceId: string;
747
2135
  addressAllowlist: Array<string> | null;
2136
+ domainAllowlist: Array<string> | null;
748
2137
  };
749
2138
 
750
2139
  type PingResource = {
@@ -757,12 +2146,24 @@ type PingResource = {
757
2146
  workspaceId: string;
758
2147
  };
759
2148
 
760
- type MemberAccess = 'member' | 'viewer';
2149
+ type RotatedKeyResource = KeyResource & {
2150
+ token: string;
2151
+ rotationCount: number;
2152
+ rotatedAt: string;
2153
+ };
2154
+
2155
+ declare const MEMBER_ACCESS_LEVELS: {
2156
+ readonly MEMBER: "member";
2157
+ readonly VIEWER: "viewer";
2158
+ };
2159
+
2160
+ type MemberAccess = (typeof MEMBER_ACCESS_LEVELS)[keyof typeof MEMBER_ACCESS_LEVELS];
761
2161
 
762
2162
  type MemberAdd = {
763
2163
  email: string;
764
2164
  roleId: string;
765
2165
  addressIds?: Array<string>;
2166
+ domainIds?: Array<string>;
766
2167
  access?: MemberAccess;
767
2168
  };
768
2169
 
@@ -777,6 +2178,31 @@ type MemberAddressResource = {
777
2178
  access: MemberAccess;
778
2179
  };
779
2180
 
2181
+ type MemberDomainResource = {
2182
+ domainId: string;
2183
+ domain: string;
2184
+ access: MemberAccess;
2185
+ };
2186
+
2187
+ type InvitationResource = {
2188
+ object: 'invitation';
2189
+ id: string;
2190
+ email: string;
2191
+ role: {
2192
+ id: string;
2193
+ name: string;
2194
+ builtin: BuiltinRole | null;
2195
+ };
2196
+ addresses: Array<MemberAddressResource>;
2197
+ domains: Array<MemberDomainResource>;
2198
+ expiresAt: string;
2199
+ expired: boolean;
2200
+ lastSentAt: string;
2201
+ delivered: boolean | null;
2202
+ deliveryError: string | null;
2203
+ createdAt: string;
2204
+ };
2205
+
780
2206
  type MemberPatch = {
781
2207
  roleId: string;
782
2208
  };
@@ -787,6 +2213,7 @@ type MemberResource = {
787
2213
  email: string;
788
2214
  name: string | null;
789
2215
  image: string | null;
2216
+ isOwner: boolean;
790
2217
  role: {
791
2218
  id: string | null;
792
2219
  name: string;
@@ -795,6 +2222,7 @@ type MemberResource = {
795
2222
  implied: boolean;
796
2223
  permissions: Array<Permission>;
797
2224
  addresses: Array<MemberAddressResource>;
2225
+ domains: Array<MemberDomainResource>;
798
2226
  createdAt: string | null;
799
2227
  };
800
2228
 
@@ -805,6 +2233,13 @@ type RemovedMemberResource = {
805
2233
  addressesRevoked: number;
806
2234
  };
807
2235
 
2236
+ type RevokedInvitationResource = {
2237
+ object: 'invitation';
2238
+ id: string;
2239
+ email: string;
2240
+ revoked: true;
2241
+ };
2242
+
808
2243
  type DeletedRoleResource = {
809
2244
  object: 'role';
810
2245
  id: string;
@@ -858,20 +2293,73 @@ type DeletedRuleResource = {
858
2293
  deleted: true;
859
2294
  };
860
2295
 
861
- declare const RULE_FIELDS: readonly ["from", "from_domain", "envelope_from", "to", "cc", "bcc", "recipient", "reply_to", "delivered_to", "subject", "body", "header", "list_id", "attachment_name", "attachment_type", "has_attachment", "attachment_size", "message_size", "spam", "hour", "weekday"];
862
- declare const RULE_OPERATORS: readonly ["matches", "contains", "equals", "starts_with", "ends_with", "gt", "lt"];
863
- declare const RULE_ACTIONS: readonly ["label", "remove_label", "archive", "mark_read", "star", "spam", "trash", "forward", "reply", "block_sender", "reject"];
864
-
865
- type RuleActionType = (typeof RULE_ACTIONS)[number];
2296
+ declare const RULE_FIELDS: {
2297
+ readonly FROM: "from";
2298
+ readonly FROM_DOMAIN: "from_domain";
2299
+ readonly ENVELOPE_FROM: "envelope_from";
2300
+ readonly TO: "to";
2301
+ readonly CC: "cc";
2302
+ readonly BCC: "bcc";
2303
+ readonly RECIPIENT: "recipient";
2304
+ readonly REPLY_TO: "reply_to";
2305
+ readonly DELIVERED_TO: "delivered_to";
2306
+ readonly SUBJECT: "subject";
2307
+ readonly BODY: "body";
2308
+ readonly HEADER: "header";
2309
+ readonly LIST_ID: "list_id";
2310
+ readonly ATTACHMENT_NAME: "attachment_name";
2311
+ readonly ATTACHMENT_TYPE: "attachment_type";
2312
+ readonly HAS_ATTACHMENT: "has_attachment";
2313
+ readonly ATTACHMENT_SIZE: "attachment_size";
2314
+ readonly MESSAGE_SIZE: "message_size";
2315
+ readonly SPAM: "spam";
2316
+ readonly HOUR: "hour";
2317
+ readonly WEEKDAY: "weekday";
2318
+ };
2319
+ declare const RULE_OPERATORS: {
2320
+ readonly MATCHES: "matches";
2321
+ readonly CONTAINS: "contains";
2322
+ readonly EQUALS: "equals";
2323
+ readonly STARTS_WITH: "starts_with";
2324
+ readonly ENDS_WITH: "ends_with";
2325
+ readonly GT: "gt";
2326
+ readonly LT: "lt";
2327
+ };
2328
+ declare const RULE_ACTIONS: {
2329
+ readonly LABEL: "label";
2330
+ readonly REMOVE_LABEL: "remove_label";
2331
+ readonly ARCHIVE: "archive";
2332
+ readonly MARK_READ: "mark_read";
2333
+ readonly STAR: "star";
2334
+ readonly SPAM: "spam";
2335
+ readonly TRASH: "trash";
2336
+ readonly FORWARD: "forward";
2337
+ readonly REPLY: "reply";
2338
+ readonly BLOCK_SENDER: "block_sender";
2339
+ readonly REJECT: "reject";
2340
+ };
2341
+ declare const RULE_MATCH_MODES: {
2342
+ readonly ALL: "all";
2343
+ readonly ANY: "any";
2344
+ };
2345
+ declare const RULE_TEST_WARNING_CODES: {
2346
+ readonly FORWARD_UNVERIFIED: "forward_unverified";
2347
+ readonly FIELD_UNEVALUABLE: "field_unevaluable";
2348
+ readonly FIELD_APPROXIMATE: "field_approximate";
2349
+ readonly FORWARD_LOOP: "forward_loop";
2350
+ readonly BODY_ENCRYPTED: "body_encrypted";
2351
+ };
2352
+
2353
+ type RuleActionType = (typeof RULE_ACTIONS)[keyof typeof RULE_ACTIONS];
866
2354
 
867
2355
  type RuleAction = {
868
2356
  type: RuleActionType;
869
2357
  value?: string;
870
2358
  };
871
2359
 
872
- type RuleField = (typeof RULE_FIELDS)[number];
2360
+ type RuleField = (typeof RULE_FIELDS)[keyof typeof RULE_FIELDS];
873
2361
 
874
- type RuleOperator = (typeof RULE_OPERATORS)[number];
2362
+ type RuleOperator = (typeof RULE_OPERATORS)[keyof typeof RULE_OPERATORS];
875
2363
 
876
2364
  type RuleCondition = {
877
2365
  field: RuleField;
@@ -887,11 +2375,13 @@ type RuleConditionInput = Partial<RuleCondition> & {
887
2375
  value: string;
888
2376
  };
889
2377
 
2378
+ type RuleMatchMode = (typeof RULE_MATCH_MODES)[keyof typeof RULE_MATCH_MODES];
2379
+
890
2380
  type RuleCreate = {
891
2381
  name: string;
892
2382
  description?: string | null;
893
2383
  enabled?: boolean;
894
- match?: 'all' | 'any';
2384
+ match?: RuleMatchMode;
895
2385
  conditions: Array<RuleConditionInput>;
896
2386
  actions: Array<RuleAction>;
897
2387
  stopProcessing?: boolean;
@@ -905,7 +2395,7 @@ type RulePatch = {
905
2395
  name?: string;
906
2396
  description?: string | null;
907
2397
  enabled?: boolean;
908
- match?: 'all' | 'any';
2398
+ match?: RuleMatchMode;
909
2399
  conditions?: Array<RuleConditionInput>;
910
2400
  actions?: Array<RuleAction>;
911
2401
  stopProcessing?: boolean;
@@ -919,7 +2409,7 @@ type RuleResource = {
919
2409
  description: string | null;
920
2410
  enabled: boolean;
921
2411
  position: number;
922
- match: 'all' | 'any';
2412
+ match: RuleMatchMode;
923
2413
  conditions: Array<RuleCondition>;
924
2414
  actions: Array<RuleAction>;
925
2415
  stopProcessing: boolean;
@@ -954,6 +2444,8 @@ type RuleTestInput = {
954
2444
  limit?: number;
955
2445
  };
956
2446
 
2447
+ type RuleTestWarningCode = (typeof RULE_TEST_WARNING_CODES)[keyof typeof RULE_TEST_WARNING_CODES];
2448
+
957
2449
  type RuleTestResource = {
958
2450
  object: 'rule_test';
959
2451
  ruleId: string;
@@ -967,11 +2459,15 @@ type RuleTestResource = {
967
2459
  receivedAt: string | null;
968
2460
  }>;
969
2461
  warnings: Array<{
970
- code: 'forward_unverified' | 'field_unevaluable' | 'field_approximate' | 'forward_loop' | 'body_encrypted' | (string & {});
2462
+ code: RuleTestWarningCode | (string & {});
971
2463
  value: string;
972
2464
  }>;
973
2465
  };
974
2466
 
2467
+ type SettingsOptions = RequestScope & {
2468
+ address?: string;
2469
+ };
2470
+
975
2471
  type SettingsPatch = {
976
2472
  signature?: string;
977
2473
  openEmailSignature?: boolean;
@@ -984,6 +2480,7 @@ type SettingsPatch = {
984
2480
 
985
2481
  type SettingsResource = {
986
2482
  object: 'settings';
2483
+ address: string | null;
987
2484
  signature: string;
988
2485
  openEmailSignature: boolean;
989
2486
  timezone: string;
@@ -994,12 +2491,53 @@ type SettingsResource = {
994
2491
  [key: string]: unknown;
995
2492
  };
996
2493
 
2494
+ type RemovedSuppressionResource = {
2495
+ object: 'suppression';
2496
+ id: string;
2497
+ email: string;
2498
+ deleted: true;
2499
+ };
2500
+
2501
+ type SuppressionAdd = {
2502
+ email: string;
2503
+ };
2504
+
2505
+ declare const SUPPRESSION_REASONS: {
2506
+ readonly BOUNCE: "bounce";
2507
+ readonly COMPLAINT: "complaint";
2508
+ readonly MANUAL: "manual";
2509
+ };
2510
+
2511
+ type SuppressionReason = (typeof SUPPRESSION_REASONS)[keyof typeof SUPPRESSION_REASONS];
2512
+
2513
+ type SuppressionListOptions = ListOptions & {
2514
+ q?: string;
2515
+ reason?: SuppressionReason;
2516
+ };
2517
+
2518
+ type SuppressionResource = {
2519
+ object: 'suppression';
2520
+ id: string;
2521
+ email: string;
2522
+ reason: SuppressionReason;
2523
+ detail: string | null;
2524
+ removable: boolean;
2525
+ createdAt: string;
2526
+ };
2527
+
997
2528
  type DeletedTemplateResource = {
998
2529
  object: 'template';
999
2530
  id: string;
1000
2531
  deleted: true;
1001
2532
  };
1002
2533
 
2534
+ type DeletedTemplateVersionResource = {
2535
+ object: 'template_version';
2536
+ templateId: string;
2537
+ version: number;
2538
+ deleted: true;
2539
+ };
2540
+
1003
2541
  type SentTemplateEmailResource = SentEmailResource & {
1004
2542
  template: {
1005
2543
  id: string;
@@ -1007,9 +2545,155 @@ type SentTemplateEmailResource = SentEmailResource & {
1007
2545
  };
1008
2546
  };
1009
2547
 
1010
- type TemplateEngine = 'blocks' | 'html';
2548
+ type TemplateAnalyticsOptions = RequestScope & {
2549
+ days?: number;
2550
+ minutes?: number;
2551
+ grain?: TrackingGrain;
2552
+ offsetMinutes?: number;
2553
+ };
2554
+
2555
+ type TemplateAnalyticsResource = {
2556
+ object: 'template_analytics';
2557
+ templateId: string;
2558
+ sends: number;
2559
+ matched: number;
2560
+ trackedForOpens: number;
2561
+ trackedForClicks: number;
2562
+ opened: number;
2563
+ clicked: number;
2564
+ openRate: number;
2565
+ clickRate: number;
2566
+ totalOpens: number;
2567
+ totalClicks: number;
2568
+ bySource: Array<{
2569
+ source: string;
2570
+ sends: number;
2571
+ }>;
2572
+ byDay: Array<{
2573
+ day: string;
2574
+ sent: number;
2575
+ trackedForOpens: number;
2576
+ trackedForClicks: number;
2577
+ opened: number;
2578
+ clicked: number;
2579
+ }>;
2580
+ byVersion: Array<{
2581
+ version: number;
2582
+ sends: number;
2583
+ trackedForOpens: number;
2584
+ trackedForClicks: number;
2585
+ opened: number;
2586
+ clicked: number;
2587
+ }>;
2588
+ recent: Array<{
2589
+ id: string;
2590
+ version: number;
2591
+ source: string;
2592
+ createdAt: string;
2593
+ matched: boolean;
2594
+ opens: boolean;
2595
+ clicks: boolean;
2596
+ openCount: number;
2597
+ clickCount: number;
2598
+ }>;
2599
+ lifetime: {
2600
+ sends: number;
2601
+ testSends: number;
2602
+ firstAt: string | null;
2603
+ lastAt: string | null;
2604
+ };
2605
+ };
2606
+
2607
+ declare const TEMPLATE_ENGINES: {
2608
+ readonly BLOCKS: "blocks";
2609
+ readonly HTML: "html";
2610
+ };
2611
+ declare const TEMPLATE_STATUSES: {
2612
+ readonly DRAFT: "draft";
2613
+ readonly ACTIVE: "active";
2614
+ readonly ARCHIVED: "archived";
2615
+ };
2616
+ declare const TEMPLATE_CATEGORIES: {
2617
+ readonly ACCOUNT: "account";
2618
+ readonly COMMERCE: "commerce";
2619
+ readonly NOTIFY: "notify";
2620
+ readonly MARKETING: "marketing";
2621
+ };
2622
+ declare const TEMPLATE_SORTS: {
2623
+ readonly UPDATED_NEWEST: "updated-newest";
2624
+ readonly UPDATED_OLDEST: "updated-oldest";
2625
+ readonly CREATED_NEWEST: "created-newest";
2626
+ readonly CREATED_OLDEST: "created-oldest";
2627
+ readonly NAME: "name";
2628
+ readonly NAME_REVERSED: "name-reversed";
2629
+ };
2630
+ declare const TEMPLATE_BLOCK_KINDS: {
2631
+ readonly SECTION: "Section";
2632
+ readonly ROW: "Row";
2633
+ readonly COLUMN: "Column";
2634
+ readonly CONTAINER: "Container";
2635
+ readonly TEXT: "Text";
2636
+ readonly HEADING: "Heading";
2637
+ readonly BUTTON: "Button";
2638
+ readonly LINK: "Link";
2639
+ readonly IMG: "Img";
2640
+ readonly HR: "Hr";
2641
+ readonly MARKDOWN: "Markdown";
2642
+ readonly CODE_BLOCK: "CodeBlock";
2643
+ readonly CODE_INLINE: "CodeInline";
2644
+ };
2645
+ declare const TEMPLATE_FONT_FORMATS: {
2646
+ readonly WOFF2: "woff2";
2647
+ readonly WOFF: "woff";
2648
+ readonly TRUETYPE: "truetype";
2649
+ readonly OPENTYPE: "opentype";
2650
+ readonly EMBEDDED_OPENTYPE: "embedded-opentype";
2651
+ readonly SVG: "svg";
2652
+ };
2653
+ declare const TEMPLATE_FONT_STYLES: {
2654
+ readonly NORMAL: "normal";
2655
+ readonly ITALIC: "italic";
2656
+ readonly OBLIQUE: "oblique";
2657
+ };
2658
+ declare const TEMPLATE_VALUE_KINDS: {
2659
+ readonly TEXT: "text";
2660
+ readonly URL: "url";
2661
+ readonly IMAGE: "image";
2662
+ };
2663
+ declare const TEMPLATE_VERSION_STATES: {
2664
+ readonly DRAFT: "draft";
2665
+ readonly PUBLISHED: "published";
2666
+ };
2667
+ declare const TEMPLATE_PREVIEW_WARNING_CODES: {
2668
+ readonly UNFILLED_PLACEHOLDER: "unfilled_placeholder";
2669
+ };
2670
+
2671
+ type TemplateBlockKind = (typeof TEMPLATE_BLOCK_KINDS)[keyof typeof TEMPLATE_BLOCK_KINDS];
2672
+
2673
+ type TemplateBlock = {
2674
+ kind: TemplateBlockKind;
2675
+ children?: Array<TemplateBlock>;
2676
+ [field: string]: unknown;
2677
+ };
2678
+
2679
+ type TemplateCategory = (typeof TEMPLATE_CATEGORIES)[keyof typeof TEMPLATE_CATEGORIES];
2680
+
2681
+ type TemplateFontFormat = (typeof TEMPLATE_FONT_FORMATS)[keyof typeof TEMPLATE_FONT_FORMATS];
2682
+
2683
+ type TemplateFontStyle = (typeof TEMPLATE_FONT_STYLES)[keyof typeof TEMPLATE_FONT_STYLES];
2684
+
2685
+ type TemplateFont = {
2686
+ fontFamily: string;
2687
+ fallbackFontFamily: string;
2688
+ webFont?: {
2689
+ url: string;
2690
+ format: TemplateFontFormat;
2691
+ };
2692
+ fontWeight?: string | number;
2693
+ fontStyle?: TemplateFontStyle;
2694
+ };
1011
2695
 
1012
- type TemplateValueKind = 'text' | 'url' | 'image';
2696
+ type TemplateValueKind = (typeof TEMPLATE_VALUE_KINDS)[keyof typeof TEMPLATE_VALUE_KINDS];
1013
2697
 
1014
2698
  type TemplateProp = {
1015
2699
  key: string;
@@ -1026,10 +2710,23 @@ type TemplateSlot = {
1026
2710
  default: string;
1027
2711
  };
1028
2712
 
2713
+ type TemplateDocument = {
2714
+ body: Array<TemplateBlock>;
2715
+ preview?: string;
2716
+ tailwind?: boolean;
2717
+ fonts?: Array<TemplateFont>;
2718
+ style?: Record<string, string | number>;
2719
+ slots?: Array<TemplateSlot>;
2720
+ props?: Array<TemplateProp>;
2721
+ [setting: string]: unknown;
2722
+ };
2723
+
2724
+ type TemplateEngine = (typeof TEMPLATE_ENGINES)[keyof typeof TEMPLATE_ENGINES];
2725
+
1029
2726
  type TemplateContent = {
1030
2727
  engine?: TemplateEngine;
1031
2728
  subject?: string;
1032
- document?: Record<string, unknown>;
2729
+ document?: TemplateDocument;
1033
2730
  html?: string;
1034
2731
  slots?: Array<Partial<TemplateSlot> & {
1035
2732
  key: string;
@@ -1039,14 +2736,21 @@ type TemplateContent = {
1039
2736
  }>;
1040
2737
  };
1041
2738
 
2739
+ type TemplateContentSource = {
2740
+ starter?: string;
2741
+ fromTemplateId?: string;
2742
+ expectedVersion?: number;
2743
+ };
2744
+
1042
2745
  type TemplateCreate = TemplateContent & {
1043
2746
  name: string;
1044
2747
  slug?: string;
1045
2748
  description?: string | null;
1046
2749
  publish?: boolean;
2750
+ starter?: string;
1047
2751
  };
1048
2752
 
1049
- type TemplateStatus = 'draft' | 'active' | 'archived';
2753
+ type TemplateStatus = (typeof TEMPLATE_STATUSES)[keyof typeof TEMPLATE_STATUSES];
1050
2754
 
1051
2755
  type TemplateResource = {
1052
2756
  object: 'template';
@@ -1065,17 +2769,19 @@ type TemplateResource = {
1065
2769
  updatedAt: string;
1066
2770
  };
1067
2771
 
2772
+ type TemplateVersionState = (typeof TEMPLATE_VERSION_STATES)[keyof typeof TEMPLATE_VERSION_STATES];
2773
+
1068
2774
  type TemplateVersionResource = {
1069
2775
  object: 'template_version';
1070
2776
  id: string;
1071
2777
  templateId: string;
1072
2778
  version: number;
1073
- state: 'draft' | 'published';
2779
+ state: TemplateVersionState;
1074
2780
  engine: TemplateEngine;
1075
2781
  subject: string;
1076
2782
  slots: Array<TemplateSlot>;
1077
2783
  props: Array<TemplateProp>;
1078
- document?: Record<string, unknown> | null;
2784
+ document?: TemplateDocument | null;
1079
2785
  html?: string | null;
1080
2786
  publishedAt: string | null;
1081
2787
  createdAt: string;
@@ -1086,14 +2792,33 @@ type TemplateDetailResource = TemplateResource & {
1086
2792
  latest: TemplateVersionResource;
1087
2793
  };
1088
2794
 
2795
+ type TemplateDuplicate = {
2796
+ name?: string;
2797
+ };
2798
+
2799
+ type TemplateFontResource = {
2800
+ object: 'template_font';
2801
+ family: string;
2802
+ fallback: string;
2803
+ stack: string;
2804
+ weight: string;
2805
+ format: TemplateFontFormat;
2806
+ url: string;
2807
+ };
2808
+
2809
+ type TemplateSort = (typeof TEMPLATE_SORTS)[keyof typeof TEMPLATE_SORTS];
2810
+
1089
2811
  type TemplateListOptions = ListOptions & {
1090
2812
  status?: TemplateStatus;
2813
+ search?: string;
2814
+ sort?: TemplateSort;
1091
2815
  };
1092
2816
 
1093
2817
  type TemplatePatch = TemplateContent & {
1094
2818
  name?: string;
2819
+ slug?: string;
1095
2820
  description?: string | null;
1096
- status?: 'active' | 'archived';
2821
+ status?: typeof TEMPLATE_STATUSES.ACTIVE | typeof TEMPLATE_STATUSES.ARCHIVED;
1097
2822
  expectedVersion?: number;
1098
2823
  };
1099
2824
 
@@ -1103,6 +2828,8 @@ type TemplatePreviewInput = {
1103
2828
  slots?: Record<string, unknown>;
1104
2829
  };
1105
2830
 
2831
+ type TemplatePreviewWarningCode = (typeof TEMPLATE_PREVIEW_WARNING_CODES)[keyof typeof TEMPLATE_PREVIEW_WARNING_CODES];
2832
+
1106
2833
  type TemplatePreviewResource = {
1107
2834
  object: 'template_preview';
1108
2835
  templateId: string;
@@ -1111,11 +2838,38 @@ type TemplatePreviewResource = {
1111
2838
  html: string;
1112
2839
  text: string;
1113
2840
  warnings: Array<{
1114
- code: 'unfilled_placeholder' | (string & {});
2841
+ code: TemplatePreviewWarningCode | (string & {});
2842
+ key: string;
2843
+ }>;
2844
+ };
2845
+
2846
+ type TemplateRenderInput = TemplateContent & {
2847
+ mark?: boolean;
2848
+ values?: {
2849
+ props?: Record<string, unknown>;
2850
+ slots?: Record<string, unknown>;
2851
+ };
2852
+ };
2853
+
2854
+ type TemplateRenderResource = {
2855
+ object: 'template_render';
2856
+ subject: string;
2857
+ html: string;
2858
+ text: string;
2859
+ warnings: Array<{
2860
+ code: TemplatePreviewWarningCode | (string & {});
1115
2861
  key: string;
1116
2862
  }>;
1117
2863
  };
1118
2864
 
2865
+ type TemplateRestoreInput = {
2866
+ expectedVersion?: number;
2867
+ };
2868
+
2869
+ type TemplateRestoredResource = TemplateDetailResource & {
2870
+ restoredFrom: number;
2871
+ };
2872
+
1119
2873
  type TemplateSend = {
1120
2874
  from: RecipientInput;
1121
2875
  to: RecipientInput | Array<RecipientInput>;
@@ -1133,6 +2887,55 @@ type TemplateSend = {
1133
2887
  translate?: SendTranslateOptions;
1134
2888
  };
1135
2889
 
2890
+ type TemplateSendListOptions = TemplateAnalyticsOptions & {
2891
+ page?: number;
2892
+ pageSize?: number;
2893
+ search?: string;
2894
+ source?: string;
2895
+ version?: number;
2896
+ opened?: boolean;
2897
+ clicked?: boolean;
2898
+ tracked?: boolean;
2899
+ };
2900
+
2901
+ type TemplateSendResource = {
2902
+ object: 'template_send';
2903
+ id: string;
2904
+ version: number;
2905
+ source: string;
2906
+ subject: string;
2907
+ createdAt: string;
2908
+ recipients: Array<string>;
2909
+ matched: boolean;
2910
+ opens: boolean;
2911
+ clicks: boolean;
2912
+ openCount: number;
2913
+ clickCount: number;
2914
+ };
2915
+
2916
+ type TemplateSendsResource = {
2917
+ items: Array<TemplateSendResource>;
2918
+ total: number;
2919
+ page: number;
2920
+ pageSize: number;
2921
+ };
2922
+
2923
+ type TemplateStarterResource = {
2924
+ object: 'template_starter';
2925
+ slug: string;
2926
+ name: string;
2927
+ description: string;
2928
+ category: TemplateCategory;
2929
+ subject: string;
2930
+ slots: Array<TemplateSlot>;
2931
+ props: Array<TemplateProp>;
2932
+ };
2933
+
2934
+ type TemplateStarterDetailResource = TemplateStarterResource & {
2935
+ document: TemplateDocument;
2936
+ preview: string;
2937
+ };
2938
+
1136
2939
  type TempInboxResource = {
1137
2940
  object: 'temp_inbox';
1138
2941
  id: string;
@@ -1197,10 +3000,13 @@ type TempMessageDetailResource = TempMessageResource & {
1197
3000
 
1198
3001
  type TempMessageListOptions = InboxScope & {
1199
3002
  limit?: number;
3003
+ cursor?: string;
1200
3004
  };
1201
3005
 
1202
3006
  type TempMessagesResource = {
1203
3007
  items: Array<TempMessageResource>;
3008
+ hasMore: boolean;
3009
+ nextCursor: string | null;
1204
3010
  expiresAt: string;
1205
3011
  };
1206
3012
 
@@ -1210,10 +3016,23 @@ type SnoozedThreadResource = {
1210
3016
  snoozedUntil: string | null;
1211
3017
  };
1212
3018
 
3019
+ declare const THREAD_SORTS: {
3020
+ readonly NEWEST: "newest";
3021
+ readonly OLDEST: "oldest";
3022
+ readonly SENDER: "sender";
3023
+ readonly SUBJECT: "subject";
3024
+ };
3025
+
3026
+ type ThreadSort = (typeof THREAD_SORTS)[keyof typeof THREAD_SORTS];
3027
+
1213
3028
  type ThreadListOptions = ListOptions & {
1214
3029
  folder?: string;
1215
3030
  query?: string;
1216
3031
  labelIds?: string | Array<string>;
3032
+ sort?: ThreadSort;
3033
+ dateFrom?: Date | string;
3034
+ dateTo?: Date | string;
3035
+ fromContacts?: boolean;
1217
3036
  };
1218
3037
 
1219
3038
  type ThreadPatch = {
@@ -1277,20 +3096,16 @@ type TrackingClickResource = Omit<TrackingOpenResource, 'object'> & {
1277
3096
  url: string;
1278
3097
  };
1279
3098
 
1280
- type TrackingGrain = 'minute' | 'hour' | 'day';
1281
-
1282
- type TrackingHitOptions = RequestScope & {
3099
+ type TrackingHitOptions = ListOptions & {
1283
3100
  includeMachine?: boolean;
1284
- limit?: number;
1285
3101
  };
1286
3102
 
1287
- type TrackingListOptions = RequestScope & {
3103
+ type TrackingListOptions = ListOptions & {
1288
3104
  opened?: boolean;
1289
3105
  clicked?: boolean;
1290
3106
  days?: number;
1291
3107
  minutes?: number;
1292
3108
  grain?: TrackingGrain;
1293
- limit?: number;
1294
3109
  };
1295
3110
 
1296
3111
  type TrackingResource = TrackingSummary & {
@@ -1323,7 +3138,6 @@ type TrackingStatsResource = {
1323
3138
  opened: number;
1324
3139
  clicked: number;
1325
3140
  }>;
1326
- hitsKnownFrom: string;
1327
3141
  topLinks: Array<{
1328
3142
  url: string;
1329
3143
  label: string | null;
@@ -1339,9 +3153,54 @@ type TrackingStatsResource = {
1339
3153
  }>;
1340
3154
  };
1341
3155
 
1342
- declare const WEBHOOK_EVENTS: readonly ["email.received", "email.sent", "email.failed", "email.cancelled", "email.scheduled", "email.queued", "email.bounced", "email.complained", "email.opened", "email.clicked"];
1343
-
1344
- type WebhookEvent = (typeof WEBHOOK_EVENTS)[number];
3156
+ declare const WEBHOOK_EVENTS: {
3157
+ readonly EMAIL_RECEIVED: "email.received";
3158
+ readonly EMAIL_REPLIED: "email.replied";
3159
+ readonly EMAIL_SENT: "email.sent";
3160
+ readonly EMAIL_FAILED: "email.failed";
3161
+ readonly EMAIL_CANCELLED: "email.cancelled";
3162
+ readonly EMAIL_SCHEDULED: "email.scheduled";
3163
+ readonly EMAIL_QUEUED: "email.queued";
3164
+ readonly EMAIL_DELIVERED: "email.delivered";
3165
+ readonly EMAIL_DELIVERY_DELAYED: "email.delivery_delayed";
3166
+ readonly EMAIL_BOUNCED: "email.bounced";
3167
+ readonly EMAIL_COMPLAINED: "email.complained";
3168
+ readonly EMAIL_SUPPRESSED: "email.suppressed";
3169
+ readonly EMAIL_OPENED: "email.opened";
3170
+ readonly EMAIL_CLICKED: "email.clicked";
3171
+ readonly EMAIL_DOWNLOADED: "email.downloaded";
3172
+ readonly DOMAIN_VERIFIED: "domain.verified";
3173
+ readonly DOMAIN_SENDING_CHANGED: "domain.sending_changed";
3174
+ readonly DOMAIN_DELETED: "domain.deleted";
3175
+ readonly SUPPRESSION_ADDED: "suppression.added";
3176
+ readonly SUPPRESSION_REMOVED: "suppression.removed";
3177
+ };
3178
+ declare const WEBHOOK_DELIVERY_STATUSES: {
3179
+ readonly DELIVERED: "delivered";
3180
+ readonly FAILED: "failed";
3181
+ };
3182
+ declare const WEBHOOK_CHANGE_TYPES: {
3183
+ readonly CREATED: "created";
3184
+ readonly UPDATED: "updated";
3185
+ readonly ENABLED: "enabled";
3186
+ readonly DISABLED: "disabled";
3187
+ readonly AUTO_DISABLED: "auto_disabled";
3188
+ readonly SECRET_ROTATED: "secret_rotated";
3189
+ readonly TESTED: "tested";
3190
+ readonly REPLAYED: "replayed";
3191
+ readonly REMOVED: "removed";
3192
+ };
3193
+ declare const WEBHOOK_REPLAY_ERROR_CODES: {
3194
+ readonly RESOURCE_NOT_FOUND: "resource_not_found";
3195
+ readonly WEBHOOK_DISABLED: "webhook_disabled";
3196
+ readonly EVENT_NOT_SUBSCRIBED: "event_not_subscribed";
3197
+ readonly EVENT_OUT_OF_SCOPE: "event_out_of_scope";
3198
+ readonly DELIVERY_NOT_REPLAYABLE: "delivery_not_replayable";
3199
+ readonly RETRY_IN_PROGRESS: "retry_in_progress";
3200
+ readonly REPLAY_IN_PROGRESS: "replay_in_progress";
3201
+ };
3202
+
3203
+ type WebhookEvent = (typeof WEBHOOK_EVENTS)[keyof typeof WEBHOOK_EVENTS];
1345
3204
 
1346
3205
  type WebhookResource = {
1347
3206
  object: 'webhook';
@@ -1353,6 +3212,8 @@ type WebhookResource = {
1353
3212
  disabledAt: string | null;
1354
3213
  disabledReason: string | null;
1355
3214
  consecutiveFailures: number;
3215
+ addressAllowlist: Array<string>;
3216
+ domainAllowlist: Array<string>;
1356
3217
  lastDeliveryAt: string | null;
1357
3218
  createdAt: string;
1358
3219
  };
@@ -1394,6 +3255,19 @@ type EmailClickedData = Omit<EmailOpenedData, 'openCount' | 'openedAt'> & {
1394
3255
  clickedAt: string;
1395
3256
  };
1396
3257
 
3258
+ type EmailDownloadedData = Omit<EmailOpenedData, 'recipient' | 'attributed' | 'openCount' | 'openedAt'> & {
3259
+ recipient: null;
3260
+ attributed: false;
3261
+ shareId: string;
3262
+ fileId: string | null;
3263
+ filename: string;
3264
+ mimeType: string;
3265
+ sizeBytes: number;
3266
+ url: string;
3267
+ downloadCount: number;
3268
+ downloadedAt: string;
3269
+ };
3270
+
1397
3271
  type WebhookSignatureHeaders = Record<string, string | Array<string> | undefined>;
1398
3272
 
1399
3273
  type VerifyWebhookProps = {
@@ -1403,21 +3277,86 @@ type VerifyWebhookProps = {
1403
3277
  toleranceSeconds?: number;
1404
3278
  };
1405
3279
 
3280
+ type WebhookActivityListOptions = ListOptions & LogWindow;
3281
+
3282
+ type WebhookChangeType = (typeof WEBHOOK_CHANGE_TYPES)[keyof typeof WEBHOOK_CHANGE_TYPES];
3283
+
3284
+ type WebhookActivityResource = {
3285
+ object: 'webhook_event';
3286
+ id: string;
3287
+ endpointId: string;
3288
+ endpointLabel: string;
3289
+ type: WebhookChangeType | (string & {});
3290
+ createdAt: string;
3291
+ actor: AuditActorResource | null;
3292
+ detail: Record<string, unknown>;
3293
+ };
3294
+
1406
3295
  type WebhookCreate = {
1407
3296
  url: string;
1408
3297
  eventTypes?: Array<WebhookEvent>;
1409
3298
  description?: string;
3299
+ addressAllowlist?: Array<string>;
3300
+ domainAllowlist?: Array<string>;
3301
+ };
3302
+
3303
+ type WebhookDeliveryStatus = (typeof WEBHOOK_DELIVERY_STATUSES)[keyof typeof WEBHOOK_DELIVERY_STATUSES];
3304
+
3305
+ type WebhookDeliveryAttempt = {
3306
+ id: string;
3307
+ attempt: number | null;
3308
+ maxAttempts: number | null;
3309
+ status: WebhookDeliveryStatus | (string & {});
3310
+ responseCode: number | null;
3311
+ durationMs: number | null;
3312
+ error: string | null;
3313
+ createdAt: string;
3314
+ };
3315
+
3316
+ type WebhookPayload<T = Record<string, unknown>> = {
3317
+ id: string;
3318
+ type: WebhookEvent | (string & {});
3319
+ createdAt: string;
3320
+ data: T;
3321
+ };
3322
+
3323
+ type WebhookReplayErrorCode = (typeof WEBHOOK_REPLAY_ERROR_CODES)[keyof typeof WEBHOOK_REPLAY_ERROR_CODES];
3324
+
3325
+ type WebhookReplayRefusal = {
3326
+ code: WebhookReplayErrorCode | (string & {});
3327
+ message: string;
3328
+ };
3329
+
3330
+ type WebhookDeliveryDetailResource = WebhookDeliveryAttempt & {
3331
+ object: 'webhook_delivery';
3332
+ endpointId: string;
3333
+ eventType: WebhookEvent | (string & {});
3334
+ eventId: string | null;
3335
+ nextAttemptAt: string | null;
3336
+ payload: WebhookPayload | null;
3337
+ responseBody: string | null;
3338
+ attempts: Array<WebhookDeliveryAttempt>;
3339
+ replayRefusal: WebhookReplayRefusal | null;
3340
+ };
3341
+
3342
+ type WebhookDeliveryListOptions = ListOptions & LogWindow & {
3343
+ status?: WebhookDeliveryStatus;
1410
3344
  };
1411
3345
 
1412
3346
  type WebhookDeliveryResource = {
1413
3347
  object: 'webhook_delivery';
1414
3348
  id: string;
3349
+ endpointId: string;
1415
3350
  eventType: WebhookEvent | (string & {});
1416
- status: 'delivered' | 'failed' | (string & {});
3351
+ eventId: string | null;
3352
+ status: WebhookDeliveryStatus | (string & {});
1417
3353
  responseCode: number | null;
1418
3354
  durationMs: number | null;
3355
+ attempt: number | null;
3356
+ maxAttempts: number | null;
1419
3357
  error: string | null;
1420
3358
  createdAt: string;
3359
+ nextAttemptAt: string | null;
1421
3360
  };
1422
3361
 
1423
3362
  type WebhookPatch = {
@@ -1425,13 +3364,23 @@ type WebhookPatch = {
1425
3364
  eventTypes?: Array<WebhookEvent>;
1426
3365
  description?: string | null;
1427
3366
  enabled?: boolean;
3367
+ addressAllowlist?: Array<string>;
3368
+ domainAllowlist?: Array<string>;
1428
3369
  };
1429
3370
 
1430
- type WebhookPayload<T = Record<string, unknown>> = {
3371
+ type WebhookReplayResource = {
3372
+ object: 'webhook_replay';
1431
3373
  id: string;
1432
- type: WebhookEvent | (string & {});
1433
- createdAt: string;
1434
- data: T;
3374
+ endpointId: string;
3375
+ replayOf: string;
3376
+ eventId: string;
3377
+ eventType: WebhookEvent | (string & {});
3378
+ delivery: {
3379
+ status: WebhookDeliveryStatus | (string & {});
3380
+ responseCode: number | null;
3381
+ durationMs: number | null;
3382
+ error: string | null;
3383
+ };
1435
3384
  };
1436
3385
 
1437
3386
  type WebhookTestResource = {
@@ -1445,12 +3394,20 @@ type WebhookTestResource = {
1445
3394
  } | null;
1446
3395
  };
1447
3396
 
3397
+ type WebhookWorkspaceActivityListOptions = WebhookActivityListOptions & {
3398
+ endpointIds?: Array<string>;
3399
+ };
3400
+
3401
+ type WebhookWorkspaceDeliveryListOptions = WebhookDeliveryListOptions & {
3402
+ endpointIds?: Array<string>;
3403
+ };
3404
+
1448
3405
  declare class Transport {
1449
3406
  #private;
1450
3407
  readonly baseUrl: string;
1451
3408
  private readonly fetchImpl;
1452
3409
  private readonly maxRetries;
1453
- private readonly timeoutMs;
3410
+ readonly timeoutMs: number;
1454
3411
  private readonly userAgent;
1455
3412
  private readonly headers;
1456
3413
  constructor(options: TransportOptions & {
@@ -1515,6 +3472,8 @@ declare const createTempMail: (options?: TempMailOptions) => ReturnType<(transpo
1515
3472
  extend: (inboxId: string, options?: InboxScope) => Promise<TempInboxResource>;
1516
3473
  delete: (inboxId: string, options?: InboxScope) => Promise<DeletedTempInboxResource>;
1517
3474
  listMessages: (inboxId: string, options?: TempMessageListOptions) => Promise<TempMessagesResource>;
3475
+ listAllMessages: (inboxId: string, options?: TempMessageListOptions) => Promise<Array<TempMessageResource>>;
3476
+ iterateMessages: (inboxId: string, options?: TempMessageListOptions) => AsyncGenerator<TempMessageResource, void, undefined>;
1518
3477
  getMessage: (inboxId: string, messageId: string, options?: InboxScope) => Promise<TempMessageDetailResource>;
1519
3478
  deleteMessage: (inboxId: string, messageId: string, options?: InboxScope) => Promise<DeletedTempMessageResource>;
1520
3479
  listAttachments: (inboxId: string, messageId: string, options?: InboxScope) => Promise<Array<AttachmentResource>>;
@@ -1527,5 +3486,5 @@ declare const resolveLanguage: (input: string | null | undefined) => LanguageRes
1527
3486
  declare const languageByCode: (code: string | null | undefined) => LanguageResource | undefined;
1528
3487
  declare const isRtlLanguage: (code: string | null | undefined) => boolean;
1529
3488
 
1530
- export { API_SCOPES, ERROR_TYPES, LANGUAGES, MESSAGE_ENCRYPTION_FORMATS, OpenEmail, OpenEmailApiError, OpenEmailNetworkError, PAGE_LIMITS, RULE_ACTIONS, RULE_FIELDS, RULE_OPERATORS, VERSION, WEBHOOK_EVENTS, WEBHOOK_SIGNATURE_HEADERS, createClient, createOpenEmail, createTempMail, OpenEmail as default, getClient, init, isApiKey, isRtlLanguage, isSealed, languageByCode, openemail, resetClient, resolveLanguage, toBase64, verifyWebhookSignature };
1531
- export type { AddressBookResource, AddressResource, ApiErrorPayload, ApiErrorProps, ApiKeyMode, ApiScope, AttachmentInput, AttachmentResource, BatchItemResource, BatchResultResource, BuiltinRole, CalendarAttendeeResource, CalendarEventResource, CalendarOccurrenceResource, CalendarRangeOptions, ClientOptions, ContactListOptions, ContactResource, CreatedTempInboxResource, CreatedWebhookResource, DeletedDraftResource, DeletedLabelResource, DeletedRoleResource, DeletedRuleResource, DeletedTempInboxResource, DeletedTempMessageResource, DeletedTemplateResource, DeletedWebhookResource, DomainDetailResource, DomainResource, DomainSendingState, DraftInput, DraftListOptions, DraftResource, DraftSummaryResource, EmailClickedData, EmailEventResource, EmailListOptions, EmailOpenedData, EmailRecipientResource, EmailResource, EmailSend, EmailSource, EmailStatus, EmailTrackingSummary, EmailTranslate, EmailTranslationResource, EmailTransport, ErrorType, FetchLike, HitKind, InboxScope, KeyResource, LabelColor, LabelInput, LabelResource, LanguageResource, ListOptions, MemberAccess, MemberAdd, MemberAddressGrant, MemberAddressResource, MemberPatch, MemberResource, MessageEncryption, MessageEncryptionFormat, MessageResource, Page, Permission, PermissionResource, PingResource, RecipientInput, RecipientStatus, RemovedMemberResource, RequestOptions, RequestScope, RoleCreate, RoleDeleteOptions, RolePatch, RoleResource, RuleAction, RuleActionType, RuleCondition, RuleConditionInput, RuleCreate, RuleField, RuleListOptions, RuleOperator, RulePatch, RuleResource, RuleRunListOptions, RuleRunResource, RuleTestInput, RuleTestResource, SavedDraftResource, SavedLabelResource, SendScope, SendTranslateOptions, SendableDomainResource, SentEmailResource, SentTemplateEmailResource, SettingsPatch, SettingsResource, SnoozedThreadResource, TempDomainResource, TempInboxCreate, TempInboxResource, TempMailOptions, TempMessageDetailResource, TempMessageListOptions, TempMessageResource, TempMessagesResource, TemplateContent, TemplateCreate, TemplateDetailResource, TemplateEngine, TemplateListOptions, TemplatePatch, TemplatePreviewInput, TemplatePreviewResource, TemplateProp, TemplateResource, TemplateSend, TemplateSlot, TemplateStatus, TemplateValueKind, TemplateVersionResource, ThreadListOptions, ThreadPatch, ThreadResource, ThreadSummaryResource, TrackingClickResource, TrackingGrain, TrackingHitOptions, TrackingLinkResource, TrackingListOptions, TrackingOpenResource, TrackingRecipientResource, TrackingRequest, TrackingResource, TrackingStatsOptions, TrackingStatsResource, TrackingSummary, TranslateOptions, TranslationResource, TransportOptions, TrashedThreadResource, UpdatedThreadResource, VerifyWebhookProps, WebhookCreate, WebhookDeliveryResource, WebhookEvent, WebhookPatch, WebhookPayload, WebhookResource, WebhookSignatureHeaders, WebhookTestResource };
3489
+ export { API_SCOPES, BROADCAST_STATUSES, CONTACT_BLOCK_LISTS, CONTACT_PHOTO_TYPES, CONTACT_THREAD_SORTS, ERROR_TYPES, FILE_DIRECTIONS, FILE_KINDS, FILE_SORTS, FILE_USAGES, LANGUAGES, MESSAGE_ENCRYPTION_FORMATS, OpenEmail, OpenEmailApiError, OpenEmailNetworkError, PAGE_LIMITS, PEOPLE_SORTS, PROVIDER_IMPORT_DOMAIN_STATES, PROVIDER_IMPORT_RESOURCES, PROVIDER_IMPORT_STATUSES, RULE_ACTIONS, RULE_FIELDS, RULE_OPERATORS, SUPPRESSION_REASONS, THREAD_SORTS, VERSION, WEBHOOK_EVENTS, WEBHOOK_REPLAY_ERROR_CODES, WEBHOOK_SIGNATURE_HEADERS, createClient, createOpenEmail, createTempMail, OpenEmail as default, getClient, init, isApiKey, isRtlLanguage, isSealed, languageByCode, openemail, resetClient, resolveLanguage, toBase64, verifyWebhookSignature };
3490
+ export type { AddressBookPage, AddressBookResource, AddressResource, ApiErrorPayload, ApiErrorProps, ApiKeyActivityListOptions, ApiKeyActivityResource, ApiKeyCreate, ApiKeyEventType, ApiKeyMode, ApiKeyPatch, ApiKeyRequestListOptions, ApiKeyRequestResource, ApiKeyResource, ApiKeyRevoke, ApiKeyStatus, ApiKeyWorkspaceActivityListOptions, ApiKeyWorkspaceRequestListOptions, ApiScope, AttachmentDeliveryMode, AttachmentInput, AttachmentResource, AudienceBatchAddResource, AudienceBatchRemoveResource, AudienceBuiltin, AudienceContactAdd, AudienceContactListOptions, AudienceContactResource, AudienceContactsBatch, AudienceCreate, AudienceGrowthBucket, AudienceGrowthOptions, AudienceGrowthResource, AudienceGrowthSeries, AudienceGrowthTotals, AudienceImport, AudienceImportResource, AudienceImportRow, AudienceListOptions, AudienceMemberResource, AudienceMemberSort, AudiencePatch, AudienceResource, AuditActorKind, AuditActorResource, BatchItemResource, BatchResultResource, BroadcastCounts, BroadcastCreate, BroadcastListOptions, BroadcastPreviewInput, BroadcastPreviewResource, BroadcastResource, BroadcastStatus, BuiltinRole, CalendarAttendeeResource, CalendarEventResource, CalendarOccurrenceResource, CalendarRangeOptions, ClientOptions, ConsolePermission, ContactActivityBucket, ContactActivityOptions, ContactActivityResource, ContactActivityTotals, ContactAudienceResource, ContactAudiencesSet, ContactBatchDeleteResource, ContactBlockList, ContactBlockResource, ContactBlockRule, ContactCreate, ContactDetailResource, ContactListOptions, ContactPatch, ContactPhotoOptions, ContactPhotoType, ContactReplyTime, ContactResource, ContactSave, ContactSource, ContactThreadListOptions, ContactThreadResource, ContactThreadSort, CreatedApiKeyResource, CreatedTempInboxResource, CreatedWebhookResource, DeletedApiKeyResource, DeletedAudienceResource, DeletedContactResource, DeletedDraftResource, DeletedFileResource, DeletedLabelResource, DeletedRoleResource, DeletedRuleResource, DeletedTempInboxResource, DeletedTempMessageResource, DeletedTemplateResource, DeletedTemplateVersionResource, DeletedWebhookResource, DomainDetailResource, DomainPatch, DomainResource, DomainSendingState, DomainStorage, DomainStorageState, DomainTracking, DomainTrackingState, DraftInput, DraftListOptions, DraftResource, DraftSummaryResource, EmailClickedData, EmailDownloadedData, EmailEventResource, EmailListOptions, EmailOpenedData, EmailRecipientResource, EmailResource, EmailSend, EmailSource, EmailStatus, EmailTrackingSummary, EmailTranslate, EmailTranslationResource, EmailTransport, EmptiedAudienceResource, ErrorType, FetchLike, FileAddressCount, FileBatchDeleteResource, FileCount, FileDayCount, FileDirection, FileKept, FileKind, FileLinkCount, FileLinkResource, FileListOptions, FileResource, FileSort, FileStatsResource, FileTypeCount, FileUploadOptions, FileUsage, HitKind, ImportChunkResource, ImportCounts, ImportCreate, ImportFailurePage, ImportFailureReason, ImportFailureResource, ImportFailuresOptions, ImportFileDescriptor, ImportFileInfo, ImportFilesInput, ImportFormat, ImportListOptions, ImportOptions, ImportProgress, ImportResource, ImportSource, ImportStatus, ImportUploadResource, InboxScope, InlineAttachmentInput, InvitationResource, KeyResource, LabelColor, LabelColorInput, LabelColorKind, LabelColorResource, LabelInput, LabelPatch, LabelResource, LanguageResource, ListOptions, LogWindow, MemberAccess, MemberAdd, MemberAddressGrant, MemberAddressResource, MemberDomainResource, MemberPatch, MemberResource, MessageEncryption, MessageEncryptionFormat, MessageEncryptionPartRole, MessageResource, Page, PeoplePage, PeopleSort, Permission, PermissionResource, PersonListOptions, PersonResource, PingResource, ProviderImportCount, ProviderImportCreate, ProviderImportDomainState, ProviderImportListOptions, ProviderImportReport, ProviderImportResource, ProviderImportResourceKind, ProviderImportStatus, ProviderInventoryResource, RawBody, RecipientInput, RecipientKind, RecipientStatus, RemovedAudienceContactResource, RemovedMemberResource, RemovedSuppressionResource, RequestOptions, RequestScope, RevokedInvitationResource, RoleCreate, RoleDeleteOptions, RolePatch, RoleResource, RotatedApiKeyResource, RotatedKeyResource, RuleAction, RuleActionType, RuleCondition, RuleConditionInput, RuleCreate, RuleField, RuleListOptions, RuleMatchMode, RuleOperator, RulePatch, RuleResource, RuleRunListOptions, RuleRunResource, RuleTestInput, RuleTestResource, RuleTestWarningCode, SavedDraftResource, SendScope, SendTranslateOptions, SendableDomainResource, SentBroadcastResource, SentEmailResource, SentTemplateEmailResource, SettingsOptions, SettingsPatch, SettingsResource, SnoozedThreadResource, StoredAttachmentInput, SuppressionAdd, SuppressionListOptions, SuppressionReason, SuppressionResource, TempDomainResource, TempInboxCreate, TempInboxResource, TempMailOptions, TempMessageDetailResource, TempMessageListOptions, TempMessageResource, TempMessagesResource, TemplateAnalyticsOptions, TemplateAnalyticsResource, TemplateBlock, TemplateBlockKind, TemplateCategory, TemplateContent, TemplateContentSource, TemplateCreate, TemplateDetailResource, TemplateDocument, TemplateDuplicate, TemplateEngine, TemplateFont, TemplateFontFormat, TemplateFontResource, TemplateFontStyle, TemplateListOptions, TemplatePatch, TemplatePreviewInput, TemplatePreviewResource, TemplatePreviewWarningCode, TemplateProp, TemplateRenderInput, TemplateRenderResource, TemplateResource, TemplateRestoreInput, TemplateRestoredResource, TemplateSend, TemplateSendListOptions, TemplateSendResource, TemplateSendsResource, TemplateSlot, TemplateSort, TemplateStarterDetailResource, TemplateStarterResource, TemplateStatus, TemplateValueKind, TemplateVersionResource, TemplateVersionState, ThreadListOptions, ThreadPatch, ThreadResource, ThreadSort, ThreadSummaryResource, TrackingClickResource, TrackingGrain, TrackingHitOptions, TrackingLinkResource, TrackingListOptions, TrackingOpenResource, TrackingRecipientResource, TrackingRequest, TrackingResource, TrackingStatsOptions, TrackingStatsResource, TrackingSummary, TranslateOptions, TranslationResource, TransportOptions, TrashedThreadResource, UpdatedThreadResource, VerifyWebhookProps, WebhookActivityListOptions, WebhookActivityResource, WebhookChangeType, WebhookCreate, WebhookDeliveryAttempt, WebhookDeliveryDetailResource, WebhookDeliveryListOptions, WebhookDeliveryResource, WebhookDeliveryStatus, WebhookEvent, WebhookPatch, WebhookPayload, WebhookReplayErrorCode, WebhookReplayRefusal, WebhookReplayResource, WebhookResource, WebhookSignatureHeaders, WebhookTestResource, WebhookWorkspaceActivityListOptions, WebhookWorkspaceDeliveryListOptions };