@openemail/sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +183 -0
- package/index.cjs +1776 -0
- package/index.d.cts +1531 -0
- package/index.d.ts +1531 -0
- package/index.js +1744 -0
- package/package.json +60 -0
package/index.d.cts
ADDED
|
@@ -0,0 +1,1531 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
type AddressResource = {
|
|
3
|
+
object: 'address';
|
|
4
|
+
address: string;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
canSend: boolean;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type SendableDomainResource = {
|
|
10
|
+
domain: string;
|
|
11
|
+
receivingVerified: boolean;
|
|
12
|
+
sendingVerified: boolean;
|
|
13
|
+
catchAll: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type AddressBookResource = {
|
|
17
|
+
unrestricted: boolean;
|
|
18
|
+
addresses: Array<AddressResource>;
|
|
19
|
+
domains: Array<SendableDomainResource>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type CalendarAttendeeResource = {
|
|
23
|
+
object: 'calendar_attendee';
|
|
24
|
+
email: string;
|
|
25
|
+
name: string | null;
|
|
26
|
+
partstat: string;
|
|
27
|
+
role: string;
|
|
28
|
+
rsvp: boolean;
|
|
29
|
+
cutype: string | null;
|
|
30
|
+
respondedAt: string | null;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type CalendarEventResource = {
|
|
34
|
+
object: 'calendar_event';
|
|
35
|
+
id: string;
|
|
36
|
+
uid: string;
|
|
37
|
+
sequence: number;
|
|
38
|
+
summary: string | null;
|
|
39
|
+
description: string | null;
|
|
40
|
+
location: string | null;
|
|
41
|
+
url: string | null;
|
|
42
|
+
start: string;
|
|
43
|
+
end: string;
|
|
44
|
+
allDay: boolean;
|
|
45
|
+
timezone: string | null;
|
|
46
|
+
recurrence: string | null;
|
|
47
|
+
exdates: Array<string>;
|
|
48
|
+
status: string;
|
|
49
|
+
transparency: string;
|
|
50
|
+
visibility: string;
|
|
51
|
+
organizer: {
|
|
52
|
+
email: string;
|
|
53
|
+
name: string | null;
|
|
54
|
+
} | null;
|
|
55
|
+
isOrganizer: boolean;
|
|
56
|
+
source: string;
|
|
57
|
+
messageId: string | null;
|
|
58
|
+
threadId: string | null;
|
|
59
|
+
alarms: Array<{
|
|
60
|
+
minutesBefore: number;
|
|
61
|
+
action: string;
|
|
62
|
+
}>;
|
|
63
|
+
attendees: Array<CalendarAttendeeResource>;
|
|
64
|
+
createdAt: string;
|
|
65
|
+
updatedAt: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type CalendarOccurrenceResource = {
|
|
69
|
+
object: 'calendar_occurrence';
|
|
70
|
+
eventId: string;
|
|
71
|
+
uid: string;
|
|
72
|
+
start: string;
|
|
73
|
+
end: string;
|
|
74
|
+
allDay: boolean;
|
|
75
|
+
summary: string | null;
|
|
76
|
+
location: string | null;
|
|
77
|
+
status: string;
|
|
78
|
+
transparency: string;
|
|
79
|
+
isOrganizer: boolean;
|
|
80
|
+
organizerEmail: string | null;
|
|
81
|
+
recurring: boolean;
|
|
82
|
+
myPartstat: string | null;
|
|
83
|
+
attendeeCount: number;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
type RequestScope = {
|
|
87
|
+
signal?: AbortSignal;
|
|
88
|
+
apiKey?: string;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
type CalendarRangeOptions = RequestScope & {
|
|
92
|
+
from: Date | string;
|
|
93
|
+
to: Date | string;
|
|
94
|
+
timezone?: string;
|
|
95
|
+
};
|
|
96
|
+
|
|
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 = {
|
|
104
|
+
filename: string;
|
|
105
|
+
content: string | Uint8Array | ArrayBuffer;
|
|
106
|
+
contentType?: string;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
type AttachmentResource = {
|
|
110
|
+
object: 'attachment';
|
|
111
|
+
attachmentId: string;
|
|
112
|
+
filename: string;
|
|
113
|
+
contentType: string;
|
|
114
|
+
size: number;
|
|
115
|
+
content: string | null;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
type BuiltinRole = 'owner' | 'admin' | 'member' | 'viewer' | 'developer' | 'billing';
|
|
119
|
+
|
|
120
|
+
type HitKind = 'human' | 'proxy' | 'machine';
|
|
121
|
+
|
|
122
|
+
declare const MESSAGE_ENCRYPTION_FORMATS: readonly ["pgp-mime", "pgp-signed", "pgp-inline", "smime-encrypted", "smime-signed"];
|
|
123
|
+
|
|
124
|
+
type MessageEncryptionFormat = (typeof MESSAGE_ENCRYPTION_FORMATS)[number];
|
|
125
|
+
|
|
126
|
+
type MessageEncryption = {
|
|
127
|
+
format: MessageEncryptionFormat;
|
|
128
|
+
detectedAt: string;
|
|
129
|
+
rawRetained: boolean;
|
|
130
|
+
parts?: Array<{
|
|
131
|
+
index: number;
|
|
132
|
+
attachmentId: string;
|
|
133
|
+
role: 'version' | 'ciphertext' | 'signature';
|
|
134
|
+
}>;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
type MessageResource = Record<string, unknown> & {
|
|
138
|
+
encryption?: MessageEncryption;
|
|
139
|
+
};
|
|
140
|
+
|
|
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
|
+
};
|
|
147
|
+
|
|
148
|
+
type TranslateOptions = {
|
|
149
|
+
to: string;
|
|
150
|
+
from?: string;
|
|
151
|
+
includeOriginal?: boolean;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
type SendTranslateOptions = TranslateOptions & {
|
|
155
|
+
subject?: boolean;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
type TrackingRequest = {
|
|
159
|
+
opens?: boolean;
|
|
160
|
+
clicks?: boolean;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
type ContactListOptions = RequestScope & {
|
|
164
|
+
limit?: number;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
type ContactResource = {
|
|
168
|
+
object: 'contact';
|
|
169
|
+
email: string;
|
|
170
|
+
name: string | null;
|
|
171
|
+
source: 'manual' | 'auto' | (string & {});
|
|
172
|
+
notes: string | null;
|
|
173
|
+
lastSeenAt: string | null;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
type ApiErrorPayload = {
|
|
177
|
+
type?: string;
|
|
178
|
+
code?: string;
|
|
179
|
+
message?: string;
|
|
180
|
+
param?: string;
|
|
181
|
+
docUrl?: string;
|
|
182
|
+
requestId?: string;
|
|
183
|
+
};
|
|
184
|
+
|
|
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"];
|
|
186
|
+
|
|
187
|
+
type ErrorType = (typeof ERROR_TYPES)[number];
|
|
188
|
+
|
|
189
|
+
type ApiErrorProps = {
|
|
190
|
+
message: string;
|
|
191
|
+
status: number | null;
|
|
192
|
+
type: ErrorType;
|
|
193
|
+
code: string;
|
|
194
|
+
param?: string;
|
|
195
|
+
docUrl?: string;
|
|
196
|
+
requestId?: string;
|
|
197
|
+
retryAfterSeconds?: number;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
201
|
+
|
|
202
|
+
type TransportOptions = {
|
|
203
|
+
apiKey?: string;
|
|
204
|
+
baseUrl?: string;
|
|
205
|
+
fetch?: FetchLike;
|
|
206
|
+
maxRetries?: number;
|
|
207
|
+
timeoutMs?: number;
|
|
208
|
+
userAgent?: string;
|
|
209
|
+
headers?: Record<string, string>;
|
|
210
|
+
disableUpdateNotice?: boolean;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
type ClientOptions = TransportOptions & {
|
|
214
|
+
dangerouslyAllowBrowser?: boolean;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
declare const Addresses: (transport: Transport) => {
|
|
218
|
+
list: (options?: RequestScope) => Promise<AddressBookResource>;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
declare const Calendar: (transport: Transport) => {
|
|
222
|
+
listEvents: (options: CalendarRangeOptions) => Promise<Array<CalendarOccurrenceResource>>;
|
|
223
|
+
getEvent: (id: string, options?: RequestScope) => Promise<CalendarEventResource>;
|
|
224
|
+
getEventIcs: (id: string, options?: RequestScope) => Promise<string>;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
declare const Contacts: (transport: Transport) => {
|
|
228
|
+
list: (options?: ContactListOptions) => Promise<Array<ContactResource>>;
|
|
229
|
+
get: (email: string, options?: RequestScope) => Promise<ContactResource>;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
declare const Domains: (transport: Transport) => {
|
|
233
|
+
list: (options?: RequestScope) => Promise<Array<DomainResource>>;
|
|
234
|
+
get: (id: string, options?: RequestScope) => Promise<DomainDetailResource>;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
declare const Drafts: (transport: Transport) => {
|
|
238
|
+
list: (options?: DraftListOptions) => Promise<Page<DraftSummaryResource>>;
|
|
239
|
+
listAll: (options?: DraftListOptions) => Promise<Array<DraftSummaryResource>>;
|
|
240
|
+
iterate: (options?: DraftListOptions) => AsyncGenerator<DraftSummaryResource, void, undefined>;
|
|
241
|
+
get: (id: string, options?: RequestScope) => Promise<DraftResource>;
|
|
242
|
+
create: (body: DraftInput, options?: RequestScope) => Promise<SavedDraftResource>;
|
|
243
|
+
update: (id: string, body: DraftInput, options?: RequestScope) => Promise<SavedDraftResource>;
|
|
244
|
+
delete: (id: string, options?: RequestScope) => Promise<DeletedDraftResource>;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
declare const Emails: (transport: Transport) => {
|
|
248
|
+
send: (body: EmailSend, options?: SendScope) => Promise<SentEmailResource>;
|
|
249
|
+
sendBatch: (emails: Array<EmailSend>, options?: SendScope) => Promise<BatchResultResource>;
|
|
250
|
+
translate: (body: EmailTranslate, options?: RequestScope) => Promise<TranslationResource>;
|
|
251
|
+
list: (options?: EmailListOptions) => Promise<Page<EmailResource>>;
|
|
252
|
+
listAll: (options?: EmailListOptions) => Promise<Array<EmailResource>>;
|
|
253
|
+
iterate: (options?: EmailListOptions) => AsyncGenerator<EmailResource, void, undefined>;
|
|
254
|
+
get: (id: string, options?: RequestScope) => Promise<EmailResource>;
|
|
255
|
+
listEvents: (id: string, options?: RequestScope) => Promise<Array<EmailEventResource>>;
|
|
256
|
+
getTracking: (id: string, options?: RequestScope) => Promise<TrackingResource>;
|
|
257
|
+
cancel: (id: string, options?: RequestScope) => Promise<EmailResource>;
|
|
258
|
+
reschedule: (id: string, scheduledAt: Date | string, options?: RequestScope) => Promise<EmailResource>;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
declare const Labels: (transport: Transport) => {
|
|
262
|
+
list: (options?: RequestScope) => Promise<Array<LabelResource>>;
|
|
263
|
+
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>;
|
|
266
|
+
delete: (id: string, options?: RequestScope) => Promise<DeletedLabelResource>;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
declare const Languages: (transport: Transport) => {
|
|
270
|
+
list: (options?: RequestScope) => Promise<Array<LanguageResource>>;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
declare const Me: (transport: Transport) => {
|
|
274
|
+
get: (options?: RequestScope) => Promise<KeyResource>;
|
|
275
|
+
ping: (options?: RequestScope) => Promise<PingResource>;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
declare const Members: (transport: Transport) => {
|
|
279
|
+
list: (options?: RequestScope) => Promise<Array<MemberResource>>;
|
|
280
|
+
get: (userId: string, options?: RequestScope) => Promise<MemberResource>;
|
|
281
|
+
add: (body: MemberAdd, options?: RequestScope) => Promise<MemberResource>;
|
|
282
|
+
update: (userId: string, patch: MemberPatch, options?: RequestScope) => Promise<MemberResource>;
|
|
283
|
+
remove: (userId: string, options?: RequestScope) => Promise<RemovedMemberResource>;
|
|
284
|
+
grantAddress: (userId: string, body: MemberAddressGrant, options?: RequestScope) => Promise<MemberResource>;
|
|
285
|
+
revokeAddress: (userId: string, addressId: string, options?: RequestScope) => Promise<MemberResource>;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
declare const Roles: (transport: Transport) => {
|
|
289
|
+
list: (options?: RequestScope) => Promise<Array<RoleResource>>;
|
|
290
|
+
get: (id: string, options?: RequestScope) => Promise<RoleResource>;
|
|
291
|
+
create: (body: RoleCreate, options?: RequestScope) => Promise<RoleResource>;
|
|
292
|
+
update: (id: string, patch: RolePatch, options?: RequestScope) => Promise<RoleResource>;
|
|
293
|
+
delete: (id: string, options?: RoleDeleteOptions) => Promise<DeletedRoleResource>;
|
|
294
|
+
listPermissions: (options?: RequestScope) => Promise<Array<PermissionResource>>;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
declare const Rules: (transport: Transport) => {
|
|
298
|
+
list: (options?: RuleListOptions) => Promise<Page<RuleResource>>;
|
|
299
|
+
listAll: (options?: RuleListOptions) => Promise<Array<RuleResource>>;
|
|
300
|
+
iterate: (options?: RuleListOptions) => AsyncGenerator<RuleResource, void, undefined>;
|
|
301
|
+
get: (id: string, options?: RequestScope) => Promise<RuleResource>;
|
|
302
|
+
create: (body: RuleCreate, options?: RequestScope) => Promise<RuleResource>;
|
|
303
|
+
update: (id: string, patch: RulePatch, options?: RequestScope) => Promise<RuleResource>;
|
|
304
|
+
delete: (id: string, options?: RequestScope) => Promise<DeletedRuleResource>;
|
|
305
|
+
reorder: (ruleIds: Array<string>, options?: RequestScope) => Promise<Array<RuleResource>>;
|
|
306
|
+
test: (id: string, body?: RuleTestInput, options?: RequestScope) => Promise<RuleTestResource>;
|
|
307
|
+
listRuns: (options?: RuleRunListOptions) => Promise<Page<RuleRunResource>>;
|
|
308
|
+
listAllRuns: (options?: RuleRunListOptions) => Promise<Array<RuleRunResource>>;
|
|
309
|
+
iterateRuns: (options?: RuleRunListOptions) => AsyncGenerator<RuleRunResource, void, undefined>;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
declare const Settings: (transport: Transport) => {
|
|
313
|
+
get: (options?: RequestScope) => Promise<SettingsResource>;
|
|
314
|
+
update: (patch: SettingsPatch, options?: RequestScope) => Promise<SettingsResource>;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
declare const TempMail: (transport: Transport) => {
|
|
318
|
+
listDomains: (options?: InboxScope) => Promise<Array<TempDomainResource>>;
|
|
319
|
+
create: (body?: TempInboxCreate, options?: InboxScope) => Promise<CreatedTempInboxResource>;
|
|
320
|
+
get: (inboxId: string, options?: InboxScope) => Promise<TempInboxResource>;
|
|
321
|
+
extend: (inboxId: string, options?: InboxScope) => Promise<TempInboxResource>;
|
|
322
|
+
delete: (inboxId: string, options?: InboxScope) => Promise<DeletedTempInboxResource>;
|
|
323
|
+
listMessages: (inboxId: string, options?: TempMessageListOptions) => Promise<TempMessagesResource>;
|
|
324
|
+
getMessage: (inboxId: string, messageId: string, options?: InboxScope) => Promise<TempMessageDetailResource>;
|
|
325
|
+
deleteMessage: (inboxId: string, messageId: string, options?: InboxScope) => Promise<DeletedTempMessageResource>;
|
|
326
|
+
listAttachments: (inboxId: string, messageId: string, options?: InboxScope) => Promise<Array<AttachmentResource>>;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
declare const Templates: (transport: Transport) => {
|
|
330
|
+
list: (options?: TemplateListOptions) => Promise<Page<TemplateResource>>;
|
|
331
|
+
listAll: (options?: TemplateListOptions) => Promise<Array<TemplateResource>>;
|
|
332
|
+
iterate: (options?: TemplateListOptions) => AsyncGenerator<TemplateResource, void, undefined>;
|
|
333
|
+
get: (idOrSlug: string, options?: RequestScope) => Promise<TemplateDetailResource>;
|
|
334
|
+
create: (body: TemplateCreate, options?: RequestScope) => Promise<TemplateResource>;
|
|
335
|
+
update: (idOrSlug: string, patch: TemplatePatch, options?: RequestScope) => Promise<TemplateDetailResource>;
|
|
336
|
+
delete: (idOrSlug: string, options?: RequestScope) => Promise<DeletedTemplateResource>;
|
|
337
|
+
listVersions: (idOrSlug: string, options?: RequestScope) => Promise<Array<TemplateVersionResource>>;
|
|
338
|
+
publish: (idOrSlug: string, options?: RequestScope) => Promise<TemplateVersionResource>;
|
|
339
|
+
preview: (idOrSlug: string, body?: TemplatePreviewInput, options?: RequestScope) => Promise<TemplatePreviewResource>;
|
|
340
|
+
send: (idOrSlug: string, body: TemplateSend, options?: SendScope) => Promise<SentTemplateEmailResource>;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
declare const Threads: (transport: Transport) => {
|
|
344
|
+
list: (options?: ThreadListOptions) => Promise<Page<ThreadSummaryResource>>;
|
|
345
|
+
listAll: (options?: ThreadListOptions) => Promise<Array<ThreadSummaryResource>>;
|
|
346
|
+
iterate: (options?: ThreadListOptions) => AsyncGenerator<ThreadSummaryResource, void, undefined>;
|
|
347
|
+
get: (id: string, options?: RequestScope) => Promise<ThreadResource>;
|
|
348
|
+
update: (id: string, patch: ThreadPatch, options?: RequestScope) => Promise<UpdatedThreadResource>;
|
|
349
|
+
trash: (id: string, options?: RequestScope) => Promise<TrashedThreadResource>;
|
|
350
|
+
snooze: (id: string, wakeAt: Date | string, options?: RequestScope) => Promise<SnoozedThreadResource>;
|
|
351
|
+
unsnooze: (id: string, options?: RequestScope) => Promise<SnoozedThreadResource>;
|
|
352
|
+
listAttachments: (id: string, messageId: string, options?: RequestScope) => Promise<Array<AttachmentResource>>;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
declare const Tracking: (transport: Transport) => {
|
|
356
|
+
list: (options?: TrackingListOptions) => Promise<Array<TrackingResource>>;
|
|
357
|
+
getStats: (options?: TrackingStatsOptions) => Promise<TrackingStatsResource>;
|
|
358
|
+
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>>;
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
declare const Webhooks: (transport: Transport) => {
|
|
364
|
+
list: (options?: RequestScope) => Promise<Array<WebhookResource>>;
|
|
365
|
+
get: (id: string, options?: RequestScope) => Promise<WebhookResource>;
|
|
366
|
+
create: (body: WebhookCreate, options?: RequestScope) => Promise<CreatedWebhookResource>;
|
|
367
|
+
update: (id: string, patch: WebhookPatch, options?: RequestScope) => Promise<WebhookResource>;
|
|
368
|
+
delete: (id: string, options?: RequestScope) => Promise<DeletedWebhookResource>;
|
|
369
|
+
rotateSecret: (id: string, options?: RequestScope) => Promise<CreatedWebhookResource>;
|
|
370
|
+
test: (id: string, options?: RequestScope) => Promise<WebhookTestResource>;
|
|
371
|
+
listDeliveries: (id: string, options?: RequestScope) => Promise<Array<WebhookDeliveryResource>>;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
declare class OpenEmail {
|
|
375
|
+
private readonly transport;
|
|
376
|
+
readonly mode: ApiKeyMode;
|
|
377
|
+
readonly me: ReturnType<typeof Me>;
|
|
378
|
+
readonly addresses: ReturnType<typeof Addresses>;
|
|
379
|
+
readonly languages: ReturnType<typeof Languages>;
|
|
380
|
+
readonly emails: ReturnType<typeof Emails>;
|
|
381
|
+
readonly templates: ReturnType<typeof Templates>;
|
|
382
|
+
readonly tracking: ReturnType<typeof Tracking>;
|
|
383
|
+
readonly threads: ReturnType<typeof Threads>;
|
|
384
|
+
readonly drafts: ReturnType<typeof Drafts>;
|
|
385
|
+
readonly labels: ReturnType<typeof Labels>;
|
|
386
|
+
readonly contacts: ReturnType<typeof Contacts>;
|
|
387
|
+
readonly domains: ReturnType<typeof Domains>;
|
|
388
|
+
readonly rules: ReturnType<typeof Rules>;
|
|
389
|
+
readonly webhooks: ReturnType<typeof Webhooks>;
|
|
390
|
+
readonly calendar: ReturnType<typeof Calendar>;
|
|
391
|
+
readonly settings: ReturnType<typeof Settings>;
|
|
392
|
+
readonly roles: ReturnType<typeof Roles>;
|
|
393
|
+
readonly members: ReturnType<typeof Members>;
|
|
394
|
+
readonly tempMail: ReturnType<typeof TempMail>;
|
|
395
|
+
constructor(configuration: ClientOptions | string);
|
|
396
|
+
get raw(): Transport;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
type InboxScope = {
|
|
400
|
+
signal?: AbortSignal;
|
|
401
|
+
inboxToken?: string;
|
|
402
|
+
};
|
|
403
|
+
|
|
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
|
+
type QueryValues = Record<string, string | number | boolean | null | undefined>;
|
|
416
|
+
|
|
417
|
+
type RequestOptions = {
|
|
418
|
+
method?: string;
|
|
419
|
+
query?: QueryValues;
|
|
420
|
+
body?: unknown;
|
|
421
|
+
signal?: AbortSignal;
|
|
422
|
+
apiKey?: string;
|
|
423
|
+
inboxToken?: string;
|
|
424
|
+
anonymous?: boolean;
|
|
425
|
+
idempotent?: boolean;
|
|
426
|
+
idempotencyKey?: string;
|
|
427
|
+
repeatable?: boolean;
|
|
428
|
+
accept?: string;
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
type SendScope = RequestScope & {
|
|
432
|
+
idempotencyKey?: string;
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
type TempMailOptions = Omit<TransportOptions, 'apiKey'> & {
|
|
436
|
+
inboxToken?: string;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
type DomainSendingState = 'verified' | 'pending' | 'failed' | 'no_identity' | 'unknown';
|
|
440
|
+
|
|
441
|
+
type DomainResource = {
|
|
442
|
+
object: 'domain';
|
|
443
|
+
id: string;
|
|
444
|
+
domain: string;
|
|
445
|
+
receiving: {
|
|
446
|
+
verified: boolean;
|
|
447
|
+
verifiedAt: string | null;
|
|
448
|
+
catchAll: boolean;
|
|
449
|
+
lastCheckedAt: string | null;
|
|
450
|
+
error: string | null;
|
|
451
|
+
};
|
|
452
|
+
sending: {
|
|
453
|
+
status: DomainSendingState;
|
|
454
|
+
canSend: boolean;
|
|
455
|
+
checkedAt: string | null;
|
|
456
|
+
error: string | null;
|
|
457
|
+
note: string;
|
|
458
|
+
};
|
|
459
|
+
createdAt: string;
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
type DomainDetailResource = DomainResource & {
|
|
463
|
+
addresses: Array<{
|
|
464
|
+
address: string;
|
|
465
|
+
enabled: boolean;
|
|
466
|
+
}>;
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
type DeletedDraftResource = {
|
|
470
|
+
object: 'draft';
|
|
471
|
+
id: string;
|
|
472
|
+
deleted: true;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
type DraftInput = {
|
|
476
|
+
to?: Array<string>;
|
|
477
|
+
cc?: Array<string>;
|
|
478
|
+
bcc?: Array<string>;
|
|
479
|
+
subject?: string;
|
|
480
|
+
html?: string;
|
|
481
|
+
text?: string;
|
|
482
|
+
from?: string;
|
|
483
|
+
threadId?: string;
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
type DraftListOptions = ListOptions & {
|
|
487
|
+
query?: string;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
type DraftResource = {
|
|
491
|
+
object: 'draft';
|
|
492
|
+
id: string;
|
|
493
|
+
to: Array<string>;
|
|
494
|
+
cc: Array<string>;
|
|
495
|
+
bcc: Array<string>;
|
|
496
|
+
subject: string;
|
|
497
|
+
html: string;
|
|
498
|
+
threadId: string | null;
|
|
499
|
+
from: string | null;
|
|
500
|
+
attachments: Array<{
|
|
501
|
+
filename: string | null;
|
|
502
|
+
contentType: string | null;
|
|
503
|
+
}>;
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
type DraftSummaryResource = {
|
|
507
|
+
object: 'draft';
|
|
508
|
+
id: string;
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
type SavedDraftResource = {
|
|
512
|
+
object: 'draft';
|
|
513
|
+
id: string | null;
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
type RecipientStatus = 'pending' | 'suppressed' | 'delivered' | 'failed' | 'bounced' | 'complained' | 'uncertain';
|
|
517
|
+
|
|
518
|
+
type EmailRecipientResource = {
|
|
519
|
+
email: string;
|
|
520
|
+
name: string | null;
|
|
521
|
+
kind: 'to' | 'cc' | 'bcc';
|
|
522
|
+
status: RecipientStatus;
|
|
523
|
+
error: string | null;
|
|
524
|
+
deliveredAt: string | null;
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
type EmailSource = 'composer' | 'api' | 'mcp' | 'ai' | 'queue';
|
|
528
|
+
|
|
529
|
+
type EmailStatus = 'queued' | 'scheduled' | 'sending' | 'sent' | 'partial' | 'cancelled' | 'failed';
|
|
530
|
+
|
|
531
|
+
type EmailTrackingSummary = {
|
|
532
|
+
opens: boolean;
|
|
533
|
+
clicks: boolean;
|
|
534
|
+
opened: boolean;
|
|
535
|
+
clicked: boolean;
|
|
536
|
+
openCount: number;
|
|
537
|
+
clickCount: number;
|
|
538
|
+
firstOpenAt: string | null;
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
type EmailTranslationResource = {
|
|
542
|
+
language: string;
|
|
543
|
+
languageName: string;
|
|
544
|
+
detectedSourceLanguage: string | null;
|
|
545
|
+
subject: boolean;
|
|
546
|
+
includeOriginal: boolean;
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
type EmailTransport = 'ses' | 'resend' | 'dev' | 'test';
|
|
550
|
+
|
|
551
|
+
type TrackingLinkResource = {
|
|
552
|
+
id: string;
|
|
553
|
+
url: string;
|
|
554
|
+
label: string | null;
|
|
555
|
+
clickCount: number;
|
|
556
|
+
clickCountRaw: number;
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
type TrackingRecipientResource = {
|
|
560
|
+
email: string | null;
|
|
561
|
+
kind: 'to' | 'cc' | 'bcc' | null;
|
|
562
|
+
attributed: boolean;
|
|
563
|
+
openCount: number;
|
|
564
|
+
clickCount: number;
|
|
565
|
+
firstOpenAt: string | null;
|
|
566
|
+
lastOpenAt: string | null;
|
|
567
|
+
firstClickAt: string | null;
|
|
568
|
+
lastClickAt: string | null;
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
type TrackingSummary = {
|
|
572
|
+
id: string;
|
|
573
|
+
sendId: string | null;
|
|
574
|
+
threadId: string | null;
|
|
575
|
+
messageId: string | null;
|
|
576
|
+
subject: string | null;
|
|
577
|
+
from: string;
|
|
578
|
+
source: EmailSource | (string & {});
|
|
579
|
+
sentAt: string | null;
|
|
580
|
+
opens: boolean;
|
|
581
|
+
clicks: boolean;
|
|
582
|
+
opened: boolean;
|
|
583
|
+
clicked: boolean;
|
|
584
|
+
attributable: boolean;
|
|
585
|
+
openCount: number;
|
|
586
|
+
clickCount: number;
|
|
587
|
+
openCountRaw: number;
|
|
588
|
+
clickCountRaw: number;
|
|
589
|
+
firstOpenAt: string | null;
|
|
590
|
+
lastOpenAt: string | null;
|
|
591
|
+
firstClickAt: string | null;
|
|
592
|
+
lastClickAt: string | null;
|
|
593
|
+
recipients: Array<TrackingRecipientResource>;
|
|
594
|
+
links: Array<TrackingLinkResource>;
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
type EmailResource = {
|
|
598
|
+
object: 'email';
|
|
599
|
+
id: string;
|
|
600
|
+
status: EmailStatus;
|
|
601
|
+
mode: ApiKeyMode;
|
|
602
|
+
from: string;
|
|
603
|
+
subject: string | null;
|
|
604
|
+
messageId: string | null;
|
|
605
|
+
threadId: string | null;
|
|
606
|
+
transport: EmailTransport | (string & {}) | null;
|
|
607
|
+
attempts: number;
|
|
608
|
+
lastError: string | null;
|
|
609
|
+
scheduledAt: string | null;
|
|
610
|
+
cancellableUntil: string | null;
|
|
611
|
+
sentAt: string | null;
|
|
612
|
+
tags: Record<string, string>;
|
|
613
|
+
source: EmailSource | (string & {});
|
|
614
|
+
createdAt: string;
|
|
615
|
+
recipients?: Array<EmailRecipientResource>;
|
|
616
|
+
tracking?: EmailTrackingSummary | TrackingSummary;
|
|
617
|
+
translation?: EmailTranslationResource;
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
type SentEmailResource = EmailResource & {
|
|
621
|
+
replayed: boolean;
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
type BatchItemResource = {
|
|
625
|
+
index: number;
|
|
626
|
+
status: 'ok';
|
|
627
|
+
email: SentEmailResource;
|
|
628
|
+
} | {
|
|
629
|
+
index: number;
|
|
630
|
+
status: 'error';
|
|
631
|
+
error: {
|
|
632
|
+
type: string;
|
|
633
|
+
code: string;
|
|
634
|
+
message: string;
|
|
635
|
+
param?: string;
|
|
636
|
+
};
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
type BatchResultResource = {
|
|
640
|
+
items: Array<BatchItemResource>;
|
|
641
|
+
sent: number;
|
|
642
|
+
failed: number;
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
type EmailEventResource = {
|
|
646
|
+
object: 'event';
|
|
647
|
+
id: string;
|
|
648
|
+
type: string;
|
|
649
|
+
data: Record<string, unknown>;
|
|
650
|
+
createdAt: string;
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
type EmailListOptions = ListOptions & {
|
|
654
|
+
status?: EmailStatus | Array<EmailStatus>;
|
|
655
|
+
from?: string;
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
type EmailSend = {
|
|
659
|
+
from: RecipientInput;
|
|
660
|
+
to: RecipientInput | Array<RecipientInput>;
|
|
661
|
+
cc?: RecipientInput | Array<RecipientInput>;
|
|
662
|
+
bcc?: RecipientInput | Array<RecipientInput>;
|
|
663
|
+
replyTo?: RecipientInput;
|
|
664
|
+
subject?: string;
|
|
665
|
+
html?: string;
|
|
666
|
+
text?: string;
|
|
667
|
+
headers?: Record<string, string>;
|
|
668
|
+
attachments?: Array<AttachmentInput>;
|
|
669
|
+
threadId?: string;
|
|
670
|
+
draftId?: string;
|
|
671
|
+
template?: {
|
|
672
|
+
id: string;
|
|
673
|
+
version?: number;
|
|
674
|
+
props?: Record<string, unknown>;
|
|
675
|
+
slots?: Record<string, unknown>;
|
|
676
|
+
};
|
|
677
|
+
scheduledAt?: Date | string;
|
|
678
|
+
cancellableForSeconds?: number;
|
|
679
|
+
tracking?: TrackingRequest;
|
|
680
|
+
signature?: boolean;
|
|
681
|
+
tags?: Record<string, string>;
|
|
682
|
+
translate?: SendTranslateOptions;
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
type EmailTranslate = TranslateOptions & {
|
|
686
|
+
html?: string;
|
|
687
|
+
text?: string;
|
|
688
|
+
subject?: string;
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
type LanguageResource = {
|
|
692
|
+
code: string;
|
|
693
|
+
label: string;
|
|
694
|
+
native: string;
|
|
695
|
+
flag: string;
|
|
696
|
+
rtl: boolean;
|
|
697
|
+
};
|
|
698
|
+
|
|
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;
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
type DeletedLabelResource = {
|
|
710
|
+
object: 'label';
|
|
711
|
+
id: string;
|
|
712
|
+
deleted: true;
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
type LabelColor = {
|
|
716
|
+
backgroundColor: string;
|
|
717
|
+
textColor: string;
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
type LabelInput = {
|
|
721
|
+
name: string;
|
|
722
|
+
color?: LabelColor;
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
type LabelResource = {
|
|
726
|
+
object: 'label';
|
|
727
|
+
id: string;
|
|
728
|
+
name: string;
|
|
729
|
+
type: string;
|
|
730
|
+
color: LabelColor | null;
|
|
731
|
+
};
|
|
732
|
+
|
|
733
|
+
type SavedLabelResource = {
|
|
734
|
+
object: 'label';
|
|
735
|
+
id: string | null;
|
|
736
|
+
name: string;
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
type KeyResource = {
|
|
740
|
+
object: 'api_key';
|
|
741
|
+
id: string;
|
|
742
|
+
mode: ApiKeyMode;
|
|
743
|
+
scopes: Array<ApiScope>;
|
|
744
|
+
roleId: string | null;
|
|
745
|
+
grantedScopes: Array<ApiScope>;
|
|
746
|
+
workspaceId: string;
|
|
747
|
+
addressAllowlist: Array<string> | null;
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
type PingResource = {
|
|
751
|
+
ok: true;
|
|
752
|
+
keyId: string;
|
|
753
|
+
mode: ApiKeyMode;
|
|
754
|
+
scopes: Array<ApiScope>;
|
|
755
|
+
roleId: string | null;
|
|
756
|
+
grantedScopes: Array<ApiScope>;
|
|
757
|
+
workspaceId: string;
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
type MemberAccess = 'member' | 'viewer';
|
|
761
|
+
|
|
762
|
+
type MemberAdd = {
|
|
763
|
+
email: string;
|
|
764
|
+
roleId: string;
|
|
765
|
+
addressIds?: Array<string>;
|
|
766
|
+
access?: MemberAccess;
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
type MemberAddressGrant = {
|
|
770
|
+
addressId: string;
|
|
771
|
+
access?: MemberAccess;
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
type MemberAddressResource = {
|
|
775
|
+
addressId: string;
|
|
776
|
+
address: string;
|
|
777
|
+
access: MemberAccess;
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
type MemberPatch = {
|
|
781
|
+
roleId: string;
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
type MemberResource = {
|
|
785
|
+
object: 'member';
|
|
786
|
+
userId: string;
|
|
787
|
+
email: string;
|
|
788
|
+
name: string | null;
|
|
789
|
+
image: string | null;
|
|
790
|
+
role: {
|
|
791
|
+
id: string | null;
|
|
792
|
+
name: string;
|
|
793
|
+
builtin: BuiltinRole | null;
|
|
794
|
+
};
|
|
795
|
+
implied: boolean;
|
|
796
|
+
permissions: Array<Permission>;
|
|
797
|
+
addresses: Array<MemberAddressResource>;
|
|
798
|
+
createdAt: string | null;
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
type RemovedMemberResource = {
|
|
802
|
+
object: 'member';
|
|
803
|
+
userId: string;
|
|
804
|
+
deleted: true;
|
|
805
|
+
addressesRevoked: number;
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
type DeletedRoleResource = {
|
|
809
|
+
object: 'role';
|
|
810
|
+
id: string;
|
|
811
|
+
deleted: true;
|
|
812
|
+
reassigned: number;
|
|
813
|
+
keysReassigned: number;
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
type PermissionResource = {
|
|
817
|
+
object: 'permission';
|
|
818
|
+
id: Permission;
|
|
819
|
+
label: string;
|
|
820
|
+
group: string;
|
|
821
|
+
scope: boolean;
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
type RoleCreate = {
|
|
825
|
+
name: string;
|
|
826
|
+
description?: string;
|
|
827
|
+
permissions: Array<Permission>;
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
type RoleDeleteOptions = RequestScope & {
|
|
831
|
+
reassignTo?: string;
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
type RolePatch = {
|
|
835
|
+
name?: string;
|
|
836
|
+
description?: string | null;
|
|
837
|
+
permissions?: Array<Permission>;
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
type RoleResource = {
|
|
841
|
+
object: 'role';
|
|
842
|
+
id: string;
|
|
843
|
+
name: string;
|
|
844
|
+
description: string | null;
|
|
845
|
+
permissions: Array<Permission>;
|
|
846
|
+
builtin: BuiltinRole | null;
|
|
847
|
+
editable: boolean;
|
|
848
|
+
deletable: boolean;
|
|
849
|
+
members: number;
|
|
850
|
+
apiKeys: number;
|
|
851
|
+
createdAt: string;
|
|
852
|
+
updatedAt: string;
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
type DeletedRuleResource = {
|
|
856
|
+
object: 'rule';
|
|
857
|
+
id: string;
|
|
858
|
+
deleted: true;
|
|
859
|
+
};
|
|
860
|
+
|
|
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];
|
|
866
|
+
|
|
867
|
+
type RuleAction = {
|
|
868
|
+
type: RuleActionType;
|
|
869
|
+
value?: string;
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
type RuleField = (typeof RULE_FIELDS)[number];
|
|
873
|
+
|
|
874
|
+
type RuleOperator = (typeof RULE_OPERATORS)[number];
|
|
875
|
+
|
|
876
|
+
type RuleCondition = {
|
|
877
|
+
field: RuleField;
|
|
878
|
+
op: RuleOperator;
|
|
879
|
+
value: string;
|
|
880
|
+
header?: string;
|
|
881
|
+
negate: boolean;
|
|
882
|
+
};
|
|
883
|
+
|
|
884
|
+
type RuleConditionInput = Partial<RuleCondition> & {
|
|
885
|
+
field: RuleField;
|
|
886
|
+
op: RuleOperator;
|
|
887
|
+
value: string;
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
type RuleCreate = {
|
|
891
|
+
name: string;
|
|
892
|
+
description?: string | null;
|
|
893
|
+
enabled?: boolean;
|
|
894
|
+
match?: 'all' | 'any';
|
|
895
|
+
conditions: Array<RuleConditionInput>;
|
|
896
|
+
actions: Array<RuleAction>;
|
|
897
|
+
stopProcessing?: boolean;
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
type RuleListOptions = ListOptions & {
|
|
901
|
+
enabled?: boolean;
|
|
902
|
+
};
|
|
903
|
+
|
|
904
|
+
type RulePatch = {
|
|
905
|
+
name?: string;
|
|
906
|
+
description?: string | null;
|
|
907
|
+
enabled?: boolean;
|
|
908
|
+
match?: 'all' | 'any';
|
|
909
|
+
conditions?: Array<RuleConditionInput>;
|
|
910
|
+
actions?: Array<RuleAction>;
|
|
911
|
+
stopProcessing?: boolean;
|
|
912
|
+
position?: number;
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
type RuleResource = {
|
|
916
|
+
object: 'rule';
|
|
917
|
+
id: string;
|
|
918
|
+
name: string;
|
|
919
|
+
description: string | null;
|
|
920
|
+
enabled: boolean;
|
|
921
|
+
position: number;
|
|
922
|
+
match: 'all' | 'any';
|
|
923
|
+
conditions: Array<RuleCondition>;
|
|
924
|
+
actions: Array<RuleAction>;
|
|
925
|
+
stopProcessing: boolean;
|
|
926
|
+
lastMatchedAt: string | null;
|
|
927
|
+
matchCount: number;
|
|
928
|
+
createdAt: string;
|
|
929
|
+
updatedAt: string;
|
|
930
|
+
};
|
|
931
|
+
|
|
932
|
+
type RuleRunListOptions = ListOptions & {
|
|
933
|
+
ruleId?: string;
|
|
934
|
+
threadId?: string;
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
type RuleRunResource = {
|
|
938
|
+
object: 'rule_run';
|
|
939
|
+
id: string;
|
|
940
|
+
ruleId: string;
|
|
941
|
+
ruleName: string;
|
|
942
|
+
threadId: string;
|
|
943
|
+
messageId: string | null;
|
|
944
|
+
sender: string;
|
|
945
|
+
subject: string;
|
|
946
|
+
actions: Array<string>;
|
|
947
|
+
failures: Array<string>;
|
|
948
|
+
createdAt: string;
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
type RuleTestInput = {
|
|
952
|
+
threadIds?: Array<string>;
|
|
953
|
+
days?: number;
|
|
954
|
+
limit?: number;
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
type RuleTestResource = {
|
|
958
|
+
object: 'rule_test';
|
|
959
|
+
ruleId: string;
|
|
960
|
+
scanned: number;
|
|
961
|
+
matched: number;
|
|
962
|
+
wouldApply: Array<string>;
|
|
963
|
+
messages: Array<{
|
|
964
|
+
threadId: string;
|
|
965
|
+
from: string;
|
|
966
|
+
subject: string;
|
|
967
|
+
receivedAt: string | null;
|
|
968
|
+
}>;
|
|
969
|
+
warnings: Array<{
|
|
970
|
+
code: 'forward_unverified' | 'field_unevaluable' | 'field_approximate' | 'forward_loop' | 'body_encrypted' | (string & {});
|
|
971
|
+
value: string;
|
|
972
|
+
}>;
|
|
973
|
+
};
|
|
974
|
+
|
|
975
|
+
type SettingsPatch = {
|
|
976
|
+
signature?: string;
|
|
977
|
+
openEmailSignature?: boolean;
|
|
978
|
+
timezone?: string;
|
|
979
|
+
language?: string;
|
|
980
|
+
defaultEmailAlias?: string;
|
|
981
|
+
trackOpens?: boolean;
|
|
982
|
+
trackClicks?: boolean;
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
type SettingsResource = {
|
|
986
|
+
object: 'settings';
|
|
987
|
+
signature: string;
|
|
988
|
+
openEmailSignature: boolean;
|
|
989
|
+
timezone: string;
|
|
990
|
+
language: string;
|
|
991
|
+
defaultEmailAlias: string;
|
|
992
|
+
trackOpens: boolean;
|
|
993
|
+
trackClicks: boolean;
|
|
994
|
+
[key: string]: unknown;
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
type DeletedTemplateResource = {
|
|
998
|
+
object: 'template';
|
|
999
|
+
id: string;
|
|
1000
|
+
deleted: true;
|
|
1001
|
+
};
|
|
1002
|
+
|
|
1003
|
+
type SentTemplateEmailResource = SentEmailResource & {
|
|
1004
|
+
template: {
|
|
1005
|
+
id: string;
|
|
1006
|
+
version: number | null;
|
|
1007
|
+
};
|
|
1008
|
+
};
|
|
1009
|
+
|
|
1010
|
+
type TemplateEngine = 'blocks' | 'html';
|
|
1011
|
+
|
|
1012
|
+
type TemplateValueKind = 'text' | 'url' | 'image';
|
|
1013
|
+
|
|
1014
|
+
type TemplateProp = {
|
|
1015
|
+
key: string;
|
|
1016
|
+
label?: string;
|
|
1017
|
+
kind: TemplateValueKind;
|
|
1018
|
+
required: boolean;
|
|
1019
|
+
default: string | null;
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
type TemplateSlot = {
|
|
1023
|
+
key: string;
|
|
1024
|
+
label?: string;
|
|
1025
|
+
kind: TemplateValueKind;
|
|
1026
|
+
default: string;
|
|
1027
|
+
};
|
|
1028
|
+
|
|
1029
|
+
type TemplateContent = {
|
|
1030
|
+
engine?: TemplateEngine;
|
|
1031
|
+
subject?: string;
|
|
1032
|
+
document?: Record<string, unknown>;
|
|
1033
|
+
html?: string;
|
|
1034
|
+
slots?: Array<Partial<TemplateSlot> & {
|
|
1035
|
+
key: string;
|
|
1036
|
+
}>;
|
|
1037
|
+
props?: Array<Partial<TemplateProp> & {
|
|
1038
|
+
key: string;
|
|
1039
|
+
}>;
|
|
1040
|
+
};
|
|
1041
|
+
|
|
1042
|
+
type TemplateCreate = TemplateContent & {
|
|
1043
|
+
name: string;
|
|
1044
|
+
slug?: string;
|
|
1045
|
+
description?: string | null;
|
|
1046
|
+
publish?: boolean;
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
type TemplateStatus = 'draft' | 'active' | 'archived';
|
|
1050
|
+
|
|
1051
|
+
type TemplateResource = {
|
|
1052
|
+
object: 'template';
|
|
1053
|
+
id: string;
|
|
1054
|
+
name: string;
|
|
1055
|
+
slug: string;
|
|
1056
|
+
description: string | null;
|
|
1057
|
+
status: TemplateStatus;
|
|
1058
|
+
publishedVersion: number | null;
|
|
1059
|
+
latestVersion: number;
|
|
1060
|
+
subject?: string;
|
|
1061
|
+
engine?: TemplateEngine;
|
|
1062
|
+
slots?: Array<TemplateSlot>;
|
|
1063
|
+
props?: Array<TemplateProp>;
|
|
1064
|
+
createdAt: string;
|
|
1065
|
+
updatedAt: string;
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
type TemplateVersionResource = {
|
|
1069
|
+
object: 'template_version';
|
|
1070
|
+
id: string;
|
|
1071
|
+
templateId: string;
|
|
1072
|
+
version: number;
|
|
1073
|
+
state: 'draft' | 'published';
|
|
1074
|
+
engine: TemplateEngine;
|
|
1075
|
+
subject: string;
|
|
1076
|
+
slots: Array<TemplateSlot>;
|
|
1077
|
+
props: Array<TemplateProp>;
|
|
1078
|
+
document?: Record<string, unknown> | null;
|
|
1079
|
+
html?: string | null;
|
|
1080
|
+
publishedAt: string | null;
|
|
1081
|
+
createdAt: string;
|
|
1082
|
+
template?: TemplateResource;
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
type TemplateDetailResource = TemplateResource & {
|
|
1086
|
+
latest: TemplateVersionResource;
|
|
1087
|
+
};
|
|
1088
|
+
|
|
1089
|
+
type TemplateListOptions = ListOptions & {
|
|
1090
|
+
status?: TemplateStatus;
|
|
1091
|
+
};
|
|
1092
|
+
|
|
1093
|
+
type TemplatePatch = TemplateContent & {
|
|
1094
|
+
name?: string;
|
|
1095
|
+
description?: string | null;
|
|
1096
|
+
status?: 'active' | 'archived';
|
|
1097
|
+
expectedVersion?: number;
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
type TemplatePreviewInput = {
|
|
1101
|
+
version?: number;
|
|
1102
|
+
props?: Record<string, unknown>;
|
|
1103
|
+
slots?: Record<string, unknown>;
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
type TemplatePreviewResource = {
|
|
1107
|
+
object: 'template_preview';
|
|
1108
|
+
templateId: string;
|
|
1109
|
+
version: number;
|
|
1110
|
+
subject: string;
|
|
1111
|
+
html: string;
|
|
1112
|
+
text: string;
|
|
1113
|
+
warnings: Array<{
|
|
1114
|
+
code: 'unfilled_placeholder' | (string & {});
|
|
1115
|
+
key: string;
|
|
1116
|
+
}>;
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
type TemplateSend = {
|
|
1120
|
+
from: RecipientInput;
|
|
1121
|
+
to: RecipientInput | Array<RecipientInput>;
|
|
1122
|
+
cc?: RecipientInput | Array<RecipientInput>;
|
|
1123
|
+
bcc?: RecipientInput | Array<RecipientInput>;
|
|
1124
|
+
replyTo?: RecipientInput;
|
|
1125
|
+
version?: number;
|
|
1126
|
+
props?: Record<string, unknown>;
|
|
1127
|
+
slots?: Record<string, unknown>;
|
|
1128
|
+
subject?: string;
|
|
1129
|
+
scheduledAt?: Date | string;
|
|
1130
|
+
cancellableForSeconds?: number;
|
|
1131
|
+
tracking?: TrackingRequest;
|
|
1132
|
+
tags?: Record<string, string>;
|
|
1133
|
+
translate?: SendTranslateOptions;
|
|
1134
|
+
};
|
|
1135
|
+
|
|
1136
|
+
type TempInboxResource = {
|
|
1137
|
+
object: 'temp_inbox';
|
|
1138
|
+
id: string;
|
|
1139
|
+
address: string;
|
|
1140
|
+
domain: string;
|
|
1141
|
+
createdAt: string;
|
|
1142
|
+
expiresAt: string;
|
|
1143
|
+
extensionsLeft: number;
|
|
1144
|
+
messageCount: number;
|
|
1145
|
+
messageLimit: number;
|
|
1146
|
+
lastMessageAt: string | null;
|
|
1147
|
+
};
|
|
1148
|
+
|
|
1149
|
+
type CreatedTempInboxResource = TempInboxResource & {
|
|
1150
|
+
token: string;
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
type DeletedTempInboxResource = {
|
|
1154
|
+
object: 'temp_inbox';
|
|
1155
|
+
id: string;
|
|
1156
|
+
destroyed: true;
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
type DeletedTempMessageResource = {
|
|
1160
|
+
object: 'temp_message';
|
|
1161
|
+
id: string;
|
|
1162
|
+
deleted: true;
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1165
|
+
type TempDomainResource = {
|
|
1166
|
+
object: 'temp_domain';
|
|
1167
|
+
domain: string;
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
type TempInboxCreate = {
|
|
1171
|
+
domain?: string;
|
|
1172
|
+
localPart?: string;
|
|
1173
|
+
ttlMinutes?: number;
|
|
1174
|
+
};
|
|
1175
|
+
|
|
1176
|
+
type TempMessageResource = {
|
|
1177
|
+
object: 'temp_message';
|
|
1178
|
+
id: string;
|
|
1179
|
+
from: {
|
|
1180
|
+
name: string | null;
|
|
1181
|
+
email: string;
|
|
1182
|
+
};
|
|
1183
|
+
to: string;
|
|
1184
|
+
subject: string;
|
|
1185
|
+
snippet: string;
|
|
1186
|
+
spam: boolean;
|
|
1187
|
+
seen: boolean;
|
|
1188
|
+
attachmentCount: number;
|
|
1189
|
+
sizeBytes: number;
|
|
1190
|
+
receivedAt: string;
|
|
1191
|
+
};
|
|
1192
|
+
|
|
1193
|
+
type TempMessageDetailResource = TempMessageResource & {
|
|
1194
|
+
message: MessageResource;
|
|
1195
|
+
truncated: boolean;
|
|
1196
|
+
};
|
|
1197
|
+
|
|
1198
|
+
type TempMessageListOptions = InboxScope & {
|
|
1199
|
+
limit?: number;
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1202
|
+
type TempMessagesResource = {
|
|
1203
|
+
items: Array<TempMessageResource>;
|
|
1204
|
+
expiresAt: string;
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
type SnoozedThreadResource = {
|
|
1208
|
+
object: 'thread';
|
|
1209
|
+
id: string;
|
|
1210
|
+
snoozedUntil: string | null;
|
|
1211
|
+
};
|
|
1212
|
+
|
|
1213
|
+
type ThreadListOptions = ListOptions & {
|
|
1214
|
+
folder?: string;
|
|
1215
|
+
query?: string;
|
|
1216
|
+
labelIds?: string | Array<string>;
|
|
1217
|
+
};
|
|
1218
|
+
|
|
1219
|
+
type ThreadPatch = {
|
|
1220
|
+
read?: boolean;
|
|
1221
|
+
addLabelIds?: Array<string>;
|
|
1222
|
+
removeLabelIds?: Array<string>;
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
type ThreadResource = {
|
|
1226
|
+
object: 'thread';
|
|
1227
|
+
id: string;
|
|
1228
|
+
messages: Array<MessageResource>;
|
|
1229
|
+
labels: Array<{
|
|
1230
|
+
id: string;
|
|
1231
|
+
name: string;
|
|
1232
|
+
color: string;
|
|
1233
|
+
}>;
|
|
1234
|
+
messageCount: number;
|
|
1235
|
+
hasUnread: boolean;
|
|
1236
|
+
totalReplies: number;
|
|
1237
|
+
};
|
|
1238
|
+
|
|
1239
|
+
type ThreadSummaryResource = {
|
|
1240
|
+
object: 'thread';
|
|
1241
|
+
id: string;
|
|
1242
|
+
};
|
|
1243
|
+
|
|
1244
|
+
type TrashedThreadResource = {
|
|
1245
|
+
object: 'thread';
|
|
1246
|
+
id: string;
|
|
1247
|
+
trashed: true;
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1250
|
+
type UpdatedThreadResource = {
|
|
1251
|
+
object: 'thread';
|
|
1252
|
+
id: string;
|
|
1253
|
+
addedLabelIds: Array<string>;
|
|
1254
|
+
removedLabelIds: Array<string>;
|
|
1255
|
+
};
|
|
1256
|
+
|
|
1257
|
+
type TrackingOpenResource = {
|
|
1258
|
+
object: 'open';
|
|
1259
|
+
id: string;
|
|
1260
|
+
trackedMessageId: string;
|
|
1261
|
+
recipient: string | null;
|
|
1262
|
+
kind: HitKind;
|
|
1263
|
+
counted: boolean;
|
|
1264
|
+
userAgent: string | null;
|
|
1265
|
+
client: string | null;
|
|
1266
|
+
device: string | null;
|
|
1267
|
+
os: string | null;
|
|
1268
|
+
country: string | null;
|
|
1269
|
+
region: string | null;
|
|
1270
|
+
city: string | null;
|
|
1271
|
+
createdAt: string;
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
type TrackingClickResource = Omit<TrackingOpenResource, 'object'> & {
|
|
1275
|
+
object: 'click';
|
|
1276
|
+
linkId: string;
|
|
1277
|
+
url: string;
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
type TrackingGrain = 'minute' | 'hour' | 'day';
|
|
1281
|
+
|
|
1282
|
+
type TrackingHitOptions = RequestScope & {
|
|
1283
|
+
includeMachine?: boolean;
|
|
1284
|
+
limit?: number;
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
type TrackingListOptions = RequestScope & {
|
|
1288
|
+
opened?: boolean;
|
|
1289
|
+
clicked?: boolean;
|
|
1290
|
+
days?: number;
|
|
1291
|
+
minutes?: number;
|
|
1292
|
+
grain?: TrackingGrain;
|
|
1293
|
+
limit?: number;
|
|
1294
|
+
};
|
|
1295
|
+
|
|
1296
|
+
type TrackingResource = TrackingSummary & {
|
|
1297
|
+
object: 'tracking';
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
type TrackingStatsOptions = RequestScope & {
|
|
1301
|
+
days?: number;
|
|
1302
|
+
minutes?: number;
|
|
1303
|
+
grain?: TrackingGrain;
|
|
1304
|
+
offsetMinutes?: number;
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1307
|
+
type TrackingStatsResource = {
|
|
1308
|
+
object: 'tracking_stats';
|
|
1309
|
+
tracked: number;
|
|
1310
|
+
opened: number;
|
|
1311
|
+
clicked: number;
|
|
1312
|
+
trackedForOpens: number;
|
|
1313
|
+
trackedForClicks: number;
|
|
1314
|
+
openRate: number;
|
|
1315
|
+
clickRate: number;
|
|
1316
|
+
totalOpens: number;
|
|
1317
|
+
totalClicks: number;
|
|
1318
|
+
machineOpens: number;
|
|
1319
|
+
medianTimeToOpenSeconds: number | null;
|
|
1320
|
+
byDay: Array<{
|
|
1321
|
+
day: string;
|
|
1322
|
+
sent: number;
|
|
1323
|
+
opened: number;
|
|
1324
|
+
clicked: number;
|
|
1325
|
+
}>;
|
|
1326
|
+
hitsKnownFrom: string;
|
|
1327
|
+
topLinks: Array<{
|
|
1328
|
+
url: string;
|
|
1329
|
+
label: string | null;
|
|
1330
|
+
clickCount: number;
|
|
1331
|
+
}>;
|
|
1332
|
+
clients: Array<{
|
|
1333
|
+
client: string;
|
|
1334
|
+
count: number;
|
|
1335
|
+
}>;
|
|
1336
|
+
countries: Array<{
|
|
1337
|
+
country: string;
|
|
1338
|
+
count: number;
|
|
1339
|
+
}>;
|
|
1340
|
+
};
|
|
1341
|
+
|
|
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];
|
|
1345
|
+
|
|
1346
|
+
type WebhookResource = {
|
|
1347
|
+
object: 'webhook';
|
|
1348
|
+
id: string;
|
|
1349
|
+
url: string;
|
|
1350
|
+
description: string | null;
|
|
1351
|
+
eventTypes: Array<WebhookEvent> | ['*'];
|
|
1352
|
+
enabled: boolean;
|
|
1353
|
+
disabledAt: string | null;
|
|
1354
|
+
disabledReason: string | null;
|
|
1355
|
+
consecutiveFailures: number;
|
|
1356
|
+
lastDeliveryAt: string | null;
|
|
1357
|
+
createdAt: string;
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1360
|
+
type CreatedWebhookResource = WebhookResource & {
|
|
1361
|
+
secret: string;
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
type DeletedWebhookResource = {
|
|
1365
|
+
object: 'webhook';
|
|
1366
|
+
id: string;
|
|
1367
|
+
deleted: true;
|
|
1368
|
+
};
|
|
1369
|
+
|
|
1370
|
+
type EmailOpenedData = {
|
|
1371
|
+
emailId: string | null;
|
|
1372
|
+
trackedMessageId: string;
|
|
1373
|
+
threadId: string | null;
|
|
1374
|
+
messageId: string | null;
|
|
1375
|
+
subject: string | null;
|
|
1376
|
+
from: string;
|
|
1377
|
+
recipient: string | null;
|
|
1378
|
+
attributed: boolean;
|
|
1379
|
+
first: boolean;
|
|
1380
|
+
client: string | null;
|
|
1381
|
+
device: string | null;
|
|
1382
|
+
os: string | null;
|
|
1383
|
+
country: string | null;
|
|
1384
|
+
via: HitKind;
|
|
1385
|
+
openCount: number;
|
|
1386
|
+
openedAt: string;
|
|
1387
|
+
};
|
|
1388
|
+
|
|
1389
|
+
type EmailClickedData = Omit<EmailOpenedData, 'openCount' | 'openedAt'> & {
|
|
1390
|
+
linkId: string;
|
|
1391
|
+
url: string;
|
|
1392
|
+
label: string | null;
|
|
1393
|
+
clickCount: number;
|
|
1394
|
+
clickedAt: string;
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1397
|
+
type WebhookSignatureHeaders = Record<string, string | Array<string> | undefined>;
|
|
1398
|
+
|
|
1399
|
+
type VerifyWebhookProps = {
|
|
1400
|
+
payload: string;
|
|
1401
|
+
headers: WebhookSignatureHeaders | Headers;
|
|
1402
|
+
secret: string;
|
|
1403
|
+
toleranceSeconds?: number;
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
type WebhookCreate = {
|
|
1407
|
+
url: string;
|
|
1408
|
+
eventTypes?: Array<WebhookEvent>;
|
|
1409
|
+
description?: string;
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
type WebhookDeliveryResource = {
|
|
1413
|
+
object: 'webhook_delivery';
|
|
1414
|
+
id: string;
|
|
1415
|
+
eventType: WebhookEvent | (string & {});
|
|
1416
|
+
status: 'delivered' | 'failed' | (string & {});
|
|
1417
|
+
responseCode: number | null;
|
|
1418
|
+
durationMs: number | null;
|
|
1419
|
+
error: string | null;
|
|
1420
|
+
createdAt: string;
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
type WebhookPatch = {
|
|
1424
|
+
url?: string;
|
|
1425
|
+
eventTypes?: Array<WebhookEvent>;
|
|
1426
|
+
description?: string | null;
|
|
1427
|
+
enabled?: boolean;
|
|
1428
|
+
};
|
|
1429
|
+
|
|
1430
|
+
type WebhookPayload<T = Record<string, unknown>> = {
|
|
1431
|
+
id: string;
|
|
1432
|
+
type: WebhookEvent | (string & {});
|
|
1433
|
+
createdAt: string;
|
|
1434
|
+
data: T;
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
type WebhookTestResource = {
|
|
1438
|
+
object: 'webhook_test';
|
|
1439
|
+
id: string;
|
|
1440
|
+
delivery: {
|
|
1441
|
+
status: string;
|
|
1442
|
+
responseCode: number | null;
|
|
1443
|
+
durationMs: number | null;
|
|
1444
|
+
error: string | null;
|
|
1445
|
+
} | null;
|
|
1446
|
+
};
|
|
1447
|
+
|
|
1448
|
+
declare class Transport {
|
|
1449
|
+
#private;
|
|
1450
|
+
readonly baseUrl: string;
|
|
1451
|
+
private readonly fetchImpl;
|
|
1452
|
+
private readonly maxRetries;
|
|
1453
|
+
private readonly timeoutMs;
|
|
1454
|
+
private readonly userAgent;
|
|
1455
|
+
private readonly headers;
|
|
1456
|
+
constructor(options: TransportOptions & {
|
|
1457
|
+
inboxToken?: string;
|
|
1458
|
+
});
|
|
1459
|
+
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
1460
|
+
private headersFor;
|
|
1461
|
+
private attempt;
|
|
1462
|
+
private parse;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
declare class OpenEmailApiError extends Error {
|
|
1466
|
+
readonly status: number | null;
|
|
1467
|
+
readonly type: ErrorType;
|
|
1468
|
+
readonly code: string;
|
|
1469
|
+
readonly param: string | undefined;
|
|
1470
|
+
readonly docUrl: string | undefined;
|
|
1471
|
+
readonly requestId: string | undefined;
|
|
1472
|
+
readonly retryAfterSeconds: number | undefined;
|
|
1473
|
+
constructor(props: ApiErrorProps);
|
|
1474
|
+
get isAuth(): boolean;
|
|
1475
|
+
get isPermission(): boolean;
|
|
1476
|
+
get isScopeMissing(): boolean;
|
|
1477
|
+
get isInvalidRequest(): boolean;
|
|
1478
|
+
get isValidation(): boolean;
|
|
1479
|
+
get isNotFound(): boolean;
|
|
1480
|
+
get isConflict(): boolean;
|
|
1481
|
+
get isRateLimited(): boolean;
|
|
1482
|
+
get isServerError(): boolean;
|
|
1483
|
+
get isRetryable(): boolean;
|
|
1484
|
+
}
|
|
1485
|
+
declare class OpenEmailNetworkError extends Error {
|
|
1486
|
+
readonly cause: unknown;
|
|
1487
|
+
readonly isTimeout: boolean;
|
|
1488
|
+
constructor(message: string, cause?: unknown, isTimeout?: boolean);
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
declare const LANGUAGES: ReadonlyArray<LanguageResource>;
|
|
1492
|
+
|
|
1493
|
+
declare const VERSION: string;
|
|
1494
|
+
|
|
1495
|
+
declare const PAGE_LIMITS: {
|
|
1496
|
+
MAX_LIMIT: number;
|
|
1497
|
+
DEFAULT_LIMIT: number;
|
|
1498
|
+
};
|
|
1499
|
+
declare const WEBHOOK_SIGNATURE_HEADERS: {
|
|
1500
|
+
SIGNATURE: string;
|
|
1501
|
+
EVENT: string;
|
|
1502
|
+
DELIVERY: string;
|
|
1503
|
+
};
|
|
1504
|
+
|
|
1505
|
+
declare const init: (configuration?: ClientOptions | string) => OpenEmail;
|
|
1506
|
+
declare const openemail: OpenEmail;
|
|
1507
|
+
declare const getClient: () => OpenEmail;
|
|
1508
|
+
declare const resetClient: () => void;
|
|
1509
|
+
declare const createOpenEmail: (configuration?: ClientOptions | string) => OpenEmail;
|
|
1510
|
+
declare const createClient: (configuration?: ClientOptions | string) => OpenEmail;
|
|
1511
|
+
declare const createTempMail: (options?: TempMailOptions) => ReturnType<(transport: Transport) => {
|
|
1512
|
+
listDomains: (options?: InboxScope) => Promise<Array<TempDomainResource>>;
|
|
1513
|
+
create: (body?: TempInboxCreate, options?: InboxScope) => Promise<CreatedTempInboxResource>;
|
|
1514
|
+
get: (inboxId: string, options?: InboxScope) => Promise<TempInboxResource>;
|
|
1515
|
+
extend: (inboxId: string, options?: InboxScope) => Promise<TempInboxResource>;
|
|
1516
|
+
delete: (inboxId: string, options?: InboxScope) => Promise<DeletedTempInboxResource>;
|
|
1517
|
+
listMessages: (inboxId: string, options?: TempMessageListOptions) => Promise<TempMessagesResource>;
|
|
1518
|
+
getMessage: (inboxId: string, messageId: string, options?: InboxScope) => Promise<TempMessageDetailResource>;
|
|
1519
|
+
deleteMessage: (inboxId: string, messageId: string, options?: InboxScope) => Promise<DeletedTempMessageResource>;
|
|
1520
|
+
listAttachments: (inboxId: string, messageId: string, options?: InboxScope) => Promise<Array<AttachmentResource>>;
|
|
1521
|
+
}>;
|
|
1522
|
+
declare const verifyWebhookSignature: <T = Record<string, unknown>>(props: VerifyWebhookProps) => Promise<WebhookPayload<T>>;
|
|
1523
|
+
declare const toBase64: (bytes: Uint8Array | ArrayBuffer) => string;
|
|
1524
|
+
declare const isApiKey: (value: unknown) => value is string;
|
|
1525
|
+
declare const isSealed: (message: Pick<MessageResource, "encryption">) => boolean;
|
|
1526
|
+
declare const resolveLanguage: (input: string | null | undefined) => LanguageResource | undefined;
|
|
1527
|
+
declare const languageByCode: (code: string | null | undefined) => LanguageResource | undefined;
|
|
1528
|
+
declare const isRtlLanguage: (code: string | null | undefined) => boolean;
|
|
1529
|
+
|
|
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 };
|