@openemail/sdk 0.0.7 → 0.0.8
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 +2 -2
- package/index.cjs +2565 -525
- package/index.d.cts +4676 -616
- package/index.d.ts +4676 -616
- package/index.js +2461 -526
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,8 +1,133 @@
|
|
|
1
|
+
const APP_HOST_STATUSES = {
|
|
2
|
+
NONE: 'none',
|
|
3
|
+
PENDING: 'pending',
|
|
4
|
+
ACTIVE: 'active',
|
|
5
|
+
FAILED: 'failed'
|
|
6
|
+
};
|
|
7
|
+
|
|
1
8
|
const AUDIENCE_MEMBER_STATUSES = {
|
|
2
9
|
SUBSCRIBED: 'subscribed',
|
|
3
10
|
UNSUBSCRIBED: 'unsubscribed'
|
|
4
11
|
};
|
|
5
12
|
|
|
13
|
+
const PLAN_IDS = {
|
|
14
|
+
FREE: 'free',
|
|
15
|
+
STARTER: 'starter',
|
|
16
|
+
BUSINESS: 'business',
|
|
17
|
+
ENTERPRISE: 'enterprise'
|
|
18
|
+
};
|
|
19
|
+
const PAID_PLAN_IDS = {
|
|
20
|
+
STARTER: 'starter',
|
|
21
|
+
BUSINESS: 'business',
|
|
22
|
+
ENTERPRISE: 'enterprise'
|
|
23
|
+
};
|
|
24
|
+
const BILLING_INTERVALS = {
|
|
25
|
+
MONTH: 'month',
|
|
26
|
+
YEAR: 'year'
|
|
27
|
+
};
|
|
28
|
+
const BILLING_THEMES = {
|
|
29
|
+
LIGHT: 'light',
|
|
30
|
+
DARK: 'dark'
|
|
31
|
+
};
|
|
32
|
+
const BILLING_USAGE_WINDOWS = {
|
|
33
|
+
ALL: 'all'
|
|
34
|
+
};
|
|
35
|
+
const BILLING_ALERT_KINDS = {
|
|
36
|
+
PAYMENT_FAILED: 'payment_failed',
|
|
37
|
+
PAY_AS_YOU_GO_PAUSED: 'pay_as_you_go_paused',
|
|
38
|
+
SENDING_PAUSED: 'sending_paused',
|
|
39
|
+
SPEND_LIMIT_REACHED: 'spend_limit_reached',
|
|
40
|
+
AI_USED_UP: 'ai_used_up',
|
|
41
|
+
PLAN_ENDING: 'plan_ending',
|
|
42
|
+
SENDS_NEARLY_USED: 'sends_nearly_used',
|
|
43
|
+
SPEND_NEARLY_REACHED: 'spend_nearly_reached',
|
|
44
|
+
UPCOMING_CHARGE: 'upcoming_charge'
|
|
45
|
+
};
|
|
46
|
+
const BILLING_ALERT_SEVERITIES = {
|
|
47
|
+
BLOCKED: 'blocked',
|
|
48
|
+
WARNING: 'warning',
|
|
49
|
+
INFO: 'info'
|
|
50
|
+
};
|
|
51
|
+
const BILLING_ALERT_TARGETS = {
|
|
52
|
+
BILLING: 'billing',
|
|
53
|
+
USAGE: 'usage'
|
|
54
|
+
};
|
|
55
|
+
const BILLING_INVOICE_SORTS = {
|
|
56
|
+
NEWEST: 'newest',
|
|
57
|
+
OLDEST: 'oldest'
|
|
58
|
+
};
|
|
59
|
+
const BILLING_INVOICE_STATUSES = {
|
|
60
|
+
DRAFT: 'draft',
|
|
61
|
+
PENDING: 'pending',
|
|
62
|
+
PAID: 'paid',
|
|
63
|
+
REFUNDED: 'refunded',
|
|
64
|
+
PARTIALLY_REFUNDED: 'partially_refunded',
|
|
65
|
+
VOID: 'void'
|
|
66
|
+
};
|
|
67
|
+
const BILLING_INVOICE_STARTS = {
|
|
68
|
+
READY: 'ready',
|
|
69
|
+
STARTED: 'started',
|
|
70
|
+
REFUSED: 'refused'
|
|
71
|
+
};
|
|
72
|
+
const PAY_AS_YOU_GO_LIMITS_CENTS = [1_000, 2_500, 5_000, 10_000, 25_000, 50_000, 100_000, 250_000, 500_000];
|
|
73
|
+
|
|
74
|
+
const BRAND_IMAGE_VARIANTS = {
|
|
75
|
+
MARK: 'mark',
|
|
76
|
+
WORDMARK: 'wordmark',
|
|
77
|
+
WORDMARK_DARK: 'wordmark-dark',
|
|
78
|
+
LOGIN_BACKGROUND: 'login-background'
|
|
79
|
+
};
|
|
80
|
+
const BRAND_IMAGE_TYPES = {
|
|
81
|
+
SVG: 'image/svg+xml',
|
|
82
|
+
PNG: 'image/png',
|
|
83
|
+
JPEG: 'image/jpeg',
|
|
84
|
+
WEBP: 'image/webp',
|
|
85
|
+
GIF: 'image/gif'
|
|
86
|
+
};
|
|
87
|
+
const BRAND_FONT_IDS = {
|
|
88
|
+
SYSTEM: 'system',
|
|
89
|
+
ARIAL: 'arial',
|
|
90
|
+
HELVETICA: 'helvetica',
|
|
91
|
+
VERDANA: 'verdana',
|
|
92
|
+
TAHOMA: 'tahoma',
|
|
93
|
+
TREBUCHET_MS: 'trebuchet-ms',
|
|
94
|
+
GEORGIA: 'georgia',
|
|
95
|
+
TIMES_NEW_ROMAN: 'times-new-roman',
|
|
96
|
+
COURIER_NEW: 'courier-new',
|
|
97
|
+
DM_SANS: 'dm-sans',
|
|
98
|
+
INTER: 'inter',
|
|
99
|
+
ROBOTO: 'roboto',
|
|
100
|
+
OPEN_SANS: 'open-sans',
|
|
101
|
+
LATO: 'lato',
|
|
102
|
+
MONTSERRAT: 'montserrat',
|
|
103
|
+
POPPINS: 'poppins',
|
|
104
|
+
NUNITO: 'nunito',
|
|
105
|
+
WORK_SANS: 'work-sans',
|
|
106
|
+
SOURCE_SANS_3: 'source-sans-3',
|
|
107
|
+
IBM_PLEX_SANS: 'ibm-plex-sans',
|
|
108
|
+
MERRIWEATHER: 'merriweather',
|
|
109
|
+
PLAYFAIR_DISPLAY: 'playfair-display',
|
|
110
|
+
INSTRUMENT_SERIF: 'instrument-serif',
|
|
111
|
+
JETBRAINS_MONO: 'jetbrains-mono',
|
|
112
|
+
DM_MONO: 'dm-mono',
|
|
113
|
+
GEIST_MONO: 'geist-mono'
|
|
114
|
+
};
|
|
115
|
+
const LOGIN_BACKGROUND_KINDS = {
|
|
116
|
+
PRESET: 'preset',
|
|
117
|
+
COLOR: 'color',
|
|
118
|
+
IMAGE: 'image'
|
|
119
|
+
};
|
|
120
|
+
const LOGIN_BACKGROUND_PRESETS = {
|
|
121
|
+
DUSK: 'dusk',
|
|
122
|
+
MIST: 'mist',
|
|
123
|
+
SAND: 'sand',
|
|
124
|
+
NIGHT: 'night'
|
|
125
|
+
};
|
|
126
|
+
const LOGIN_LOGOS = {
|
|
127
|
+
DARK: 'dark',
|
|
128
|
+
LIGHT: 'light'
|
|
129
|
+
};
|
|
130
|
+
|
|
6
131
|
const BROADCAST_STATUSES = {
|
|
7
132
|
SCHEDULED: 'scheduled',
|
|
8
133
|
QUEUED: 'queued',
|
|
@@ -24,7 +149,61 @@ const BROADCAST_RECIPIENT_FILTERS = {
|
|
|
24
149
|
UNSUBSCRIBED: 'unsubscribed'
|
|
25
150
|
};
|
|
26
151
|
|
|
27
|
-
|
|
152
|
+
const CALENDAR_RESPONSES = {
|
|
153
|
+
ACCEPTED: 'ACCEPTED',
|
|
154
|
+
DECLINED: 'DECLINED',
|
|
155
|
+
TENTATIVE: 'TENTATIVE'
|
|
156
|
+
};
|
|
157
|
+
const CALENDAR_TRANSPARENCIES = {
|
|
158
|
+
OPAQUE: 'OPAQUE',
|
|
159
|
+
TRANSPARENT: 'TRANSPARENT'
|
|
160
|
+
};
|
|
161
|
+
const CALENDAR_VISIBILITIES = {
|
|
162
|
+
PUBLIC: 'PUBLIC',
|
|
163
|
+
PRIVATE: 'PRIVATE',
|
|
164
|
+
CONFIDENTIAL: 'CONFIDENTIAL'
|
|
165
|
+
};
|
|
166
|
+
const CALENDAR_REMINDER_ACTIONS = {
|
|
167
|
+
DISPLAY: 'DISPLAY',
|
|
168
|
+
EMAIL: 'EMAIL',
|
|
169
|
+
AUDIO: 'AUDIO'
|
|
170
|
+
};
|
|
171
|
+
const CALENDAR_FEED_MODES = {
|
|
172
|
+
FULL: 'full',
|
|
173
|
+
BUSY: 'busy'
|
|
174
|
+
};
|
|
175
|
+
const CALENDAR_COLORS = {
|
|
176
|
+
BLUE: 'blue',
|
|
177
|
+
SKY: 'sky',
|
|
178
|
+
TEAL: 'teal',
|
|
179
|
+
GREEN: 'green',
|
|
180
|
+
LIME: 'lime',
|
|
181
|
+
YELLOW: 'yellow',
|
|
182
|
+
ORANGE: 'orange',
|
|
183
|
+
RED: 'red',
|
|
184
|
+
PINK: 'pink',
|
|
185
|
+
PURPLE: 'purple',
|
|
186
|
+
GRAY: 'gray'
|
|
187
|
+
};
|
|
188
|
+
const CALENDAR_SUBSCRIPTION_STATUSES = {
|
|
189
|
+
ACTIVE: 'active',
|
|
190
|
+
FAILING: 'failing',
|
|
191
|
+
STOPPED: 'stopped'
|
|
192
|
+
};
|
|
193
|
+
const CALENDAR_SUBSCRIPTION_ERRORS = {
|
|
194
|
+
UNREACHABLE: 'unreachable',
|
|
195
|
+
TOO_LARGE: 'too-large',
|
|
196
|
+
NOT_A_CALENDAR: 'not-a-calendar',
|
|
197
|
+
TOO_MANY_EVENTS: 'too-many-events'
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const CHAT_SORTS = {
|
|
201
|
+
NEWEST: 'newest',
|
|
202
|
+
OLDEST: 'oldest',
|
|
203
|
+
TITLE: 'title'
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
var version = "0.0.8";
|
|
28
207
|
|
|
29
208
|
const BUILD_BASE_URL = 'https://api.openemail.uk';
|
|
30
209
|
|
|
@@ -79,9 +258,17 @@ const CLIENT_MESSAGES = {
|
|
|
79
258
|
NO_FETCH: 'No global fetch is available. Pass one as { fetch }, or run on Node 20+, Bun, Deno, Cloudflare Workers or a browser.',
|
|
80
259
|
EMPTY_SEGMENT: 'An id must not be empty.',
|
|
81
260
|
FILENAME_REQUIRED: 'A file name is required. Pass it as { filename }, the name the file is stored and downloaded under.',
|
|
82
|
-
DOT_SEGMENT: 'is not a usable id: a path segment made only of dots is removed by URL parsers, so the request would reach a different endpoint.'
|
|
261
|
+
DOT_SEGMENT: 'is not a usable id: a path segment made only of dots is removed by URL parsers, so the request would reach a different endpoint.',
|
|
262
|
+
PATH_SHAPE: 'is not a usable request path. Pass a path on the API that begins with a single "/", such as "/threads". Anything else could send the request, and the credential it carries, to another host.',
|
|
263
|
+
OFF_ORIGIN: 'leaves the API origin, so the request was not sent. Pass a path on the API that begins with a single "/", such as "/threads".'
|
|
83
264
|
};
|
|
265
|
+
const DOT_ONLY_SEGMENT = /^\.+$/;
|
|
84
266
|
|
|
267
|
+
const CONTACT_SOURCES = {
|
|
268
|
+
MANUAL: 'manual',
|
|
269
|
+
AUTO: 'auto',
|
|
270
|
+
FORM: 'form'
|
|
271
|
+
};
|
|
85
272
|
const PEOPLE_SORTS = {
|
|
86
273
|
RECENT: 'recent',
|
|
87
274
|
NAME: 'name',
|
|
@@ -103,6 +290,47 @@ const CONTACT_PHOTO_TYPES = {
|
|
|
103
290
|
WEBP: 'image/webp',
|
|
104
291
|
GIF: 'image/gif'
|
|
105
292
|
};
|
|
293
|
+
const CONTACT_CARD_LABELS = {
|
|
294
|
+
HOME: 'home',
|
|
295
|
+
WORK: 'work',
|
|
296
|
+
MOBILE: 'mobile',
|
|
297
|
+
MAIN: 'main',
|
|
298
|
+
FAX: 'fax',
|
|
299
|
+
PAGER: 'pager',
|
|
300
|
+
OTHER: 'other'
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
const DNS_CONNECTION_STATUSES = {
|
|
304
|
+
ACTIVE: 'active',
|
|
305
|
+
NEEDS_REAUTH: 'needs-reauth',
|
|
306
|
+
REVOKED: 'revoked',
|
|
307
|
+
ERROR: 'error'
|
|
308
|
+
};
|
|
309
|
+
const DNS_PROVISION_STATES = {
|
|
310
|
+
UNMANAGED: 'unmanaged',
|
|
311
|
+
READY: 'ready',
|
|
312
|
+
AWAITING_SYNC: 'awaiting-sync',
|
|
313
|
+
AWAITING_SIGNING: 'awaiting-signing',
|
|
314
|
+
CONFLICT: 'conflict',
|
|
315
|
+
BLOCKED: 'blocked'
|
|
316
|
+
};
|
|
317
|
+
const DNS_ZONE_RESOLUTION_KINDS = {
|
|
318
|
+
RESOLVED: 'resolved',
|
|
319
|
+
AMBIGUOUS: 'ambiguous',
|
|
320
|
+
NONE: 'none',
|
|
321
|
+
UNUSABLE: 'unusable'
|
|
322
|
+
};
|
|
323
|
+
const DNS_SYNC_PURPOSES = {
|
|
324
|
+
DMARC: 'dmarc',
|
|
325
|
+
TRACKING: 'tracking',
|
|
326
|
+
STORAGE: 'storage',
|
|
327
|
+
BIMI: 'bimi',
|
|
328
|
+
APP_HOST: 'app-host'
|
|
329
|
+
};
|
|
330
|
+
const DNS_SYNC_OUTCOMES = {
|
|
331
|
+
SYNCED: 'synced',
|
|
332
|
+
REFUSED: 'refused'
|
|
333
|
+
};
|
|
106
334
|
|
|
107
335
|
const DOMAIN_RECORD_STATUSES = {
|
|
108
336
|
FOUND: 'found',
|
|
@@ -115,6 +343,61 @@ const DOMAIN_DMARC_STAGES = {
|
|
|
115
343
|
QUARANTINE: 'quarantine',
|
|
116
344
|
REJECT: 'reject'
|
|
117
345
|
};
|
|
346
|
+
const DOMAIN_DMARC_POLICIES = {
|
|
347
|
+
NONE: 'none',
|
|
348
|
+
QUARANTINE: 'quarantine',
|
|
349
|
+
REJECT: 'reject'
|
|
350
|
+
};
|
|
351
|
+
const DOMAIN_LOGO_MARK_KINDS = {
|
|
352
|
+
VERIFIED: 'verified',
|
|
353
|
+
COMMON: 'common',
|
|
354
|
+
UNKNOWN: 'unknown'
|
|
355
|
+
};
|
|
356
|
+
const DOMAIN_LOGO_RECORD_OUTCOMES = {
|
|
357
|
+
PUBLISHED: 'published',
|
|
358
|
+
MANUAL: 'manual',
|
|
359
|
+
BLOCKED: 'blocked',
|
|
360
|
+
BUSY: 'busy',
|
|
361
|
+
FAILED: 'failed'
|
|
362
|
+
};
|
|
363
|
+
const DOMAIN_ADDRESS_DESTINATIONS = {
|
|
364
|
+
MAILBOX: 'mailbox',
|
|
365
|
+
FORWARD: 'forward'
|
|
366
|
+
};
|
|
367
|
+
const ADDRESS_FORWARD_STATUSES = {
|
|
368
|
+
LIVE: 'live',
|
|
369
|
+
PENDING: 'pending',
|
|
370
|
+
REFUSED: 'refused',
|
|
371
|
+
PAUSED: 'paused'
|
|
372
|
+
};
|
|
373
|
+
const ADDRESS_FORWARD_CONSENT_STATUSES = {
|
|
374
|
+
SENT: 'sent',
|
|
375
|
+
ALREADY_CONFIRMED: 'already-confirmed',
|
|
376
|
+
REVOKED: 'revoked',
|
|
377
|
+
TOO_SOON: 'too-soon',
|
|
378
|
+
SEND_FAILED: 'send-failed'
|
|
379
|
+
};
|
|
380
|
+
const ADDRESS_MEMBER_VIAS = {
|
|
381
|
+
OWNER: 'owner',
|
|
382
|
+
EVERY_ADDRESS: 'every-address',
|
|
383
|
+
WHOLE_DOMAIN: 'whole-domain',
|
|
384
|
+
DIRECT: 'direct'
|
|
385
|
+
};
|
|
386
|
+
const MAIL_APP_SECURITIES = {
|
|
387
|
+
SSL_TLS: 'ssl-tls'
|
|
388
|
+
};
|
|
389
|
+
const MAIL_APP_PROTOCOLS = {
|
|
390
|
+
IMAP: 'imap',
|
|
391
|
+
SMTP: 'smtp',
|
|
392
|
+
POP3: 'pop3',
|
|
393
|
+
CALDAV: 'caldav',
|
|
394
|
+
CARDDAV: 'carddav'
|
|
395
|
+
};
|
|
396
|
+
const APP_PASSWORD_ORIGINS = {
|
|
397
|
+
SETTINGS: 'settings',
|
|
398
|
+
SETUP_LINK: 'setup-link',
|
|
399
|
+
API: 'api'
|
|
400
|
+
};
|
|
118
401
|
|
|
119
402
|
const MESSAGE_ENCRYPTION_FORMATS = {
|
|
120
403
|
PGP_MIME: 'pgp-mime',
|
|
@@ -157,6 +440,25 @@ const ERROR_NAMES = {
|
|
|
157
440
|
NETWORK: 'OpenEmailNetworkError',
|
|
158
441
|
TIMEOUT: 'TimeoutError'};
|
|
159
442
|
|
|
443
|
+
const EXPORT_STATUSES = {
|
|
444
|
+
QUEUED: 'queued',
|
|
445
|
+
RUNNING: 'running',
|
|
446
|
+
READY: 'ready',
|
|
447
|
+
FAILED: 'failed',
|
|
448
|
+
EXPIRED: 'expired'
|
|
449
|
+
};
|
|
450
|
+
const EXPORT_PHASES = {
|
|
451
|
+
PLANNING: 'planning',
|
|
452
|
+
MAIL: 'mail',
|
|
453
|
+
RECORDS: 'records',
|
|
454
|
+
FINISHING: 'finishing'
|
|
455
|
+
};
|
|
456
|
+
const EXPORT_REFUSALS = {
|
|
457
|
+
NOT_PERMITTED: 'not-permitted',
|
|
458
|
+
MAILBOX_LOGIN: 'mailbox-login',
|
|
459
|
+
TWO_FACTOR_REQUIRED: 'two-factor-required'
|
|
460
|
+
};
|
|
461
|
+
|
|
160
462
|
const FILE_SORTS = {
|
|
161
463
|
NEWEST: 'newest',
|
|
162
464
|
OLDEST: 'oldest',
|
|
@@ -186,6 +488,109 @@ const FILE_VISIBILITIES = {
|
|
|
186
488
|
PRIVATE: 'private'
|
|
187
489
|
};
|
|
188
490
|
|
|
491
|
+
const FORM_STATUSES = {
|
|
492
|
+
DRAFT: 'draft',
|
|
493
|
+
LIVE: 'live',
|
|
494
|
+
PAUSED: 'paused'
|
|
495
|
+
};
|
|
496
|
+
const FORM_SUBMISSION_STATUSES = {
|
|
497
|
+
PENDING: 'pending',
|
|
498
|
+
ADDED: 'added'
|
|
499
|
+
};
|
|
500
|
+
const FORM_FIELD_TYPES = {
|
|
501
|
+
EMAIL: 'email',
|
|
502
|
+
TEXT: 'text',
|
|
503
|
+
TEXTAREA: 'textarea',
|
|
504
|
+
NUMBER: 'number',
|
|
505
|
+
PHONE: 'phone',
|
|
506
|
+
URL: 'url',
|
|
507
|
+
DATE: 'date',
|
|
508
|
+
SELECT: 'select',
|
|
509
|
+
RADIO: 'radio',
|
|
510
|
+
CHECKBOXES: 'checkboxes',
|
|
511
|
+
CHECKBOX: 'checkbox',
|
|
512
|
+
CONSENT: 'consent',
|
|
513
|
+
AUDIENCES: 'audiences',
|
|
514
|
+
HIDDEN: 'hidden',
|
|
515
|
+
HEADING: 'heading',
|
|
516
|
+
PARAGRAPH: 'paragraph',
|
|
517
|
+
DIVIDER: 'divider'
|
|
518
|
+
};
|
|
519
|
+
const FORM_STARTER_SLUGS = {
|
|
520
|
+
BLANK: 'blank',
|
|
521
|
+
NEWSLETTER: 'newsletter',
|
|
522
|
+
WAITLIST: 'waitlist',
|
|
523
|
+
EVENT: 'event',
|
|
524
|
+
EARLY_ACCESS: 'early-access',
|
|
525
|
+
CONTACT: 'contact'
|
|
526
|
+
};
|
|
527
|
+
const FORM_CONFIRM_SOURCES = {
|
|
528
|
+
LINK: 'link',
|
|
529
|
+
APPROVAL: 'approval'
|
|
530
|
+
};
|
|
531
|
+
const FORM_CONTACT_FIELDS = {
|
|
532
|
+
EMAIL: 'email',
|
|
533
|
+
FIRST_NAME: 'firstName',
|
|
534
|
+
LAST_NAME: 'lastName',
|
|
535
|
+
NAME: 'name'
|
|
536
|
+
};
|
|
537
|
+
const FORM_FIELD_WIDTHS = {
|
|
538
|
+
FULL: 'full',
|
|
539
|
+
HALF: 'half'
|
|
540
|
+
};
|
|
541
|
+
const FORM_FONTS = {
|
|
542
|
+
SYSTEM: 'system',
|
|
543
|
+
SANS: 'sans',
|
|
544
|
+
SERIF: 'serif',
|
|
545
|
+
MONO: 'mono'
|
|
546
|
+
};
|
|
547
|
+
const FORM_RADII = {
|
|
548
|
+
NONE: 'none',
|
|
549
|
+
SM: 'sm',
|
|
550
|
+
MD: 'md',
|
|
551
|
+
LG: 'lg',
|
|
552
|
+
FULL: 'full'
|
|
553
|
+
};
|
|
554
|
+
const FORM_WIDTHS = {
|
|
555
|
+
NARROW: 'narrow',
|
|
556
|
+
NORMAL: 'normal',
|
|
557
|
+
WIDE: 'wide'
|
|
558
|
+
};
|
|
559
|
+
const FORM_LAYOUTS = {
|
|
560
|
+
CARD: 'card',
|
|
561
|
+
PLAIN: 'plain'
|
|
562
|
+
};
|
|
563
|
+
const FORM_ALIGNS = {
|
|
564
|
+
LEFT: 'left',
|
|
565
|
+
CENTER: 'center'
|
|
566
|
+
};
|
|
567
|
+
const FORM_SUCCESS_ACTIONS = {
|
|
568
|
+
MESSAGE: 'message',
|
|
569
|
+
REDIRECT: 'redirect'
|
|
570
|
+
};
|
|
571
|
+
const FORM_SENDER_ISSUES = {
|
|
572
|
+
MISSING: 'missing',
|
|
573
|
+
NOT_SENDABLE: 'not_sendable',
|
|
574
|
+
NOT_ALLOWED: 'not_allowed'
|
|
575
|
+
};
|
|
576
|
+
const FORM_FIELD_ERRORS = {
|
|
577
|
+
REQUIRED: 'required',
|
|
578
|
+
EMAIL: 'email',
|
|
579
|
+
NUMBER: 'number',
|
|
580
|
+
MIN: 'min',
|
|
581
|
+
MAX: 'max',
|
|
582
|
+
TOO_SHORT: 'too_short',
|
|
583
|
+
TOO_LONG: 'too_long',
|
|
584
|
+
URL: 'url',
|
|
585
|
+
DATE: 'date',
|
|
586
|
+
PHONE: 'phone',
|
|
587
|
+
OPTION: 'option'
|
|
588
|
+
};
|
|
589
|
+
const FORM_SUBSCRIBE_OUTCOMES = {
|
|
590
|
+
ADDED: 'added',
|
|
591
|
+
PENDING: 'pending'
|
|
592
|
+
};
|
|
593
|
+
|
|
189
594
|
const HTTP_METHODS = {
|
|
190
595
|
GET: 'GET',
|
|
191
596
|
POST: 'POST',
|
|
@@ -217,6 +622,21 @@ const RETRY = {
|
|
|
217
622
|
};
|
|
218
623
|
const IDEMPOTENCY_KEY_PREFIX = 'oe-';
|
|
219
624
|
|
|
625
|
+
const IMPORT_FORMATS = {
|
|
626
|
+
GMAIL: 'gmail',
|
|
627
|
+
OPENEMAIL: 'openemail',
|
|
628
|
+
THUNDERBIRD: 'thunderbird',
|
|
629
|
+
PROTON: 'proton',
|
|
630
|
+
MBOX: 'mbox',
|
|
631
|
+
EML: 'eml'
|
|
632
|
+
};
|
|
633
|
+
const PROVIDER_IMPORT_PROVIDERS = {
|
|
634
|
+
RESEND: 'resend',
|
|
635
|
+
SENDGRID: 'sendgrid',
|
|
636
|
+
POSTMARK: 'postmark',
|
|
637
|
+
MAILGUN: 'mailgun',
|
|
638
|
+
MAILCHIMP: 'mailchimp'
|
|
639
|
+
};
|
|
220
640
|
const PROVIDER_IMPORT_RESOURCES = {
|
|
221
641
|
SUPPRESSIONS: 'suppressions',
|
|
222
642
|
AUDIENCES: 'audiences',
|
|
@@ -239,6 +659,74 @@ const PROVIDER_IMPORT_DOMAIN_STATES = {
|
|
|
239
659
|
VERIFIED: 'verified'
|
|
240
660
|
};
|
|
241
661
|
|
|
662
|
+
const KNOWLEDGE_KINDS = {
|
|
663
|
+
NOTE: 'note',
|
|
664
|
+
FILE: 'file',
|
|
665
|
+
LINK: 'link'
|
|
666
|
+
};
|
|
667
|
+
const KNOWLEDGE_LEVELS = {
|
|
668
|
+
WORKSPACE: 'workspace',
|
|
669
|
+
DOMAIN: 'domain',
|
|
670
|
+
ADDRESS: 'address'
|
|
671
|
+
};
|
|
672
|
+
const KNOWLEDGE_STATUSES = {
|
|
673
|
+
QUEUED: 'queued',
|
|
674
|
+
PROCESSING: 'processing',
|
|
675
|
+
READY: 'ready',
|
|
676
|
+
FAILED: 'failed'
|
|
677
|
+
};
|
|
678
|
+
const KNOWLEDGE_FAILURES = {
|
|
679
|
+
UNSUPPORTED: 'unsupported',
|
|
680
|
+
EMPTY: 'empty',
|
|
681
|
+
TOO_LARGE: 'too_large',
|
|
682
|
+
FETCH_FAILED: 'fetch_failed',
|
|
683
|
+
BLOCKED_URL: 'blocked_url',
|
|
684
|
+
CONVERSION_FAILED: 'conversion_failed',
|
|
685
|
+
INDEX_FAILED: 'index_failed',
|
|
686
|
+
OVER_ALLOWANCE: 'over_allowance',
|
|
687
|
+
MISSING_FILE: 'missing_file'
|
|
688
|
+
};
|
|
689
|
+
const KNOWLEDGE_ORIGINS = {
|
|
690
|
+
APP: 'app',
|
|
691
|
+
API: 'api',
|
|
692
|
+
ASSISTANT: 'assistant',
|
|
693
|
+
MCP: 'mcp'
|
|
694
|
+
};
|
|
695
|
+
const KNOWLEDGE_REFRESH_DAY_CHOICES = {
|
|
696
|
+
DAY: 1,
|
|
697
|
+
WEEK: 7,
|
|
698
|
+
MONTH: 30
|
|
699
|
+
};
|
|
700
|
+
const KNOWLEDGE_SUGGESTION_KINDS = {
|
|
701
|
+
LEARNED: 'learned',
|
|
702
|
+
QUESTION: 'question'
|
|
703
|
+
};
|
|
704
|
+
const KNOWLEDGE_SUGGESTION_STATUSES = {
|
|
705
|
+
PENDING: 'pending',
|
|
706
|
+
ACCEPTED: 'accepted',
|
|
707
|
+
DISMISSED: 'dismissed'
|
|
708
|
+
};
|
|
709
|
+
const KNOWLEDGE_FLAG_KINDS = {
|
|
710
|
+
DUPLICATE: 'duplicate',
|
|
711
|
+
CONFLICT: 'conflict'
|
|
712
|
+
};
|
|
713
|
+
const KNOWLEDGE_FLAG_STATUSES = {
|
|
714
|
+
OPEN: 'open',
|
|
715
|
+
DISMISSED: 'dismissed'
|
|
716
|
+
};
|
|
717
|
+
const KNOWLEDGE_CONNECTOR_KINDS = {
|
|
718
|
+
SITE: 'site',
|
|
719
|
+
SITEMAP: 'sitemap',
|
|
720
|
+
FEED: 'feed',
|
|
721
|
+
ZENDESK: 'zendesk'
|
|
722
|
+
};
|
|
723
|
+
const KNOWLEDGE_CONNECTOR_STATUSES = {
|
|
724
|
+
QUEUED: 'queued',
|
|
725
|
+
SYNCING: 'syncing',
|
|
726
|
+
READY: 'ready',
|
|
727
|
+
FAILED: 'failed'
|
|
728
|
+
};
|
|
729
|
+
|
|
242
730
|
const LANGUAGES = [
|
|
243
731
|
{ code: 'en', label: 'English', native: 'English', flag: '🇬🇧', rtl: false },
|
|
244
732
|
{ code: 'es', label: 'Spanish', native: 'Español', flag: '🇪🇸', rtl: false },
|
|
@@ -465,6 +953,47 @@ const LANGUAGE_ALIASES = [
|
|
|
465
953
|
];
|
|
466
954
|
const LANGUAGE_SUBTAG_PATTERN = /[-_]/;
|
|
467
955
|
|
|
956
|
+
const THREAD_SUMMARY_STATES = {
|
|
957
|
+
READY: 'ready',
|
|
958
|
+
PENDING: 'pending',
|
|
959
|
+
NONE: 'none'
|
|
960
|
+
};
|
|
961
|
+
const REPLY_SUGGESTION_STATES = {
|
|
962
|
+
READY: 'ready',
|
|
963
|
+
PENDING: 'pending',
|
|
964
|
+
NONE: 'none'
|
|
965
|
+
};
|
|
966
|
+
const MAIL_SERVICES = {
|
|
967
|
+
OPENEMAIL: 'openemail',
|
|
968
|
+
GMAIL: 'gmail',
|
|
969
|
+
OUTLOOK: 'outlook',
|
|
970
|
+
ICLOUD: 'icloud',
|
|
971
|
+
YAHOO: 'yahoo',
|
|
972
|
+
PROTON: 'proton',
|
|
973
|
+
ZOHO: 'zoho',
|
|
974
|
+
FASTMAIL: 'fastmail',
|
|
975
|
+
RESEND: 'resend',
|
|
976
|
+
SENDGRID: 'sendgrid',
|
|
977
|
+
MAILGUN: 'mailgun',
|
|
978
|
+
POSTMARK: 'postmark',
|
|
979
|
+
MAILCHIMP: 'mailchimp',
|
|
980
|
+
BREVO: 'brevo',
|
|
981
|
+
SPARKPOST: 'sparkpost',
|
|
982
|
+
HUBSPOT: 'hubspot',
|
|
983
|
+
AMAZON_SES: 'amazon-ses'
|
|
984
|
+
};
|
|
985
|
+
|
|
986
|
+
const THREAD_NOTE_COLORS = {
|
|
987
|
+
DEFAULT: 'default',
|
|
988
|
+
RED: 'red',
|
|
989
|
+
ORANGE: 'orange',
|
|
990
|
+
YELLOW: 'yellow',
|
|
991
|
+
GREEN: 'green',
|
|
992
|
+
BLUE: 'blue',
|
|
993
|
+
PURPLE: 'purple',
|
|
994
|
+
PINK: 'pink'
|
|
995
|
+
};
|
|
996
|
+
|
|
468
997
|
const PAGINATION = {
|
|
469
998
|
MAX_LIMIT: 100,
|
|
470
999
|
DEFAULT_LIMIT: 25
|
|
@@ -508,11 +1037,14 @@ const QUERY_KEYS = {
|
|
|
508
1037
|
AUDIENCE_IDS: 'audienceIds',
|
|
509
1038
|
AUDIENCE_ID: 'audienceId',
|
|
510
1039
|
BROADCAST_ID: 'broadcastId',
|
|
1040
|
+
BROADCAST_IDS: 'broadcastIds',
|
|
511
1041
|
EMAIL: 'email',
|
|
1042
|
+
WITHOUT_EMAIL: 'withoutEmail',
|
|
512
1043
|
BLOCKED: 'blocked',
|
|
513
1044
|
DATE_FROM: 'dateFrom',
|
|
514
1045
|
DATE_TO: 'dateTo',
|
|
515
1046
|
FROM_CONTACTS: 'fromContacts',
|
|
1047
|
+
SEMANTIC: 'semantic',
|
|
516
1048
|
REASON: 'reason',
|
|
517
1049
|
KIND: 'kind',
|
|
518
1050
|
ENDPOINT_IDS: 'endpointIds',
|
|
@@ -520,124 +1052,42 @@ const QUERY_KEYS = {
|
|
|
520
1052
|
SINCE: 'since',
|
|
521
1053
|
UNTIL: 'until',
|
|
522
1054
|
FAILED_ONLY: 'failedOnly',
|
|
523
|
-
FILENAME: 'filename'
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
const PATHS = {
|
|
528
|
-
PING: '/ping',
|
|
529
|
-
KEYS: '/keys',
|
|
530
|
-
KEYS_REQUESTS: '/keys/requests',
|
|
531
|
-
KEYS_ACTIVITY: '/keys/activity',
|
|
532
|
-
KEYS_SELF: '/keys/self',
|
|
533
|
-
KEYS_SELF_ROTATE: '/keys/self/rotate',
|
|
534
|
-
ADDRESSES: '/addresses',
|
|
535
|
-
LANGUAGES: '/languages',
|
|
536
|
-
EMAILS: '/emails',
|
|
537
|
-
EMAILS_BATCH: '/emails/batch',
|
|
538
|
-
EMAILS_TRANSLATE: '/emails/translate',
|
|
539
|
-
THREADS: '/threads',
|
|
540
|
-
DRAFTS: '/drafts',
|
|
541
|
-
LABELS: '/labels',
|
|
542
|
-
LABELS_COLORS: '/labels/colors',
|
|
543
|
-
CONTACTS: '/contacts',
|
|
544
|
-
CONTACTS_PEOPLE: '/contacts/people',
|
|
545
|
-
CONTACTS_BATCH_DELETE: '/contacts/batch-delete',
|
|
546
|
-
AUDIENCES: '/audiences',
|
|
547
|
-
AUDIENCES_GROWTH: '/audiences/growth',
|
|
548
|
-
BROADCASTS: '/broadcasts',
|
|
549
|
-
BROADCASTS_PREVIEW: '/broadcasts/preview',
|
|
550
|
-
DOMAINS: '/domains',
|
|
551
|
-
WEBHOOKS: '/webhooks',
|
|
552
|
-
WEBHOOKS_DELIVERIES: '/webhooks/deliveries',
|
|
553
|
-
WEBHOOKS_ACTIVITY: '/webhooks/activity',
|
|
554
|
-
IMPORTS: '/imports',
|
|
555
|
-
PROVIDER_IMPORTS: '/provider-imports',
|
|
556
|
-
PROVIDER_IMPORTS_INSPECT: '/provider-imports/inspect',
|
|
557
|
-
TEMPLATES: '/templates',
|
|
558
|
-
TEMPLATES_FONTS: '/templates/fonts',
|
|
559
|
-
TEMPLATES_RENDER: '/templates/render',
|
|
560
|
-
TEMPLATES_STARTERS: '/templates/starters',
|
|
561
|
-
RULES: '/rules',
|
|
562
|
-
RULES_RUNS: '/rules/runs',
|
|
563
|
-
RULES_REORDER: '/rules/reorder',
|
|
564
|
-
TRACKING: '/tracking',
|
|
565
|
-
TRACKING_STATS: '/tracking/stats',
|
|
566
|
-
CALENDAR_EVENTS: '/calendar/events',
|
|
567
|
-
SETTINGS: '/settings',
|
|
568
|
-
SECURITY_STEP_UP: '/security/step-up',
|
|
569
|
-
SECURITY_STEP_UP_VERIFY: '/security/step-up/verify',
|
|
570
|
-
ROLES: '/roles',
|
|
571
|
-
ROLES_PERMISSIONS: '/roles/permissions',
|
|
572
|
-
MEMBERS: '/members',
|
|
573
|
-
MEMBERS_INVITATIONS: '/members/invitations',
|
|
574
|
-
SUPPRESSIONS: '/suppressions',
|
|
575
|
-
FILES: '/files',
|
|
576
|
-
FILES_STATS: '/files/stats',
|
|
577
|
-
FILES_BATCH_DELETE: '/files/batch-delete',
|
|
578
|
-
TEMP_MAIL_DOMAINS: '/temp-mail/domains',
|
|
579
|
-
TEMP_MAIL_INBOXES: '/temp-mail/inboxes'
|
|
580
|
-
};
|
|
581
|
-
const SEGMENTS = {
|
|
582
|
-
ACTIVITY: 'activity',
|
|
1055
|
+
FILENAME: 'filename',
|
|
1056
|
+
DOMAIN: 'domain',
|
|
1057
|
+
SCHEDULED_FROM: 'scheduledFrom',
|
|
1058
|
+
SCHEDULED_TO: 'scheduledTo',
|
|
583
1059
|
ADDRESSES: 'addresses',
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
CONTACTS: 'contacts',
|
|
594
|
-
CONTENT: 'content',
|
|
595
|
-
DELIVERIES: 'deliveries',
|
|
596
|
-
DUPLICATE: 'duplicate',
|
|
597
|
-
EMPTY: 'empty',
|
|
598
|
-
EVENTS: 'events',
|
|
599
|
-
EXTEND: 'extend',
|
|
600
|
-
FAILURES: 'failures',
|
|
601
|
-
FILES: 'files',
|
|
602
|
-
ICS: 'ics',
|
|
603
|
-
IMPORT: 'import',
|
|
604
|
-
LINKS: 'links',
|
|
605
|
-
MESSAGES: 'messages',
|
|
606
|
-
OPENS: 'opens',
|
|
607
|
-
PHOTO: 'photo',
|
|
608
|
-
PREVIEW: 'preview',
|
|
609
|
-
REPLAY: 'replay',
|
|
610
|
-
REQUESTS: 'requests',
|
|
611
|
-
RESEND: 'resend',
|
|
612
|
-
RESTORE: 'restore',
|
|
613
|
-
REVOKE: 'revoke',
|
|
614
|
-
ROTATE: 'rotate',
|
|
615
|
-
ROTATE_SECRET: 'rotate-secret',
|
|
616
|
-
RECIPIENTS: 'recipients',
|
|
617
|
-
SEND: 'send',
|
|
1060
|
+
OFFSET: 'offset',
|
|
1061
|
+
REFRESH: 'refresh',
|
|
1062
|
+
CONFIRM: 'confirm',
|
|
1063
|
+
USERNAME: 'username',
|
|
1064
|
+
SCOPE: 'scope',
|
|
1065
|
+
LEVEL: 'level',
|
|
1066
|
+
PINNED: 'pinned',
|
|
1067
|
+
TITLE: 'title',
|
|
1068
|
+
ITEM_ID: 'itemId',
|
|
618
1069
|
SENDS: 'sends',
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
THREADS: 'threads',
|
|
624
|
-
TRACKING: 'tracking',
|
|
625
|
-
TRASH: 'trash',
|
|
626
|
-
UNSNOOZE: 'unsnooze',
|
|
627
|
-
UPLOAD: 'upload',
|
|
628
|
-
VERIFY: 'verify',
|
|
629
|
-
VERSIONS: 'versions'
|
|
1070
|
+
DOMAINS: 'domains',
|
|
1071
|
+
PEOPLE: 'people',
|
|
1072
|
+
AI_ACTIONS: 'aiActions',
|
|
1073
|
+
INTERVAL: 'interval'
|
|
630
1074
|
};
|
|
1075
|
+
const LIST_SEPARATOR = ',';
|
|
631
1076
|
|
|
1077
|
+
const DOCS_PATHS = {
|
|
1078
|
+
SDK_CHANGELOG: '/docs/sdk/changelog'};
|
|
1079
|
+
|
|
1080
|
+
const APP_ORIGIN = 'https://openemail.uk';
|
|
632
1081
|
const VERSION = version;
|
|
633
1082
|
const NPM_REGISTRY_URL = 'https://registry.npmjs.org/@openemail/sdk';
|
|
634
1083
|
const UPDATE_NOTICE = {
|
|
635
1084
|
ENV_DISABLE: 'OPENEMAIL_DISABLE_UPDATE_NOTICE',
|
|
636
1085
|
TIMEOUT_MS: 2_000,
|
|
637
1086
|
PACKAGE: '@openemail/sdk',
|
|
638
|
-
CHANGELOG_URL:
|
|
1087
|
+
CHANGELOG_URL: `${APP_ORIGIN}${DOCS_PATHS.SDK_CHANGELOG}`,
|
|
639
1088
|
ICON: 'ℹ'
|
|
640
1089
|
};
|
|
1090
|
+
const VERSION_TAG_PREFIX = /^v/;
|
|
641
1091
|
|
|
642
1092
|
const RULE_FIELDS = {
|
|
643
1093
|
FROM: 'from',
|
|
@@ -719,7 +1169,23 @@ const API_SCOPES = {
|
|
|
719
1169
|
SETTINGS_WRITE: 'settings:write',
|
|
720
1170
|
KEYS_WRITE: 'keys:write',
|
|
721
1171
|
KEYS_READ: 'keys:read',
|
|
722
|
-
KEYS_MANAGE: 'keys:manage'
|
|
1172
|
+
KEYS_MANAGE: 'keys:manage',
|
|
1173
|
+
FORMS_READ: 'forms:read',
|
|
1174
|
+
FORMS_WRITE: 'forms:write',
|
|
1175
|
+
KNOWLEDGE_READ: 'knowledge:read',
|
|
1176
|
+
KNOWLEDGE_WRITE: 'knowledge:write',
|
|
1177
|
+
BILLING_READ: 'billing:read',
|
|
1178
|
+
BILLING_WRITE: 'billing:write',
|
|
1179
|
+
ACCOUNT_READ: 'account:read',
|
|
1180
|
+
ACCOUNT_WRITE: 'account:write'
|
|
1181
|
+
};
|
|
1182
|
+
const CONSOLE_PERMISSIONS = {
|
|
1183
|
+
ADDRESSES_ALL: 'addresses:all',
|
|
1184
|
+
API_KEYS_READ: 'api-keys:read',
|
|
1185
|
+
API_KEYS_WRITE: 'api-keys:write',
|
|
1186
|
+
BILLING_READ: 'billing:read',
|
|
1187
|
+
BILLING_WRITE: 'billing:write',
|
|
1188
|
+
WORKSPACE_MANAGE: 'workspace:manage'
|
|
723
1189
|
};
|
|
724
1190
|
|
|
725
1191
|
const STEP_UP_METHODS = {
|
|
@@ -742,6 +1208,14 @@ const SUPPRESSION_REASONS = {
|
|
|
742
1208
|
MANUAL: 'manual'
|
|
743
1209
|
};
|
|
744
1210
|
|
|
1211
|
+
const TEMPLATE_IMAGE_TYPES = {
|
|
1212
|
+
PNG: 'image/png',
|
|
1213
|
+
JPEG: 'image/jpeg',
|
|
1214
|
+
WEBP: 'image/webp',
|
|
1215
|
+
GIF: 'image/gif',
|
|
1216
|
+
SVG: 'image/svg+xml'
|
|
1217
|
+
};
|
|
1218
|
+
|
|
745
1219
|
const THREAD_SORTS = {
|
|
746
1220
|
NEWEST: 'newest',
|
|
747
1221
|
OLDEST: 'oldest',
|
|
@@ -749,6 +1223,38 @@ const THREAD_SORTS = {
|
|
|
749
1223
|
SUBJECT: 'subject'
|
|
750
1224
|
};
|
|
751
1225
|
|
|
1226
|
+
const BIMI_STATUSES = {
|
|
1227
|
+
PRESENT: 'present',
|
|
1228
|
+
PARTIAL: 'partial',
|
|
1229
|
+
ABSENT: 'absent',
|
|
1230
|
+
INVALID: 'invalid'
|
|
1231
|
+
};
|
|
1232
|
+
const DELIVERABILITY_CHECK_IDS = {
|
|
1233
|
+
MX: 'mx',
|
|
1234
|
+
SPF: 'spf',
|
|
1235
|
+
DKIM: 'dkim',
|
|
1236
|
+
DMARC: 'dmarc',
|
|
1237
|
+
BIMI: 'bimi'
|
|
1238
|
+
};
|
|
1239
|
+
const DELIVERABILITY_CHECK_STATUSES = {
|
|
1240
|
+
PASS: 'pass',
|
|
1241
|
+
WARN: 'warn',
|
|
1242
|
+
FAIL: 'fail',
|
|
1243
|
+
ABSENT: 'absent'
|
|
1244
|
+
};
|
|
1245
|
+
const DELIVERABILITY_GRADES = {
|
|
1246
|
+
A: 'A',
|
|
1247
|
+
B: 'B',
|
|
1248
|
+
C: 'C',
|
|
1249
|
+
D: 'D',
|
|
1250
|
+
F: 'F'
|
|
1251
|
+
};
|
|
1252
|
+
const PLAN_BLOCKERS = {
|
|
1253
|
+
DOMAINS: 'domains',
|
|
1254
|
+
PEOPLE: 'people',
|
|
1255
|
+
SENDS: 'sends'
|
|
1256
|
+
};
|
|
1257
|
+
|
|
752
1258
|
const WEBHOOK_EVENTS = {
|
|
753
1259
|
EMAIL_RECEIVED: 'email.received',
|
|
754
1260
|
EMAIL_REPLIED: 'email.replied',
|
|
@@ -771,7 +1277,9 @@ const WEBHOOK_EVENTS = {
|
|
|
771
1277
|
SUPPRESSION_ADDED: 'suppression.added',
|
|
772
1278
|
SUPPRESSION_REMOVED: 'suppression.removed',
|
|
773
1279
|
FILE_UPLOADED: 'file.uploaded',
|
|
774
|
-
FILE_DELETED: 'file.deleted'
|
|
1280
|
+
FILE_DELETED: 'file.deleted',
|
|
1281
|
+
FORM_SUBMITTED: 'form.submitted',
|
|
1282
|
+
FORM_CONFIRMED: 'form.confirmed'
|
|
775
1283
|
};
|
|
776
1284
|
const WEBHOOK_REPLAY_ERROR_CODES = {
|
|
777
1285
|
RESOURCE_NOT_FOUND: 'resource_not_found',
|
|
@@ -794,6 +1302,7 @@ const WEBHOOK_SIGNATURE = {
|
|
|
794
1302
|
VALUE_SEPARATOR: '=',
|
|
795
1303
|
TOLERANCE_SECONDS: 300
|
|
796
1304
|
};
|
|
1305
|
+
const HMAC_SIGN_USAGES = ['sign'];
|
|
797
1306
|
const WEBHOOK_MESSAGES = {
|
|
798
1307
|
MISSING_HEADER: 'Missing the X-OpenEmail-Signature header.',
|
|
799
1308
|
MALFORMED_HEADER: 'X-OpenEmail-Signature is not in the form t=<seconds>,v1=<hex>.',
|
|
@@ -802,6 +1311,95 @@ const WEBHOOK_MESSAGES = {
|
|
|
802
1311
|
NO_WEBCRYPTO: 'No WebCrypto is available. Verifying a webhook signature needs globalThis.crypto.subtle, which Node 20+, Bun, Deno, Cloudflare Workers and browsers over HTTPS all provide.'
|
|
803
1312
|
};
|
|
804
1313
|
|
|
1314
|
+
const REWRITE_TARGETS = {
|
|
1315
|
+
SUBJECT: 'subject',
|
|
1316
|
+
BODY: 'body'
|
|
1317
|
+
};
|
|
1318
|
+
const REWRITE_ACTIONS = {
|
|
1319
|
+
SHORTEN: 'shorten',
|
|
1320
|
+
LENGTHEN: 'lengthen',
|
|
1321
|
+
REPHRASE: 'rephrase',
|
|
1322
|
+
FORMAL: 'formal',
|
|
1323
|
+
CASUAL: 'casual',
|
|
1324
|
+
CUSTOM: 'custom'
|
|
1325
|
+
};
|
|
1326
|
+
|
|
1327
|
+
const SUBSCRIPTION_STATUSES = {
|
|
1328
|
+
ACTIVE: 'active',
|
|
1329
|
+
UNSUBSCRIBED: 'unsubscribed'
|
|
1330
|
+
};
|
|
1331
|
+
const SUBSCRIPTION_SORTS = {
|
|
1332
|
+
RECENT: 'recent',
|
|
1333
|
+
MOST: 'most',
|
|
1334
|
+
UNREAD: 'unread',
|
|
1335
|
+
NAME: 'name'
|
|
1336
|
+
};
|
|
1337
|
+
const SUBSCRIPTION_DESTINATIONS = {
|
|
1338
|
+
ARCHIVE: 'archive',
|
|
1339
|
+
BIN: 'bin',
|
|
1340
|
+
LABEL: 'label'
|
|
1341
|
+
};
|
|
1342
|
+
const UNSUBSCRIBE_METHODS = {
|
|
1343
|
+
ONE_CLICK: 'one-click',
|
|
1344
|
+
EMAIL: 'email',
|
|
1345
|
+
LINK: 'link'
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1348
|
+
const EMAIL_NOTIFICATION_CATEGORIES = {
|
|
1349
|
+
ACCOUNT: 'account',
|
|
1350
|
+
BILLING: 'billing',
|
|
1351
|
+
ACTIVITY: 'activity',
|
|
1352
|
+
PRODUCT: 'product'
|
|
1353
|
+
};
|
|
1354
|
+
const USERNAME_STATUSES = {
|
|
1355
|
+
AVAILABLE: 'available',
|
|
1356
|
+
CURRENT: 'current',
|
|
1357
|
+
TAKEN: 'taken',
|
|
1358
|
+
RESERVED: 'reserved',
|
|
1359
|
+
INVALID: 'invalid',
|
|
1360
|
+
TOO_SHORT: 'too_short',
|
|
1361
|
+
TOO_LONG: 'too_long'
|
|
1362
|
+
};
|
|
1363
|
+
const CONNECTED_APP_KINDS = {
|
|
1364
|
+
APP: 'app',
|
|
1365
|
+
CLI: 'cli'
|
|
1366
|
+
};
|
|
1367
|
+
const CONNECTED_APP_STATUSES = {
|
|
1368
|
+
ACTIVE: 'active',
|
|
1369
|
+
EXPIRED: 'expired',
|
|
1370
|
+
NEEDS_APPROVAL: 'needs-approval',
|
|
1371
|
+
ACCESS_LOST: 'access-lost'
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
const WORKSPACE_KINDS = {
|
|
1375
|
+
BUSINESS: 'business',
|
|
1376
|
+
PERSONAL: 'personal'
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1379
|
+
const SETTINGS_TIME_FORMATS = {
|
|
1380
|
+
H12: '12h',
|
|
1381
|
+
H24: '24h'
|
|
1382
|
+
};
|
|
1383
|
+
const SETTINGS_DATE_FORMATS = {
|
|
1384
|
+
DMY: 'dmy',
|
|
1385
|
+
MDY: 'mdy',
|
|
1386
|
+
YMD: 'ymd'
|
|
1387
|
+
};
|
|
1388
|
+
const SETTINGS_WEEK_STARTS = {
|
|
1389
|
+
MONDAY: 'monday',
|
|
1390
|
+
SUNDAY: 'sunday'
|
|
1391
|
+
};
|
|
1392
|
+
const SETTINGS_COLOR_THEMES = {
|
|
1393
|
+
LIGHT: 'light',
|
|
1394
|
+
DARK: 'dark',
|
|
1395
|
+
SYSTEM: 'system'
|
|
1396
|
+
};
|
|
1397
|
+
const SETTINGS_IMAGE_COMPRESSIONS = {
|
|
1398
|
+
LOW: 'low',
|
|
1399
|
+
MEDIUM: 'medium',
|
|
1400
|
+
ORIGINAL: 'original'
|
|
1401
|
+
};
|
|
1402
|
+
|
|
805
1403
|
const PAGE_LIMITS = PAGINATION;
|
|
806
1404
|
const WEBHOOK_SIGNATURE_HEADERS = WEBHOOK_HEADERS;
|
|
807
1405
|
|
|
@@ -815,32 +1413,325 @@ const LOOPBACK_IPV6_ADDRESS = '[::1]';
|
|
|
815
1413
|
const UNSPECIFIED_HOSTNAMES = ['0.0.0.0', '::', '[::]'];
|
|
816
1414
|
const LOCAL_HOSTS = [...LOOPBACK_HOSTNAMES, LOOPBACK_IPV4_ADDRESS, ...UNSPECIFIED_HOSTNAMES];
|
|
817
1415
|
const ENDPOINT_SCHEME_PATTERN = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
1416
|
+
const TRAILING_SLASHES = /\/+$/;
|
|
818
1417
|
|
|
819
1418
|
const RETRYABLE_STATUSES = new Set(RETRY.STATUSES);
|
|
820
1419
|
const RETRYABLE_METHODS = new Set(RETRY.METHODS);
|
|
821
1420
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
1421
|
+
const API_PATHS = {
|
|
1422
|
+
PING: '/ping',
|
|
1423
|
+
LANGUAGES: '/languages',
|
|
1424
|
+
EMAILS: '/emails',
|
|
1425
|
+
EMAILS_BATCH: '/emails/batch',
|
|
1426
|
+
EMAILS_TRANSLATE: '/emails/translate',
|
|
1427
|
+
EMAILS_CHECK: '/emails/check',
|
|
1428
|
+
EMAILS_COMPOSE: '/emails/compose',
|
|
1429
|
+
EMAILS_REWRITE: '/emails/rewrite',
|
|
1430
|
+
EMAILS_SUBJECT: '/emails/subject',
|
|
1431
|
+
EMAIL: '/emails/:id',
|
|
1432
|
+
EMAIL_CANCEL: '/emails/:id/cancel',
|
|
1433
|
+
EMAIL_EVENTS: '/emails/:id/events',
|
|
1434
|
+
EMAIL_TRACKING: '/emails/:id/tracking',
|
|
1435
|
+
TRACKING: '/tracking',
|
|
1436
|
+
TRACKING_STATS: '/tracking/stats',
|
|
1437
|
+
TRACKED: '/tracking/:id',
|
|
1438
|
+
TRACKED_OPENS: '/tracking/:id/opens',
|
|
1439
|
+
TRACKED_CLICKS: '/tracking/:id/clicks',
|
|
1440
|
+
TEMPLATES: '/templates',
|
|
1441
|
+
TEMPLATE_FONTS: '/templates/fonts',
|
|
1442
|
+
TEMPLATE_STARTERS: '/templates/starters',
|
|
1443
|
+
TEMPLATE_STARTER: '/templates/starters/:slug',
|
|
1444
|
+
TEMPLATE_RENDER: '/templates/render',
|
|
1445
|
+
TEMPLATE_IMAGES: '/templates/images',
|
|
1446
|
+
TEMPLATES_DESIGN: '/templates/design',
|
|
1447
|
+
TEMPLATE_REDESIGN: '/templates/:id/redesign',
|
|
1448
|
+
TEMPLATE: '/templates/:id',
|
|
1449
|
+
TEMPLATE_DUPLICATE: '/templates/:id/duplicate',
|
|
1450
|
+
TEMPLATE_CONTENT: '/templates/:id/content',
|
|
1451
|
+
TEMPLATE_VERSIONS: '/templates/:id/versions',
|
|
1452
|
+
TEMPLATE_VERSION: '/templates/:id/versions/:version',
|
|
1453
|
+
TEMPLATE_VERSION_RESTORE: '/templates/:id/versions/:version/restore',
|
|
1454
|
+
TEMPLATE_PREVIEW: '/templates/:id/preview',
|
|
1455
|
+
TEMPLATE_ANALYTICS: '/templates/:id/analytics',
|
|
1456
|
+
TEMPLATE_SENDS: '/templates/:id/sends',
|
|
1457
|
+
TEMPLATE_SEND: '/templates/:id/send',
|
|
1458
|
+
RULES: '/rules',
|
|
1459
|
+
RULE_RUNS: '/rules/runs',
|
|
1460
|
+
RULES_REORDER: '/rules/reorder',
|
|
1461
|
+
RULE: '/rules/:id',
|
|
1462
|
+
RULE_TEST: '/rules/:id/test',
|
|
1463
|
+
THREADS: '/threads',
|
|
1464
|
+
THREAD: '/threads/:id',
|
|
1465
|
+
THREAD_TRASH: '/threads/:id/trash',
|
|
1466
|
+
THREAD_SNOOZE: '/threads/:id/snooze',
|
|
1467
|
+
THREAD_UNSNOOZE: '/threads/:id/unsnooze',
|
|
1468
|
+
THREAD_MESSAGE_ATTACHMENTS: '/threads/:id/messages/:messageId/attachments',
|
|
1469
|
+
THREADS_COUNTS: '/threads/counts',
|
|
1470
|
+
THREAD_RESTORE: '/threads/:id/restore',
|
|
1471
|
+
THREAD_SUMMARY: '/threads/:id/summary',
|
|
1472
|
+
THREAD_REPLY_SUGGESTIONS: '/threads/:id/reply-suggestions',
|
|
1473
|
+
THREAD_EVENT: '/threads/:id/event',
|
|
1474
|
+
THREAD_NOTES: '/threads/:id/notes',
|
|
1475
|
+
THREAD_NOTES_REORDER: '/threads/:id/notes/reorder',
|
|
1476
|
+
THREAD_NOTE: '/threads/:id/notes/:noteId',
|
|
1477
|
+
THREAD_UNSUBSCRIBE: '/threads/:id/unsubscribe',
|
|
1478
|
+
DRAFTS: '/drafts',
|
|
1479
|
+
DRAFT: '/drafts/:id',
|
|
1480
|
+
LABELS: '/labels',
|
|
1481
|
+
LABEL_COLORS: '/labels/colors',
|
|
1482
|
+
LABEL: '/labels/:id',
|
|
1483
|
+
CONTACTS: '/contacts',
|
|
1484
|
+
CONTACTS_PEOPLE: '/contacts/people',
|
|
1485
|
+
CONTACTS_BATCH_DELETE: '/contacts/batch-delete',
|
|
1486
|
+
CONTACT_CARDS: '/contacts/cards',
|
|
1487
|
+
CONTACT_CARD: '/contacts/cards/:id',
|
|
1488
|
+
CONTACT: '/contacts/:email',
|
|
1489
|
+
CONTACT_PHOTO: '/contacts/:email/photo',
|
|
1490
|
+
CONTACT_BLOCK: '/contacts/:email/block',
|
|
1491
|
+
CONTACT_THREADS: '/contacts/:email/threads',
|
|
1492
|
+
CONTACT_ACTIVITY: '/contacts/:email/activity',
|
|
1493
|
+
CONTACT_AUDIENCES: '/contacts/:email/audiences',
|
|
1494
|
+
AUDIENCES: '/audiences',
|
|
1495
|
+
AUDIENCES_GROWTH: '/audiences/growth',
|
|
1496
|
+
AUDIENCE: '/audiences/:id',
|
|
1497
|
+
AUDIENCE_CONTACTS: '/audiences/:id/contacts',
|
|
1498
|
+
AUDIENCE_CONTACT: '/audiences/:id/contacts/:email',
|
|
1499
|
+
AUDIENCE_CONTACTS_BATCH: '/audiences/:id/contacts/batch',
|
|
1500
|
+
AUDIENCE_CONTACTS_BATCH_REMOVE: '/audiences/:id/contacts/batch-remove',
|
|
1501
|
+
AUDIENCE_IMPORT: '/audiences/:id/import',
|
|
1502
|
+
AUDIENCE_EMPTY: '/audiences/:id/empty',
|
|
1503
|
+
FORMS: '/forms',
|
|
1504
|
+
FORM_STARTERS: '/forms/starters',
|
|
1505
|
+
FORM_STARTER: '/forms/starters/:slug',
|
|
1506
|
+
FORM: '/forms/:id',
|
|
1507
|
+
FORM_PUBLISH: '/forms/:id/publish',
|
|
1508
|
+
FORM_PAUSE: '/forms/:id/pause',
|
|
1509
|
+
FORM_RESUME: '/forms/:id/resume',
|
|
1510
|
+
FORM_DUPLICATE: '/forms/:id/duplicate',
|
|
1511
|
+
FORM_ANALYTICS: '/forms/:id/analytics',
|
|
1512
|
+
FORM_SUBMISSIONS: '/forms/:id/submissions',
|
|
1513
|
+
FORM_SUBMISSIONS_BATCH_REMOVE: '/forms/:id/submissions/batch-remove',
|
|
1514
|
+
FORM_SUBMISSION: '/forms/:id/submissions/:submissionId',
|
|
1515
|
+
FORM_SUBMISSION_APPROVE: '/forms/:id/submissions/:submissionId/approve',
|
|
1516
|
+
FORM_SUBMISSION_RESEND: '/forms/:id/submissions/:submissionId/resend',
|
|
1517
|
+
FORMS_DESIGN: '/forms/design',
|
|
1518
|
+
FORM_REDESIGN: '/forms/:id/redesign',
|
|
1519
|
+
BROADCASTS: '/broadcasts',
|
|
1520
|
+
BROADCASTS_PREVIEW: '/broadcasts/preview',
|
|
1521
|
+
BROADCASTS_ANALYTICS: '/broadcasts/analytics',
|
|
1522
|
+
BROADCAST: '/broadcasts/:id',
|
|
1523
|
+
BROADCAST_RECIPIENTS: '/broadcasts/:id/recipients',
|
|
1524
|
+
BROADCAST_RECIPIENT: '/broadcasts/:id/recipients/:emailId',
|
|
1525
|
+
BROADCAST_STATS: '/broadcasts/:id/stats',
|
|
1526
|
+
BROADCAST_CANCEL: '/broadcasts/:id/cancel',
|
|
1527
|
+
DOMAINS: '/domains',
|
|
1528
|
+
DOMAIN: '/domains/:id',
|
|
1529
|
+
DOMAIN_VERIFY: '/domains/:id/verify',
|
|
1530
|
+
DOMAIN_LOGO: '/domains/:id/logo',
|
|
1531
|
+
DOMAIN_LOGO_CERTIFICATE: '/domains/:id/logo/certificate',
|
|
1532
|
+
DOMAIN_ADDRESSES: '/domains/:id/addresses',
|
|
1533
|
+
DOMAIN_ADDRESS: '/domains/:id/addresses/:addressId',
|
|
1534
|
+
DOMAIN_ADDRESS_PHOTO: '/domains/:id/addresses/:addressId/photo',
|
|
1535
|
+
DOMAIN_ADDRESS_FORWARDS: '/domains/:id/addresses/:addressId/forwards',
|
|
1536
|
+
DOMAIN_ADDRESS_FORWARD: '/domains/:id/addresses/:addressId/forwards/:forwardId',
|
|
1537
|
+
DOMAIN_ADDRESS_FORWARD_RESEND: '/domains/:id/addresses/:addressId/forwards/:forwardId/resend',
|
|
1538
|
+
DOMAIN_ADDRESS_MEMBERS: '/domains/:id/addresses/:addressId/members',
|
|
1539
|
+
DOMAIN_ADDRESS_LOGIN: '/domains/:id/addresses/:addressId/login',
|
|
1540
|
+
DOMAIN_ADDRESS_MAIL_APPS: '/domains/:id/addresses/:addressId/mail-apps',
|
|
1541
|
+
DOMAIN_ADDRESS_APP_PASSWORDS: '/domains/:id/addresses/:addressId/app-passwords',
|
|
1542
|
+
DOMAIN_ADDRESS_APP_PASSWORD: '/domains/:id/addresses/:addressId/app-passwords/:passwordId',
|
|
1543
|
+
DOMAIN_ADDRESS_MAIL_APP_SETUP: '/domains/:id/addresses/:addressId/mail-app-setup',
|
|
1544
|
+
DOMAIN_DNS: '/domains/:id/dns',
|
|
1545
|
+
DOMAIN_DNS_SYNC: '/domains/:id/dns/sync',
|
|
1546
|
+
DNS_CONNECTIONS: '/dns-connections',
|
|
1547
|
+
DNS_CONNECTION: '/dns-connections/:id',
|
|
1548
|
+
APP_HOST: '/app-host',
|
|
1549
|
+
APP_HOST_VERIFY: '/app-host/verify',
|
|
1550
|
+
BRANDING: '/branding',
|
|
1551
|
+
BRANDING_IMAGE: '/branding/images/:variant',
|
|
1552
|
+
ADDRESSES: '/addresses',
|
|
1553
|
+
WEBHOOKS: '/webhooks',
|
|
1554
|
+
WEBHOOKS_DELIVERIES: '/webhooks/deliveries',
|
|
1555
|
+
WEBHOOKS_ACTIVITY: '/webhooks/activity',
|
|
1556
|
+
WEBHOOKS_EVENTS: '/webhooks/events',
|
|
1557
|
+
WEBHOOKS_STATS: '/webhooks/stats',
|
|
1558
|
+
WEBHOOK: '/webhooks/:id',
|
|
1559
|
+
WEBHOOK_ROTATE_SECRET: '/webhooks/:id/rotate-secret',
|
|
1560
|
+
WEBHOOK_TEST: '/webhooks/:id/test',
|
|
1561
|
+
WEBHOOK_DELIVERIES: '/webhooks/:id/deliveries',
|
|
1562
|
+
WEBHOOK_DELIVERY: '/webhooks/:id/deliveries/:deliveryId',
|
|
1563
|
+
WEBHOOK_DELIVERY_REPLAY: '/webhooks/:id/deliveries/:deliveryId/replay',
|
|
1564
|
+
WEBHOOK_ACTIVITY: '/webhooks/:id/activity',
|
|
1565
|
+
IMPORTS: '/imports',
|
|
1566
|
+
IMPORT: '/imports/:id',
|
|
1567
|
+
IMPORT_UPLOAD: '/imports/:id/upload',
|
|
1568
|
+
IMPORT_FILE_CHUNK: '/imports/:id/files/:file/chunks/:chunk',
|
|
1569
|
+
IMPORT_START: '/imports/:id/start',
|
|
1570
|
+
IMPORT_CANCEL: '/imports/:id/cancel',
|
|
1571
|
+
IMPORT_FAILURES: '/imports/:id/failures',
|
|
1572
|
+
PROVIDER_IMPORTS: '/provider-imports',
|
|
1573
|
+
PROVIDER_IMPORTS_INSPECT: '/provider-imports/inspect',
|
|
1574
|
+
PROVIDER_IMPORT: '/provider-imports/:id',
|
|
1575
|
+
PROVIDER_IMPORT_CANCEL: '/provider-imports/:id/cancel',
|
|
1576
|
+
CALENDAR_EVENTS: '/calendar/events',
|
|
1577
|
+
CALENDAR_EVENT: '/calendar/events/:id',
|
|
1578
|
+
CALENDAR_EVENT_ICS: '/calendar/events/:id/ics',
|
|
1579
|
+
CALENDAR_EVENT_CANCEL: '/calendar/events/:id/cancel',
|
|
1580
|
+
CALENDAR_EVENT_RESPOND: '/calendar/events/:id/respond',
|
|
1581
|
+
CALENDAR_EVENT_DECLINE_PROPOSAL: '/calendar/events/:id/decline-proposal',
|
|
1582
|
+
CALENDAR_FEEDS: '/calendar/feeds',
|
|
1583
|
+
CALENDAR_FEED: '/calendar/feeds/:id',
|
|
1584
|
+
CALENDAR_FEED_RESET: '/calendar/feeds/:id/reset',
|
|
1585
|
+
CALENDAR_SUBSCRIPTIONS: '/calendar/subscriptions',
|
|
1586
|
+
CALENDAR_SUBSCRIPTION: '/calendar/subscriptions/:id',
|
|
1587
|
+
CALENDAR_SUBSCRIPTION_REFRESH: '/calendar/subscriptions/:id/refresh',
|
|
1588
|
+
SETTINGS: '/settings',
|
|
1589
|
+
ROLES: '/roles',
|
|
1590
|
+
ROLE_PERMISSIONS: '/roles/permissions',
|
|
1591
|
+
ROLE: '/roles/:id',
|
|
1592
|
+
MEMBERS: '/members',
|
|
1593
|
+
MEMBER: '/members/:userId',
|
|
1594
|
+
MEMBER_ADDRESSES: '/members/:userId/addresses',
|
|
1595
|
+
MEMBER_ADDRESS: '/members/:userId/addresses/:addressId',
|
|
1596
|
+
MEMBER_DOMAINS: '/members/:userId/domains',
|
|
1597
|
+
MEMBER_DOMAIN: '/members/:userId/domains/:domainId',
|
|
1598
|
+
MEMBER_INVITATIONS: '/members/invitations',
|
|
1599
|
+
MEMBER_INVITATION: '/members/invitations/:invitationId',
|
|
1600
|
+
MEMBER_INVITATION_RESEND: '/members/invitations/:invitationId/resend',
|
|
1601
|
+
KEYS: '/keys',
|
|
1602
|
+
KEYS_REQUESTS: '/keys/requests',
|
|
1603
|
+
KEYS_ACTIVITY: '/keys/activity',
|
|
1604
|
+
KEYS_STATS: '/keys/stats',
|
|
1605
|
+
KEY_SELF: '/keys/self',
|
|
1606
|
+
KEY_SELF_ROTATE: '/keys/self/rotate',
|
|
1607
|
+
KEY: '/keys/:id',
|
|
1608
|
+
KEY_ROTATE: '/keys/:id/rotate',
|
|
1609
|
+
KEY_REVOKE: '/keys/:id/revoke',
|
|
1610
|
+
KEY_REQUESTS: '/keys/:id/requests',
|
|
1611
|
+
KEY_ACTIVITY: '/keys/:id/activity',
|
|
1612
|
+
SUPPRESSIONS: '/suppressions',
|
|
1613
|
+
SUPPRESSION: '/suppressions/:id',
|
|
1614
|
+
FILES: '/files',
|
|
1615
|
+
FILES_STATS: '/files/stats',
|
|
1616
|
+
FILES_BATCH_DELETE: '/files/batch-delete',
|
|
1617
|
+
FILE: '/files/:id',
|
|
1618
|
+
FILE_CONTENT: '/files/:id/content',
|
|
1619
|
+
FILE_LINKS: '/files/:id/links',
|
|
1620
|
+
FILE_LINK: '/files/:id/links/:linkId',
|
|
1621
|
+
KNOWLEDGE: '/knowledge',
|
|
1622
|
+
KNOWLEDGE_LEVELS: '/knowledge/levels',
|
|
1623
|
+
KNOWLEDGE_USAGE: '/knowledge/usage',
|
|
1624
|
+
KNOWLEDGE_SEARCH: '/knowledge/search',
|
|
1625
|
+
KNOWLEDGE_NOTES: '/knowledge/notes',
|
|
1626
|
+
KNOWLEDGE_LINKS: '/knowledge/links',
|
|
1627
|
+
KNOWLEDGE_FILES: '/knowledge/files',
|
|
1628
|
+
KNOWLEDGE_ITEM: '/knowledge/:id',
|
|
1629
|
+
KNOWLEDGE_ITEM_REFRESH: '/knowledge/:id/refresh',
|
|
1630
|
+
KNOWLEDGE_SUGGESTIONS: '/knowledge/suggestions',
|
|
1631
|
+
KNOWLEDGE_SUGGESTION_ACCEPT: '/knowledge/suggestions/:id/accept',
|
|
1632
|
+
KNOWLEDGE_SUGGESTION_DISMISS: '/knowledge/suggestions/:id/dismiss',
|
|
1633
|
+
KNOWLEDGE_FLAGS: '/knowledge/flags',
|
|
1634
|
+
KNOWLEDGE_FLAG_DISMISS: '/knowledge/flags/:id/dismiss',
|
|
1635
|
+
KNOWLEDGE_CONNECTORS: '/knowledge/connectors',
|
|
1636
|
+
KNOWLEDGE_CONNECTOR: '/knowledge/connectors/:id',
|
|
1637
|
+
KNOWLEDGE_CONNECTOR_SYNC: '/knowledge/connectors/:id/sync',
|
|
1638
|
+
KNOWLEDGE_DRAFTS: '/knowledge/drafts',
|
|
1639
|
+
KNOWLEDGE_STATS: '/knowledge/stats',
|
|
1640
|
+
SECURITY_STEP_UP: '/security/step-up',
|
|
1641
|
+
SECURITY_STEP_UP_VERIFY: '/security/step-up/verify',
|
|
1642
|
+
SENDER: '/senders/:email',
|
|
1643
|
+
SENDER_RESEARCH: '/senders/:email/research',
|
|
1644
|
+
ANALYTICS_MAILBOX: '/analytics/mailbox',
|
|
1645
|
+
ANALYTICS_SENDING: '/analytics/sending',
|
|
1646
|
+
CHATS: '/chats',
|
|
1647
|
+
CHAT: '/chats/:id',
|
|
1648
|
+
MAILBOX_EXPORTS: '/exports',
|
|
1649
|
+
MAILBOX_EXPORTS_PREVIEW: '/exports/preview',
|
|
1650
|
+
MAILBOX_EXPORT: '/exports/:id',
|
|
1651
|
+
MAILBOX_EXPORT_CONTENT: '/exports/:id/content',
|
|
1652
|
+
ENCRYPTION_KEYS: '/encryption/keys',
|
|
1653
|
+
ENCRYPTION_KEYS_LOOKUP: '/encryption/keys/lookup',
|
|
1654
|
+
BILLING: '/billing',
|
|
1655
|
+
BILLING_PLANS: '/billing/plans',
|
|
1656
|
+
BILLING_USAGE: '/billing/usage',
|
|
1657
|
+
BILLING_ALERTS: '/billing/alerts',
|
|
1658
|
+
BILLING_COUNTRIES: '/billing/countries',
|
|
1659
|
+
BILLING_PAY_AS_YOU_GO: '/billing/pay-as-you-go',
|
|
1660
|
+
BILLING_PAY_AS_YOU_GO_LIMIT: '/billing/pay-as-you-go/limit',
|
|
1661
|
+
BILLING_PAY_AS_YOU_GO_CONFIRM: '/billing/pay-as-you-go/confirm',
|
|
1662
|
+
BILLING_CHECKOUT: '/billing/checkout',
|
|
1663
|
+
BILLING_PORTAL: '/billing/portal',
|
|
1664
|
+
BILLING_INVOICES: '/billing/invoices',
|
|
1665
|
+
BILLING_INVOICE: '/billing/invoices/:orderId',
|
|
1666
|
+
BILLING_INVOICE_DETAILS: '/billing/invoices/:orderId/details',
|
|
1667
|
+
SUPPORT: '/support',
|
|
1668
|
+
TOOLS_DMARC: '/tools/dmarc',
|
|
1669
|
+
TOOLS_BIMI: '/tools/bimi',
|
|
1670
|
+
TOOLS_DELIVERABILITY: '/tools/deliverability',
|
|
1671
|
+
TOOLS_VERIFICATION_CODE: '/tools/verification-code',
|
|
1672
|
+
TOOLS_COST: '/tools/cost',
|
|
1673
|
+
SUBSCRIPTIONS: '/subscriptions',
|
|
1674
|
+
SUBSCRIPTION_UNSUBSCRIBE: '/subscriptions/:id/unsubscribe',
|
|
1675
|
+
SUBSCRIPTION_MOVE: '/subscriptions/:id/move',
|
|
1676
|
+
SUBSCRIPTION_DOMAINS: '/subscriptions/domains',
|
|
1677
|
+
SUBSCRIPTION_DOMAIN_UNSUBSCRIBE: '/subscriptions/domains/:domain/unsubscribe',
|
|
1678
|
+
WORKSPACES: '/workspaces',
|
|
1679
|
+
WORKSPACES_ACTIVE: '/workspaces/active',
|
|
1680
|
+
WORKSPACE: '/workspaces/:id',
|
|
1681
|
+
ACCOUNT_NOTIFICATIONS: '/account/notifications',
|
|
1682
|
+
ACCOUNT_NOTIFICATION_EMAIL: '/account/notifications/email/:category',
|
|
1683
|
+
ACCOUNT_NOTIFICATION_PUSH: '/account/notifications/push/:workspaceId',
|
|
1684
|
+
ACCOUNT_PHOTO: '/account/photo',
|
|
1685
|
+
ACCOUNT_USERNAME: '/account/username',
|
|
1686
|
+
ACCOUNT_USERNAME_AVAILABILITY: '/account/username/availability',
|
|
1687
|
+
ACCOUNT_CONNECTED_APPS: '/account/connected-apps',
|
|
1688
|
+
ACCOUNT_CONNECTED_APP: '/account/connected-apps/:clientId',
|
|
1689
|
+
ACCOUNT_INVITATIONS: '/account/invitations',
|
|
1690
|
+
ACCOUNT_INVITATION_ACCEPT: '/account/invitations/:invitationId/accept',
|
|
1691
|
+
ACCOUNT_INVITATION_DECLINE: '/account/invitations/:invitationId/decline',
|
|
1692
|
+
TEMP_MAIL_DOMAINS: '/temp-mail/domains',
|
|
1693
|
+
TEMP_MAIL_INBOXES: '/temp-mail/inboxes',
|
|
1694
|
+
TEMP_MAIL_INBOX: '/temp-mail/inboxes/:id',
|
|
1695
|
+
TEMP_MAIL_INBOX_EXTEND: '/temp-mail/inboxes/:id/extend',
|
|
1696
|
+
TEMP_MAIL_MESSAGES: '/temp-mail/inboxes/:id/messages',
|
|
1697
|
+
TEMP_MAIL_MESSAGE: '/temp-mail/inboxes/:id/messages/:messageId',
|
|
1698
|
+
TEMP_MAIL_MESSAGE_ATTACHMENTS: '/temp-mail/inboxes/:id/messages/:messageId/attachments',
|
|
1699
|
+
SUBSCRIBE_FORM: '/subscribe/:formId'};
|
|
1700
|
+
|
|
1701
|
+
const PATH_PARAM = /:([A-Za-z0-9_]+)(?:\{[^}]*\})?/g;
|
|
1702
|
+
const OPTIONAL_PATH_PARAM = /\/:([A-Za-z0-9_]+)\?/g;
|
|
1703
|
+
const fillPath = (pattern, params) => {
|
|
1704
|
+
const values = params;
|
|
1705
|
+
return pattern
|
|
1706
|
+
.replace(OPTIONAL_PATH_PARAM, (_, name) => {
|
|
1707
|
+
const value = values[name];
|
|
1708
|
+
return value === undefined || value === '' ? '' : `/${encodeURIComponent(String(value))}`;
|
|
1709
|
+
})
|
|
1710
|
+
.replace(PATH_PARAM, (_, name) => encodeURIComponent(String(values[name] ?? '')));
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1713
|
+
({
|
|
1714
|
+
scopes: [API_SCOPES.KEYS_MANAGE]});
|
|
1715
|
+
|
|
1716
|
+
({
|
|
1717
|
+
scopes: [API_SCOPES.KEYS_MANAGE]});
|
|
1718
|
+
|
|
1719
|
+
({
|
|
1720
|
+
scopes: [API_SCOPES.KEYS_READ]});
|
|
1721
|
+
|
|
1722
|
+
({
|
|
1723
|
+
scopes: [API_SCOPES.KEYS_READ]});
|
|
1724
|
+
|
|
1725
|
+
({
|
|
1726
|
+
scopes: [API_SCOPES.KEYS_READ]});
|
|
1727
|
+
|
|
1728
|
+
({
|
|
1729
|
+
scopes: [API_SCOPES.KEYS_READ]});
|
|
1730
|
+
|
|
1731
|
+
({
|
|
1732
|
+
scopes: [API_SCOPES.KEYS_READ]});
|
|
1733
|
+
|
|
1734
|
+
({
|
|
844
1735
|
scopes: [API_SCOPES.KEYS_READ]});
|
|
845
1736
|
|
|
846
1737
|
({
|
|
@@ -968,8 +1859,10 @@ class OpenEmailApiError extends Error {
|
|
|
968
1859
|
docUrl;
|
|
969
1860
|
requestId;
|
|
970
1861
|
retryAfterSeconds;
|
|
1862
|
+
fields;
|
|
1863
|
+
body;
|
|
971
1864
|
constructor(props) {
|
|
972
|
-
const { message, status, type, code, param, docUrl, requestId, retryAfterSeconds } = props;
|
|
1865
|
+
const { message, status, type, code, param, docUrl, requestId, retryAfterSeconds, fields, body } = props;
|
|
973
1866
|
super(message);
|
|
974
1867
|
this.name = ERROR_NAMES.API;
|
|
975
1868
|
this.status = status;
|
|
@@ -979,6 +1872,8 @@ class OpenEmailApiError extends Error {
|
|
|
979
1872
|
this.docUrl = docUrl;
|
|
980
1873
|
this.requestId = requestId;
|
|
981
1874
|
this.retryAfterSeconds = retryAfterSeconds;
|
|
1875
|
+
this.fields = fields;
|
|
1876
|
+
this.body = body;
|
|
982
1877
|
}
|
|
983
1878
|
get isAuth() {
|
|
984
1879
|
return this.type === ERROR_TYPES.AUTHENTICATION_ERROR;
|
|
@@ -1028,7 +1923,7 @@ class OpenEmailNetworkError extends Error {
|
|
|
1028
1923
|
let checked = false;
|
|
1029
1924
|
const Parts = (value) => value
|
|
1030
1925
|
.trim()
|
|
1031
|
-
.replace(
|
|
1926
|
+
.replace(VERSION_TAG_PREFIX, '')
|
|
1032
1927
|
.split('.')
|
|
1033
1928
|
.map(part => Number.parseInt(part, 10));
|
|
1034
1929
|
const IsNewer = (candidate, current) => {
|
|
@@ -1091,20 +1986,18 @@ const Backoff = (attempt) => {
|
|
|
1091
1986
|
return Math.round(ceiling * (0.5 + Math.random() * 0.5));
|
|
1092
1987
|
};
|
|
1093
1988
|
|
|
1094
|
-
const PATH_SHAPE = 'is not a usable request path. Pass a path on the API that begins with a single "/", such as "/threads". Anything else could send the request, and the credential it carries, to another host.';
|
|
1095
|
-
const OFF_ORIGIN = 'leaves the API origin, so the request was not sent. Pass a path on the API that begins with a single "/", such as "/threads".';
|
|
1096
1989
|
const ApiUrl = (baseUrl, path) => {
|
|
1097
1990
|
if (typeof path !== 'string' || !path.startsWith('/') || path.startsWith('//') || path.startsWith('/\\')) {
|
|
1098
|
-
throw new Error(`${JSON.stringify(path)} ${PATH_SHAPE}`);
|
|
1991
|
+
throw new Error(`${JSON.stringify(path)} ${CLIENT_MESSAGES.PATH_SHAPE}`);
|
|
1099
1992
|
}
|
|
1100
|
-
const url = `${baseUrl.replace(
|
|
1993
|
+
const url = `${baseUrl.replace(TRAILING_SLASHES, '')}${path}`;
|
|
1101
1994
|
let origin = null;
|
|
1102
1995
|
try {
|
|
1103
1996
|
origin = new URL(url).origin;
|
|
1104
1997
|
}
|
|
1105
1998
|
catch { }
|
|
1106
1999
|
if (origin === null || origin !== new URL(baseUrl).origin)
|
|
1107
|
-
throw new Error(`${JSON.stringify(path)} ${OFF_ORIGIN}`);
|
|
2000
|
+
throw new Error(`${JSON.stringify(path)} ${CLIENT_MESSAGES.OFF_ORIGIN}`);
|
|
1108
2001
|
return url;
|
|
1109
2002
|
};
|
|
1110
2003
|
|
|
@@ -1222,6 +2115,11 @@ const ReadPayload = (body) => {
|
|
|
1222
2115
|
return typeof error === 'object' && error !== null ? error : {};
|
|
1223
2116
|
};
|
|
1224
2117
|
const Text = (value) => typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
2118
|
+
const IsFieldProblem = (value) => typeof value === 'object'
|
|
2119
|
+
&& value !== null
|
|
2120
|
+
&& typeof value.key === 'string'
|
|
2121
|
+
&& typeof value.error === 'string';
|
|
2122
|
+
const Fields = (value) => Array.isArray(value) ? value.filter(IsFieldProblem) : undefined;
|
|
1225
2123
|
const ToErrorProps = (response, body, rawText, retryAfterSeconds) => {
|
|
1226
2124
|
const payload = ReadPayload(body);
|
|
1227
2125
|
return {
|
|
@@ -1233,14 +2131,16 @@ const ToErrorProps = (response, body, rawText, retryAfterSeconds) => {
|
|
|
1233
2131
|
param: Text(payload.param),
|
|
1234
2132
|
docUrl: Text(payload.docUrl),
|
|
1235
2133
|
requestId: Text(payload.requestId) ?? response.headers.get(HEADER_KEYS.REQUEST_ID) ?? undefined,
|
|
1236
|
-
retryAfterSeconds
|
|
2134
|
+
retryAfterSeconds,
|
|
2135
|
+
fields: Fields(payload.fields),
|
|
2136
|
+
body
|
|
1237
2137
|
};
|
|
1238
2138
|
};
|
|
1239
2139
|
|
|
1240
2140
|
const Substitute = (url) => {
|
|
1241
2141
|
const suggestion = new URL(url.href);
|
|
1242
2142
|
suggestion.hostname = url.hostname.startsWith('[') ? LOOPBACK_IPV6_ADDRESS : LOOPBACK_IPV4_ADDRESS;
|
|
1243
|
-
return suggestion.href.replace(
|
|
2143
|
+
return suggestion.href.replace(TRAILING_SLASHES, '');
|
|
1244
2144
|
};
|
|
1245
2145
|
const UnspecifiedHostMessage = (baseUrl, url) => `${JSON.stringify(baseUrl)} names ${url.hostname}, an address a server listens on, not one to send requests to. For a server on this machine, use ${Substitute(url)}.`;
|
|
1246
2146
|
|
|
@@ -1265,7 +2165,7 @@ const ParseBaseUrl = (value) => {
|
|
|
1265
2165
|
}
|
|
1266
2166
|
};
|
|
1267
2167
|
const ValidBaseUrl = (value) => {
|
|
1268
|
-
const trimmed = value.trim().replace(
|
|
2168
|
+
const trimmed = value.trim().replace(TRAILING_SLASHES, '');
|
|
1269
2169
|
const parsed = ParseBaseUrl(trimmed);
|
|
1270
2170
|
if (!parsed)
|
|
1271
2171
|
throw new Error(`${JSON.stringify(value)} ${CLIENT_MESSAGES.BASE_URL_SHAPE}`);
|
|
@@ -1461,75 +2361,9 @@ const FetchList = async (transport, path, options = {}, query) => {
|
|
|
1461
2361
|
return (payload?.data ?? []);
|
|
1462
2362
|
};
|
|
1463
2363
|
|
|
1464
|
-
const Segment = (value) => {
|
|
1465
|
-
if (typeof value !== 'string' || value.length === 0)
|
|
1466
|
-
throw new Error(CLIENT_MESSAGES.EMPTY_SEGMENT);
|
|
1467
|
-
if (/^\.+$/.test(value))
|
|
1468
|
-
throw new Error(`${JSON.stringify(value)} ${CLIENT_MESSAGES.DOT_SEGMENT}`);
|
|
1469
|
-
return encodeURIComponent(value);
|
|
1470
|
-
};
|
|
1471
|
-
const EmailPath = (id) => `${PATHS.EMAILS}/${Segment(id)}`;
|
|
1472
|
-
const EmailChildPath = (id, segment) => `${EmailPath(id)}/${segment}`;
|
|
1473
|
-
const ThreadPath = (id) => `${PATHS.THREADS}/${Segment(id)}`;
|
|
1474
|
-
const ThreadChildPath = (id, segment) => `${ThreadPath(id)}/${segment}`;
|
|
1475
|
-
const ThreadMessageAttachmentsPath = (id, messageId) => `${ThreadPath(id)}/${SEGMENTS.MESSAGES}/${Segment(messageId)}/${SEGMENTS.ATTACHMENTS}`;
|
|
1476
|
-
const DraftPath = (id) => `${PATHS.DRAFTS}/${Segment(id)}`;
|
|
1477
|
-
const LabelPath = (id) => `${PATHS.LABELS}/${Segment(id)}`;
|
|
1478
|
-
const ContactPath = (email) => `${PATHS.CONTACTS}/${Segment(email)}`;
|
|
1479
|
-
const ContactChildPath = (email, segment) => `${ContactPath(email)}/${segment}`;
|
|
1480
|
-
const AudiencePath = (id) => `${PATHS.AUDIENCES}/${Segment(id)}`;
|
|
1481
|
-
const AudienceChildPath = (id, segment) => `${AudiencePath(id)}/${segment}`;
|
|
1482
|
-
const AudienceContactsPath = (id) => `${AudiencePath(id)}/${SEGMENTS.CONTACTS}`;
|
|
1483
|
-
const AudienceContactsChildPath = (id, segment) => `${AudienceContactsPath(id)}/${segment}`;
|
|
1484
|
-
const AudienceContactPath = (id, email) => `${AudienceContactsPath(id)}/${Segment(email)}`;
|
|
1485
|
-
const BroadcastPath = (id) => `${PATHS.BROADCASTS}/${Segment(id)}`;
|
|
1486
|
-
const BroadcastChildPath = (id, segment) => `${BroadcastPath(id)}/${segment}`;
|
|
1487
|
-
const BroadcastRecipientPath = (id, emailId) => `${BroadcastChildPath(id, SEGMENTS.RECIPIENTS)}/${Segment(emailId)}`;
|
|
1488
|
-
const DomainPath = (id) => `${PATHS.DOMAINS}/${Segment(id)}`;
|
|
1489
|
-
const DomainChildPath = (id, segment) => `${DomainPath(id)}/${segment}`;
|
|
1490
|
-
const DomainAddressesPath = (id) => `${DomainPath(id)}/${SEGMENTS.ADDRESSES}`;
|
|
1491
|
-
const DomainAddressPath = (id, addressId) => `${DomainAddressesPath(id)}/${Segment(addressId)}`;
|
|
1492
|
-
const WebhookPath = (id) => `${PATHS.WEBHOOKS}/${Segment(id)}`;
|
|
1493
|
-
const WebhookChildPath = (id, segment) => `${WebhookPath(id)}/${segment}`;
|
|
1494
|
-
const WebhookDeliveryPath = (id, deliveryId) => `${WebhookChildPath(id, SEGMENTS.DELIVERIES)}/${Segment(deliveryId)}`;
|
|
1495
|
-
const WebhookDeliveryReplayPath = (id, deliveryId) => `${WebhookDeliveryPath(id, deliveryId)}/${SEGMENTS.REPLAY}`;
|
|
1496
|
-
const KeyPath = (id) => `${PATHS.KEYS}/${Segment(id)}`;
|
|
1497
|
-
const KeyChildPath = (id, segment) => `${KeyPath(id)}/${segment}`;
|
|
1498
|
-
const ImportPath = (id) => `${PATHS.IMPORTS}/${Segment(id)}`;
|
|
1499
|
-
const ProviderImportPath = (id) => `${PATHS.PROVIDER_IMPORTS}/${Segment(id)}`;
|
|
1500
|
-
const ProviderImportChildPath = (id, segment) => `${ProviderImportPath(id)}/${segment}`;
|
|
1501
|
-
const ImportChildPath = (id, segment) => `${ImportPath(id)}/${segment}`;
|
|
1502
|
-
const ImportChunkPath = (id, file, chunk) => `${ImportPath(id)}/${SEGMENTS.FILES}/${Segment(String(file))}/${SEGMENTS.CHUNKS}/${Segment(String(chunk))}`;
|
|
1503
|
-
const TemplatePath = (idOrSlug) => `${PATHS.TEMPLATES}/${Segment(idOrSlug)}`;
|
|
1504
|
-
const TemplateChildPath = (idOrSlug, segment) => `${TemplatePath(idOrSlug)}/${segment}`;
|
|
1505
|
-
const TemplateStarterPath = (slug) => `${PATHS.TEMPLATES_STARTERS}/${Segment(slug)}`;
|
|
1506
|
-
const TemplateVersionPath = (idOrSlug, version) => `${TemplateChildPath(idOrSlug, SEGMENTS.VERSIONS)}/${Segment(String(version))}`;
|
|
1507
|
-
const TemplateVersionChildPath = (idOrSlug, version, segment) => `${TemplateVersionPath(idOrSlug, version)}/${segment}`;
|
|
1508
|
-
const RulePath = (id) => `${PATHS.RULES}/${Segment(id)}`;
|
|
1509
|
-
const RuleChildPath = (id, segment) => `${RulePath(id)}/${segment}`;
|
|
1510
|
-
const TrackingPath = (id) => `${PATHS.TRACKING}/${Segment(id)}`;
|
|
1511
|
-
const TrackingChildPath = (id, segment) => `${TrackingPath(id)}/${segment}`;
|
|
1512
|
-
const CalendarEventPath = (id) => `${PATHS.CALENDAR_EVENTS}/${Segment(id)}`;
|
|
1513
|
-
const CalendarEventIcsPath = (id) => `${CalendarEventPath(id)}/${SEGMENTS.ICS}`;
|
|
1514
|
-
const RolePath = (id) => `${PATHS.ROLES}/${Segment(id)}`;
|
|
1515
|
-
const MemberPath = (userId) => `${PATHS.MEMBERS}/${Segment(userId)}`;
|
|
1516
|
-
const MemberAddressesPath = (userId) => `${MemberPath(userId)}/${SEGMENTS.ADDRESSES}`;
|
|
1517
|
-
const MemberAddressPath = (userId, addressId) => `${MemberAddressesPath(userId)}/${Segment(addressId)}`;
|
|
1518
|
-
const MemberInvitationPath = (id) => `${PATHS.MEMBERS_INVITATIONS}/${Segment(id)}`;
|
|
1519
|
-
const MemberInvitationResendPath = (id) => `${MemberInvitationPath(id)}/${SEGMENTS.RESEND}`;
|
|
1520
|
-
const SuppressionPath = (id) => `${PATHS.SUPPRESSIONS}/${Segment(id)}`;
|
|
1521
|
-
const FilePath = (id) => `${PATHS.FILES}/${Segment(id)}`;
|
|
1522
|
-
const FileChildPath = (id, segment) => `${FilePath(id)}/${segment}`;
|
|
1523
|
-
const FileLinkPath = (id, linkId) => `${FileChildPath(id, SEGMENTS.LINKS)}/${Segment(linkId)}`;
|
|
1524
|
-
const TempInboxPath = (id) => `${PATHS.TEMP_MAIL_INBOXES}/${Segment(id)}`;
|
|
1525
|
-
const TempInboxExtendPath = (id) => `${TempInboxPath(id)}/${SEGMENTS.EXTEND}`;
|
|
1526
|
-
const TempMessagesPath = (id) => `${TempInboxPath(id)}/${SEGMENTS.MESSAGES}`;
|
|
1527
|
-
const TempMessagePath = (id, messageId) => `${TempMessagesPath(id)}/${Segment(messageId)}`;
|
|
1528
|
-
const TempMessageAttachmentsPath = (id, messageId) => `${TempMessagePath(id, messageId)}/${SEGMENTS.ATTACHMENTS}`;
|
|
1529
|
-
|
|
1530
2364
|
const Addresses = (transport) => {
|
|
1531
2365
|
const page = async (options = {}) => {
|
|
1532
|
-
const envelope = await transport.request(
|
|
2366
|
+
const envelope = await transport.request(API_PATHS.ADDRESSES, {
|
|
1533
2367
|
query: { [QUERY_KEYS.LIMIT]: options.limit, [CURSOR_STYLES.CURSOR.PARAM]: options.cursor },
|
|
1534
2368
|
signal: options.signal,
|
|
1535
2369
|
apiKey: options.apiKey
|
|
@@ -1546,18 +2380,56 @@ const Addresses = (transport) => {
|
|
|
1546
2380
|
return {
|
|
1547
2381
|
list: page,
|
|
1548
2382
|
listAll: async (options = {}) => {
|
|
2383
|
+
let cursor = options.cursor;
|
|
1549
2384
|
let current = await page(options);
|
|
1550
2385
|
const addresses = [...current.addresses];
|
|
1551
|
-
while (current.hasMore && current.nextCursor) {
|
|
1552
|
-
|
|
2386
|
+
while (current.hasMore && current.nextCursor && current.nextCursor !== cursor) {
|
|
2387
|
+
cursor = current.nextCursor;
|
|
2388
|
+
current = await page({ ...options, cursor });
|
|
1553
2389
|
addresses.push(...current.addresses);
|
|
1554
2390
|
}
|
|
1555
2391
|
return { unrestricted: current.unrestricted, addresses, domains: current.domains };
|
|
1556
2392
|
},
|
|
1557
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2393
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.ADDRESSES, CURSOR_STYLES.CURSOR, options)
|
|
1558
2394
|
};
|
|
1559
2395
|
};
|
|
1560
2396
|
|
|
2397
|
+
const AppHost = (transport) => ({
|
|
2398
|
+
get: (options = {}) => transport.request(API_PATHS.APP_HOST, { signal: options.signal, apiKey: options.apiKey }),
|
|
2399
|
+
set: (body, options = {}) => transport.request(API_PATHS.APP_HOST, {
|
|
2400
|
+
method: HTTP_METHODS.PUT,
|
|
2401
|
+
body,
|
|
2402
|
+
repeatable: true,
|
|
2403
|
+
signal: options.signal,
|
|
2404
|
+
apiKey: options.apiKey
|
|
2405
|
+
}),
|
|
2406
|
+
verify: (options = {}) => transport.request(API_PATHS.APP_HOST_VERIFY, {
|
|
2407
|
+
method: HTTP_METHODS.POST,
|
|
2408
|
+
repeatable: true,
|
|
2409
|
+
signal: options.signal,
|
|
2410
|
+
apiKey: options.apiKey
|
|
2411
|
+
}),
|
|
2412
|
+
delete: (options = {}) => transport.request(API_PATHS.APP_HOST, {
|
|
2413
|
+
method: HTTP_METHODS.DELETE,
|
|
2414
|
+
repeatable: true,
|
|
2415
|
+
signal: options.signal,
|
|
2416
|
+
apiKey: options.apiKey
|
|
2417
|
+
})
|
|
2418
|
+
});
|
|
2419
|
+
|
|
2420
|
+
const AssertSegment = (value) => {
|
|
2421
|
+
if ((typeof value !== 'string' && typeof value !== 'number') || String(value).length === 0)
|
|
2422
|
+
throw new Error(CLIENT_MESSAGES.EMPTY_SEGMENT);
|
|
2423
|
+
if (DOT_ONLY_SEGMENT.test(String(value)))
|
|
2424
|
+
throw new Error(`${JSON.stringify(String(value))} ${CLIENT_MESSAGES.DOT_SEGMENT}`);
|
|
2425
|
+
};
|
|
2426
|
+
const RequestPath = (pattern, params) => {
|
|
2427
|
+
const values = params;
|
|
2428
|
+
for (const [, name] of pattern.matchAll(PATH_PARAM))
|
|
2429
|
+
AssertSegment(values[name]);
|
|
2430
|
+
return fillPath(pattern, params);
|
|
2431
|
+
};
|
|
2432
|
+
|
|
1561
2433
|
const MemberQuery = (options) => ({
|
|
1562
2434
|
[QUERY_KEYS.Q]: options.q,
|
|
1563
2435
|
[QUERY_KEYS.SOURCE]: options.source,
|
|
@@ -1572,70 +2444,162 @@ const GrowthQuery = (options) => ({
|
|
|
1572
2444
|
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes
|
|
1573
2445
|
});
|
|
1574
2446
|
const Audiences = (transport) => ({
|
|
1575
|
-
list: (options = {}) => FetchPage(transport,
|
|
1576
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
1577
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
1578
|
-
growth: (options = {}) => transport.request(
|
|
2447
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.AUDIENCES, CURSOR_STYLES.CURSOR, options),
|
|
2448
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.AUDIENCES, CURSOR_STYLES.CURSOR, options),
|
|
2449
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.AUDIENCES, CURSOR_STYLES.CURSOR, options),
|
|
2450
|
+
growth: (options = {}) => transport.request(API_PATHS.AUDIENCES_GROWTH, {
|
|
1579
2451
|
query: GrowthQuery(options),
|
|
1580
2452
|
signal: options.signal,
|
|
1581
2453
|
apiKey: options.apiKey
|
|
1582
2454
|
}),
|
|
1583
|
-
get: (id, options = {}) => transport.request(
|
|
1584
|
-
create: (body, options = {}) => transport.request(
|
|
2455
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.AUDIENCE, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
2456
|
+
create: (body, options = {}) => transport.request(API_PATHS.AUDIENCES, {
|
|
1585
2457
|
method: HTTP_METHODS.POST,
|
|
1586
2458
|
body,
|
|
1587
2459
|
signal: options.signal,
|
|
1588
2460
|
apiKey: options.apiKey
|
|
1589
2461
|
}),
|
|
1590
|
-
update: (id, patch, options = {}) => transport.request(
|
|
2462
|
+
update: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.AUDIENCE, { id }), {
|
|
1591
2463
|
method: HTTP_METHODS.PATCH,
|
|
1592
2464
|
body: patch,
|
|
1593
2465
|
repeatable: true,
|
|
1594
2466
|
signal: options.signal,
|
|
1595
2467
|
apiKey: options.apiKey
|
|
1596
2468
|
}),
|
|
1597
|
-
delete: (id, options = {}) => transport.request(
|
|
2469
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.AUDIENCE, { id }), {
|
|
1598
2470
|
method: HTTP_METHODS.DELETE,
|
|
1599
2471
|
signal: options.signal,
|
|
1600
2472
|
apiKey: options.apiKey
|
|
1601
2473
|
}),
|
|
1602
|
-
empty: (id, options = {}) => transport.request(
|
|
2474
|
+
empty: (id, options = {}) => transport.request(RequestPath(API_PATHS.AUDIENCE_EMPTY, { id }), {
|
|
1603
2475
|
method: HTTP_METHODS.POST,
|
|
1604
2476
|
signal: options.signal,
|
|
1605
2477
|
apiKey: options.apiKey
|
|
1606
2478
|
}),
|
|
1607
|
-
listContacts: (id, options = {}) => FetchPage(transport,
|
|
1608
|
-
listAllContacts: (id, options = {}) => CollectAll(transport,
|
|
1609
|
-
iterateContacts: (id, options = {}) => IteratePages(transport,
|
|
1610
|
-
addContact: (id, body, options = {}) => transport.request(
|
|
2479
|
+
listContacts: (id, options = {}) => FetchPage(transport, RequestPath(API_PATHS.AUDIENCE_CONTACTS, { id }), CURSOR_STYLES.CURSOR, options, MemberQuery(options)),
|
|
2480
|
+
listAllContacts: (id, options = {}) => CollectAll(transport, RequestPath(API_PATHS.AUDIENCE_CONTACTS, { id }), CURSOR_STYLES.CURSOR, options, MemberQuery(options)),
|
|
2481
|
+
iterateContacts: (id, options = {}) => IteratePages(transport, RequestPath(API_PATHS.AUDIENCE_CONTACTS, { id }), CURSOR_STYLES.CURSOR, options, MemberQuery(options)),
|
|
2482
|
+
addContact: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.AUDIENCE_CONTACTS, { id }), {
|
|
1611
2483
|
method: HTTP_METHODS.POST,
|
|
1612
2484
|
body,
|
|
1613
2485
|
repeatable: true,
|
|
1614
2486
|
signal: options.signal,
|
|
1615
2487
|
apiKey: options.apiKey
|
|
1616
2488
|
}),
|
|
1617
|
-
removeContact: (id, email, options = {}) => transport.request(
|
|
2489
|
+
removeContact: (id, email, options = {}) => transport.request(RequestPath(API_PATHS.AUDIENCE_CONTACT, { id, email }), {
|
|
1618
2490
|
method: HTTP_METHODS.DELETE,
|
|
1619
2491
|
signal: options.signal,
|
|
1620
2492
|
apiKey: options.apiKey
|
|
1621
2493
|
}),
|
|
1622
|
-
addContacts: (id, body, options = {}) => transport.request(
|
|
2494
|
+
addContacts: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.AUDIENCE_CONTACTS_BATCH, { id }), {
|
|
2495
|
+
method: HTTP_METHODS.POST,
|
|
2496
|
+
body,
|
|
2497
|
+
repeatable: true,
|
|
2498
|
+
signal: options.signal,
|
|
2499
|
+
apiKey: options.apiKey
|
|
2500
|
+
}),
|
|
2501
|
+
removeContacts: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.AUDIENCE_CONTACTS_BATCH_REMOVE, { id }), {
|
|
1623
2502
|
method: HTTP_METHODS.POST,
|
|
1624
2503
|
body,
|
|
1625
2504
|
repeatable: true,
|
|
1626
2505
|
signal: options.signal,
|
|
1627
2506
|
apiKey: options.apiKey
|
|
1628
2507
|
}),
|
|
1629
|
-
|
|
2508
|
+
importContacts: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.AUDIENCE_IMPORT, { id }), {
|
|
1630
2509
|
method: HTTP_METHODS.POST,
|
|
1631
2510
|
body,
|
|
1632
2511
|
repeatable: true,
|
|
1633
2512
|
signal: options.signal,
|
|
1634
2513
|
apiKey: options.apiKey
|
|
2514
|
+
})
|
|
2515
|
+
});
|
|
2516
|
+
|
|
2517
|
+
const Billing = (transport) => ({
|
|
2518
|
+
get: (options = {}) => transport.request(API_PATHS.BILLING, { signal: options.signal, apiKey: options.apiKey }),
|
|
2519
|
+
listPlans: (options = {}) => transport.request(API_PATHS.BILLING_PLANS, { signal: options.signal, apiKey: options.apiKey }),
|
|
2520
|
+
getUsage: (options = {}) => transport.request(API_PATHS.BILLING_USAGE, {
|
|
2521
|
+
query: { [QUERY_KEYS.DAYS]: options.days },
|
|
2522
|
+
signal: options.signal,
|
|
2523
|
+
apiKey: options.apiKey
|
|
2524
|
+
}),
|
|
2525
|
+
listAlerts: (options = {}) => transport.request(API_PATHS.BILLING_ALERTS, { signal: options.signal, apiKey: options.apiKey }),
|
|
2526
|
+
listCountries: (options = {}) => transport.request(API_PATHS.BILLING_COUNTRIES, { signal: options.signal, apiKey: options.apiKey }),
|
|
2527
|
+
getPayAsYouGo: (options = {}) => transport.request(API_PATHS.BILLING_PAY_AS_YOU_GO, { signal: options.signal, apiKey: options.apiKey }),
|
|
2528
|
+
setPayAsYouGo: (body, options = {}) => transport.request(API_PATHS.BILLING_PAY_AS_YOU_GO, {
|
|
2529
|
+
method: HTTP_METHODS.PATCH,
|
|
2530
|
+
body,
|
|
2531
|
+
signal: options.signal,
|
|
2532
|
+
apiKey: options.apiKey
|
|
2533
|
+
}),
|
|
2534
|
+
setPayAsYouGoLimit: (body, options = {}) => transport.request(API_PATHS.BILLING_PAY_AS_YOU_GO_LIMIT, {
|
|
2535
|
+
method: HTTP_METHODS.PUT,
|
|
2536
|
+
body,
|
|
2537
|
+
signal: options.signal,
|
|
2538
|
+
apiKey: options.apiKey
|
|
2539
|
+
}),
|
|
2540
|
+
confirmPayAsYouGo: (options = {}) => transport.request(API_PATHS.BILLING_PAY_AS_YOU_GO_CONFIRM, {
|
|
2541
|
+
method: HTTP_METHODS.POST,
|
|
2542
|
+
signal: options.signal,
|
|
2543
|
+
apiKey: options.apiKey
|
|
2544
|
+
}),
|
|
2545
|
+
startCheckout: (body, options = {}) => transport.request(API_PATHS.BILLING_CHECKOUT, {
|
|
2546
|
+
method: HTTP_METHODS.POST,
|
|
2547
|
+
body,
|
|
2548
|
+
signal: options.signal,
|
|
2549
|
+
apiKey: options.apiKey
|
|
1635
2550
|
}),
|
|
1636
|
-
|
|
2551
|
+
openPortal: (body = {}, options = {}) => transport.request(API_PATHS.BILLING_PORTAL, {
|
|
1637
2552
|
method: HTTP_METHODS.POST,
|
|
1638
2553
|
body,
|
|
2554
|
+
signal: options.signal,
|
|
2555
|
+
apiKey: options.apiKey
|
|
2556
|
+
}),
|
|
2557
|
+
listInvoices: (options = {}) => transport.request(API_PATHS.BILLING_INVOICES, {
|
|
2558
|
+
query: {
|
|
2559
|
+
[QUERY_KEYS.PAGE]: options.page,
|
|
2560
|
+
[QUERY_KEYS.LIMIT]: options.limit,
|
|
2561
|
+
[QUERY_KEYS.SORT]: options.sort,
|
|
2562
|
+
[QUERY_KEYS.SEARCH]: options.search
|
|
2563
|
+
},
|
|
2564
|
+
signal: options.signal,
|
|
2565
|
+
apiKey: options.apiKey
|
|
2566
|
+
}),
|
|
2567
|
+
getInvoice: (orderId, options = {}) => transport.request(RequestPath(API_PATHS.BILLING_INVOICE, { orderId }), {
|
|
2568
|
+
signal: options.signal,
|
|
2569
|
+
apiKey: options.apiKey
|
|
2570
|
+
}),
|
|
2571
|
+
saveInvoiceDetails: (orderId, body, options = {}) => transport.request(RequestPath(API_PATHS.BILLING_INVOICE_DETAILS, { orderId }), {
|
|
2572
|
+
method: HTTP_METHODS.PUT,
|
|
2573
|
+
body,
|
|
2574
|
+
signal: options.signal,
|
|
2575
|
+
apiKey: options.apiKey
|
|
2576
|
+
})
|
|
2577
|
+
});
|
|
2578
|
+
|
|
2579
|
+
const ImageType = (data, options) => {
|
|
2580
|
+
if (options.contentType)
|
|
2581
|
+
return options.contentType;
|
|
2582
|
+
return typeof Blob !== 'undefined' && data instanceof Blob && data.type ? data.type : undefined;
|
|
2583
|
+
};
|
|
2584
|
+
const Branding = (transport) => ({
|
|
2585
|
+
get: (options = {}) => transport.request(API_PATHS.BRANDING, { signal: options.signal, apiKey: options.apiKey }),
|
|
2586
|
+
update: (body, options = {}) => transport.request(API_PATHS.BRANDING, {
|
|
2587
|
+
method: HTTP_METHODS.PATCH,
|
|
2588
|
+
body,
|
|
2589
|
+
repeatable: true,
|
|
2590
|
+
signal: options.signal,
|
|
2591
|
+
apiKey: options.apiKey
|
|
2592
|
+
}),
|
|
2593
|
+
uploadImage: (variant, data, options = {}) => transport.request(RequestPath(API_PATHS.BRANDING_IMAGE, { variant }), {
|
|
2594
|
+
method: HTTP_METHODS.PUT,
|
|
2595
|
+
raw: data,
|
|
2596
|
+
contentType: ImageType(data, options),
|
|
2597
|
+
repeatable: true,
|
|
2598
|
+
signal: options.signal,
|
|
2599
|
+
apiKey: options.apiKey
|
|
2600
|
+
}),
|
|
2601
|
+
removeImage: (variant, options = {}) => transport.request(RequestPath(API_PATHS.BRANDING_IMAGE, { variant }), {
|
|
2602
|
+
method: HTTP_METHODS.DELETE,
|
|
1639
2603
|
repeatable: true,
|
|
1640
2604
|
signal: options.signal,
|
|
1641
2605
|
apiKey: options.apiKey
|
|
@@ -1679,25 +2643,39 @@ const TemplateSendToWire = (body) => ({
|
|
|
1679
2643
|
bcc: Many(body.bcc),
|
|
1680
2644
|
scheduledAt: Instant(body.scheduledAt)
|
|
1681
2645
|
});
|
|
2646
|
+
const EmailUpdateToWire = (patch) => ({
|
|
2647
|
+
...patch,
|
|
2648
|
+
to: Many(patch.to),
|
|
2649
|
+
cc: Many(patch.cc),
|
|
2650
|
+
bcc: Many(patch.bcc),
|
|
2651
|
+
scheduledAt: Instant(patch.scheduledAt)
|
|
2652
|
+
});
|
|
1682
2653
|
const ToInstant = Instant;
|
|
1683
2654
|
|
|
1684
|
-
const ListQuery$
|
|
2655
|
+
const ListQuery$d = (options) => ({
|
|
1685
2656
|
[QUERY_KEYS.AUDIENCE_ID]: options.audienceId
|
|
1686
2657
|
});
|
|
1687
2658
|
const RecipientQuery = (options) => ({
|
|
1688
2659
|
[QUERY_KEYS.FILTER]: options.filter,
|
|
1689
2660
|
[QUERY_KEYS.Q]: options.q
|
|
1690
2661
|
});
|
|
1691
|
-
const RecipientsPath = (id) =>
|
|
2662
|
+
const RecipientsPath = (id) => RequestPath(API_PATHS.BROADCAST_RECIPIENTS, { id });
|
|
2663
|
+
const AnalyticsQuery = (options) => ({
|
|
2664
|
+
[QUERY_KEYS.BROADCAST_IDS]: options.broadcastIds?.join(LIST_SEPARATOR),
|
|
2665
|
+
[QUERY_KEYS.DAYS]: options.days,
|
|
2666
|
+
[QUERY_KEYS.MINUTES]: options.minutes,
|
|
2667
|
+
[QUERY_KEYS.GRAIN]: options.grain,
|
|
2668
|
+
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes
|
|
2669
|
+
});
|
|
1692
2670
|
const Broadcasts = (transport) => ({
|
|
1693
|
-
preview: (body, options = {}) => transport.request(
|
|
2671
|
+
preview: (body, options = {}) => transport.request(API_PATHS.BROADCASTS_PREVIEW, {
|
|
1694
2672
|
method: HTTP_METHODS.POST,
|
|
1695
2673
|
body: { audienceIds: body.audienceIds },
|
|
1696
2674
|
repeatable: true,
|
|
1697
2675
|
signal: options.signal,
|
|
1698
2676
|
apiKey: options.apiKey
|
|
1699
2677
|
}),
|
|
1700
|
-
send: (body, options = {}) => transport.request(
|
|
2678
|
+
send: (body, options = {}) => transport.request(API_PATHS.BROADCASTS, {
|
|
1701
2679
|
method: HTTP_METHODS.POST,
|
|
1702
2680
|
body: { ...body, scheduledAt: ToInstant(body.scheduledAt) },
|
|
1703
2681
|
idempotent: true,
|
|
@@ -1706,26 +2684,33 @@ const Broadcasts = (transport) => ({
|
|
|
1706
2684
|
signal: options.signal,
|
|
1707
2685
|
apiKey: options.apiKey
|
|
1708
2686
|
}),
|
|
1709
|
-
list: (options = {}) => FetchPage(transport,
|
|
1710
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
1711
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
1712
|
-
get: (id, options = {}) => transport.request(
|
|
2687
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.BROADCASTS, CURSOR_STYLES.CURSOR, options, ListQuery$d(options)),
|
|
2688
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.BROADCASTS, CURSOR_STYLES.CURSOR, options, ListQuery$d(options)),
|
|
2689
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.BROADCASTS, CURSOR_STYLES.CURSOR, options, ListQuery$d(options)),
|
|
2690
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.BROADCAST, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
1713
2691
|
listRecipients: (id, options = {}) => FetchPage(transport, RecipientsPath(id), CURSOR_STYLES.CURSOR, options, RecipientQuery(options)),
|
|
1714
2692
|
listAllRecipients: (id, options = {}) => CollectAll(transport, RecipientsPath(id), CURSOR_STYLES.CURSOR, options, RecipientQuery(options)),
|
|
1715
2693
|
iterateRecipients: (id, options = {}) => IteratePages(transport, RecipientsPath(id), CURSOR_STYLES.CURSOR, options, RecipientQuery(options)),
|
|
1716
|
-
getRecipient: (id, emailId, options = {}) => transport.request(
|
|
2694
|
+
getRecipient: (id, emailId, options = {}) => transport.request(RequestPath(API_PATHS.BROADCAST_RECIPIENT, { id, emailId }), {
|
|
1717
2695
|
signal: options.signal,
|
|
1718
2696
|
apiKey: options.apiKey
|
|
1719
2697
|
}),
|
|
1720
|
-
stats: (id, options = {}) => transport.request(
|
|
2698
|
+
stats: (id, options = {}) => transport.request(RequestPath(API_PATHS.BROADCAST_STATS, { id }), {
|
|
1721
2699
|
query: {
|
|
1722
2700
|
[QUERY_KEYS.GRAIN]: options.grain,
|
|
1723
|
-
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes
|
|
2701
|
+
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes,
|
|
2702
|
+
[QUERY_KEYS.DAYS]: options.days,
|
|
2703
|
+
[QUERY_KEYS.MINUTES]: options.minutes
|
|
1724
2704
|
},
|
|
1725
2705
|
signal: options.signal,
|
|
1726
2706
|
apiKey: options.apiKey
|
|
1727
2707
|
}),
|
|
1728
|
-
|
|
2708
|
+
analytics: (options = {}) => transport.request(API_PATHS.BROADCASTS_ANALYTICS, {
|
|
2709
|
+
query: AnalyticsQuery(options),
|
|
2710
|
+
signal: options.signal,
|
|
2711
|
+
apiKey: options.apiKey
|
|
2712
|
+
}),
|
|
2713
|
+
cancel: (id, options = {}) => transport.request(RequestPath(API_PATHS.BROADCAST_CANCEL, { id }), {
|
|
1729
2714
|
method: HTTP_METHODS.POST,
|
|
1730
2715
|
repeatable: true,
|
|
1731
2716
|
signal: options.signal,
|
|
@@ -1738,22 +2723,111 @@ const RangeQuery = (options) => ({
|
|
|
1738
2723
|
[QUERY_KEYS.TO]: ToInstant(options.to),
|
|
1739
2724
|
[QUERY_KEYS.TIMEZONE]: options.timezone
|
|
1740
2725
|
});
|
|
2726
|
+
const EventWire = (body) => ({
|
|
2727
|
+
...body,
|
|
2728
|
+
start: ToInstant(body.start),
|
|
2729
|
+
end: ToInstant(body.end)
|
|
2730
|
+
});
|
|
2731
|
+
const AnswerWire = (body) => ({
|
|
2732
|
+
...body,
|
|
2733
|
+
...(body.proposedStart !== undefined ? { proposedStart: ToInstant(body.proposedStart) } : {}),
|
|
2734
|
+
...(body.proposedEnd !== undefined ? { proposedEnd: ToInstant(body.proposedEnd) } : {})
|
|
2735
|
+
});
|
|
1741
2736
|
const Calendar = (transport) => ({
|
|
1742
|
-
listEvents: (options) => FetchPage(transport,
|
|
1743
|
-
listAllEvents: (options) => CollectAll(transport,
|
|
1744
|
-
iterateEvents: (options) => IteratePages(transport,
|
|
1745
|
-
getEvent: (id, options = {}) => transport.request(
|
|
1746
|
-
getEventIcs: (id, options = {}) => transport.request(
|
|
2737
|
+
listEvents: (options) => FetchPage(transport, API_PATHS.CALENDAR_EVENTS, CURSOR_STYLES.CURSOR, options, RangeQuery(options)),
|
|
2738
|
+
listAllEvents: (options) => CollectAll(transport, API_PATHS.CALENDAR_EVENTS, CURSOR_STYLES.CURSOR, options, RangeQuery(options)),
|
|
2739
|
+
iterateEvents: (options) => IteratePages(transport, API_PATHS.CALENDAR_EVENTS, CURSOR_STYLES.CURSOR, options, RangeQuery(options)),
|
|
2740
|
+
getEvent: (id, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_EVENT, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
2741
|
+
getEventIcs: (id, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_EVENT_ICS, { id }), {
|
|
1747
2742
|
accept: CONTENT_TYPES.CALENDAR,
|
|
1748
2743
|
signal: options.signal,
|
|
1749
2744
|
apiKey: options.apiKey
|
|
2745
|
+
}),
|
|
2746
|
+
createEvent: (body, options = {}) => transport.request(API_PATHS.CALENDAR_EVENTS, {
|
|
2747
|
+
method: HTTP_METHODS.POST,
|
|
2748
|
+
body: EventWire(body),
|
|
2749
|
+
signal: options.signal,
|
|
2750
|
+
apiKey: options.apiKey
|
|
2751
|
+
}),
|
|
2752
|
+
updateEvent: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_EVENT, { id }), {
|
|
2753
|
+
method: HTTP_METHODS.PATCH,
|
|
2754
|
+
body: EventWire(patch),
|
|
2755
|
+
signal: options.signal,
|
|
2756
|
+
apiKey: options.apiKey
|
|
2757
|
+
}),
|
|
2758
|
+
deleteEvent: (id, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_EVENT, { id }), {
|
|
2759
|
+
method: HTTP_METHODS.DELETE,
|
|
2760
|
+
signal: options.signal,
|
|
2761
|
+
apiKey: options.apiKey
|
|
2762
|
+
}),
|
|
2763
|
+
cancelEvent: (id, body = {}, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_EVENT_CANCEL, { id }), {
|
|
2764
|
+
method: HTTP_METHODS.POST,
|
|
2765
|
+
body,
|
|
2766
|
+
signal: options.signal,
|
|
2767
|
+
apiKey: options.apiKey
|
|
2768
|
+
}),
|
|
2769
|
+
respondToEvent: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_EVENT_RESPOND, { id }), {
|
|
2770
|
+
method: HTTP_METHODS.POST,
|
|
2771
|
+
body: AnswerWire(body),
|
|
2772
|
+
signal: options.signal,
|
|
2773
|
+
apiKey: options.apiKey
|
|
2774
|
+
}),
|
|
2775
|
+
declineProposal: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_EVENT_DECLINE_PROPOSAL, { id }), {
|
|
2776
|
+
method: HTTP_METHODS.POST,
|
|
2777
|
+
body,
|
|
2778
|
+
signal: options.signal,
|
|
2779
|
+
apiKey: options.apiKey
|
|
2780
|
+
}),
|
|
2781
|
+
listFeeds: (options = {}) => FetchList(transport, API_PATHS.CALENDAR_FEEDS, options),
|
|
2782
|
+
createFeed: (body, options = {}) => transport.request(API_PATHS.CALENDAR_FEEDS, {
|
|
2783
|
+
method: HTTP_METHODS.POST,
|
|
2784
|
+
body,
|
|
2785
|
+
signal: options.signal,
|
|
2786
|
+
apiKey: options.apiKey
|
|
2787
|
+
}),
|
|
2788
|
+
resetFeed: (id, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_FEED_RESET, { id }), {
|
|
2789
|
+
method: HTTP_METHODS.POST,
|
|
2790
|
+
signal: options.signal,
|
|
2791
|
+
apiKey: options.apiKey
|
|
2792
|
+
}),
|
|
2793
|
+
deleteFeed: (id, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_FEED, { id }), {
|
|
2794
|
+
method: HTTP_METHODS.DELETE,
|
|
2795
|
+
signal: options.signal,
|
|
2796
|
+
apiKey: options.apiKey
|
|
2797
|
+
}),
|
|
2798
|
+
listSubscriptions: (options = {}) => FetchList(transport, API_PATHS.CALENDAR_SUBSCRIPTIONS, options),
|
|
2799
|
+
createSubscription: (body, options = {}) => transport.request(API_PATHS.CALENDAR_SUBSCRIPTIONS, {
|
|
2800
|
+
method: HTTP_METHODS.POST,
|
|
2801
|
+
body,
|
|
2802
|
+
signal: options.signal,
|
|
2803
|
+
apiKey: options.apiKey
|
|
2804
|
+
}),
|
|
2805
|
+
updateSubscription: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_SUBSCRIPTION, { id }), {
|
|
2806
|
+
method: HTTP_METHODS.PATCH,
|
|
2807
|
+
body: patch,
|
|
2808
|
+
signal: options.signal,
|
|
2809
|
+
apiKey: options.apiKey
|
|
2810
|
+
}),
|
|
2811
|
+
refreshSubscription: (id, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_SUBSCRIPTION_REFRESH, { id }), {
|
|
2812
|
+
method: HTTP_METHODS.POST,
|
|
2813
|
+
signal: options.signal,
|
|
2814
|
+
apiKey: options.apiKey
|
|
2815
|
+
}),
|
|
2816
|
+
deleteSubscription: (id, options = {}) => transport.request(RequestPath(API_PATHS.CALENDAR_SUBSCRIPTION, { id }), {
|
|
2817
|
+
method: HTTP_METHODS.DELETE,
|
|
2818
|
+
signal: options.signal,
|
|
2819
|
+
apiKey: options.apiKey
|
|
1750
2820
|
})
|
|
1751
2821
|
});
|
|
1752
2822
|
|
|
1753
|
-
const ListQuery$
|
|
2823
|
+
const ListQuery$c = (options) => ({
|
|
1754
2824
|
[QUERY_KEYS.SOURCE]: options.source,
|
|
1755
2825
|
[QUERY_KEYS.Q]: options.q
|
|
1756
2826
|
});
|
|
2827
|
+
const CardQuery = (options) => ({
|
|
2828
|
+
[QUERY_KEYS.EMAIL]: options.email,
|
|
2829
|
+
[QUERY_KEYS.WITHOUT_EMAIL]: options.withoutEmail === undefined ? undefined : String(options.withoutEmail)
|
|
2830
|
+
});
|
|
1757
2831
|
const PeopleQuery = (options) => ({
|
|
1758
2832
|
[QUERY_KEYS.Q]: options.q,
|
|
1759
2833
|
[QUERY_KEYS.EMAIL]: options.email,
|
|
@@ -1769,35 +2843,35 @@ const ActivityQuery = (options) => ({
|
|
|
1769
2843
|
[QUERY_KEYS.GRAIN]: options.grain,
|
|
1770
2844
|
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes
|
|
1771
2845
|
});
|
|
1772
|
-
const PhotoType = (data, options) => {
|
|
2846
|
+
const PhotoType$2 = (data, options) => {
|
|
1773
2847
|
if (options.contentType)
|
|
1774
2848
|
return options.contentType;
|
|
1775
2849
|
return typeof Blob !== 'undefined' && data instanceof Blob && data.type ? data.type : undefined;
|
|
1776
2850
|
};
|
|
1777
2851
|
const Contacts = (transport) => ({
|
|
1778
|
-
list: (options = {}) => FetchPage(transport,
|
|
1779
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
1780
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
1781
|
-
get: (email, options = {}) => transport.request(
|
|
1782
|
-
create: (body, options = {}) => transport.request(
|
|
2852
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.CONTACTS, CURSOR_STYLES.CURSOR, options, ListQuery$c(options)),
|
|
2853
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.CONTACTS, CURSOR_STYLES.CURSOR, options, ListQuery$c(options)),
|
|
2854
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.CONTACTS, CURSOR_STYLES.CURSOR, options, ListQuery$c(options)),
|
|
2855
|
+
get: (email, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT, { email }), { signal: options.signal, apiKey: options.apiKey }),
|
|
2856
|
+
create: (body, options = {}) => transport.request(API_PATHS.CONTACTS, {
|
|
1783
2857
|
method: HTTP_METHODS.POST,
|
|
1784
2858
|
body,
|
|
1785
2859
|
signal: options.signal,
|
|
1786
2860
|
apiKey: options.apiKey
|
|
1787
2861
|
}),
|
|
1788
|
-
update: (email, patch, options = {}) => transport.request(
|
|
2862
|
+
update: (email, patch, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT, { email }), {
|
|
1789
2863
|
method: HTTP_METHODS.PATCH,
|
|
1790
2864
|
body: patch,
|
|
1791
2865
|
repeatable: true,
|
|
1792
2866
|
signal: options.signal,
|
|
1793
2867
|
apiKey: options.apiKey
|
|
1794
2868
|
}),
|
|
1795
|
-
delete: (email, options = {}) => transport.request(
|
|
2869
|
+
delete: (email, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT, { email }), {
|
|
1796
2870
|
method: HTTP_METHODS.DELETE,
|
|
1797
2871
|
signal: options.signal,
|
|
1798
2872
|
apiKey: options.apiKey
|
|
1799
2873
|
}),
|
|
1800
|
-
setAudiences: (email, body, options = {}) => transport.request(
|
|
2874
|
+
setAudiences: (email, body, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT_AUDIENCES, { email }), {
|
|
1801
2875
|
method: HTTP_METHODS.PUT,
|
|
1802
2876
|
body,
|
|
1803
2877
|
repeatable: true,
|
|
@@ -1805,7 +2879,7 @@ const Contacts = (transport) => ({
|
|
|
1805
2879
|
apiKey: options.apiKey
|
|
1806
2880
|
}),
|
|
1807
2881
|
listPeople: async (options = {}) => {
|
|
1808
|
-
const payload = await transport.request(
|
|
2882
|
+
const payload = await transport.request(API_PATHS.CONTACTS_PEOPLE, {
|
|
1809
2883
|
query: {
|
|
1810
2884
|
...PeopleQuery(options),
|
|
1811
2885
|
[QUERY_KEYS.LIMIT]: options.limit,
|
|
@@ -1823,144 +2897,301 @@ const Contacts = (transport) => ({
|
|
|
1823
2897
|
seen: payload?.seen === true
|
|
1824
2898
|
};
|
|
1825
2899
|
},
|
|
1826
|
-
listAllPeople: (options = {}) => CollectAll(transport,
|
|
1827
|
-
iteratePeople: (options = {}) => IteratePages(transport,
|
|
1828
|
-
save: (email, body = {}, options = {}) => transport.request(
|
|
2900
|
+
listAllPeople: (options = {}) => CollectAll(transport, API_PATHS.CONTACTS_PEOPLE, CURSOR_STYLES.CURSOR, options, PeopleQuery(options)),
|
|
2901
|
+
iteratePeople: (options = {}) => IteratePages(transport, API_PATHS.CONTACTS_PEOPLE, CURSOR_STYLES.CURSOR, options, PeopleQuery(options)),
|
|
2902
|
+
save: (email, body = {}, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT, { email }), {
|
|
1829
2903
|
method: HTTP_METHODS.PUT,
|
|
1830
2904
|
body,
|
|
1831
2905
|
repeatable: true,
|
|
1832
2906
|
signal: options.signal,
|
|
1833
2907
|
apiKey: options.apiKey
|
|
1834
2908
|
}),
|
|
1835
|
-
deleteMany: (emails, options = {}) => transport.request(
|
|
2909
|
+
deleteMany: (emails, options = {}) => transport.request(API_PATHS.CONTACTS_BATCH_DELETE, {
|
|
1836
2910
|
method: HTTP_METHODS.POST,
|
|
1837
2911
|
body: { emails },
|
|
1838
2912
|
repeatable: true,
|
|
1839
2913
|
signal: options.signal,
|
|
1840
2914
|
apiKey: options.apiKey
|
|
1841
2915
|
}),
|
|
1842
|
-
setPhoto: (email, data, options = {}) => transport.request(
|
|
2916
|
+
setPhoto: (email, data, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT_PHOTO, { email }), {
|
|
1843
2917
|
method: HTTP_METHODS.PUT,
|
|
1844
2918
|
raw: data,
|
|
1845
|
-
contentType: PhotoType(data, options),
|
|
2919
|
+
contentType: PhotoType$2(data, options),
|
|
1846
2920
|
repeatable: true,
|
|
1847
2921
|
signal: options.signal,
|
|
1848
2922
|
apiKey: options.apiKey
|
|
1849
2923
|
}),
|
|
1850
|
-
removePhoto: (email, options = {}) => transport.request(
|
|
2924
|
+
removePhoto: (email, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT_PHOTO, { email }), {
|
|
1851
2925
|
method: HTTP_METHODS.DELETE,
|
|
1852
2926
|
repeatable: true,
|
|
1853
2927
|
signal: options.signal,
|
|
1854
2928
|
apiKey: options.apiKey
|
|
1855
2929
|
}),
|
|
1856
|
-
block: (email, options = {}) => transport.request(
|
|
2930
|
+
block: (email, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT_BLOCK, { email }), {
|
|
1857
2931
|
method: HTTP_METHODS.POST,
|
|
1858
2932
|
repeatable: true,
|
|
1859
2933
|
signal: options.signal,
|
|
1860
2934
|
apiKey: options.apiKey
|
|
1861
2935
|
}),
|
|
1862
|
-
unblock: (email, options = {}) => transport.request(
|
|
2936
|
+
unblock: (email, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT_BLOCK, { email }), {
|
|
1863
2937
|
method: HTTP_METHODS.DELETE,
|
|
1864
2938
|
repeatable: true,
|
|
1865
2939
|
signal: options.signal,
|
|
1866
2940
|
apiKey: options.apiKey
|
|
1867
2941
|
}),
|
|
1868
|
-
listThreads: (email, options = {}) => FetchPage(transport,
|
|
1869
|
-
listAllThreads: (email, options = {}) => CollectAll(transport,
|
|
1870
|
-
iterateThreads: (email, options = {}) => IteratePages(transport,
|
|
1871
|
-
activity: (email, options = {}) => transport.request(
|
|
2942
|
+
listThreads: (email, options = {}) => FetchPage(transport, RequestPath(API_PATHS.CONTACT_THREADS, { email }), CURSOR_STYLES.CURSOR, options, ThreadQuery(options)),
|
|
2943
|
+
listAllThreads: (email, options = {}) => CollectAll(transport, RequestPath(API_PATHS.CONTACT_THREADS, { email }), CURSOR_STYLES.CURSOR, options, ThreadQuery(options)),
|
|
2944
|
+
iterateThreads: (email, options = {}) => IteratePages(transport, RequestPath(API_PATHS.CONTACT_THREADS, { email }), CURSOR_STYLES.CURSOR, options, ThreadQuery(options)),
|
|
2945
|
+
activity: (email, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT_ACTIVITY, { email }), {
|
|
1872
2946
|
query: ActivityQuery(options),
|
|
1873
2947
|
signal: options.signal,
|
|
1874
2948
|
apiKey: options.apiKey
|
|
2949
|
+
}),
|
|
2950
|
+
listCards: (options = {}) => FetchPage(transport, API_PATHS.CONTACT_CARDS, CURSOR_STYLES.CURSOR, options, CardQuery(options)),
|
|
2951
|
+
listAllCards: (options = {}) => CollectAll(transport, API_PATHS.CONTACT_CARDS, CURSOR_STYLES.CURSOR, options, CardQuery(options)),
|
|
2952
|
+
iterateCards: (options = {}) => IteratePages(transport, API_PATHS.CONTACT_CARDS, CURSOR_STYLES.CURSOR, options, CardQuery(options)),
|
|
2953
|
+
getCard: (id, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT_CARD, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
2954
|
+
createCard: (body, options = {}) => transport.request(API_PATHS.CONTACT_CARDS, {
|
|
2955
|
+
method: HTTP_METHODS.POST,
|
|
2956
|
+
body,
|
|
2957
|
+
signal: options.signal,
|
|
2958
|
+
apiKey: options.apiKey
|
|
2959
|
+
}),
|
|
2960
|
+
updateCard: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT_CARD, { id }), {
|
|
2961
|
+
method: HTTP_METHODS.PATCH,
|
|
2962
|
+
body: patch,
|
|
2963
|
+
repeatable: true,
|
|
2964
|
+
signal: options.signal,
|
|
2965
|
+
apiKey: options.apiKey
|
|
2966
|
+
}),
|
|
2967
|
+
deleteCard: (id, options = {}) => transport.request(RequestPath(API_PATHS.CONTACT_CARD, { id }), {
|
|
2968
|
+
method: HTTP_METHODS.DELETE,
|
|
2969
|
+
signal: options.signal,
|
|
2970
|
+
apiKey: options.apiKey
|
|
1875
2971
|
})
|
|
1876
2972
|
});
|
|
1877
2973
|
|
|
2974
|
+
const PhotoType$1 = (data, options) => {
|
|
2975
|
+
if (options.contentType)
|
|
2976
|
+
return options.contentType;
|
|
2977
|
+
return typeof Blob !== 'undefined' && data instanceof Blob && data.type ? data.type : undefined;
|
|
2978
|
+
};
|
|
1878
2979
|
const Domains = (transport) => ({
|
|
1879
|
-
list: (options = {}) => FetchPage(transport,
|
|
1880
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
1881
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
1882
|
-
get: (id, options = {}) => transport.request(
|
|
1883
|
-
create: (body, options = {}) => transport.request(
|
|
2980
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.DOMAINS, CURSOR_STYLES.CURSOR, options),
|
|
2981
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.DOMAINS, CURSOR_STYLES.CURSOR, options),
|
|
2982
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.DOMAINS, CURSOR_STYLES.CURSOR, options),
|
|
2983
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
2984
|
+
create: (body, options = {}) => transport.request(API_PATHS.DOMAINS, {
|
|
1884
2985
|
method: HTTP_METHODS.POST,
|
|
1885
2986
|
body,
|
|
1886
2987
|
signal: options.signal,
|
|
1887
2988
|
apiKey: options.apiKey
|
|
1888
2989
|
}),
|
|
1889
|
-
verify: (id, options = {}) => transport.request(
|
|
2990
|
+
verify: (id, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_VERIFY, { id }), {
|
|
1890
2991
|
method: HTTP_METHODS.POST,
|
|
1891
2992
|
repeatable: true,
|
|
1892
2993
|
signal: options.signal,
|
|
1893
2994
|
apiKey: options.apiKey
|
|
1894
2995
|
}),
|
|
1895
|
-
update: (id, patch, options = {}) => transport.request(
|
|
2996
|
+
update: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN, { id }), {
|
|
1896
2997
|
method: HTTP_METHODS.PATCH,
|
|
1897
2998
|
body: patch,
|
|
1898
2999
|
repeatable: true,
|
|
1899
3000
|
signal: options.signal,
|
|
1900
3001
|
apiKey: options.apiKey
|
|
1901
3002
|
}),
|
|
1902
|
-
delete: (id, options = {}) => transport.request(
|
|
3003
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN, { id }), {
|
|
1903
3004
|
method: HTTP_METHODS.DELETE,
|
|
1904
3005
|
signal: options.signal,
|
|
1905
3006
|
apiKey: options.apiKey
|
|
1906
3007
|
}),
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
createAddress: (id, body, options = {}) => transport.request(DomainAddressesPath(id), {
|
|
1911
|
-
method: HTTP_METHODS.POST,
|
|
3008
|
+
getLogo: (id, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_LOGO, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3009
|
+
setLogo: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_LOGO, { id }), {
|
|
3010
|
+
method: HTTP_METHODS.PUT,
|
|
1912
3011
|
body,
|
|
1913
3012
|
repeatable: true,
|
|
1914
3013
|
signal: options.signal,
|
|
1915
3014
|
apiKey: options.apiKey
|
|
1916
3015
|
}),
|
|
1917
|
-
|
|
1918
|
-
|
|
3016
|
+
removeLogo: (id, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_LOGO, { id }), {
|
|
3017
|
+
method: HTTP_METHODS.DELETE,
|
|
3018
|
+
repeatable: true,
|
|
3019
|
+
signal: options.signal,
|
|
3020
|
+
apiKey: options.apiKey
|
|
3021
|
+
}),
|
|
3022
|
+
setLogoCertificate: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_LOGO_CERTIFICATE, { id }), {
|
|
3023
|
+
method: HTTP_METHODS.PUT,
|
|
3024
|
+
body,
|
|
3025
|
+
repeatable: true,
|
|
3026
|
+
signal: options.signal,
|
|
3027
|
+
apiKey: options.apiKey
|
|
3028
|
+
}),
|
|
3029
|
+
removeLogoCertificate: (id, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_LOGO_CERTIFICATE, { id }), {
|
|
3030
|
+
method: HTTP_METHODS.DELETE,
|
|
3031
|
+
repeatable: true,
|
|
3032
|
+
signal: options.signal,
|
|
3033
|
+
apiKey: options.apiKey
|
|
3034
|
+
}),
|
|
3035
|
+
listAddresses: (id, options = {}) => FetchPage(transport, RequestPath(API_PATHS.DOMAIN_ADDRESSES, { id }), CURSOR_STYLES.CURSOR, options),
|
|
3036
|
+
listAllAddresses: (id, options = {}) => CollectAll(transport, RequestPath(API_PATHS.DOMAIN_ADDRESSES, { id }), CURSOR_STYLES.CURSOR, options),
|
|
3037
|
+
iterateAddresses: (id, options = {}) => IteratePages(transport, RequestPath(API_PATHS.DOMAIN_ADDRESSES, { id }), CURSOR_STYLES.CURSOR, options),
|
|
3038
|
+
createAddress: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESSES, { id }), {
|
|
3039
|
+
method: HTTP_METHODS.POST,
|
|
3040
|
+
body,
|
|
3041
|
+
repeatable: true,
|
|
3042
|
+
signal: options.signal,
|
|
3043
|
+
apiKey: options.apiKey
|
|
3044
|
+
}),
|
|
3045
|
+
getAddress: (id, addressId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS, { id, addressId }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3046
|
+
updateAddress: (id, addressId, patch, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS, { id, addressId }), {
|
|
3047
|
+
method: HTTP_METHODS.PATCH,
|
|
3048
|
+
body: patch,
|
|
3049
|
+
repeatable: true,
|
|
3050
|
+
signal: options.signal,
|
|
3051
|
+
apiKey: options.apiKey
|
|
3052
|
+
}),
|
|
3053
|
+
setAddressPhoto: (id, addressId, data, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_PHOTO, { id, addressId }), {
|
|
3054
|
+
method: HTTP_METHODS.PUT,
|
|
3055
|
+
raw: data,
|
|
3056
|
+
contentType: PhotoType$1(data, options),
|
|
3057
|
+
repeatable: true,
|
|
3058
|
+
signal: options.signal,
|
|
3059
|
+
apiKey: options.apiKey
|
|
3060
|
+
}),
|
|
3061
|
+
removeAddressPhoto: (id, addressId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_PHOTO, { id, addressId }), {
|
|
3062
|
+
method: HTTP_METHODS.DELETE,
|
|
3063
|
+
repeatable: true,
|
|
3064
|
+
signal: options.signal,
|
|
3065
|
+
apiKey: options.apiKey
|
|
3066
|
+
}),
|
|
3067
|
+
deleteAddress: (id, addressId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS, { id, addressId }), {
|
|
3068
|
+
method: HTTP_METHODS.DELETE,
|
|
3069
|
+
signal: options.signal,
|
|
3070
|
+
apiKey: options.apiKey
|
|
3071
|
+
}),
|
|
3072
|
+
listAddressForwards: (id, addressId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_FORWARDS, { id, addressId }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3073
|
+
addAddressForwards: (id, addressId, body, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_FORWARDS, { id, addressId }), {
|
|
3074
|
+
method: HTTP_METHODS.POST,
|
|
3075
|
+
body,
|
|
3076
|
+
signal: options.signal,
|
|
3077
|
+
apiKey: options.apiKey
|
|
3078
|
+
}),
|
|
3079
|
+
updateAddressForward: (id, addressId, forwardId, patch, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_FORWARD, { id, addressId, forwardId }), {
|
|
1919
3080
|
method: HTTP_METHODS.PATCH,
|
|
1920
3081
|
body: patch,
|
|
1921
3082
|
repeatable: true,
|
|
1922
3083
|
signal: options.signal,
|
|
1923
3084
|
apiKey: options.apiKey
|
|
1924
3085
|
}),
|
|
1925
|
-
|
|
3086
|
+
deleteAddressForward: (id, addressId, forwardId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_FORWARD, { id, addressId, forwardId }), {
|
|
3087
|
+
method: HTTP_METHODS.DELETE,
|
|
3088
|
+
signal: options.signal,
|
|
3089
|
+
apiKey: options.apiKey
|
|
3090
|
+
}),
|
|
3091
|
+
resendAddressForwardConsent: (id, addressId, forwardId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_FORWARD_RESEND, { id, addressId, forwardId }), {
|
|
3092
|
+
method: HTTP_METHODS.POST,
|
|
3093
|
+
signal: options.signal,
|
|
3094
|
+
apiKey: options.apiKey
|
|
3095
|
+
}),
|
|
3096
|
+
listAddressMembers: (id, addressId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_MEMBERS, { id, addressId }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3097
|
+
getAddressLogin: (id, addressId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_LOGIN, { id, addressId }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3098
|
+
setAddressLogin: (id, addressId, body, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_LOGIN, { id, addressId }), {
|
|
3099
|
+
method: HTTP_METHODS.PUT,
|
|
3100
|
+
body,
|
|
3101
|
+
signal: options.signal,
|
|
3102
|
+
apiKey: options.apiKey
|
|
3103
|
+
}),
|
|
3104
|
+
deleteAddressLogin: (id, addressId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_LOGIN, { id, addressId }), {
|
|
1926
3105
|
method: HTTP_METHODS.DELETE,
|
|
1927
3106
|
signal: options.signal,
|
|
1928
3107
|
apiKey: options.apiKey
|
|
3108
|
+
}),
|
|
3109
|
+
getMailAppSettings: (id, addressId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_MAIL_APPS, { id, addressId }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3110
|
+
updateMailAppSettings: (id, addressId, patch, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_MAIL_APPS, { id, addressId }), {
|
|
3111
|
+
method: HTTP_METHODS.PATCH,
|
|
3112
|
+
body: patch,
|
|
3113
|
+
repeatable: true,
|
|
3114
|
+
signal: options.signal,
|
|
3115
|
+
apiKey: options.apiKey
|
|
3116
|
+
}),
|
|
3117
|
+
listAppPasswords: (id, addressId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_APP_PASSWORDS, { id, addressId }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3118
|
+
createAppPassword: (id, addressId, body, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_APP_PASSWORDS, { id, addressId }), {
|
|
3119
|
+
method: HTTP_METHODS.POST,
|
|
3120
|
+
body,
|
|
3121
|
+
signal: options.signal,
|
|
3122
|
+
apiKey: options.apiKey
|
|
3123
|
+
}),
|
|
3124
|
+
updateAppPassword: (id, addressId, passwordId, patch, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_APP_PASSWORD, { id, addressId, passwordId }), {
|
|
3125
|
+
method: HTTP_METHODS.PATCH,
|
|
3126
|
+
body: patch,
|
|
3127
|
+
repeatable: true,
|
|
3128
|
+
signal: options.signal,
|
|
3129
|
+
apiKey: options.apiKey
|
|
3130
|
+
}),
|
|
3131
|
+
deleteAppPassword: (id, addressId, passwordId, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_APP_PASSWORD, { id, addressId, passwordId }), {
|
|
3132
|
+
method: HTTP_METHODS.DELETE,
|
|
3133
|
+
signal: options.signal,
|
|
3134
|
+
apiKey: options.apiKey
|
|
3135
|
+
}),
|
|
3136
|
+
sendMailAppSetup: (id, addressId, body, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_ADDRESS_MAIL_APP_SETUP, { id, addressId }), {
|
|
3137
|
+
method: HTTP_METHODS.POST,
|
|
3138
|
+
body,
|
|
3139
|
+
signal: options.signal,
|
|
3140
|
+
apiKey: options.apiKey
|
|
3141
|
+
}),
|
|
3142
|
+
getDns: (id, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_DNS, { id }), {
|
|
3143
|
+
query: { [QUERY_KEYS.REFRESH]: options.refresh },
|
|
3144
|
+
signal: options.signal,
|
|
3145
|
+
apiKey: options.apiKey
|
|
3146
|
+
}),
|
|
3147
|
+
setDnsZone: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_DNS, { id }), {
|
|
3148
|
+
method: HTTP_METHODS.PUT,
|
|
3149
|
+
body,
|
|
3150
|
+
signal: options.signal,
|
|
3151
|
+
apiKey: options.apiKey
|
|
3152
|
+
}),
|
|
3153
|
+
syncDns: (id, body = {}, options = {}) => transport.request(RequestPath(API_PATHS.DOMAIN_DNS_SYNC, { id }), {
|
|
3154
|
+
method: HTTP_METHODS.POST,
|
|
3155
|
+
body,
|
|
3156
|
+
signal: options.signal,
|
|
3157
|
+
apiKey: options.apiKey
|
|
1929
3158
|
})
|
|
1930
3159
|
});
|
|
1931
3160
|
|
|
1932
|
-
const ListQuery$
|
|
3161
|
+
const ListQuery$b = (options) => ({ [QUERY_KEYS.QUERY]: options.query });
|
|
1933
3162
|
const Drafts = (transport) => ({
|
|
1934
|
-
list: (options = {}) => FetchPage(transport,
|
|
1935
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
1936
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
1937
|
-
get: (id, options = {}) => transport.request(
|
|
1938
|
-
create: (body, options = {}) => transport.request(
|
|
3163
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.DRAFTS, CURSOR_STYLES.PAGE_TOKEN, options, ListQuery$b(options)),
|
|
3164
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.DRAFTS, CURSOR_STYLES.PAGE_TOKEN, options, ListQuery$b(options)),
|
|
3165
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.DRAFTS, CURSOR_STYLES.PAGE_TOKEN, options, ListQuery$b(options)),
|
|
3166
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.DRAFT, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3167
|
+
create: (body, options = {}) => transport.request(API_PATHS.DRAFTS, {
|
|
1939
3168
|
method: HTTP_METHODS.POST,
|
|
1940
3169
|
body,
|
|
1941
3170
|
signal: options.signal,
|
|
1942
3171
|
apiKey: options.apiKey
|
|
1943
3172
|
}),
|
|
1944
|
-
update: (id, body, options = {}) => transport.request(
|
|
3173
|
+
update: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.DRAFT, { id }), {
|
|
1945
3174
|
method: HTTP_METHODS.PATCH,
|
|
1946
3175
|
body,
|
|
1947
3176
|
signal: options.signal,
|
|
1948
3177
|
apiKey: options.apiKey
|
|
1949
3178
|
}),
|
|
1950
|
-
delete: (id, options = {}) => transport.request(
|
|
3179
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.DRAFT, { id }), {
|
|
1951
3180
|
method: HTTP_METHODS.DELETE,
|
|
1952
3181
|
signal: options.signal,
|
|
1953
3182
|
apiKey: options.apiKey
|
|
1954
3183
|
})
|
|
1955
3184
|
});
|
|
1956
3185
|
|
|
1957
|
-
const ListQuery$
|
|
3186
|
+
const ListQuery$a = (options) => ({
|
|
1958
3187
|
[QUERY_KEYS.STATUS]: Array.isArray(options.status) ? options.status.join(LIST_SEPARATOR) : options.status,
|
|
1959
3188
|
[QUERY_KEYS.FROM]: options.from,
|
|
1960
|
-
[QUERY_KEYS.BROADCAST_ID]: options.broadcastId
|
|
3189
|
+
[QUERY_KEYS.BROADCAST_ID]: options.broadcastId,
|
|
3190
|
+
[QUERY_KEYS.SCHEDULED_FROM]: options.scheduledFrom === undefined ? undefined : ToInstant(options.scheduledFrom),
|
|
3191
|
+
[QUERY_KEYS.SCHEDULED_TO]: options.scheduledTo === undefined ? undefined : ToInstant(options.scheduledTo)
|
|
1961
3192
|
});
|
|
1962
3193
|
const Emails = (transport) => ({
|
|
1963
|
-
send: (body, options = {}) => transport.request(
|
|
3194
|
+
send: (body, options = {}) => transport.request(API_PATHS.EMAILS, {
|
|
1964
3195
|
method: HTTP_METHODS.POST,
|
|
1965
3196
|
body: EmailToWire(body),
|
|
1966
3197
|
idempotent: true,
|
|
@@ -1970,7 +3201,7 @@ const Emails = (transport) => ({
|
|
|
1970
3201
|
apiKey: options.apiKey
|
|
1971
3202
|
}),
|
|
1972
3203
|
sendBatch: async (emails, options = {}) => {
|
|
1973
|
-
const result = await transport.request(
|
|
3204
|
+
const result = await transport.request(API_PATHS.EMAILS_BATCH, {
|
|
1974
3205
|
method: HTTP_METHODS.POST,
|
|
1975
3206
|
body: { emails: emails.map(EmailToWire) },
|
|
1976
3207
|
idempotent: true,
|
|
@@ -1981,44 +3212,66 @@ const Emails = (transport) => ({
|
|
|
1981
3212
|
});
|
|
1982
3213
|
return { items: result.data, sent: result.sent, failed: result.failed };
|
|
1983
3214
|
},
|
|
1984
|
-
translate: (body, options = {}) => transport.request(
|
|
3215
|
+
translate: (body, options = {}) => transport.request(API_PATHS.EMAILS_TRANSLATE, {
|
|
1985
3216
|
method: HTTP_METHODS.POST,
|
|
1986
3217
|
body,
|
|
1987
3218
|
signal: options.signal,
|
|
1988
3219
|
apiKey: options.apiKey
|
|
1989
3220
|
}),
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
3221
|
+
check: (body, options = {}) => transport.request(API_PATHS.EMAILS_CHECK, {
|
|
3222
|
+
method: HTTP_METHODS.POST,
|
|
3223
|
+
body,
|
|
3224
|
+
signal: options.signal,
|
|
3225
|
+
apiKey: options.apiKey
|
|
3226
|
+
}),
|
|
3227
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.EMAILS, CURSOR_STYLES.CURSOR, options, ListQuery$a(options)),
|
|
3228
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.EMAILS, CURSOR_STYLES.CURSOR, options, ListQuery$a(options)),
|
|
3229
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.EMAILS, CURSOR_STYLES.CURSOR, options, ListQuery$a(options)),
|
|
3230
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.EMAIL, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3231
|
+
listEvents: (id, options = {}) => FetchPage(transport, RequestPath(API_PATHS.EMAIL_EVENTS, { id }), CURSOR_STYLES.CURSOR, options),
|
|
3232
|
+
listAllEvents: (id, options = {}) => CollectAll(transport, RequestPath(API_PATHS.EMAIL_EVENTS, { id }), CURSOR_STYLES.CURSOR, options),
|
|
3233
|
+
iterateEvents: (id, options = {}) => IteratePages(transport, RequestPath(API_PATHS.EMAIL_EVENTS, { id }), CURSOR_STYLES.CURSOR, options),
|
|
3234
|
+
getTracking: (id, options = {}) => transport.request(RequestPath(API_PATHS.EMAIL_TRACKING, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3235
|
+
cancel: (id, options = {}) => transport.request(RequestPath(API_PATHS.EMAIL_CANCEL, { id }), {
|
|
1999
3236
|
method: HTTP_METHODS.POST,
|
|
2000
3237
|
repeatable: true,
|
|
2001
3238
|
signal: options.signal,
|
|
2002
3239
|
apiKey: options.apiKey
|
|
2003
3240
|
}),
|
|
2004
|
-
reschedule: (id, scheduledAt, options = {}) => transport.request(
|
|
3241
|
+
reschedule: (id, scheduledAt, options = {}) => transport.request(RequestPath(API_PATHS.EMAIL, { id }), {
|
|
2005
3242
|
method: HTTP_METHODS.PATCH,
|
|
2006
3243
|
body: { scheduledAt: ToInstant(scheduledAt) },
|
|
2007
3244
|
repeatable: true,
|
|
2008
3245
|
signal: options.signal,
|
|
2009
3246
|
apiKey: options.apiKey
|
|
3247
|
+
}),
|
|
3248
|
+
update: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.EMAIL, { id }), {
|
|
3249
|
+
method: HTTP_METHODS.PATCH,
|
|
3250
|
+
body: EmailUpdateToWire(patch),
|
|
3251
|
+
repeatable: true,
|
|
3252
|
+
signal: options.signal,
|
|
3253
|
+
apiKey: options.apiKey
|
|
3254
|
+
}),
|
|
3255
|
+
compose: (body, options = {}) => transport.request(API_PATHS.EMAILS_COMPOSE, {
|
|
3256
|
+
method: HTTP_METHODS.POST,
|
|
3257
|
+
body,
|
|
3258
|
+
signal: options.signal,
|
|
3259
|
+
apiKey: options.apiKey
|
|
3260
|
+
}),
|
|
3261
|
+
rewrite: (body, options = {}) => transport.request(API_PATHS.EMAILS_REWRITE, {
|
|
3262
|
+
method: HTTP_METHODS.POST,
|
|
3263
|
+
body,
|
|
3264
|
+
signal: options.signal,
|
|
3265
|
+
apiKey: options.apiKey
|
|
3266
|
+
}),
|
|
3267
|
+
suggestSubject: (body, options = {}) => transport.request(API_PATHS.EMAILS_SUBJECT, {
|
|
3268
|
+
method: HTTP_METHODS.POST,
|
|
3269
|
+
body,
|
|
3270
|
+
signal: options.signal,
|
|
3271
|
+
apiKey: options.apiKey
|
|
2010
3272
|
})
|
|
2011
3273
|
});
|
|
2012
3274
|
|
|
2013
|
-
const ListQuery$6 = (options) => ({
|
|
2014
|
-
[QUERY_KEYS.Q]: options.q,
|
|
2015
|
-
[QUERY_KEYS.KIND]: options.kind,
|
|
2016
|
-
[QUERY_KEYS.DIRECTION]: options.direction,
|
|
2017
|
-
[QUERY_KEYS.ADDRESS]: options.address,
|
|
2018
|
-
[QUERY_KEYS.SINCE]: ToInstant(options.since),
|
|
2019
|
-
[QUERY_KEYS.UNTIL]: ToInstant(options.until),
|
|
2020
|
-
[QUERY_KEYS.SORT]: options.sort
|
|
2021
|
-
});
|
|
2022
3275
|
const UploadName = (options) => {
|
|
2023
3276
|
const filename = typeof options?.filename === 'string' ? options.filename.trim() : '';
|
|
2024
3277
|
if (!filename)
|
|
@@ -2035,33 +3288,49 @@ const UploadTimeout = (transport, options) => {
|
|
|
2035
3288
|
return options.timeoutMs;
|
|
2036
3289
|
return transport.timeoutMs > 0 ? Math.max(transport.timeoutMs, DEFAULTS.UPLOAD_TIMEOUT_MS) : transport.timeoutMs;
|
|
2037
3290
|
};
|
|
3291
|
+
|
|
3292
|
+
const ListQuery$9 = (options) => ({
|
|
3293
|
+
[QUERY_KEYS.Q]: options.q,
|
|
3294
|
+
[QUERY_KEYS.KIND]: options.kind,
|
|
3295
|
+
[QUERY_KEYS.DIRECTION]: options.direction,
|
|
3296
|
+
[QUERY_KEYS.ADDRESS]: options.address,
|
|
3297
|
+
[QUERY_KEYS.SINCE]: ToInstant(options.since),
|
|
3298
|
+
[QUERY_KEYS.UNTIL]: ToInstant(options.until),
|
|
3299
|
+
[QUERY_KEYS.SORT]: options.sort
|
|
3300
|
+
});
|
|
2038
3301
|
const Files = (transport) => ({
|
|
2039
|
-
list: (options = {}) => FetchPage(transport,
|
|
2040
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2041
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2042
|
-
get: (id, options = {}) => transport.request(
|
|
2043
|
-
stats: (options = {}) => transport.request(
|
|
2044
|
-
download: (id, options = {}) => transport.request(
|
|
3302
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.FILES, CURSOR_STYLES.CURSOR, options, ListQuery$9(options)),
|
|
3303
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.FILES, CURSOR_STYLES.CURSOR, options, ListQuery$9(options)),
|
|
3304
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.FILES, CURSOR_STYLES.CURSOR, options, ListQuery$9(options)),
|
|
3305
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.FILE, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3306
|
+
stats: (options = {}) => transport.request(API_PATHS.FILES_STATS, { signal: options.signal, apiKey: options.apiKey }),
|
|
3307
|
+
download: (id, options = {}) => transport.request(RequestPath(API_PATHS.FILE_CONTENT, { id }), {
|
|
2045
3308
|
binary: true,
|
|
2046
3309
|
signal: options.signal,
|
|
2047
3310
|
apiKey: options.apiKey
|
|
2048
3311
|
}),
|
|
2049
|
-
listLinks: (id, options = {}) => FetchPage(transport,
|
|
2050
|
-
listAllLinks: (id, options = {}) => CollectAll(transport,
|
|
2051
|
-
iterateLinks: (id, options = {}) => IteratePages(transport,
|
|
2052
|
-
createLink: (id, options = {}) => transport.request(
|
|
3312
|
+
listLinks: (id, options = {}) => FetchPage(transport, RequestPath(API_PATHS.FILE_LINKS, { id }), CURSOR_STYLES.CURSOR, options),
|
|
3313
|
+
listAllLinks: (id, options = {}) => CollectAll(transport, RequestPath(API_PATHS.FILE_LINKS, { id }), CURSOR_STYLES.CURSOR, options),
|
|
3314
|
+
iterateLinks: (id, options = {}) => IteratePages(transport, RequestPath(API_PATHS.FILE_LINKS, { id }), CURSOR_STYLES.CURSOR, options),
|
|
3315
|
+
createLink: (id, options = {}) => transport.request(RequestPath(API_PATHS.FILE_LINKS, { id }), {
|
|
2053
3316
|
method: HTTP_METHODS.POST,
|
|
2054
3317
|
body: options.domain ? { domain: options.domain } : {},
|
|
2055
3318
|
signal: options.signal,
|
|
2056
3319
|
apiKey: options.apiKey
|
|
2057
3320
|
}),
|
|
2058
|
-
revokeLink: (id, linkId, options = {}) => transport.request(
|
|
3321
|
+
revokeLink: (id, linkId, options = {}) => transport.request(RequestPath(API_PATHS.FILE_LINK, { id, linkId }), {
|
|
3322
|
+
method: HTTP_METHODS.DELETE,
|
|
3323
|
+
repeatable: true,
|
|
3324
|
+
signal: options.signal,
|
|
3325
|
+
apiKey: options.apiKey
|
|
3326
|
+
}),
|
|
3327
|
+
revokeAllLinks: (id, options = {}) => transport.request(RequestPath(API_PATHS.FILE_LINKS, { id }), {
|
|
2059
3328
|
method: HTTP_METHODS.DELETE,
|
|
2060
3329
|
repeatable: true,
|
|
2061
3330
|
signal: options.signal,
|
|
2062
3331
|
apiKey: options.apiKey
|
|
2063
3332
|
}),
|
|
2064
|
-
upload: (data, options) => transport.request(
|
|
3333
|
+
upload: (data, options) => transport.request(API_PATHS.FILES, {
|
|
2065
3334
|
method: HTTP_METHODS.POST,
|
|
2066
3335
|
query: { [QUERY_KEYS.FILENAME]: UploadName(options) },
|
|
2067
3336
|
raw: data,
|
|
@@ -2070,12 +3339,12 @@ const Files = (transport) => ({
|
|
|
2070
3339
|
signal: options.signal,
|
|
2071
3340
|
apiKey: options.apiKey
|
|
2072
3341
|
}),
|
|
2073
|
-
delete: (id, options = {}) => transport.request(
|
|
3342
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.FILE, { id }), {
|
|
2074
3343
|
method: HTTP_METHODS.DELETE,
|
|
2075
3344
|
signal: options.signal,
|
|
2076
3345
|
apiKey: options.apiKey
|
|
2077
3346
|
}),
|
|
2078
|
-
deleteMany: (ids, options = {}) => transport.request(
|
|
3347
|
+
deleteMany: (ids, options = {}) => transport.request(API_PATHS.FILES_BATCH_DELETE, {
|
|
2079
3348
|
method: HTTP_METHODS.POST,
|
|
2080
3349
|
body: { ids },
|
|
2081
3350
|
signal: options.signal,
|
|
@@ -2083,7 +3352,116 @@ const Files = (transport) => ({
|
|
|
2083
3352
|
})
|
|
2084
3353
|
});
|
|
2085
3354
|
|
|
2086
|
-
const
|
|
3355
|
+
const SubmissionQuery = (options) => ({
|
|
3356
|
+
[QUERY_KEYS.Q]: options.q,
|
|
3357
|
+
[QUERY_KEYS.STATUS]: options.status
|
|
3358
|
+
});
|
|
3359
|
+
const WindowQuery$3 = (options) => ({
|
|
3360
|
+
[QUERY_KEYS.DAYS]: options.days,
|
|
3361
|
+
[QUERY_KEYS.MINUTES]: options.minutes,
|
|
3362
|
+
[QUERY_KEYS.GRAIN]: options.grain,
|
|
3363
|
+
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes
|
|
3364
|
+
});
|
|
3365
|
+
const Forms = (transport) => ({
|
|
3366
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.FORMS, CURSOR_STYLES.CURSOR, options),
|
|
3367
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.FORMS, CURSOR_STYLES.CURSOR, options),
|
|
3368
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.FORMS, CURSOR_STYLES.CURSOR, options),
|
|
3369
|
+
create: (body, options = {}) => transport.request(API_PATHS.FORMS, {
|
|
3370
|
+
method: HTTP_METHODS.POST,
|
|
3371
|
+
body,
|
|
3372
|
+
signal: options.signal,
|
|
3373
|
+
apiKey: options.apiKey
|
|
3374
|
+
}),
|
|
3375
|
+
design: (body, options = {}) => transport.request(API_PATHS.FORMS_DESIGN, {
|
|
3376
|
+
method: HTTP_METHODS.POST,
|
|
3377
|
+
body,
|
|
3378
|
+
signal: options.signal,
|
|
3379
|
+
apiKey: options.apiKey
|
|
3380
|
+
}),
|
|
3381
|
+
redesign: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.FORM_REDESIGN, { id }), {
|
|
3382
|
+
method: HTTP_METHODS.POST,
|
|
3383
|
+
body,
|
|
3384
|
+
signal: options.signal,
|
|
3385
|
+
apiKey: options.apiKey
|
|
3386
|
+
}),
|
|
3387
|
+
listStarters: (options = {}) => FetchList(transport, API_PATHS.FORM_STARTERS, options),
|
|
3388
|
+
getStarter: (slug, options = {}) => transport.request(RequestPath(API_PATHS.FORM_STARTER, { slug }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3389
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.FORM, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3390
|
+
update: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.FORM, { id }), {
|
|
3391
|
+
method: HTTP_METHODS.PATCH,
|
|
3392
|
+
body: patch,
|
|
3393
|
+
repeatable: true,
|
|
3394
|
+
signal: options.signal,
|
|
3395
|
+
apiKey: options.apiKey
|
|
3396
|
+
}),
|
|
3397
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.FORM, { id }), {
|
|
3398
|
+
method: HTTP_METHODS.DELETE,
|
|
3399
|
+
signal: options.signal,
|
|
3400
|
+
apiKey: options.apiKey
|
|
3401
|
+
}),
|
|
3402
|
+
publish: (id, options = {}) => transport.request(RequestPath(API_PATHS.FORM_PUBLISH, { id }), {
|
|
3403
|
+
method: HTTP_METHODS.POST,
|
|
3404
|
+
repeatable: true,
|
|
3405
|
+
signal: options.signal,
|
|
3406
|
+
apiKey: options.apiKey
|
|
3407
|
+
}),
|
|
3408
|
+
pause: (id, options = {}) => transport.request(RequestPath(API_PATHS.FORM_PAUSE, { id }), {
|
|
3409
|
+
method: HTTP_METHODS.POST,
|
|
3410
|
+
repeatable: true,
|
|
3411
|
+
signal: options.signal,
|
|
3412
|
+
apiKey: options.apiKey
|
|
3413
|
+
}),
|
|
3414
|
+
resume: (id, options = {}) => transport.request(RequestPath(API_PATHS.FORM_RESUME, { id }), {
|
|
3415
|
+
method: HTTP_METHODS.POST,
|
|
3416
|
+
repeatable: true,
|
|
3417
|
+
signal: options.signal,
|
|
3418
|
+
apiKey: options.apiKey
|
|
3419
|
+
}),
|
|
3420
|
+
duplicate: (id, options = {}) => transport.request(RequestPath(API_PATHS.FORM_DUPLICATE, { id }), {
|
|
3421
|
+
method: HTTP_METHODS.POST,
|
|
3422
|
+
signal: options.signal,
|
|
3423
|
+
apiKey: options.apiKey
|
|
3424
|
+
}),
|
|
3425
|
+
analytics: (id, options = {}) => transport.request(RequestPath(API_PATHS.FORM_ANALYTICS, { id }), {
|
|
3426
|
+
query: WindowQuery$3(options),
|
|
3427
|
+
signal: options.signal,
|
|
3428
|
+
apiKey: options.apiKey
|
|
3429
|
+
}),
|
|
3430
|
+
listSubmissions: (id, options = {}) => FetchPage(transport, RequestPath(API_PATHS.FORM_SUBMISSIONS, { id }), CURSOR_STYLES.CURSOR, options, SubmissionQuery(options)),
|
|
3431
|
+
listAllSubmissions: (id, options = {}) => CollectAll(transport, RequestPath(API_PATHS.FORM_SUBMISSIONS, { id }), CURSOR_STYLES.CURSOR, options, SubmissionQuery(options)),
|
|
3432
|
+
iterateSubmissions: (id, options = {}) => IteratePages(transport, RequestPath(API_PATHS.FORM_SUBMISSIONS, { id }), CURSOR_STYLES.CURSOR, options, SubmissionQuery(options)),
|
|
3433
|
+
getSubmission: (id, submissionId, options = {}) => transport.request(RequestPath(API_PATHS.FORM_SUBMISSION, { id, submissionId }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3434
|
+
deleteSubmission: (id, submissionId, options = {}) => transport.request(RequestPath(API_PATHS.FORM_SUBMISSION, { id, submissionId }), {
|
|
3435
|
+
method: HTTP_METHODS.DELETE,
|
|
3436
|
+
signal: options.signal,
|
|
3437
|
+
apiKey: options.apiKey
|
|
3438
|
+
}),
|
|
3439
|
+
deleteSubmissions: (id, submissionIds, options = {}) => transport.request(RequestPath(API_PATHS.FORM_SUBMISSIONS_BATCH_REMOVE, { id }), {
|
|
3440
|
+
method: HTTP_METHODS.POST,
|
|
3441
|
+
body: { ids: submissionIds },
|
|
3442
|
+
signal: options.signal,
|
|
3443
|
+
apiKey: options.apiKey
|
|
3444
|
+
}),
|
|
3445
|
+
approveSubmission: (id, submissionId, options = {}) => transport.request(RequestPath(API_PATHS.FORM_SUBMISSION_APPROVE, { id, submissionId }), {
|
|
3446
|
+
method: HTTP_METHODS.POST,
|
|
3447
|
+
repeatable: true,
|
|
3448
|
+
signal: options.signal,
|
|
3449
|
+
apiKey: options.apiKey
|
|
3450
|
+
}),
|
|
3451
|
+
resendConfirmation: (id, submissionId, options = {}) => transport.request(RequestPath(API_PATHS.FORM_SUBMISSION_RESEND, { id, submissionId }), {
|
|
3452
|
+
method: HTTP_METHODS.POST,
|
|
3453
|
+
signal: options.signal,
|
|
3454
|
+
apiKey: options.apiKey
|
|
3455
|
+
}),
|
|
3456
|
+
subscribe: (formId, values, options = {}) => transport.request(RequestPath(API_PATHS.SUBSCRIBE_FORM, { formId }), {
|
|
3457
|
+
method: HTTP_METHODS.POST,
|
|
3458
|
+
body: values,
|
|
3459
|
+
anonymous: true,
|
|
3460
|
+
signal: options.signal
|
|
3461
|
+
})
|
|
3462
|
+
});
|
|
3463
|
+
|
|
3464
|
+
const ListQuery$8 = (options) => ({ addressId: options.addressId });
|
|
2087
3465
|
const SizeOf = (data) => data instanceof Blob ? data.size : data.byteLength;
|
|
2088
3466
|
const SliceOf = (data, start, end) => {
|
|
2089
3467
|
if (data instanceof Blob)
|
|
@@ -2093,48 +3471,48 @@ const SliceOf = (data, start, end) => {
|
|
|
2093
3471
|
return new Uint8Array(data, start, end - start);
|
|
2094
3472
|
};
|
|
2095
3473
|
const Imports = (transport) => {
|
|
2096
|
-
const create = (body, options = {}) => transport.request(
|
|
3474
|
+
const create = (body, options = {}) => transport.request(API_PATHS.IMPORTS, {
|
|
2097
3475
|
method: HTTP_METHODS.POST,
|
|
2098
3476
|
body,
|
|
2099
3477
|
signal: options.signal,
|
|
2100
3478
|
apiKey: options.apiKey
|
|
2101
3479
|
});
|
|
2102
|
-
const uploadChunk = (id, file, chunk, data, options = {}) => transport.request(
|
|
3480
|
+
const uploadChunk = (id, file, chunk, data, options = {}) => transport.request(RequestPath(API_PATHS.IMPORT_FILE_CHUNK, { id, file, chunk }), {
|
|
2103
3481
|
method: HTTP_METHODS.PUT,
|
|
2104
3482
|
raw: data,
|
|
2105
3483
|
repeatable: true,
|
|
2106
3484
|
signal: options.signal,
|
|
2107
3485
|
apiKey: options.apiKey
|
|
2108
3486
|
});
|
|
2109
|
-
const start = (id, options = {}) => transport.request(
|
|
3487
|
+
const start = (id, options = {}) => transport.request(RequestPath(API_PATHS.IMPORT_START, { id }), {
|
|
2110
3488
|
method: HTTP_METHODS.POST,
|
|
2111
3489
|
repeatable: true,
|
|
2112
3490
|
signal: options.signal,
|
|
2113
3491
|
apiKey: options.apiKey
|
|
2114
3492
|
});
|
|
2115
3493
|
return {
|
|
2116
|
-
list: (options = {}) => FetchPage(transport,
|
|
2117
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2118
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2119
|
-
get: (id, options = {}) => transport.request(
|
|
3494
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.IMPORTS, CURSOR_STYLES.CURSOR, options, ListQuery$8(options)),
|
|
3495
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.IMPORTS, CURSOR_STYLES.CURSOR, options, ListQuery$8(options)),
|
|
3496
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.IMPORTS, CURSOR_STYLES.CURSOR, options, ListQuery$8(options)),
|
|
3497
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.IMPORT, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
2120
3498
|
create,
|
|
2121
|
-
uploadState: (id, options = {}) => transport.request(
|
|
3499
|
+
uploadState: (id, options = {}) => transport.request(RequestPath(API_PATHS.IMPORT_UPLOAD, { id }), {
|
|
2122
3500
|
signal: options.signal,
|
|
2123
3501
|
apiKey: options.apiKey
|
|
2124
3502
|
}),
|
|
2125
3503
|
uploadChunk,
|
|
2126
3504
|
start,
|
|
2127
|
-
cancel: (id, options = {}) => transport.request(
|
|
3505
|
+
cancel: (id, options = {}) => transport.request(RequestPath(API_PATHS.IMPORT_CANCEL, { id }), {
|
|
2128
3506
|
method: HTTP_METHODS.POST,
|
|
2129
3507
|
signal: options.signal,
|
|
2130
3508
|
apiKey: options.apiKey
|
|
2131
3509
|
}),
|
|
2132
|
-
listFailures: (id, options = {}) => transport.request(
|
|
3510
|
+
listFailures: (id, options = {}) => transport.request(RequestPath(API_PATHS.IMPORT_FAILURES, { id }), {
|
|
2133
3511
|
query: { after: options.after, limit: options.limit },
|
|
2134
3512
|
signal: options.signal,
|
|
2135
3513
|
apiKey: options.apiKey
|
|
2136
3514
|
}),
|
|
2137
|
-
deleteUpload: (id, options = {}) => transport.request(
|
|
3515
|
+
deleteUpload: (id, options = {}) => transport.request(RequestPath(API_PATHS.IMPORT_UPLOAD, { id }), {
|
|
2138
3516
|
method: HTTP_METHODS.DELETE,
|
|
2139
3517
|
signal: options.signal,
|
|
2140
3518
|
apiKey: options.apiKey
|
|
@@ -2181,72 +3559,214 @@ const WorkspaceActivityQuery$1 = (options) => ({
|
|
|
2181
3559
|
[QUERY_KEYS.KEY_IDS]: options.keyIds?.join(LIST_SEPARATOR)
|
|
2182
3560
|
});
|
|
2183
3561
|
const Keys = (transport) => ({
|
|
2184
|
-
list: (options = {}) => FetchPage(transport,
|
|
2185
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2186
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2187
|
-
get: (id, options = {}) => transport.request(
|
|
2188
|
-
create: (body, options = {}) => transport.request(
|
|
3562
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.KEYS, CURSOR_STYLES.CURSOR, options),
|
|
3563
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.KEYS, CURSOR_STYLES.CURSOR, options),
|
|
3564
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.KEYS, CURSOR_STYLES.CURSOR, options),
|
|
3565
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.KEY, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3566
|
+
create: (body, options = {}) => transport.request(API_PATHS.KEYS, {
|
|
2189
3567
|
method: HTTP_METHODS.POST,
|
|
2190
3568
|
body,
|
|
2191
3569
|
signal: options.signal,
|
|
2192
3570
|
apiKey: options.apiKey
|
|
2193
3571
|
}),
|
|
2194
|
-
update: (id, patch, options = {}) => transport.request(
|
|
3572
|
+
update: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.KEY, { id }), {
|
|
2195
3573
|
method: HTTP_METHODS.PATCH,
|
|
2196
3574
|
body: patch,
|
|
2197
3575
|
repeatable: true,
|
|
2198
3576
|
signal: options.signal,
|
|
2199
3577
|
apiKey: options.apiKey
|
|
2200
3578
|
}),
|
|
2201
|
-
delete: (id, options = {}) => transport.request(
|
|
3579
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.KEY, { id }), {
|
|
2202
3580
|
method: HTTP_METHODS.DELETE,
|
|
2203
3581
|
signal: options.signal,
|
|
2204
3582
|
apiKey: options.apiKey
|
|
2205
3583
|
}),
|
|
2206
|
-
rotate: (id, options = {}) => transport.request(
|
|
3584
|
+
rotate: (id, options = {}) => transport.request(RequestPath(API_PATHS.KEY_ROTATE, { id }), {
|
|
2207
3585
|
method: HTTP_METHODS.POST,
|
|
2208
3586
|
signal: options.signal,
|
|
2209
3587
|
apiKey: options.apiKey
|
|
2210
3588
|
}),
|
|
2211
|
-
revoke: (id, body = {}, options = {}) => transport.request(
|
|
3589
|
+
revoke: (id, body = {}, options = {}) => transport.request(RequestPath(API_PATHS.KEY_REVOKE, { id }), {
|
|
2212
3590
|
method: HTTP_METHODS.POST,
|
|
2213
3591
|
body,
|
|
2214
3592
|
repeatable: true,
|
|
2215
3593
|
signal: options.signal,
|
|
2216
3594
|
apiKey: options.apiKey
|
|
2217
3595
|
}),
|
|
2218
|
-
listRequests: (id, options = {}) => FetchPage(transport,
|
|
2219
|
-
listAllRequests: (id, options = {}) => CollectAll(transport,
|
|
2220
|
-
iterateRequests: (id, options = {}) => IteratePages(transport,
|
|
2221
|
-
listActivity: (id, options = {}) => FetchPage(transport,
|
|
2222
|
-
listAllActivity: (id, options = {}) => CollectAll(transport,
|
|
2223
|
-
iterateActivity: (id, options = {}) => IteratePages(transport,
|
|
2224
|
-
listWorkspaceRequests: (options = {}) => FetchPage(transport,
|
|
2225
|
-
listAllWorkspaceRequests: (options = {}) => CollectAll(transport,
|
|
2226
|
-
iterateWorkspaceRequests: (options = {}) => IteratePages(transport,
|
|
2227
|
-
listWorkspaceActivity: (options = {}) => FetchPage(transport,
|
|
2228
|
-
listAllWorkspaceActivity: (options = {}) => CollectAll(transport,
|
|
2229
|
-
iterateWorkspaceActivity: (options = {}) => IteratePages(transport,
|
|
3596
|
+
listRequests: (id, options = {}) => FetchPage(transport, RequestPath(API_PATHS.KEY_REQUESTS, { id }), CURSOR_STYLES.CURSOR, options, RequestQuery(options)),
|
|
3597
|
+
listAllRequests: (id, options = {}) => CollectAll(transport, RequestPath(API_PATHS.KEY_REQUESTS, { id }), CURSOR_STYLES.CURSOR, options, RequestQuery(options)),
|
|
3598
|
+
iterateRequests: (id, options = {}) => IteratePages(transport, RequestPath(API_PATHS.KEY_REQUESTS, { id }), CURSOR_STYLES.CURSOR, options, RequestQuery(options)),
|
|
3599
|
+
listActivity: (id, options = {}) => FetchPage(transport, RequestPath(API_PATHS.KEY_ACTIVITY, { id }), CURSOR_STYLES.CURSOR, options, WindowQuery$2(options)),
|
|
3600
|
+
listAllActivity: (id, options = {}) => CollectAll(transport, RequestPath(API_PATHS.KEY_ACTIVITY, { id }), CURSOR_STYLES.CURSOR, options, WindowQuery$2(options)),
|
|
3601
|
+
iterateActivity: (id, options = {}) => IteratePages(transport, RequestPath(API_PATHS.KEY_ACTIVITY, { id }), CURSOR_STYLES.CURSOR, options, WindowQuery$2(options)),
|
|
3602
|
+
listWorkspaceRequests: (options = {}) => FetchPage(transport, API_PATHS.KEYS_REQUESTS, CURSOR_STYLES.CURSOR, options, WorkspaceRequestQuery(options)),
|
|
3603
|
+
listAllWorkspaceRequests: (options = {}) => CollectAll(transport, API_PATHS.KEYS_REQUESTS, CURSOR_STYLES.CURSOR, options, WorkspaceRequestQuery(options)),
|
|
3604
|
+
iterateWorkspaceRequests: (options = {}) => IteratePages(transport, API_PATHS.KEYS_REQUESTS, CURSOR_STYLES.CURSOR, options, WorkspaceRequestQuery(options)),
|
|
3605
|
+
listWorkspaceActivity: (options = {}) => FetchPage(transport, API_PATHS.KEYS_ACTIVITY, CURSOR_STYLES.CURSOR, options, WorkspaceActivityQuery$1(options)),
|
|
3606
|
+
listAllWorkspaceActivity: (options = {}) => CollectAll(transport, API_PATHS.KEYS_ACTIVITY, CURSOR_STYLES.CURSOR, options, WorkspaceActivityQuery$1(options)),
|
|
3607
|
+
iterateWorkspaceActivity: (options = {}) => IteratePages(transport, API_PATHS.KEYS_ACTIVITY, CURSOR_STYLES.CURSOR, options, WorkspaceActivityQuery$1(options)),
|
|
3608
|
+
stats: (options = {}) => transport.request(API_PATHS.KEYS_STATS, {
|
|
3609
|
+
query: {
|
|
3610
|
+
...WindowQuery$2(options),
|
|
3611
|
+
[QUERY_KEYS.KEY_IDS]: options.keyIds?.join(LIST_SEPARATOR),
|
|
3612
|
+
[QUERY_KEYS.GRAIN]: options.grain,
|
|
3613
|
+
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes
|
|
3614
|
+
},
|
|
3615
|
+
signal: options.signal,
|
|
3616
|
+
apiKey: options.apiKey
|
|
3617
|
+
})
|
|
3618
|
+
});
|
|
3619
|
+
|
|
3620
|
+
const ListQuery$7 = (options) => ({
|
|
3621
|
+
[QUERY_KEYS.SCOPE]: options.scope,
|
|
3622
|
+
[QUERY_KEYS.LEVEL]: options.level,
|
|
3623
|
+
[QUERY_KEYS.KIND]: options.kind,
|
|
3624
|
+
[QUERY_KEYS.STATUS]: options.status,
|
|
3625
|
+
[QUERY_KEYS.PINNED]: options.pinned,
|
|
3626
|
+
[QUERY_KEYS.Q]: options.q
|
|
3627
|
+
});
|
|
3628
|
+
const SuggestionQuery = (options) => ({
|
|
3629
|
+
[QUERY_KEYS.KIND]: options.kind,
|
|
3630
|
+
[QUERY_KEYS.STATUS]: options.status
|
|
3631
|
+
});
|
|
3632
|
+
const Knowledge = (transport) => ({
|
|
3633
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.KNOWLEDGE, CURSOR_STYLES.CURSOR, options, ListQuery$7(options)),
|
|
3634
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.KNOWLEDGE, CURSOR_STYLES.CURSOR, options, ListQuery$7(options)),
|
|
3635
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.KNOWLEDGE, CURSOR_STYLES.CURSOR, options, ListQuery$7(options)),
|
|
3636
|
+
levels: (options = {}) => FetchList(transport, API_PATHS.KNOWLEDGE_LEVELS, options),
|
|
3637
|
+
usage: (options = {}) => transport.request(API_PATHS.KNOWLEDGE_USAGE, { signal: options.signal, apiKey: options.apiKey }),
|
|
3638
|
+
search: (body, options = {}) => transport.request(API_PATHS.KNOWLEDGE_SEARCH, {
|
|
3639
|
+
method: HTTP_METHODS.POST,
|
|
3640
|
+
body,
|
|
3641
|
+
repeatable: true,
|
|
3642
|
+
signal: options.signal,
|
|
3643
|
+
apiKey: options.apiKey
|
|
3644
|
+
}),
|
|
3645
|
+
createNote: (body, options = {}) => transport.request(API_PATHS.KNOWLEDGE_NOTES, {
|
|
3646
|
+
method: HTTP_METHODS.POST,
|
|
3647
|
+
body,
|
|
3648
|
+
signal: options.signal,
|
|
3649
|
+
apiKey: options.apiKey
|
|
3650
|
+
}),
|
|
3651
|
+
addLink: (body, options = {}) => transport.request(API_PATHS.KNOWLEDGE_LINKS, {
|
|
3652
|
+
method: HTTP_METHODS.POST,
|
|
3653
|
+
body,
|
|
3654
|
+
signal: options.signal,
|
|
3655
|
+
apiKey: options.apiKey
|
|
3656
|
+
}),
|
|
3657
|
+
uploadFile: (data, options) => transport.request(API_PATHS.KNOWLEDGE_FILES, {
|
|
3658
|
+
method: HTTP_METHODS.POST,
|
|
3659
|
+
query: {
|
|
3660
|
+
[QUERY_KEYS.FILENAME]: UploadName(options),
|
|
3661
|
+
[QUERY_KEYS.SCOPE]: options.scope,
|
|
3662
|
+
[QUERY_KEYS.TITLE]: options.title
|
|
3663
|
+
},
|
|
3664
|
+
raw: data,
|
|
3665
|
+
contentType: UploadType(data, options),
|
|
3666
|
+
timeoutMs: UploadTimeout(transport, options),
|
|
3667
|
+
signal: options.signal,
|
|
3668
|
+
apiKey: options.apiKey
|
|
3669
|
+
}),
|
|
3670
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.KNOWLEDGE_ITEM, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3671
|
+
update: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.KNOWLEDGE_ITEM, { id }), {
|
|
3672
|
+
method: HTTP_METHODS.PATCH,
|
|
3673
|
+
body: patch,
|
|
3674
|
+
repeatable: true,
|
|
3675
|
+
signal: options.signal,
|
|
3676
|
+
apiKey: options.apiKey
|
|
3677
|
+
}),
|
|
3678
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.KNOWLEDGE_ITEM, { id }), {
|
|
3679
|
+
method: HTTP_METHODS.DELETE,
|
|
3680
|
+
signal: options.signal,
|
|
3681
|
+
apiKey: options.apiKey
|
|
3682
|
+
}),
|
|
3683
|
+
refresh: (id, options = {}) => transport.request(RequestPath(API_PATHS.KNOWLEDGE_ITEM_REFRESH, { id }), {
|
|
3684
|
+
method: HTTP_METHODS.POST,
|
|
3685
|
+
repeatable: true,
|
|
3686
|
+
signal: options.signal,
|
|
3687
|
+
apiKey: options.apiKey
|
|
3688
|
+
}),
|
|
3689
|
+
stats: (options = {}) => transport.request(API_PATHS.KNOWLEDGE_STATS, {
|
|
3690
|
+
query: { [QUERY_KEYS.DAYS]: options.days },
|
|
3691
|
+
signal: options.signal,
|
|
3692
|
+
apiKey: options.apiKey
|
|
3693
|
+
}),
|
|
3694
|
+
listSuggestions: (options = {}) => FetchPage(transport, API_PATHS.KNOWLEDGE_SUGGESTIONS, CURSOR_STYLES.CURSOR, options, SuggestionQuery(options)),
|
|
3695
|
+
listAllSuggestions: (options = {}) => CollectAll(transport, API_PATHS.KNOWLEDGE_SUGGESTIONS, CURSOR_STYLES.CURSOR, options, SuggestionQuery(options)),
|
|
3696
|
+
iterateSuggestions: (options = {}) => IteratePages(transport, API_PATHS.KNOWLEDGE_SUGGESTIONS, CURSOR_STYLES.CURSOR, options, SuggestionQuery(options)),
|
|
3697
|
+
acceptSuggestion: (id, body = {}, options = {}) => transport.request(RequestPath(API_PATHS.KNOWLEDGE_SUGGESTION_ACCEPT, { id }), {
|
|
3698
|
+
method: HTTP_METHODS.POST,
|
|
3699
|
+
body,
|
|
3700
|
+
signal: options.signal,
|
|
3701
|
+
apiKey: options.apiKey
|
|
3702
|
+
}),
|
|
3703
|
+
dismissSuggestion: (id, options = {}) => transport.request(RequestPath(API_PATHS.KNOWLEDGE_SUGGESTION_DISMISS, { id }), {
|
|
3704
|
+
method: HTTP_METHODS.POST,
|
|
3705
|
+
signal: options.signal,
|
|
3706
|
+
apiKey: options.apiKey
|
|
3707
|
+
}),
|
|
3708
|
+
listFlags: (options = {}) => FetchList(transport, API_PATHS.KNOWLEDGE_FLAGS, options, {
|
|
3709
|
+
[QUERY_KEYS.ITEM_ID]: options.itemId,
|
|
3710
|
+
[QUERY_KEYS.LIMIT]: options.limit
|
|
3711
|
+
}),
|
|
3712
|
+
dismissFlag: (id, options = {}) => transport.request(RequestPath(API_PATHS.KNOWLEDGE_FLAG_DISMISS, { id }), {
|
|
3713
|
+
method: HTTP_METHODS.POST,
|
|
3714
|
+
repeatable: true,
|
|
3715
|
+
signal: options.signal,
|
|
3716
|
+
apiKey: options.apiKey
|
|
3717
|
+
}),
|
|
3718
|
+
listConnectors: (options = {}) => FetchList(transport, API_PATHS.KNOWLEDGE_CONNECTORS, options),
|
|
3719
|
+
addConnector: (body, options = {}) => transport.request(API_PATHS.KNOWLEDGE_CONNECTORS, {
|
|
3720
|
+
method: HTTP_METHODS.POST,
|
|
3721
|
+
body,
|
|
3722
|
+
signal: options.signal,
|
|
3723
|
+
apiKey: options.apiKey
|
|
3724
|
+
}),
|
|
3725
|
+
getConnector: (id, options = {}) => transport.request(RequestPath(API_PATHS.KNOWLEDGE_CONNECTOR, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3726
|
+
updateConnector: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.KNOWLEDGE_CONNECTOR, { id }), {
|
|
3727
|
+
method: HTTP_METHODS.PATCH,
|
|
3728
|
+
body: patch,
|
|
3729
|
+
repeatable: true,
|
|
3730
|
+
signal: options.signal,
|
|
3731
|
+
apiKey: options.apiKey
|
|
3732
|
+
}),
|
|
3733
|
+
deleteConnector: (id, options = {}) => transport.request(RequestPath(API_PATHS.KNOWLEDGE_CONNECTOR, { id }), {
|
|
3734
|
+
method: HTTP_METHODS.DELETE,
|
|
3735
|
+
signal: options.signal,
|
|
3736
|
+
apiKey: options.apiKey
|
|
3737
|
+
}),
|
|
3738
|
+
syncConnector: (id, options = {}) => transport.request(RequestPath(API_PATHS.KNOWLEDGE_CONNECTOR_SYNC, { id }), {
|
|
3739
|
+
method: HTTP_METHODS.POST,
|
|
3740
|
+
repeatable: true,
|
|
3741
|
+
signal: options.signal,
|
|
3742
|
+
apiKey: options.apiKey
|
|
3743
|
+
}),
|
|
3744
|
+
draftFromThread: (body, options = {}) => transport.request(API_PATHS.KNOWLEDGE_DRAFTS, {
|
|
3745
|
+
method: HTTP_METHODS.POST,
|
|
3746
|
+
body,
|
|
3747
|
+
signal: options.signal,
|
|
3748
|
+
apiKey: options.apiKey
|
|
3749
|
+
})
|
|
2230
3750
|
});
|
|
2231
3751
|
|
|
2232
3752
|
const ProviderImports = (transport) => ({
|
|
2233
|
-
inspect: (apiKey, options = {}) => transport.request(
|
|
3753
|
+
inspect: (apiKey, options = {}) => transport.request(API_PATHS.PROVIDER_IMPORTS_INSPECT, {
|
|
2234
3754
|
method: HTTP_METHODS.POST,
|
|
2235
|
-
body: { apiKey },
|
|
3755
|
+
body: options.provider === undefined ? { apiKey } : { apiKey, provider: options.provider },
|
|
2236
3756
|
signal: options.signal,
|
|
2237
3757
|
apiKey: options.apiKey
|
|
2238
3758
|
}),
|
|
2239
|
-
create: (body, options = {}) => transport.request(
|
|
3759
|
+
create: (body, options = {}) => transport.request(API_PATHS.PROVIDER_IMPORTS, {
|
|
2240
3760
|
method: HTTP_METHODS.POST,
|
|
2241
3761
|
body,
|
|
2242
3762
|
signal: options.signal,
|
|
2243
3763
|
apiKey: options.apiKey
|
|
2244
3764
|
}),
|
|
2245
|
-
list: (options = {}) => FetchPage(transport,
|
|
2246
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2247
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2248
|
-
get: (id, options = {}) => transport.request(
|
|
2249
|
-
cancel: (id, options = {}) => transport.request(
|
|
3765
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.PROVIDER_IMPORTS, CURSOR_STYLES.CURSOR, options),
|
|
3766
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.PROVIDER_IMPORTS, CURSOR_STYLES.CURSOR, options),
|
|
3767
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.PROVIDER_IMPORTS, CURSOR_STYLES.CURSOR, options),
|
|
3768
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.PROVIDER_IMPORT, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3769
|
+
cancel: (id, options = {}) => transport.request(RequestPath(API_PATHS.PROVIDER_IMPORT_CANCEL, { id }), {
|
|
2250
3770
|
method: HTTP_METHODS.POST,
|
|
2251
3771
|
signal: options.signal,
|
|
2252
3772
|
apiKey: options.apiKey
|
|
@@ -2254,25 +3774,25 @@ const ProviderImports = (transport) => ({
|
|
|
2254
3774
|
});
|
|
2255
3775
|
|
|
2256
3776
|
const Labels = (transport) => ({
|
|
2257
|
-
list: (options = {}) => FetchPage(transport,
|
|
2258
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2259
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2260
|
-
listColors: (options = {}) => FetchList(transport,
|
|
2261
|
-
get: (id, options = {}) => transport.request(
|
|
2262
|
-
create: (body, options = {}) => transport.request(
|
|
3777
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.LABELS, CURSOR_STYLES.CURSOR, options),
|
|
3778
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.LABELS, CURSOR_STYLES.CURSOR, options),
|
|
3779
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.LABELS, CURSOR_STYLES.CURSOR, options),
|
|
3780
|
+
listColors: (options = {}) => FetchList(transport, API_PATHS.LABEL_COLORS, options),
|
|
3781
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.LABEL, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3782
|
+
create: (body, options = {}) => transport.request(API_PATHS.LABELS, {
|
|
2263
3783
|
method: HTTP_METHODS.POST,
|
|
2264
3784
|
body,
|
|
2265
3785
|
signal: options.signal,
|
|
2266
3786
|
apiKey: options.apiKey
|
|
2267
3787
|
}),
|
|
2268
|
-
update: (id, patch, options = {}) => transport.request(
|
|
3788
|
+
update: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.LABEL, { id }), {
|
|
2269
3789
|
method: HTTP_METHODS.PATCH,
|
|
2270
3790
|
body: patch,
|
|
2271
3791
|
repeatable: true,
|
|
2272
3792
|
signal: options.signal,
|
|
2273
3793
|
apiKey: options.apiKey
|
|
2274
3794
|
}),
|
|
2275
|
-
delete: (id, options = {}) => transport.request(
|
|
3795
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.LABEL, { id }), {
|
|
2276
3796
|
method: HTTP_METHODS.DELETE,
|
|
2277
3797
|
signal: options.signal,
|
|
2278
3798
|
apiKey: options.apiKey
|
|
@@ -2280,13 +3800,13 @@ const Labels = (transport) => ({
|
|
|
2280
3800
|
});
|
|
2281
3801
|
|
|
2282
3802
|
const Languages = (transport) => ({
|
|
2283
|
-
list: (options = {}) => FetchList(transport,
|
|
3803
|
+
list: (options = {}) => FetchList(transport, API_PATHS.LANGUAGES, options)
|
|
2284
3804
|
});
|
|
2285
3805
|
|
|
2286
3806
|
const Me = (transport) => ({
|
|
2287
|
-
get: (options = {}) => transport.request(
|
|
2288
|
-
ping: (options = {}) => transport.request(
|
|
2289
|
-
rotate: (options = {}) => transport.request(
|
|
3807
|
+
get: (options = {}) => transport.request(API_PATHS.KEY_SELF, { signal: options.signal, apiKey: options.apiKey }),
|
|
3808
|
+
ping: (options = {}) => transport.request(API_PATHS.PING, { signal: options.signal, apiKey: options.apiKey }),
|
|
3809
|
+
rotate: (options = {}) => transport.request(API_PATHS.KEY_SELF_ROTATE, {
|
|
2290
3810
|
method: HTTP_METHODS.POST,
|
|
2291
3811
|
signal: options.signal,
|
|
2292
3812
|
apiKey: options.apiKey
|
|
@@ -2294,49 +3814,61 @@ const Me = (transport) => ({
|
|
|
2294
3814
|
});
|
|
2295
3815
|
|
|
2296
3816
|
const Members = (transport) => ({
|
|
2297
|
-
list: (options = {}) => FetchPage(transport,
|
|
2298
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2299
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2300
|
-
get: (userId, options = {}) => transport.request(
|
|
2301
|
-
add: (body, options = {}) => transport.request(
|
|
3817
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.MEMBERS, CURSOR_STYLES.CURSOR, options),
|
|
3818
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.MEMBERS, CURSOR_STYLES.CURSOR, options),
|
|
3819
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.MEMBERS, CURSOR_STYLES.CURSOR, options),
|
|
3820
|
+
get: (userId, options = {}) => transport.request(RequestPath(API_PATHS.MEMBER, { userId }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3821
|
+
add: (body, options = {}) => transport.request(API_PATHS.MEMBERS, {
|
|
2302
3822
|
method: HTTP_METHODS.POST,
|
|
2303
3823
|
body,
|
|
2304
3824
|
signal: options.signal,
|
|
2305
3825
|
apiKey: options.apiKey
|
|
2306
3826
|
}),
|
|
2307
|
-
update: (userId, patch, options = {}) => transport.request(
|
|
3827
|
+
update: (userId, patch, options = {}) => transport.request(RequestPath(API_PATHS.MEMBER, { userId }), {
|
|
2308
3828
|
method: HTTP_METHODS.PATCH,
|
|
2309
3829
|
body: patch,
|
|
2310
3830
|
repeatable: true,
|
|
2311
3831
|
signal: options.signal,
|
|
2312
3832
|
apiKey: options.apiKey
|
|
2313
3833
|
}),
|
|
2314
|
-
remove: (userId, options = {}) => transport.request(
|
|
3834
|
+
remove: (userId, options = {}) => transport.request(RequestPath(API_PATHS.MEMBER, { userId }), {
|
|
2315
3835
|
method: HTTP_METHODS.DELETE,
|
|
2316
3836
|
signal: options.signal,
|
|
2317
3837
|
apiKey: options.apiKey
|
|
2318
3838
|
}),
|
|
2319
|
-
grantAddress: (userId, body, options = {}) => transport.request(
|
|
3839
|
+
grantAddress: (userId, body, options = {}) => transport.request(RequestPath(API_PATHS.MEMBER_ADDRESSES, { userId }), {
|
|
2320
3840
|
method: HTTP_METHODS.POST,
|
|
2321
3841
|
body,
|
|
2322
3842
|
repeatable: true,
|
|
2323
3843
|
signal: options.signal,
|
|
2324
3844
|
apiKey: options.apiKey
|
|
2325
3845
|
}),
|
|
2326
|
-
revokeAddress: (userId, addressId, options = {}) => transport.request(
|
|
3846
|
+
revokeAddress: (userId, addressId, options = {}) => transport.request(RequestPath(API_PATHS.MEMBER_ADDRESS, { userId, addressId }), {
|
|
2327
3847
|
method: HTTP_METHODS.DELETE,
|
|
2328
3848
|
signal: options.signal,
|
|
2329
3849
|
apiKey: options.apiKey
|
|
2330
3850
|
}),
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
3851
|
+
grantDomain: (userId, body, options = {}) => transport.request(RequestPath(API_PATHS.MEMBER_DOMAINS, { userId }), {
|
|
3852
|
+
method: HTTP_METHODS.POST,
|
|
3853
|
+
body,
|
|
3854
|
+
repeatable: true,
|
|
3855
|
+
signal: options.signal,
|
|
3856
|
+
apiKey: options.apiKey
|
|
3857
|
+
}),
|
|
3858
|
+
revokeDomain: (userId, domainId, options = {}) => transport.request(RequestPath(API_PATHS.MEMBER_DOMAIN, { userId, domainId }), {
|
|
3859
|
+
method: HTTP_METHODS.DELETE,
|
|
3860
|
+
signal: options.signal,
|
|
3861
|
+
apiKey: options.apiKey
|
|
3862
|
+
}),
|
|
3863
|
+
listInvitations: (options = {}) => FetchPage(transport, API_PATHS.MEMBER_INVITATIONS, CURSOR_STYLES.CURSOR, options),
|
|
3864
|
+
listAllInvitations: (options = {}) => CollectAll(transport, API_PATHS.MEMBER_INVITATIONS, CURSOR_STYLES.CURSOR, options),
|
|
3865
|
+
iterateInvitations: (options = {}) => IteratePages(transport, API_PATHS.MEMBER_INVITATIONS, CURSOR_STYLES.CURSOR, options),
|
|
3866
|
+
revokeInvitation: (invitationId, options = {}) => transport.request(RequestPath(API_PATHS.MEMBER_INVITATION, { invitationId }), {
|
|
2335
3867
|
method: HTTP_METHODS.DELETE,
|
|
2336
3868
|
signal: options.signal,
|
|
2337
3869
|
apiKey: options.apiKey
|
|
2338
3870
|
}),
|
|
2339
|
-
resendInvitation: (invitationId, options = {}) => transport.request(
|
|
3871
|
+
resendInvitation: (invitationId, options = {}) => transport.request(RequestPath(API_PATHS.MEMBER_INVITATION_RESEND, { invitationId }), {
|
|
2340
3872
|
method: HTTP_METHODS.POST,
|
|
2341
3873
|
signal: options.signal,
|
|
2342
3874
|
apiKey: options.apiKey
|
|
@@ -2344,33 +3876,33 @@ const Members = (transport) => ({
|
|
|
2344
3876
|
});
|
|
2345
3877
|
|
|
2346
3878
|
const Roles = (transport) => ({
|
|
2347
|
-
list: (options = {}) => FetchPage(transport,
|
|
2348
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2349
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2350
|
-
get: (id, options = {}) => transport.request(
|
|
2351
|
-
create: (body, options = {}) => transport.request(
|
|
3879
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.ROLES, CURSOR_STYLES.CURSOR, options),
|
|
3880
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.ROLES, CURSOR_STYLES.CURSOR, options),
|
|
3881
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.ROLES, CURSOR_STYLES.CURSOR, options),
|
|
3882
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.ROLE, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3883
|
+
create: (body, options = {}) => transport.request(API_PATHS.ROLES, {
|
|
2352
3884
|
method: HTTP_METHODS.POST,
|
|
2353
3885
|
body,
|
|
2354
3886
|
signal: options.signal,
|
|
2355
3887
|
apiKey: options.apiKey
|
|
2356
3888
|
}),
|
|
2357
|
-
update: (id, patch, options = {}) => transport.request(
|
|
3889
|
+
update: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.ROLE, { id }), {
|
|
2358
3890
|
method: HTTP_METHODS.PATCH,
|
|
2359
3891
|
body: patch,
|
|
2360
3892
|
repeatable: true,
|
|
2361
3893
|
signal: options.signal,
|
|
2362
3894
|
apiKey: options.apiKey
|
|
2363
3895
|
}),
|
|
2364
|
-
delete: (id, options = {}) => transport.request(
|
|
3896
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.ROLE, { id }), {
|
|
2365
3897
|
method: HTTP_METHODS.DELETE,
|
|
2366
3898
|
query: { [QUERY_KEYS.REASSIGN_TO]: options.reassignTo },
|
|
2367
3899
|
signal: options.signal,
|
|
2368
3900
|
apiKey: options.apiKey
|
|
2369
3901
|
}),
|
|
2370
|
-
listPermissions: (options = {}) => FetchList(transport,
|
|
3902
|
+
listPermissions: (options = {}) => FetchList(transport, API_PATHS.ROLE_PERMISSIONS, options)
|
|
2371
3903
|
});
|
|
2372
3904
|
|
|
2373
|
-
const ListQuery$
|
|
3905
|
+
const ListQuery$6 = (options) => ({
|
|
2374
3906
|
[QUERY_KEYS.ENABLED]: options.enabled === undefined ? undefined : String(options.enabled)
|
|
2375
3907
|
});
|
|
2376
3908
|
const RunsQuery = (options) => ({
|
|
@@ -2378,29 +3910,29 @@ const RunsQuery = (options) => ({
|
|
|
2378
3910
|
[QUERY_KEYS.THREAD_ID]: options.threadId
|
|
2379
3911
|
});
|
|
2380
3912
|
const Rules = (transport) => ({
|
|
2381
|
-
list: (options = {}) => FetchPage(transport,
|
|
2382
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2383
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2384
|
-
get: (id, options = {}) => transport.request(
|
|
2385
|
-
create: (body, options = {}) => transport.request(
|
|
3913
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.RULES, CURSOR_STYLES.CURSOR, options, ListQuery$6(options)),
|
|
3914
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.RULES, CURSOR_STYLES.CURSOR, options, ListQuery$6(options)),
|
|
3915
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.RULES, CURSOR_STYLES.CURSOR, options, ListQuery$6(options)),
|
|
3916
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.RULE, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3917
|
+
create: (body, options = {}) => transport.request(API_PATHS.RULES, {
|
|
2386
3918
|
method: HTTP_METHODS.POST,
|
|
2387
3919
|
body,
|
|
2388
3920
|
signal: options.signal,
|
|
2389
3921
|
apiKey: options.apiKey
|
|
2390
3922
|
}),
|
|
2391
|
-
update: (id, patch, options = {}) => transport.request(
|
|
3923
|
+
update: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.RULE, { id }), {
|
|
2392
3924
|
method: HTTP_METHODS.PATCH,
|
|
2393
3925
|
body: patch,
|
|
2394
3926
|
signal: options.signal,
|
|
2395
3927
|
apiKey: options.apiKey
|
|
2396
3928
|
}),
|
|
2397
|
-
delete: (id, options = {}) => transport.request(
|
|
3929
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.RULE, { id }), {
|
|
2398
3930
|
method: HTTP_METHODS.DELETE,
|
|
2399
3931
|
signal: options.signal,
|
|
2400
3932
|
apiKey: options.apiKey
|
|
2401
3933
|
}),
|
|
2402
3934
|
reorder: async (ruleIds, options = {}) => {
|
|
2403
|
-
const envelope = await transport.request(
|
|
3935
|
+
const envelope = await transport.request(API_PATHS.RULES_REORDER, {
|
|
2404
3936
|
method: HTTP_METHODS.POST,
|
|
2405
3937
|
body: { ruleIds },
|
|
2406
3938
|
repeatable: true,
|
|
@@ -2409,27 +3941,27 @@ const Rules = (transport) => ({
|
|
|
2409
3941
|
});
|
|
2410
3942
|
return envelope?.data ?? [];
|
|
2411
3943
|
},
|
|
2412
|
-
test: (id, body = {}, options = {}) => transport.request(
|
|
3944
|
+
test: (id, body = {}, options = {}) => transport.request(RequestPath(API_PATHS.RULE_TEST, { id }), {
|
|
2413
3945
|
method: HTTP_METHODS.POST,
|
|
2414
3946
|
body,
|
|
2415
3947
|
repeatable: true,
|
|
2416
3948
|
signal: options.signal,
|
|
2417
3949
|
apiKey: options.apiKey
|
|
2418
3950
|
}),
|
|
2419
|
-
listRuns: (options = {}) => FetchPage(transport,
|
|
2420
|
-
listAllRuns: (options = {}) => CollectAll(transport,
|
|
2421
|
-
iterateRuns: (options = {}) => IteratePages(transport,
|
|
3951
|
+
listRuns: (options = {}) => FetchPage(transport, API_PATHS.RULE_RUNS, CURSOR_STYLES.CURSOR, options, RunsQuery(options)),
|
|
3952
|
+
listAllRuns: (options = {}) => CollectAll(transport, API_PATHS.RULE_RUNS, CURSOR_STYLES.CURSOR, options, RunsQuery(options)),
|
|
3953
|
+
iterateRuns: (options = {}) => IteratePages(transport, API_PATHS.RULE_RUNS, CURSOR_STYLES.CURSOR, options, RunsQuery(options))
|
|
2422
3954
|
});
|
|
2423
3955
|
|
|
2424
3956
|
const Security = (transport) => ({
|
|
2425
|
-
stepUpStatus: (options = {}) => transport.request(
|
|
2426
|
-
beginStepUp: (body = {}, options = {}) => transport.request(
|
|
3957
|
+
stepUpStatus: (options = {}) => transport.request(API_PATHS.SECURITY_STEP_UP, { signal: options.signal, apiKey: options.apiKey }),
|
|
3958
|
+
beginStepUp: (body = {}, options = {}) => transport.request(API_PATHS.SECURITY_STEP_UP, {
|
|
2427
3959
|
method: HTTP_METHODS.POST,
|
|
2428
3960
|
body,
|
|
2429
3961
|
signal: options.signal,
|
|
2430
3962
|
apiKey: options.apiKey
|
|
2431
3963
|
}),
|
|
2432
|
-
verifyStepUp: (body, options = {}) => transport.request(
|
|
3964
|
+
verifyStepUp: (body, options = {}) => transport.request(API_PATHS.SECURITY_STEP_UP_VERIFY, {
|
|
2433
3965
|
method: HTTP_METHODS.POST,
|
|
2434
3966
|
body,
|
|
2435
3967
|
signal: options.signal,
|
|
@@ -2438,12 +3970,12 @@ const Security = (transport) => ({
|
|
|
2438
3970
|
});
|
|
2439
3971
|
|
|
2440
3972
|
const Settings = (transport) => ({
|
|
2441
|
-
get: (options = {}) => transport.request(
|
|
3973
|
+
get: (options = {}) => transport.request(API_PATHS.SETTINGS, {
|
|
2442
3974
|
query: { [QUERY_KEYS.ADDRESS]: options.address },
|
|
2443
3975
|
signal: options.signal,
|
|
2444
3976
|
apiKey: options.apiKey
|
|
2445
3977
|
}),
|
|
2446
|
-
update: (patch, options = {}) => transport.request(
|
|
3978
|
+
update: (patch, options = {}) => transport.request(API_PATHS.SETTINGS, {
|
|
2447
3979
|
method: HTTP_METHODS.PATCH,
|
|
2448
3980
|
query: { [QUERY_KEYS.ADDRESS]: options.address },
|
|
2449
3981
|
body: patch,
|
|
@@ -2453,23 +3985,23 @@ const Settings = (transport) => ({
|
|
|
2453
3985
|
})
|
|
2454
3986
|
});
|
|
2455
3987
|
|
|
2456
|
-
const ListQuery$
|
|
3988
|
+
const ListQuery$5 = (options) => ({
|
|
2457
3989
|
[QUERY_KEYS.Q]: options.q,
|
|
2458
3990
|
[QUERY_KEYS.REASON]: options.reason
|
|
2459
3991
|
});
|
|
2460
3992
|
const Suppressions = (transport) => ({
|
|
2461
|
-
list: (options = {}) => FetchPage(transport,
|
|
2462
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2463
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2464
|
-
get: (id, options = {}) => transport.request(
|
|
2465
|
-
add: (body, options = {}) => transport.request(
|
|
3993
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.SUPPRESSIONS, CURSOR_STYLES.CURSOR, options, ListQuery$5(options)),
|
|
3994
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.SUPPRESSIONS, CURSOR_STYLES.CURSOR, options, ListQuery$5(options)),
|
|
3995
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.SUPPRESSIONS, CURSOR_STYLES.CURSOR, options, ListQuery$5(options)),
|
|
3996
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.SUPPRESSION, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
3997
|
+
add: (body, options = {}) => transport.request(API_PATHS.SUPPRESSIONS, {
|
|
2466
3998
|
method: HTTP_METHODS.POST,
|
|
2467
3999
|
body,
|
|
2468
4000
|
repeatable: true,
|
|
2469
4001
|
signal: options.signal,
|
|
2470
4002
|
apiKey: options.apiKey
|
|
2471
4003
|
}),
|
|
2472
|
-
remove: (id, options = {}) => transport.request(
|
|
4004
|
+
remove: (id, options = {}) => transport.request(RequestPath(API_PATHS.SUPPRESSION, { id }), {
|
|
2473
4005
|
method: HTTP_METHODS.DELETE,
|
|
2474
4006
|
signal: options.signal,
|
|
2475
4007
|
apiKey: options.apiKey
|
|
@@ -2477,7 +4009,7 @@ const Suppressions = (transport) => ({
|
|
|
2477
4009
|
});
|
|
2478
4010
|
|
|
2479
4011
|
const MessagePage = async (transport, inboxId, options) => {
|
|
2480
|
-
const envelope = await transport.request(
|
|
4012
|
+
const envelope = await transport.request(RequestPath(API_PATHS.TEMP_MAIL_MESSAGES, { id: inboxId }), {
|
|
2481
4013
|
query: { [QUERY_KEYS.LIMIT]: options.limit, [QUERY_KEYS.CURSOR]: options.cursor },
|
|
2482
4014
|
inboxToken: options.inboxToken,
|
|
2483
4015
|
signal: options.signal
|
|
@@ -2502,26 +4034,26 @@ const IterateMessages = async function* (transport, inboxId, options) {
|
|
|
2502
4034
|
}
|
|
2503
4035
|
};
|
|
2504
4036
|
const TempMail = (transport) => ({
|
|
2505
|
-
listDomains: async (options = {}) => (await transport.request(
|
|
4037
|
+
listDomains: async (options = {}) => (await transport.request(API_PATHS.TEMP_MAIL_DOMAINS, {
|
|
2506
4038
|
anonymous: true,
|
|
2507
4039
|
signal: options.signal
|
|
2508
4040
|
}))?.data ?? [],
|
|
2509
|
-
create: (body = {}, options = {}) => transport.request(
|
|
4041
|
+
create: (body = {}, options = {}) => transport.request(API_PATHS.TEMP_MAIL_INBOXES, {
|
|
2510
4042
|
method: HTTP_METHODS.POST,
|
|
2511
4043
|
body,
|
|
2512
4044
|
anonymous: true,
|
|
2513
4045
|
signal: options.signal
|
|
2514
4046
|
}),
|
|
2515
|
-
get: (inboxId, options = {}) => transport.request(
|
|
4047
|
+
get: (inboxId, options = {}) => transport.request(RequestPath(API_PATHS.TEMP_MAIL_INBOX, { id: inboxId }), {
|
|
2516
4048
|
inboxToken: options.inboxToken,
|
|
2517
4049
|
signal: options.signal
|
|
2518
4050
|
}),
|
|
2519
|
-
extend: (inboxId, options = {}) => transport.request(
|
|
4051
|
+
extend: (inboxId, options = {}) => transport.request(RequestPath(API_PATHS.TEMP_MAIL_INBOX_EXTEND, { id: inboxId }), {
|
|
2520
4052
|
method: HTTP_METHODS.POST,
|
|
2521
4053
|
inboxToken: options.inboxToken,
|
|
2522
4054
|
signal: options.signal
|
|
2523
4055
|
}),
|
|
2524
|
-
delete: (inboxId, options = {}) => transport.request(
|
|
4056
|
+
delete: (inboxId, options = {}) => transport.request(RequestPath(API_PATHS.TEMP_MAIL_INBOX, { id: inboxId }), {
|
|
2525
4057
|
method: HTTP_METHODS.DELETE,
|
|
2526
4058
|
inboxToken: options.inboxToken,
|
|
2527
4059
|
signal: options.signal
|
|
@@ -2534,22 +4066,22 @@ const TempMail = (transport) => ({
|
|
|
2534
4066
|
return all;
|
|
2535
4067
|
},
|
|
2536
4068
|
iterateMessages: (inboxId, options = {}) => IterateMessages(transport, inboxId, options),
|
|
2537
|
-
getMessage: (inboxId, messageId, options = {}) => transport.request(
|
|
4069
|
+
getMessage: (inboxId, messageId, options = {}) => transport.request(RequestPath(API_PATHS.TEMP_MAIL_MESSAGE, { id: inboxId, messageId }), {
|
|
2538
4070
|
inboxToken: options.inboxToken,
|
|
2539
4071
|
signal: options.signal
|
|
2540
4072
|
}),
|
|
2541
|
-
deleteMessage: (inboxId, messageId, options = {}) => transport.request(
|
|
4073
|
+
deleteMessage: (inboxId, messageId, options = {}) => transport.request(RequestPath(API_PATHS.TEMP_MAIL_MESSAGE, { id: inboxId, messageId }), {
|
|
2542
4074
|
method: HTTP_METHODS.DELETE,
|
|
2543
4075
|
inboxToken: options.inboxToken,
|
|
2544
4076
|
signal: options.signal
|
|
2545
4077
|
}),
|
|
2546
|
-
listAttachments: async (inboxId, messageId, options = {}) => (await transport.request(
|
|
4078
|
+
listAttachments: async (inboxId, messageId, options = {}) => (await transport.request(RequestPath(API_PATHS.TEMP_MAIL_MESSAGE_ATTACHMENTS, { id: inboxId, messageId }), {
|
|
2547
4079
|
inboxToken: options.inboxToken,
|
|
2548
4080
|
signal: options.signal
|
|
2549
4081
|
}))?.data ?? []
|
|
2550
4082
|
});
|
|
2551
4083
|
|
|
2552
|
-
const ListQuery$
|
|
4084
|
+
const ListQuery$4 = (options) => ({
|
|
2553
4085
|
[QUERY_KEYS.STATUS]: options.status,
|
|
2554
4086
|
[QUERY_KEYS.SEARCH]: options.search,
|
|
2555
4087
|
[QUERY_KEYS.SORT]: options.sort
|
|
@@ -2562,84 +4094,85 @@ const WindowQuery$1 = (options) => ({
|
|
|
2562
4094
|
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes
|
|
2563
4095
|
});
|
|
2564
4096
|
const Templates = (transport) => ({
|
|
2565
|
-
list: (options = {}) => FetchPage(transport,
|
|
2566
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2567
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2568
|
-
listStarters: (options = {}) => FetchList(transport,
|
|
2569
|
-
listFonts: (options = {}) => FetchList(transport,
|
|
2570
|
-
getStarter: (slug, options = {}) => transport.request(
|
|
2571
|
-
render: (body, options = {}) => transport.request(
|
|
4097
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.TEMPLATES, CURSOR_STYLES.CURSOR, options, ListQuery$4(options)),
|
|
4098
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.TEMPLATES, CURSOR_STYLES.CURSOR, options, ListQuery$4(options)),
|
|
4099
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.TEMPLATES, CURSOR_STYLES.CURSOR, options, ListQuery$4(options)),
|
|
4100
|
+
listStarters: (options = {}) => FetchList(transport, API_PATHS.TEMPLATE_STARTERS, options),
|
|
4101
|
+
listFonts: (options = {}) => FetchList(transport, API_PATHS.TEMPLATE_FONTS, options),
|
|
4102
|
+
getStarter: (slug, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE_STARTER, { slug }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4103
|
+
render: (body, options = {}) => transport.request(API_PATHS.TEMPLATE_RENDER, {
|
|
2572
4104
|
method: HTTP_METHODS.POST,
|
|
2573
4105
|
body,
|
|
2574
4106
|
repeatable: true,
|
|
2575
4107
|
signal: options.signal,
|
|
2576
4108
|
apiKey: options.apiKey
|
|
2577
4109
|
}),
|
|
2578
|
-
get: (idOrSlug, options = {}) => transport.request(
|
|
2579
|
-
create: (body, options = {}) => transport.request(
|
|
4110
|
+
get: (idOrSlug, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE, { id: idOrSlug }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4111
|
+
create: (body, options = {}) => transport.request(API_PATHS.TEMPLATES, {
|
|
2580
4112
|
method: HTTP_METHODS.POST,
|
|
2581
4113
|
body,
|
|
2582
4114
|
signal: options.signal,
|
|
2583
4115
|
apiKey: options.apiKey
|
|
2584
4116
|
}),
|
|
2585
|
-
update: (idOrSlug, patch, options = {}) => transport.request(
|
|
4117
|
+
update: (idOrSlug, patch, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE, { id: idOrSlug }), {
|
|
2586
4118
|
method: HTTP_METHODS.PATCH,
|
|
2587
4119
|
body: patch,
|
|
2588
4120
|
signal: options.signal,
|
|
2589
4121
|
apiKey: options.apiKey
|
|
2590
4122
|
}),
|
|
2591
|
-
delete: (idOrSlug, options = {}) => transport.request(
|
|
4123
|
+
delete: (idOrSlug, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE, { id: idOrSlug }), {
|
|
2592
4124
|
method: HTTP_METHODS.DELETE,
|
|
2593
4125
|
signal: options.signal,
|
|
2594
4126
|
apiKey: options.apiKey
|
|
2595
4127
|
}),
|
|
2596
|
-
duplicate: (idOrSlug, body = {}, options = {}) => transport.request(
|
|
4128
|
+
duplicate: (idOrSlug, body = {}, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE_DUPLICATE, { id: idOrSlug }), {
|
|
2597
4129
|
method: HTTP_METHODS.POST,
|
|
2598
4130
|
body,
|
|
2599
4131
|
signal: options.signal,
|
|
2600
4132
|
apiKey: options.apiKey
|
|
2601
4133
|
}),
|
|
2602
|
-
replaceContent: (idOrSlug, body, options = {}) => transport.request(
|
|
4134
|
+
replaceContent: (idOrSlug, body, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE_CONTENT, { id: idOrSlug }), {
|
|
2603
4135
|
method: HTTP_METHODS.POST,
|
|
2604
4136
|
body,
|
|
2605
4137
|
signal: options.signal,
|
|
2606
4138
|
apiKey: options.apiKey
|
|
2607
4139
|
}),
|
|
2608
|
-
listVersions: (idOrSlug, options = {}) => FetchPage(transport,
|
|
2609
|
-
listAllVersions: (idOrSlug, options = {}) => CollectAll(transport,
|
|
2610
|
-
iterateVersions: (idOrSlug, options = {}) => IteratePages(transport,
|
|
2611
|
-
getVersion: (idOrSlug, version, options = {}) => transport.request(
|
|
2612
|
-
deleteVersion: (idOrSlug, version, options = {}) => transport.request(
|
|
4140
|
+
listVersions: (idOrSlug, options = {}) => FetchPage(transport, RequestPath(API_PATHS.TEMPLATE_VERSIONS, { id: idOrSlug }), CURSOR_STYLES.CURSOR, options),
|
|
4141
|
+
listAllVersions: (idOrSlug, options = {}) => CollectAll(transport, RequestPath(API_PATHS.TEMPLATE_VERSIONS, { id: idOrSlug }), CURSOR_STYLES.CURSOR, options),
|
|
4142
|
+
iterateVersions: (idOrSlug, options = {}) => IteratePages(transport, RequestPath(API_PATHS.TEMPLATE_VERSIONS, { id: idOrSlug }), CURSOR_STYLES.CURSOR, options),
|
|
4143
|
+
getVersion: (idOrSlug, version, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE_VERSION, { id: idOrSlug, version }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4144
|
+
deleteVersion: (idOrSlug, version, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE_VERSION, { id: idOrSlug, version }), {
|
|
2613
4145
|
method: HTTP_METHODS.DELETE,
|
|
2614
4146
|
signal: options.signal,
|
|
2615
4147
|
apiKey: options.apiKey
|
|
2616
4148
|
}),
|
|
2617
|
-
restoreVersion: (idOrSlug, version, body = {}, options = {}) => transport.request(
|
|
4149
|
+
restoreVersion: (idOrSlug, version, body = {}, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE_VERSION_RESTORE, { id: idOrSlug, version }), {
|
|
2618
4150
|
method: HTTP_METHODS.POST,
|
|
2619
4151
|
body,
|
|
2620
4152
|
signal: options.signal,
|
|
2621
4153
|
apiKey: options.apiKey
|
|
2622
4154
|
}),
|
|
2623
|
-
publish: (idOrSlug, options = {}) => transport.request(
|
|
4155
|
+
publish: (idOrSlug, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE_VERSIONS, { id: idOrSlug }), {
|
|
2624
4156
|
method: HTTP_METHODS.POST,
|
|
4157
|
+
...(options.expectedVersion === undefined ? {} : { body: { expectedVersion: options.expectedVersion } }),
|
|
2625
4158
|
repeatable: true,
|
|
2626
4159
|
signal: options.signal,
|
|
2627
4160
|
apiKey: options.apiKey
|
|
2628
4161
|
}),
|
|
2629
|
-
preview: (idOrSlug, body = {}, options = {}) => transport.request(
|
|
4162
|
+
preview: (idOrSlug, body = {}, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE_PREVIEW, { id: idOrSlug }), {
|
|
2630
4163
|
method: HTTP_METHODS.POST,
|
|
2631
4164
|
body,
|
|
2632
4165
|
repeatable: true,
|
|
2633
4166
|
signal: options.signal,
|
|
2634
4167
|
apiKey: options.apiKey
|
|
2635
4168
|
}),
|
|
2636
|
-
getAnalytics: (idOrSlug, options = {}) => transport.request(
|
|
4169
|
+
getAnalytics: (idOrSlug, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE_ANALYTICS, { id: idOrSlug }), {
|
|
2637
4170
|
query: WindowQuery$1(options),
|
|
2638
4171
|
signal: options.signal,
|
|
2639
4172
|
apiKey: options.apiKey
|
|
2640
4173
|
}),
|
|
2641
4174
|
listSends: async (idOrSlug, options = {}) => {
|
|
2642
|
-
const envelope = await transport.request(
|
|
4175
|
+
const envelope = await transport.request(RequestPath(API_PATHS.TEMPLATE_SENDS, { id: idOrSlug }), {
|
|
2643
4176
|
query: {
|
|
2644
4177
|
...WindowQuery$1(options),
|
|
2645
4178
|
[QUERY_KEYS.PAGE]: options.page,
|
|
@@ -2661,7 +4194,7 @@ const Templates = (transport) => ({
|
|
|
2661
4194
|
pageSize: envelope?.pageSize ?? 0
|
|
2662
4195
|
};
|
|
2663
4196
|
},
|
|
2664
|
-
send: (idOrSlug, body, options = {}) => transport.request(
|
|
4197
|
+
send: (idOrSlug, body, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE_SEND, { id: idOrSlug }), {
|
|
2665
4198
|
method: HTTP_METHODS.POST,
|
|
2666
4199
|
body: TemplateSendToWire(body),
|
|
2667
4200
|
idempotent: true,
|
|
@@ -2669,84 +4202,160 @@ const Templates = (transport) => ({
|
|
|
2669
4202
|
repeatable: true,
|
|
2670
4203
|
signal: options.signal,
|
|
2671
4204
|
apiKey: options.apiKey
|
|
4205
|
+
}),
|
|
4206
|
+
listImages: (options = {}) => FetchPage(transport, API_PATHS.TEMPLATE_IMAGES, CURSOR_STYLES.CURSOR, options),
|
|
4207
|
+
listAllImages: (options = {}) => CollectAll(transport, API_PATHS.TEMPLATE_IMAGES, CURSOR_STYLES.CURSOR, options),
|
|
4208
|
+
iterateImages: (options = {}) => IteratePages(transport, API_PATHS.TEMPLATE_IMAGES, CURSOR_STYLES.CURSOR, options),
|
|
4209
|
+
uploadImage: (data, options = {}) => transport.request(API_PATHS.TEMPLATE_IMAGES, {
|
|
4210
|
+
method: HTTP_METHODS.POST,
|
|
4211
|
+
raw: data,
|
|
4212
|
+
contentType: options.contentType ?? (typeof Blob !== 'undefined' && data instanceof Blob && data.type ? data.type : undefined),
|
|
4213
|
+
signal: options.signal,
|
|
4214
|
+
apiKey: options.apiKey
|
|
4215
|
+
}),
|
|
4216
|
+
design: (body, options = {}) => transport.request(API_PATHS.TEMPLATES_DESIGN, {
|
|
4217
|
+
method: HTTP_METHODS.POST,
|
|
4218
|
+
body,
|
|
4219
|
+
signal: options.signal,
|
|
4220
|
+
apiKey: options.apiKey
|
|
4221
|
+
}),
|
|
4222
|
+
redesign: (idOrSlug, body, options = {}) => transport.request(RequestPath(API_PATHS.TEMPLATE_REDESIGN, { id: idOrSlug }), {
|
|
4223
|
+
method: HTTP_METHODS.POST,
|
|
4224
|
+
body,
|
|
4225
|
+
signal: options.signal,
|
|
4226
|
+
apiKey: options.apiKey
|
|
2672
4227
|
})
|
|
2673
4228
|
});
|
|
2674
4229
|
|
|
2675
|
-
const ListQuery$
|
|
4230
|
+
const ListQuery$3 = (options) => ({
|
|
2676
4231
|
[QUERY_KEYS.FOLDER]: options.folder,
|
|
2677
4232
|
[QUERY_KEYS.QUERY]: options.query,
|
|
2678
4233
|
[QUERY_KEYS.LABEL_IDS]: Array.isArray(options.labelIds) ? options.labelIds.join(LIST_SEPARATOR) : options.labelIds,
|
|
2679
4234
|
[QUERY_KEYS.SORT]: options.sort,
|
|
2680
4235
|
[QUERY_KEYS.DATE_FROM]: options.dateFrom === undefined ? undefined : ToInstant(options.dateFrom),
|
|
2681
4236
|
[QUERY_KEYS.DATE_TO]: options.dateTo === undefined ? undefined : ToInstant(options.dateTo),
|
|
2682
|
-
[QUERY_KEYS.FROM_CONTACTS]: options.fromContacts === undefined ? undefined : String(options.fromContacts)
|
|
4237
|
+
[QUERY_KEYS.FROM_CONTACTS]: options.fromContacts === undefined ? undefined : String(options.fromContacts),
|
|
4238
|
+
[QUERY_KEYS.SEMANTIC]: options.semantic === undefined ? undefined : String(options.semantic),
|
|
4239
|
+
[QUERY_KEYS.ADDRESS]: options.address
|
|
2683
4240
|
});
|
|
2684
4241
|
const Threads = (transport) => ({
|
|
2685
|
-
list: (options = {}) => FetchPage(transport,
|
|
2686
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2687
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2688
|
-
get: (id, options = {}) => transport.request(
|
|
2689
|
-
update: (id, patch, options = {}) => transport.request(
|
|
4242
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.THREADS, CURSOR_STYLES.PAGE_TOKEN, options, ListQuery$3(options)),
|
|
4243
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.THREADS, CURSOR_STYLES.PAGE_TOKEN, options, ListQuery$3(options)),
|
|
4244
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.THREADS, CURSOR_STYLES.PAGE_TOKEN, options, ListQuery$3(options)),
|
|
4245
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.THREAD, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4246
|
+
update: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.THREAD, { id }), {
|
|
2690
4247
|
method: HTTP_METHODS.PATCH,
|
|
2691
4248
|
body: patch,
|
|
2692
4249
|
repeatable: true,
|
|
2693
4250
|
signal: options.signal,
|
|
2694
4251
|
apiKey: options.apiKey
|
|
2695
4252
|
}),
|
|
2696
|
-
trash: (id, options = {}) => transport.request(
|
|
4253
|
+
trash: (id, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_TRASH, { id }), {
|
|
2697
4254
|
method: HTTP_METHODS.POST,
|
|
2698
4255
|
repeatable: true,
|
|
2699
4256
|
signal: options.signal,
|
|
2700
4257
|
apiKey: options.apiKey
|
|
2701
4258
|
}),
|
|
2702
|
-
snooze: (id, wakeAt, options = {}) => transport.request(
|
|
4259
|
+
snooze: (id, wakeAt, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_SNOOZE, { id }), {
|
|
2703
4260
|
method: HTTP_METHODS.POST,
|
|
2704
4261
|
body: { wakeAt: ToInstant(wakeAt) },
|
|
2705
4262
|
repeatable: true,
|
|
2706
4263
|
signal: options.signal,
|
|
2707
4264
|
apiKey: options.apiKey
|
|
2708
4265
|
}),
|
|
2709
|
-
unsnooze: (id, options = {}) => transport.request(
|
|
4266
|
+
unsnooze: (id, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_UNSNOOZE, { id }), {
|
|
4267
|
+
method: HTTP_METHODS.POST,
|
|
4268
|
+
repeatable: true,
|
|
4269
|
+
signal: options.signal,
|
|
4270
|
+
apiKey: options.apiKey
|
|
4271
|
+
}),
|
|
4272
|
+
listAttachments: (id, messageId, options = {}) => FetchList(transport, RequestPath(API_PATHS.THREAD_MESSAGE_ATTACHMENTS, { id, messageId }), options),
|
|
4273
|
+
getEvent: (id, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_EVENT, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4274
|
+
listNotes: (id, options = {}) => FetchList(transport, RequestPath(API_PATHS.THREAD_NOTES, { id }), options),
|
|
4275
|
+
createNote: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_NOTES, { id }), {
|
|
4276
|
+
method: HTTP_METHODS.POST,
|
|
4277
|
+
body,
|
|
4278
|
+
signal: options.signal,
|
|
4279
|
+
apiKey: options.apiKey
|
|
4280
|
+
}),
|
|
4281
|
+
updateNote: (id, noteId, patch, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_NOTE, { id, noteId }), {
|
|
4282
|
+
method: HTTP_METHODS.PATCH,
|
|
4283
|
+
body: patch,
|
|
4284
|
+
repeatable: true,
|
|
4285
|
+
signal: options.signal,
|
|
4286
|
+
apiKey: options.apiKey
|
|
4287
|
+
}),
|
|
4288
|
+
deleteNote: (id, noteId, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_NOTE, { id, noteId }), {
|
|
4289
|
+
method: HTTP_METHODS.DELETE,
|
|
4290
|
+
signal: options.signal,
|
|
4291
|
+
apiKey: options.apiKey
|
|
4292
|
+
}),
|
|
4293
|
+
reorderNotes: (id, ids, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_NOTES_REORDER, { id }), {
|
|
4294
|
+
method: HTTP_METHODS.POST,
|
|
4295
|
+
body: { ids },
|
|
4296
|
+
repeatable: true,
|
|
4297
|
+
signal: options.signal,
|
|
4298
|
+
apiKey: options.apiKey
|
|
4299
|
+
}).then(payload => payload?.data ?? []),
|
|
4300
|
+
counts: (options = {}) => transport.request(API_PATHS.THREADS_COUNTS, {
|
|
4301
|
+
query: { [QUERY_KEYS.ADDRESS]: options.address },
|
|
4302
|
+
signal: options.signal,
|
|
4303
|
+
apiKey: options.apiKey
|
|
4304
|
+
}),
|
|
4305
|
+
summary: (id, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_SUMMARY, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4306
|
+
replySuggestions: (id, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_REPLY_SUGGESTIONS, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4307
|
+
restore: (id, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_RESTORE, { id }), {
|
|
2710
4308
|
method: HTTP_METHODS.POST,
|
|
2711
4309
|
repeatable: true,
|
|
2712
4310
|
signal: options.signal,
|
|
2713
4311
|
apiKey: options.apiKey
|
|
2714
4312
|
}),
|
|
2715
|
-
|
|
4313
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.THREAD, { id }), {
|
|
4314
|
+
method: HTTP_METHODS.DELETE,
|
|
4315
|
+
signal: options.signal,
|
|
4316
|
+
apiKey: options.apiKey
|
|
4317
|
+
}),
|
|
4318
|
+
unsubscribe: (id, options = {}) => transport.request(RequestPath(API_PATHS.THREAD_UNSUBSCRIBE, { id }), {
|
|
4319
|
+
method: HTTP_METHODS.POST,
|
|
4320
|
+
signal: options.signal,
|
|
4321
|
+
apiKey: options.apiKey
|
|
4322
|
+
})
|
|
2716
4323
|
});
|
|
2717
4324
|
|
|
2718
4325
|
const Flag = (value) => value === undefined ? undefined : String(value);
|
|
2719
4326
|
const HitQuery = (options) => ({
|
|
2720
4327
|
[QUERY_KEYS.INCLUDE_MACHINE]: Flag(options.includeMachine)
|
|
2721
4328
|
});
|
|
2722
|
-
const ListQuery = (options) => ({
|
|
4329
|
+
const ListQuery$2 = (options) => ({
|
|
2723
4330
|
[QUERY_KEYS.OPENED]: Flag(options.opened),
|
|
2724
4331
|
[QUERY_KEYS.CLICKED]: Flag(options.clicked),
|
|
2725
4332
|
[QUERY_KEYS.DAYS]: options.days,
|
|
2726
4333
|
[QUERY_KEYS.MINUTES]: options.minutes,
|
|
2727
|
-
[QUERY_KEYS.GRAIN]: options.grain
|
|
4334
|
+
[QUERY_KEYS.GRAIN]: options.grain,
|
|
4335
|
+
[QUERY_KEYS.ADDRESS]: options.address
|
|
2728
4336
|
});
|
|
2729
4337
|
const Tracking = (transport) => ({
|
|
2730
|
-
list: (options = {}) => FetchPage(transport,
|
|
2731
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2732
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2733
|
-
getStats: (options = {}) => transport.request(
|
|
4338
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.TRACKING, CURSOR_STYLES.CURSOR, options, ListQuery$2(options)),
|
|
4339
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.TRACKING, CURSOR_STYLES.CURSOR, options, ListQuery$2(options)),
|
|
4340
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.TRACKING, CURSOR_STYLES.CURSOR, options, ListQuery$2(options)),
|
|
4341
|
+
getStats: (options = {}) => transport.request(API_PATHS.TRACKING_STATS, {
|
|
2734
4342
|
query: {
|
|
2735
4343
|
[QUERY_KEYS.DAYS]: options.days,
|
|
2736
4344
|
[QUERY_KEYS.MINUTES]: options.minutes,
|
|
2737
4345
|
[QUERY_KEYS.GRAIN]: options.grain,
|
|
2738
|
-
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes
|
|
4346
|
+
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes,
|
|
4347
|
+
[QUERY_KEYS.ADDRESS]: options.address
|
|
2739
4348
|
},
|
|
2740
4349
|
signal: options.signal,
|
|
2741
4350
|
apiKey: options.apiKey
|
|
2742
4351
|
}),
|
|
2743
|
-
get: (id, options = {}) => transport.request(
|
|
2744
|
-
listOpens: (id, options = {}) => FetchPage(transport,
|
|
2745
|
-
listAllOpens: (id, options = {}) => CollectAll(transport,
|
|
2746
|
-
iterateOpens: (id, options = {}) => IteratePages(transport,
|
|
2747
|
-
listClicks: (id, options = {}) => FetchPage(transport,
|
|
2748
|
-
listAllClicks: (id, options = {}) => CollectAll(transport,
|
|
2749
|
-
iterateClicks: (id, options = {}) => IteratePages(transport,
|
|
4352
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.TRACKED, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4353
|
+
listOpens: (id, options = {}) => FetchPage(transport, RequestPath(API_PATHS.TRACKED_OPENS, { id }), CURSOR_STYLES.CURSOR, options, HitQuery(options)),
|
|
4354
|
+
listAllOpens: (id, options = {}) => CollectAll(transport, RequestPath(API_PATHS.TRACKED_OPENS, { id }), CURSOR_STYLES.CURSOR, options, HitQuery(options)),
|
|
4355
|
+
iterateOpens: (id, options = {}) => IteratePages(transport, RequestPath(API_PATHS.TRACKED_OPENS, { id }), CURSOR_STYLES.CURSOR, options, HitQuery(options)),
|
|
4356
|
+
listClicks: (id, options = {}) => FetchPage(transport, RequestPath(API_PATHS.TRACKED_CLICKS, { id }), CURSOR_STYLES.CURSOR, options, HitQuery(options)),
|
|
4357
|
+
listAllClicks: (id, options = {}) => CollectAll(transport, RequestPath(API_PATHS.TRACKED_CLICKS, { id }), CURSOR_STYLES.CURSOR, options, HitQuery(options)),
|
|
4358
|
+
iterateClicks: (id, options = {}) => IteratePages(transport, RequestPath(API_PATHS.TRACKED_CLICKS, { id }), CURSOR_STYLES.CURSOR, options, HitQuery(options))
|
|
2750
4359
|
});
|
|
2751
4360
|
|
|
2752
4361
|
const WindowQuery = (options) => ({
|
|
@@ -2766,56 +4375,350 @@ const WorkspaceActivityQuery = (options) => ({
|
|
|
2766
4375
|
[QUERY_KEYS.ENDPOINT_IDS]: options.endpointIds?.join(LIST_SEPARATOR)
|
|
2767
4376
|
});
|
|
2768
4377
|
const Webhooks = (transport) => ({
|
|
2769
|
-
list: (options = {}) => FetchPage(transport,
|
|
2770
|
-
listAll: (options = {}) => CollectAll(transport,
|
|
2771
|
-
iterate: (options = {}) => IteratePages(transport,
|
|
2772
|
-
get: (id, options = {}) => transport.request(
|
|
2773
|
-
create: (body, options = {}) => transport.request(
|
|
4378
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.WEBHOOKS, CURSOR_STYLES.CURSOR, options),
|
|
4379
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.WEBHOOKS, CURSOR_STYLES.CURSOR, options),
|
|
4380
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.WEBHOOKS, CURSOR_STYLES.CURSOR, options),
|
|
4381
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.WEBHOOK, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4382
|
+
create: (body, options = {}) => transport.request(API_PATHS.WEBHOOKS, {
|
|
2774
4383
|
method: HTTP_METHODS.POST,
|
|
2775
4384
|
body,
|
|
2776
4385
|
signal: options.signal,
|
|
2777
4386
|
apiKey: options.apiKey
|
|
2778
4387
|
}),
|
|
2779
|
-
update: (id, patch, options = {}) => transport.request(
|
|
4388
|
+
update: (id, patch, options = {}) => transport.request(RequestPath(API_PATHS.WEBHOOK, { id }), {
|
|
2780
4389
|
method: HTTP_METHODS.PATCH,
|
|
2781
4390
|
body: patch,
|
|
2782
4391
|
repeatable: true,
|
|
2783
4392
|
signal: options.signal,
|
|
2784
4393
|
apiKey: options.apiKey
|
|
2785
4394
|
}),
|
|
2786
|
-
delete: (id, options = {}) => transport.request(
|
|
4395
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.WEBHOOK, { id }), {
|
|
4396
|
+
method: HTTP_METHODS.DELETE,
|
|
4397
|
+
signal: options.signal,
|
|
4398
|
+
apiKey: options.apiKey
|
|
4399
|
+
}),
|
|
4400
|
+
rotateSecret: (id, options = {}) => transport.request(RequestPath(API_PATHS.WEBHOOK_ROTATE_SECRET, { id }), {
|
|
4401
|
+
method: HTTP_METHODS.POST,
|
|
4402
|
+
signal: options.signal,
|
|
4403
|
+
apiKey: options.apiKey
|
|
4404
|
+
}),
|
|
4405
|
+
test: (id, options = {}) => transport.request(RequestPath(API_PATHS.WEBHOOK_TEST, { id }), {
|
|
4406
|
+
method: HTTP_METHODS.POST,
|
|
4407
|
+
signal: options.signal,
|
|
4408
|
+
apiKey: options.apiKey
|
|
4409
|
+
}),
|
|
4410
|
+
listDeliveries: (id, options = {}) => FetchPage(transport, RequestPath(API_PATHS.WEBHOOK_DELIVERIES, { id }), CURSOR_STYLES.CURSOR, options, DeliveryQuery(options)),
|
|
4411
|
+
listAllDeliveries: (id, options = {}) => CollectAll(transport, RequestPath(API_PATHS.WEBHOOK_DELIVERIES, { id }), CURSOR_STYLES.CURSOR, options, DeliveryQuery(options)),
|
|
4412
|
+
iterateDeliveries: (id, options = {}) => IteratePages(transport, RequestPath(API_PATHS.WEBHOOK_DELIVERIES, { id }), CURSOR_STYLES.CURSOR, options, DeliveryQuery(options)),
|
|
4413
|
+
listWorkspaceDeliveries: (options = {}) => FetchPage(transport, API_PATHS.WEBHOOKS_DELIVERIES, CURSOR_STYLES.CURSOR, options, WorkspaceDeliveryQuery(options)),
|
|
4414
|
+
listAllWorkspaceDeliveries: (options = {}) => CollectAll(transport, API_PATHS.WEBHOOKS_DELIVERIES, CURSOR_STYLES.CURSOR, options, WorkspaceDeliveryQuery(options)),
|
|
4415
|
+
iterateWorkspaceDeliveries: (options = {}) => IteratePages(transport, API_PATHS.WEBHOOKS_DELIVERIES, CURSOR_STYLES.CURSOR, options, WorkspaceDeliveryQuery(options)),
|
|
4416
|
+
listActivity: (id, options = {}) => FetchPage(transport, RequestPath(API_PATHS.WEBHOOK_ACTIVITY, { id }), CURSOR_STYLES.CURSOR, options, WindowQuery(options)),
|
|
4417
|
+
listAllActivity: (id, options = {}) => CollectAll(transport, RequestPath(API_PATHS.WEBHOOK_ACTIVITY, { id }), CURSOR_STYLES.CURSOR, options, WindowQuery(options)),
|
|
4418
|
+
iterateActivity: (id, options = {}) => IteratePages(transport, RequestPath(API_PATHS.WEBHOOK_ACTIVITY, { id }), CURSOR_STYLES.CURSOR, options, WindowQuery(options)),
|
|
4419
|
+
listWorkspaceActivity: (options = {}) => FetchPage(transport, API_PATHS.WEBHOOKS_ACTIVITY, CURSOR_STYLES.CURSOR, options, WorkspaceActivityQuery(options)),
|
|
4420
|
+
listAllWorkspaceActivity: (options = {}) => CollectAll(transport, API_PATHS.WEBHOOKS_ACTIVITY, CURSOR_STYLES.CURSOR, options, WorkspaceActivityQuery(options)),
|
|
4421
|
+
iterateWorkspaceActivity: (options = {}) => IteratePages(transport, API_PATHS.WEBHOOKS_ACTIVITY, CURSOR_STYLES.CURSOR, options, WorkspaceActivityQuery(options)),
|
|
4422
|
+
getDelivery: (id, deliveryId, options = {}) => transport.request(RequestPath(API_PATHS.WEBHOOK_DELIVERY, { id, deliveryId }), {
|
|
4423
|
+
signal: options.signal,
|
|
4424
|
+
apiKey: options.apiKey
|
|
4425
|
+
}),
|
|
4426
|
+
replayDelivery: (id, deliveryId, options = {}) => transport.request(RequestPath(API_PATHS.WEBHOOK_DELIVERY_REPLAY, { id, deliveryId }), {
|
|
4427
|
+
method: HTTP_METHODS.POST,
|
|
4428
|
+
signal: options.signal,
|
|
4429
|
+
apiKey: options.apiKey
|
|
4430
|
+
}),
|
|
4431
|
+
listEvents: (options = {}) => transport.request(API_PATHS.WEBHOOKS_EVENTS, {
|
|
4432
|
+
signal: options.signal,
|
|
4433
|
+
apiKey: options.apiKey
|
|
4434
|
+
}),
|
|
4435
|
+
stats: (options = {}) => transport.request(API_PATHS.WEBHOOKS_STATS, {
|
|
4436
|
+
query: {
|
|
4437
|
+
...WindowQuery(options),
|
|
4438
|
+
[QUERY_KEYS.ENDPOINT_IDS]: options.endpointIds?.join(LIST_SEPARATOR),
|
|
4439
|
+
[QUERY_KEYS.GRAIN]: options.grain,
|
|
4440
|
+
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes
|
|
4441
|
+
},
|
|
4442
|
+
signal: options.signal,
|
|
4443
|
+
apiKey: options.apiKey
|
|
4444
|
+
})
|
|
4445
|
+
});
|
|
4446
|
+
|
|
4447
|
+
const Tools = (transport) => ({
|
|
4448
|
+
checkDmarc: (domain, options = {}) => transport.request(API_PATHS.TOOLS_DMARC, {
|
|
4449
|
+
query: { [QUERY_KEYS.DOMAIN]: domain },
|
|
4450
|
+
signal: options.signal,
|
|
4451
|
+
apiKey: options.apiKey
|
|
4452
|
+
}),
|
|
4453
|
+
checkBimi: (domain, options = {}) => transport.request(API_PATHS.TOOLS_BIMI, {
|
|
4454
|
+
query: { [QUERY_KEYS.DOMAIN]: domain },
|
|
4455
|
+
signal: options.signal,
|
|
4456
|
+
apiKey: options.apiKey
|
|
4457
|
+
}),
|
|
4458
|
+
checkDeliverability: (domain, options = {}) => transport.request(API_PATHS.TOOLS_DELIVERABILITY, {
|
|
4459
|
+
query: { [QUERY_KEYS.DOMAIN]: domain },
|
|
4460
|
+
signal: options.signal,
|
|
4461
|
+
apiKey: options.apiKey
|
|
4462
|
+
}),
|
|
4463
|
+
readVerificationCode: (body, options = {}) => transport.request(API_PATHS.TOOLS_VERIFICATION_CODE, {
|
|
4464
|
+
method: HTTP_METHODS.POST,
|
|
4465
|
+
body,
|
|
4466
|
+
signal: options.signal,
|
|
4467
|
+
apiKey: options.apiKey
|
|
4468
|
+
}),
|
|
4469
|
+
estimateCost: (options = {}) => transport.request(API_PATHS.TOOLS_COST, {
|
|
4470
|
+
query: {
|
|
4471
|
+
[QUERY_KEYS.SENDS]: options.sends,
|
|
4472
|
+
[QUERY_KEYS.DOMAINS]: options.domains,
|
|
4473
|
+
[QUERY_KEYS.PEOPLE]: options.people,
|
|
4474
|
+
[QUERY_KEYS.AI_ACTIONS]: options.aiActions,
|
|
4475
|
+
[QUERY_KEYS.INTERVAL]: options.interval
|
|
4476
|
+
},
|
|
4477
|
+
signal: options.signal,
|
|
4478
|
+
apiKey: options.apiKey
|
|
4479
|
+
})
|
|
4480
|
+
});
|
|
4481
|
+
|
|
4482
|
+
const Support = (transport) => ({
|
|
4483
|
+
send: (body, options = {}) => transport.request(API_PATHS.SUPPORT, {
|
|
4484
|
+
method: HTTP_METHODS.POST,
|
|
4485
|
+
body,
|
|
4486
|
+
signal: options.signal,
|
|
4487
|
+
apiKey: options.apiKey
|
|
4488
|
+
})
|
|
4489
|
+
});
|
|
4490
|
+
|
|
4491
|
+
const Encryption = (transport) => ({
|
|
4492
|
+
listKeys: (options = {}) => FetchList(transport, API_PATHS.ENCRYPTION_KEYS, options),
|
|
4493
|
+
publishKey: (body, options = {}) => transport.request(API_PATHS.ENCRYPTION_KEYS, {
|
|
4494
|
+
method: HTTP_METHODS.POST,
|
|
4495
|
+
body,
|
|
4496
|
+
signal: options.signal,
|
|
4497
|
+
apiKey: options.apiKey
|
|
4498
|
+
}),
|
|
4499
|
+
lookupKeys: (options) => FetchList(transport, API_PATHS.ENCRYPTION_KEYS_LOOKUP, options, {
|
|
4500
|
+
[QUERY_KEYS.ADDRESSES]: options.addresses.join(LIST_SEPARATOR)
|
|
4501
|
+
})
|
|
4502
|
+
});
|
|
4503
|
+
|
|
4504
|
+
const Senders = (transport) => ({
|
|
4505
|
+
get: (email, options = {}) => transport.request(RequestPath(API_PATHS.SENDER, { email }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4506
|
+
research: (email, options = {}) => transport.request(RequestPath(API_PATHS.SENDER_RESEARCH, { email }), {
|
|
4507
|
+
method: HTTP_METHODS.POST,
|
|
4508
|
+
repeatable: true,
|
|
4509
|
+
signal: options.signal,
|
|
4510
|
+
apiKey: options.apiKey
|
|
4511
|
+
})
|
|
4512
|
+
});
|
|
4513
|
+
|
|
4514
|
+
const ListQuery$1 = (options) => ({
|
|
4515
|
+
[QUERY_KEYS.Q]: options.q,
|
|
4516
|
+
[QUERY_KEYS.SORT]: options.sort
|
|
4517
|
+
});
|
|
4518
|
+
const Chats = (transport) => ({
|
|
4519
|
+
list: (options = {}) => FetchPage(transport, API_PATHS.CHATS, CURSOR_STYLES.CURSOR, options, ListQuery$1(options)),
|
|
4520
|
+
listAll: (options = {}) => CollectAll(transport, API_PATHS.CHATS, CURSOR_STYLES.CURSOR, options, ListQuery$1(options)),
|
|
4521
|
+
iterate: (options = {}) => IteratePages(transport, API_PATHS.CHATS, CURSOR_STYLES.CURSOR, options, ListQuery$1(options)),
|
|
4522
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.CHAT, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4523
|
+
rename: (id, title, options = {}) => transport.request(RequestPath(API_PATHS.CHAT, { id }), {
|
|
4524
|
+
method: HTTP_METHODS.PATCH,
|
|
4525
|
+
body: { title },
|
|
4526
|
+
repeatable: true,
|
|
4527
|
+
signal: options.signal,
|
|
4528
|
+
apiKey: options.apiKey
|
|
4529
|
+
}),
|
|
4530
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.CHAT, { id }), {
|
|
2787
4531
|
method: HTTP_METHODS.DELETE,
|
|
2788
4532
|
signal: options.signal,
|
|
2789
4533
|
apiKey: options.apiKey
|
|
4534
|
+
})
|
|
4535
|
+
});
|
|
4536
|
+
|
|
4537
|
+
const MailboxQuery = (options) => ({
|
|
4538
|
+
[QUERY_KEYS.FROM]: options.from === undefined ? undefined : ToInstant(options.from),
|
|
4539
|
+
[QUERY_KEYS.TO]: options.to === undefined ? undefined : ToInstant(options.to),
|
|
4540
|
+
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes,
|
|
4541
|
+
[QUERY_KEYS.GRAIN]: options.grain,
|
|
4542
|
+
[QUERY_KEYS.ADDRESS]: options.address
|
|
4543
|
+
});
|
|
4544
|
+
const SendingQuery = (options) => ({
|
|
4545
|
+
[QUERY_KEYS.DAYS]: options.days,
|
|
4546
|
+
[QUERY_KEYS.MINUTES]: options.minutes,
|
|
4547
|
+
[QUERY_KEYS.OFFSET_MINUTES]: options.offsetMinutes,
|
|
4548
|
+
[QUERY_KEYS.GRAIN]: options.grain,
|
|
4549
|
+
[QUERY_KEYS.ADDRESS]: options.address
|
|
4550
|
+
});
|
|
4551
|
+
const Analytics = (transport) => ({
|
|
4552
|
+
mailbox: (options = {}) => transport.request(API_PATHS.ANALYTICS_MAILBOX, {
|
|
4553
|
+
query: MailboxQuery(options),
|
|
4554
|
+
signal: options.signal,
|
|
4555
|
+
apiKey: options.apiKey
|
|
4556
|
+
}),
|
|
4557
|
+
sending: (options = {}) => transport.request(API_PATHS.ANALYTICS_SENDING, {
|
|
4558
|
+
query: SendingQuery(options),
|
|
4559
|
+
signal: options.signal,
|
|
4560
|
+
apiKey: options.apiKey
|
|
4561
|
+
})
|
|
4562
|
+
});
|
|
4563
|
+
|
|
4564
|
+
const ListQuery = (options) => ({
|
|
4565
|
+
[QUERY_KEYS.STATUS]: options.status,
|
|
4566
|
+
[QUERY_KEYS.Q]: options.q,
|
|
4567
|
+
[QUERY_KEYS.SORT]: options.sort,
|
|
4568
|
+
[QUERY_KEYS.LIMIT]: options.limit,
|
|
4569
|
+
[QUERY_KEYS.OFFSET]: options.offset,
|
|
4570
|
+
[QUERY_KEYS.ADDRESS]: options.address
|
|
4571
|
+
});
|
|
4572
|
+
const Subscriptions = (transport) => ({
|
|
4573
|
+
list: (options = {}) => transport.request(API_PATHS.SUBSCRIPTIONS, {
|
|
4574
|
+
query: ListQuery(options),
|
|
4575
|
+
signal: options.signal,
|
|
4576
|
+
apiKey: options.apiKey
|
|
4577
|
+
}),
|
|
4578
|
+
listDomains: (options = {}) => transport.request(API_PATHS.SUBSCRIPTION_DOMAINS, {
|
|
4579
|
+
query: ListQuery(options),
|
|
4580
|
+
signal: options.signal,
|
|
4581
|
+
apiKey: options.apiKey
|
|
4582
|
+
}),
|
|
4583
|
+
unsubscribe: (id, body = {}, options = {}) => transport.request(RequestPath(API_PATHS.SUBSCRIPTION_UNSUBSCRIBE, { id }), {
|
|
4584
|
+
method: HTTP_METHODS.POST,
|
|
4585
|
+
body,
|
|
4586
|
+
signal: options.signal,
|
|
4587
|
+
apiKey: options.apiKey
|
|
4588
|
+
}),
|
|
4589
|
+
unsubscribeDomain: (domain, body = {}, options = {}) => transport.request(RequestPath(API_PATHS.SUBSCRIPTION_DOMAIN_UNSUBSCRIBE, { domain }), {
|
|
4590
|
+
method: HTTP_METHODS.POST,
|
|
4591
|
+
body,
|
|
4592
|
+
signal: options.signal,
|
|
4593
|
+
apiKey: options.apiKey
|
|
4594
|
+
}),
|
|
4595
|
+
move: (id, body, options = {}) => transport.request(RequestPath(API_PATHS.SUBSCRIPTION_MOVE, { id }), {
|
|
4596
|
+
method: HTTP_METHODS.POST,
|
|
4597
|
+
body,
|
|
4598
|
+
repeatable: true,
|
|
4599
|
+
signal: options.signal,
|
|
4600
|
+
apiKey: options.apiKey
|
|
4601
|
+
})
|
|
4602
|
+
});
|
|
4603
|
+
|
|
4604
|
+
const Exports = (transport) => ({
|
|
4605
|
+
preview: (options = {}) => transport.request(API_PATHS.MAILBOX_EXPORTS_PREVIEW, { signal: options.signal, apiKey: options.apiKey }),
|
|
4606
|
+
list: (options = {}) => transport.request(API_PATHS.MAILBOX_EXPORTS, {
|
|
4607
|
+
query: { [QUERY_KEYS.LIMIT]: options.limit, [QUERY_KEYS.OFFSET]: options.offset },
|
|
4608
|
+
signal: options.signal,
|
|
4609
|
+
apiKey: options.apiKey
|
|
2790
4610
|
}),
|
|
2791
|
-
|
|
4611
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.MAILBOX_EXPORT, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4612
|
+
start: (options = {}) => transport.request(API_PATHS.MAILBOX_EXPORTS, {
|
|
2792
4613
|
method: HTTP_METHODS.POST,
|
|
2793
4614
|
signal: options.signal,
|
|
2794
4615
|
apiKey: options.apiKey
|
|
2795
4616
|
}),
|
|
2796
|
-
|
|
4617
|
+
download: (id, options = {}) => transport.request(RequestPath(API_PATHS.MAILBOX_EXPORT_CONTENT, { id }), {
|
|
4618
|
+
binary: true,
|
|
4619
|
+
signal: options.signal,
|
|
4620
|
+
apiKey: options.apiKey
|
|
4621
|
+
})
|
|
4622
|
+
});
|
|
4623
|
+
|
|
4624
|
+
const DnsConnections = (transport) => ({
|
|
4625
|
+
list: (options = {}) => transport.request(API_PATHS.DNS_CONNECTIONS, { signal: options.signal, apiKey: options.apiKey }),
|
|
4626
|
+
get: (id, options = {}) => transport.request(RequestPath(API_PATHS.DNS_CONNECTION, { id }), { signal: options.signal, apiKey: options.apiKey }),
|
|
4627
|
+
delete: (id, options = {}) => transport.request(RequestPath(API_PATHS.DNS_CONNECTION, { id }), {
|
|
4628
|
+
method: HTTP_METHODS.DELETE,
|
|
4629
|
+
signal: options.signal,
|
|
4630
|
+
apiKey: options.apiKey
|
|
4631
|
+
})
|
|
4632
|
+
});
|
|
4633
|
+
|
|
4634
|
+
const Workspaces = (transport) => ({
|
|
4635
|
+
list: (options = {}) => transport.request(API_PATHS.WORKSPACES, { signal: options.signal, apiKey: options.apiKey }),
|
|
4636
|
+
create: (body, options = {}) => transport.request(API_PATHS.WORKSPACES, {
|
|
2797
4637
|
method: HTTP_METHODS.POST,
|
|
4638
|
+
body,
|
|
4639
|
+
signal: options.signal,
|
|
4640
|
+
apiKey: options.apiKey
|
|
4641
|
+
}),
|
|
4642
|
+
getActive: (options = {}) => transport.request(API_PATHS.WORKSPACES_ACTIVE, { signal: options.signal, apiKey: options.apiKey }),
|
|
4643
|
+
setActive: (workspaceId, options = {}) => transport.request(API_PATHS.WORKSPACES_ACTIVE, {
|
|
4644
|
+
method: HTTP_METHODS.PUT,
|
|
4645
|
+
body: { workspaceId },
|
|
4646
|
+
repeatable: true,
|
|
4647
|
+
signal: options.signal,
|
|
4648
|
+
apiKey: options.apiKey
|
|
4649
|
+
}),
|
|
4650
|
+
delete: (id, options) => transport.request(RequestPath(API_PATHS.WORKSPACE, { id }), {
|
|
4651
|
+
method: HTTP_METHODS.DELETE,
|
|
4652
|
+
query: { [QUERY_KEYS.CONFIRM]: options.confirm },
|
|
4653
|
+
signal: options.signal,
|
|
4654
|
+
apiKey: options.apiKey
|
|
4655
|
+
})
|
|
4656
|
+
});
|
|
4657
|
+
|
|
4658
|
+
const PhotoType = (data, options) => {
|
|
4659
|
+
if (options.contentType)
|
|
4660
|
+
return options.contentType;
|
|
4661
|
+
return typeof Blob !== 'undefined' && data instanceof Blob && data.type ? data.type : undefined;
|
|
4662
|
+
};
|
|
4663
|
+
const Account = (transport) => ({
|
|
4664
|
+
getNotifications: (options = {}) => transport.request(API_PATHS.ACCOUNT_NOTIFICATIONS, { signal: options.signal, apiKey: options.apiKey }),
|
|
4665
|
+
setEmailNotification: (category, body, options = {}) => transport.request(RequestPath(API_PATHS.ACCOUNT_NOTIFICATION_EMAIL, { category }), {
|
|
4666
|
+
method: HTTP_METHODS.PUT,
|
|
4667
|
+
body: { enabled: body.enabled },
|
|
4668
|
+
repeatable: true,
|
|
4669
|
+
signal: options.signal,
|
|
4670
|
+
apiKey: options.apiKey
|
|
4671
|
+
}),
|
|
4672
|
+
setPushMuted: (workspaceId, body, options = {}) => transport.request(RequestPath(API_PATHS.ACCOUNT_NOTIFICATION_PUSH, { workspaceId }), {
|
|
4673
|
+
method: HTTP_METHODS.PUT,
|
|
4674
|
+
body: { muted: body.muted },
|
|
4675
|
+
repeatable: true,
|
|
4676
|
+
signal: options.signal,
|
|
4677
|
+
apiKey: options.apiKey
|
|
4678
|
+
}),
|
|
4679
|
+
setPhoto: (data, options = {}) => transport.request(API_PATHS.ACCOUNT_PHOTO, {
|
|
4680
|
+
method: HTTP_METHODS.PUT,
|
|
4681
|
+
raw: data,
|
|
4682
|
+
contentType: PhotoType(data, options),
|
|
4683
|
+
repeatable: true,
|
|
4684
|
+
signal: options.signal,
|
|
4685
|
+
apiKey: options.apiKey
|
|
4686
|
+
}),
|
|
4687
|
+
removePhoto: (options = {}) => transport.request(API_PATHS.ACCOUNT_PHOTO, {
|
|
4688
|
+
method: HTTP_METHODS.DELETE,
|
|
4689
|
+
repeatable: true,
|
|
4690
|
+
signal: options.signal,
|
|
4691
|
+
apiKey: options.apiKey
|
|
4692
|
+
}),
|
|
4693
|
+
getUsername: (options = {}) => transport.request(API_PATHS.ACCOUNT_USERNAME, { signal: options.signal, apiKey: options.apiKey }),
|
|
4694
|
+
checkUsername: (username, options = {}) => transport.request(API_PATHS.ACCOUNT_USERNAME_AVAILABILITY, {
|
|
4695
|
+
query: { [QUERY_KEYS.USERNAME]: username },
|
|
4696
|
+
signal: options.signal,
|
|
4697
|
+
apiKey: options.apiKey
|
|
4698
|
+
}),
|
|
4699
|
+
setUsername: (username, options = {}) => transport.request(API_PATHS.ACCOUNT_USERNAME, {
|
|
4700
|
+
method: HTTP_METHODS.PUT,
|
|
4701
|
+
body: { username },
|
|
4702
|
+
signal: options.signal,
|
|
4703
|
+
apiKey: options.apiKey
|
|
4704
|
+
}),
|
|
4705
|
+
listConnectedApps: (options = {}) => FetchList(transport, API_PATHS.ACCOUNT_CONNECTED_APPS, options),
|
|
4706
|
+
revokeConnectedApp: (clientId, options = {}) => transport.request(RequestPath(API_PATHS.ACCOUNT_CONNECTED_APP, { clientId }), {
|
|
4707
|
+
method: HTTP_METHODS.DELETE,
|
|
2798
4708
|
signal: options.signal,
|
|
2799
4709
|
apiKey: options.apiKey
|
|
2800
4710
|
}),
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
iterateWorkspaceDeliveries: (options = {}) => IteratePages(transport, PATHS.WEBHOOKS_DELIVERIES, CURSOR_STYLES.CURSOR, options, WorkspaceDeliveryQuery(options)),
|
|
2807
|
-
listActivity: (id, options = {}) => FetchPage(transport, WebhookChildPath(id, SEGMENTS.ACTIVITY), CURSOR_STYLES.CURSOR, options, WindowQuery(options)),
|
|
2808
|
-
listAllActivity: (id, options = {}) => CollectAll(transport, WebhookChildPath(id, SEGMENTS.ACTIVITY), CURSOR_STYLES.CURSOR, options, WindowQuery(options)),
|
|
2809
|
-
iterateActivity: (id, options = {}) => IteratePages(transport, WebhookChildPath(id, SEGMENTS.ACTIVITY), CURSOR_STYLES.CURSOR, options, WindowQuery(options)),
|
|
2810
|
-
listWorkspaceActivity: (options = {}) => FetchPage(transport, PATHS.WEBHOOKS_ACTIVITY, CURSOR_STYLES.CURSOR, options, WorkspaceActivityQuery(options)),
|
|
2811
|
-
listAllWorkspaceActivity: (options = {}) => CollectAll(transport, PATHS.WEBHOOKS_ACTIVITY, CURSOR_STYLES.CURSOR, options, WorkspaceActivityQuery(options)),
|
|
2812
|
-
iterateWorkspaceActivity: (options = {}) => IteratePages(transport, PATHS.WEBHOOKS_ACTIVITY, CURSOR_STYLES.CURSOR, options, WorkspaceActivityQuery(options)),
|
|
2813
|
-
getDelivery: (id, deliveryId, options = {}) => transport.request(WebhookDeliveryPath(id, deliveryId), {
|
|
4711
|
+
listInvitations: (options = {}) => FetchList(transport, API_PATHS.ACCOUNT_INVITATIONS, options),
|
|
4712
|
+
acceptInvitation: (invitationId, options = {}) => transport.request(RequestPath(API_PATHS.ACCOUNT_INVITATION_ACCEPT, { invitationId }), {
|
|
4713
|
+
method: HTTP_METHODS.POST,
|
|
4714
|
+
body: options.activate === undefined ? {} : { activate: options.activate },
|
|
4715
|
+
repeatable: true,
|
|
2814
4716
|
signal: options.signal,
|
|
2815
4717
|
apiKey: options.apiKey
|
|
2816
4718
|
}),
|
|
2817
|
-
|
|
4719
|
+
declineInvitation: (invitationId, options = {}) => transport.request(RequestPath(API_PATHS.ACCOUNT_INVITATION_DECLINE, { invitationId }), {
|
|
2818
4720
|
method: HTTP_METHODS.POST,
|
|
4721
|
+
repeatable: true,
|
|
2819
4722
|
signal: options.signal,
|
|
2820
4723
|
apiKey: options.apiKey
|
|
2821
4724
|
})
|
|
@@ -2837,8 +4740,12 @@ class OpenEmail {
|
|
|
2837
4740
|
labels;
|
|
2838
4741
|
contacts;
|
|
2839
4742
|
audiences;
|
|
4743
|
+
billing;
|
|
4744
|
+
forms;
|
|
2840
4745
|
broadcasts;
|
|
2841
4746
|
domains;
|
|
4747
|
+
appHost;
|
|
4748
|
+
branding;
|
|
2842
4749
|
rules;
|
|
2843
4750
|
webhooks;
|
|
2844
4751
|
imports;
|
|
@@ -2849,7 +4756,19 @@ class OpenEmail {
|
|
|
2849
4756
|
members;
|
|
2850
4757
|
suppressions;
|
|
2851
4758
|
files;
|
|
4759
|
+
knowledge;
|
|
2852
4760
|
tempMail;
|
|
4761
|
+
exports;
|
|
4762
|
+
chats;
|
|
4763
|
+
encryption;
|
|
4764
|
+
support;
|
|
4765
|
+
tools;
|
|
4766
|
+
senders;
|
|
4767
|
+
analytics;
|
|
4768
|
+
subscriptions;
|
|
4769
|
+
dnsConnections;
|
|
4770
|
+
workspaces;
|
|
4771
|
+
account;
|
|
2853
4772
|
constructor(configuration) {
|
|
2854
4773
|
const options = typeof configuration === 'string' ? { apiKey: configuration } : configuration;
|
|
2855
4774
|
AssertCredential(options.apiKey, options.accessToken, true);
|
|
@@ -2870,8 +4789,12 @@ class OpenEmail {
|
|
|
2870
4789
|
this.labels = Labels(this.transport);
|
|
2871
4790
|
this.contacts = Contacts(this.transport);
|
|
2872
4791
|
this.audiences = Audiences(this.transport);
|
|
4792
|
+
this.billing = Billing(this.transport);
|
|
4793
|
+
this.forms = Forms(this.transport);
|
|
2873
4794
|
this.broadcasts = Broadcasts(this.transport);
|
|
2874
4795
|
this.domains = Domains(this.transport);
|
|
4796
|
+
this.appHost = AppHost(this.transport);
|
|
4797
|
+
this.branding = Branding(this.transport);
|
|
2875
4798
|
this.rules = Rules(this.transport);
|
|
2876
4799
|
this.webhooks = Webhooks(this.transport);
|
|
2877
4800
|
this.imports = Imports(this.transport);
|
|
@@ -2882,7 +4805,19 @@ class OpenEmail {
|
|
|
2882
4805
|
this.members = Members(this.transport);
|
|
2883
4806
|
this.suppressions = Suppressions(this.transport);
|
|
2884
4807
|
this.files = Files(this.transport);
|
|
4808
|
+
this.knowledge = Knowledge(this.transport);
|
|
2885
4809
|
this.tempMail = TempMail(this.transport);
|
|
4810
|
+
this.exports = Exports(this.transport);
|
|
4811
|
+
this.chats = Chats(this.transport);
|
|
4812
|
+
this.encryption = Encryption(this.transport);
|
|
4813
|
+
this.support = Support(this.transport);
|
|
4814
|
+
this.tools = Tools(this.transport);
|
|
4815
|
+
this.senders = Senders(this.transport);
|
|
4816
|
+
this.analytics = Analytics(this.transport);
|
|
4817
|
+
this.subscriptions = Subscriptions(this.transport);
|
|
4818
|
+
this.dnsConnections = DnsConnections(this.transport);
|
|
4819
|
+
this.workspaces = Workspaces(this.transport);
|
|
4820
|
+
this.account = Account(this.transport);
|
|
2886
4821
|
}
|
|
2887
4822
|
get raw() {
|
|
2888
4823
|
return this.transport;
|
|
@@ -2916,7 +4851,7 @@ const HostnameOf = (authority) => {
|
|
|
2916
4851
|
const NormaliseEndpoint = (value) => {
|
|
2917
4852
|
if (!value)
|
|
2918
4853
|
return undefined;
|
|
2919
|
-
const trimmed = value.trim().replace(
|
|
4854
|
+
const trimmed = value.trim().replace(TRAILING_SLASHES, '');
|
|
2920
4855
|
if (trimmed.length === 0)
|
|
2921
4856
|
return undefined;
|
|
2922
4857
|
if (ENDPOINT_SCHEME_PATTERN.test(trimmed))
|
|
@@ -3003,7 +4938,7 @@ const VerifyWebhookSignature = async (props) => {
|
|
|
3003
4938
|
throw new Error(WEBHOOK_MESSAGES.OUT_OF_TOLERANCE.replace('{{drift}}', String(drift)).replace('{{tolerance}}', String(tolerance)));
|
|
3004
4939
|
}
|
|
3005
4940
|
const encoder = new TextEncoder();
|
|
3006
|
-
const key = await subtle.importKey('raw', encoder.encode(secret), { name: 'HMAC', hash: 'SHA-256' }, false,
|
|
4941
|
+
const key = await subtle.importKey('raw', encoder.encode(secret), { name: 'HMAC', hash: 'SHA-256' }, false, HMAC_SIGN_USAGES);
|
|
3007
4942
|
const expected = Hex(await subtle.sign('HMAC', key, encoder.encode(`${parsed.timestamp}.${payload}`)));
|
|
3008
4943
|
if (!parsed.signatures.some(candidate => Equal(expected, candidate)))
|
|
3009
4944
|
throw new Error(WEBHOOK_MESSAGES.MISMATCH);
|
|
@@ -3034,27 +4969,27 @@ const DefaultClient = new Proxy({}, {
|
|
|
3034
4969
|
});
|
|
3035
4970
|
|
|
3036
4971
|
const Key = (value) => value.trim().toLowerCase();
|
|
3037
|
-
const
|
|
3038
|
-
const
|
|
3039
|
-
const
|
|
3040
|
-
const
|
|
3041
|
-
const LanguageByCode = (code) => code ?
|
|
4972
|
+
const byCode = new Map(LANGUAGES.map(language => [Key(language.code), language]));
|
|
4973
|
+
const byLabel = new Map(LANGUAGES.map(language => [Key(language.label), language]));
|
|
4974
|
+
const byNative = new Map(LANGUAGES.map(language => [Key(language.native), language]));
|
|
4975
|
+
const aliasCodes = new Map(LANGUAGE_ALIASES.map(([alias, code]) => [Key(alias), Key(code)]));
|
|
4976
|
+
const LanguageByCode = (code) => code ? byCode.get(Key(code)) : undefined;
|
|
3042
4977
|
const ResolveLanguage = (input) => {
|
|
3043
4978
|
if (!input)
|
|
3044
4979
|
return undefined;
|
|
3045
4980
|
const key = Key(input);
|
|
3046
4981
|
if (!key)
|
|
3047
4982
|
return undefined;
|
|
3048
|
-
const aliased =
|
|
4983
|
+
const aliased = aliasCodes.get(key);
|
|
3049
4984
|
if (aliased)
|
|
3050
|
-
return
|
|
3051
|
-
const direct =
|
|
4985
|
+
return byCode.get(aliased);
|
|
4986
|
+
const direct = byCode.get(key) ?? byLabel.get(key) ?? byNative.get(key);
|
|
3052
4987
|
if (direct)
|
|
3053
4988
|
return direct;
|
|
3054
4989
|
const base = key.split(LANGUAGE_SUBTAG_PATTERN)[0];
|
|
3055
4990
|
if (!base || base === key)
|
|
3056
4991
|
return undefined;
|
|
3057
|
-
return
|
|
4992
|
+
return byCode.get(aliasCodes.get(base) ?? base);
|
|
3058
4993
|
};
|
|
3059
4994
|
const IsRtlLanguage = (code) => ResolveLanguage(code)?.rtl === true;
|
|
3060
4995
|
|
|
@@ -3074,4 +5009,4 @@ const resolveLanguage = ResolveLanguage;
|
|
|
3074
5009
|
const languageByCode = LanguageByCode;
|
|
3075
5010
|
const isRtlLanguage = IsRtlLanguage;
|
|
3076
5011
|
|
|
3077
|
-
export { API_SCOPES, AUDIENCE_MEMBER_STATUSES, BROADCAST_RECIPIENT_FILTERS, BROADCAST_STATUSES, CONTACT_BLOCK_LISTS, CONTACT_PHOTO_TYPES, CONTACT_THREAD_SORTS, CREDENTIAL_KINDS, DOMAIN_DMARC_STAGES, DOMAIN_RECORD_STATUSES, ERROR_TYPES, FILE_DIRECTIONS, FILE_KINDS, FILE_SORTS, FILE_USAGES, FILE_VISIBILITIES, 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, STEP_UP_ERROR_CODES, STEP_UP_METHODS, SUPPRESSION_REASONS, THREAD_SORTS, VERSION, WEBHOOK_EVENTS, WEBHOOK_REPLAY_ERROR_CODES, WEBHOOK_SIGNATURE_HEADERS, createClient, createOpenEmail, createTempMail, OpenEmail as default, getClient, init, isAccessToken, isApiKey, isRtlLanguage, isSealed, languageByCode, openemail, resetClient, resolveLanguage, toBase64, verifyWebhookSignature };
|
|
5012
|
+
export { ADDRESS_FORWARD_CONSENT_STATUSES, ADDRESS_FORWARD_STATUSES, ADDRESS_MEMBER_VIAS, API_SCOPES, APP_HOST_STATUSES, APP_PASSWORD_ORIGINS, AUDIENCE_MEMBER_STATUSES, BILLING_ALERT_KINDS, BILLING_ALERT_SEVERITIES, BILLING_ALERT_TARGETS, BILLING_INTERVALS, BILLING_INVOICE_SORTS, BILLING_INVOICE_STARTS, BILLING_INVOICE_STATUSES, BILLING_THEMES, BILLING_USAGE_WINDOWS, BIMI_STATUSES, BRAND_FONT_IDS, BRAND_IMAGE_TYPES, BRAND_IMAGE_VARIANTS, BROADCAST_RECIPIENT_FILTERS, BROADCAST_STATUSES, CALENDAR_COLORS, CALENDAR_FEED_MODES, CALENDAR_REMINDER_ACTIONS, CALENDAR_RESPONSES, CALENDAR_SUBSCRIPTION_ERRORS, CALENDAR_SUBSCRIPTION_STATUSES, CALENDAR_TRANSPARENCIES, CALENDAR_VISIBILITIES, CHAT_SORTS, CONNECTED_APP_KINDS, CONNECTED_APP_STATUSES, CONSOLE_PERMISSIONS, CONTACT_BLOCK_LISTS, CONTACT_CARD_LABELS, CONTACT_PHOTO_TYPES, CONTACT_SOURCES, CONTACT_THREAD_SORTS, CREDENTIAL_KINDS, DELIVERABILITY_CHECK_IDS, DELIVERABILITY_CHECK_STATUSES, DELIVERABILITY_GRADES, DNS_CONNECTION_STATUSES, DNS_PROVISION_STATES, DNS_SYNC_OUTCOMES, DNS_SYNC_PURPOSES, DNS_ZONE_RESOLUTION_KINDS, DOMAIN_ADDRESS_DESTINATIONS, DOMAIN_DMARC_POLICIES, DOMAIN_DMARC_STAGES, DOMAIN_LOGO_MARK_KINDS, DOMAIN_LOGO_RECORD_OUTCOMES, DOMAIN_RECORD_STATUSES, EMAIL_NOTIFICATION_CATEGORIES, ERROR_TYPES, EXPORT_PHASES, EXPORT_REFUSALS, EXPORT_STATUSES, FILE_DIRECTIONS, FILE_KINDS, FILE_SORTS, FILE_USAGES, FILE_VISIBILITIES, FORM_ALIGNS, FORM_CONFIRM_SOURCES, FORM_CONTACT_FIELDS, FORM_FIELD_ERRORS, FORM_FIELD_TYPES, FORM_FIELD_WIDTHS, FORM_FONTS, FORM_LAYOUTS, FORM_RADII, FORM_SENDER_ISSUES, FORM_STARTER_SLUGS, FORM_STATUSES, FORM_SUBMISSION_STATUSES, FORM_SUBSCRIBE_OUTCOMES, FORM_SUCCESS_ACTIONS, FORM_WIDTHS, IMPORT_FORMATS, KNOWLEDGE_CONNECTOR_KINDS, KNOWLEDGE_CONNECTOR_STATUSES, KNOWLEDGE_FAILURES, KNOWLEDGE_FLAG_KINDS, KNOWLEDGE_FLAG_STATUSES, KNOWLEDGE_KINDS, KNOWLEDGE_LEVELS, KNOWLEDGE_ORIGINS, KNOWLEDGE_REFRESH_DAY_CHOICES, KNOWLEDGE_STATUSES, KNOWLEDGE_SUGGESTION_KINDS, KNOWLEDGE_SUGGESTION_STATUSES, LANGUAGES, LOGIN_BACKGROUND_KINDS, LOGIN_BACKGROUND_PRESETS, LOGIN_LOGOS, MAIL_APP_PROTOCOLS, MAIL_APP_SECURITIES, MAIL_SERVICES, MESSAGE_ENCRYPTION_FORMATS, OpenEmail, OpenEmailApiError, OpenEmailNetworkError, PAGE_LIMITS, PAID_PLAN_IDS, PAY_AS_YOU_GO_LIMITS_CENTS, PEOPLE_SORTS, PLAN_BLOCKERS, PLAN_IDS, PROVIDER_IMPORT_DOMAIN_STATES, PROVIDER_IMPORT_PROVIDERS, PROVIDER_IMPORT_RESOURCES, PROVIDER_IMPORT_STATUSES, REPLY_SUGGESTION_STATES, REWRITE_ACTIONS, REWRITE_TARGETS, RULE_ACTIONS, RULE_FIELDS, RULE_OPERATORS, SETTINGS_COLOR_THEMES, SETTINGS_DATE_FORMATS, SETTINGS_IMAGE_COMPRESSIONS, SETTINGS_TIME_FORMATS, SETTINGS_WEEK_STARTS, STEP_UP_ERROR_CODES, STEP_UP_METHODS, SUBSCRIPTION_DESTINATIONS, SUBSCRIPTION_SORTS, SUBSCRIPTION_STATUSES, SUPPRESSION_REASONS, TEMPLATE_IMAGE_TYPES, THREAD_NOTE_COLORS, THREAD_SORTS, THREAD_SUMMARY_STATES, UNSUBSCRIBE_METHODS, USERNAME_STATUSES, VERSION, WEBHOOK_EVENTS, WEBHOOK_REPLAY_ERROR_CODES, WEBHOOK_SIGNATURE_HEADERS, WORKSPACE_KINDS, createClient, createOpenEmail, createTempMail, OpenEmail as default, getClient, init, isAccessToken, isApiKey, isRtlLanguage, isSealed, languageByCode, openemail, resetClient, resolveLanguage, toBase64, verifyWebhookSignature };
|