@stackshift-cloud/sdk 1.3.1 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +68 -0
  2. package/dist/asset-media-v2.d.ts +15 -1
  3. package/dist/asset-workflows.d.ts +5 -13
  4. package/dist/assets-dam-types.d.ts +35 -0
  5. package/dist/assets.d.ts +11 -2
  6. package/dist/assets.js +22 -0
  7. package/dist/client.d.ts +2 -0
  8. package/dist/client.js +5 -1
  9. package/dist/generated/assets-contract.d.ts +41 -6
  10. package/dist/generated/assets-contract.js +8 -1
  11. package/dist/index.d.ts +12 -3
  12. package/dist/index.js +7 -0
  13. package/dist/mail-billing.d.ts +12 -0
  14. package/dist/mail-billing.js +3 -0
  15. package/dist/mail-brands.d.ts +14 -1
  16. package/dist/mail-campaigns.d.ts +6 -3
  17. package/dist/mail-campaigns.js +6 -4
  18. package/dist/mail-delivery-types.d.ts +1 -0
  19. package/dist/mail-events-webhooks.d.ts +8 -3
  20. package/dist/mail-events-webhooks.js +13 -0
  21. package/dist/mail-mailboxes.d.ts +358 -0
  22. package/dist/mail-mailboxes.js +202 -0
  23. package/dist/mail-webhook-types.d.ts +40 -1
  24. package/dist/mail.d.ts +8 -0
  25. package/dist/mail.js +15 -0
  26. package/dist/partner.d.ts +369 -0
  27. package/dist/partner.js +70 -0
  28. package/dist/support-action-manifest.d.ts +3 -0
  29. package/dist/support-action-manifest.js +40 -0
  30. package/dist/support-action-receiver.d.ts +20 -0
  31. package/dist/support-action-receiver.js +37 -0
  32. package/dist/support-action-sqlite.d.ts +17 -0
  33. package/dist/support-action-sqlite.js +30 -0
  34. package/dist/support-action-types.d.ts +93 -0
  35. package/dist/support-action-types.js +1 -0
  36. package/dist/support-actions.d.ts +19 -0
  37. package/dist/support-actions.js +213 -0
  38. package/dist/types.d.ts +5 -0
  39. package/package.json +3 -2
@@ -40,6 +40,9 @@ export interface MailAudienceMemberImport {
40
40
  consentIp?: string;
41
41
  attributes?: Record<string, string>;
42
42
  }
43
+ export interface MailBrandFilterOptions {
44
+ brandId?: string;
45
+ }
43
46
  export interface MailCampaignContent {
44
47
  subject: string;
45
48
  previewText?: string;
@@ -50,7 +53,7 @@ export interface MailCampaignContent {
50
53
  }
51
54
  export interface MailCampaignInput {
52
55
  simulation?: MailSimulationOptions;
53
- name: string;
56
+ name?: string;
54
57
  audienceId: string;
55
58
  segmentId?: string;
56
59
  from?: string;
@@ -95,7 +98,7 @@ export declare class MailAudiencesClient {
95
98
  name: string;
96
99
  description?: string;
97
100
  }): Promise<MailAudience>;
98
- list(): Promise<{
101
+ list(options?: MailBrandFilterOptions): Promise<{
99
102
  data: MailAudience[];
100
103
  }>;
101
104
  get(id: string): Promise<MailAudience>;
@@ -116,7 +119,7 @@ export declare class MailCampaignsClient {
116
119
  private readonly client;
117
120
  constructor(client: StackShift);
118
121
  create(input: MailCampaignInput): Promise<MailCampaign>;
119
- list(): Promise<{
122
+ list(options?: MailBrandFilterOptions): Promise<{
120
123
  data: MailCampaign[];
121
124
  }>;
122
125
  get(id: string): Promise<MailCampaign>;
@@ -6,8 +6,9 @@ export class MailAudiencesClient {
6
6
  create(input) {
7
7
  return this.client.mailRequest('/mail/audiences', { method: 'POST', body: input });
8
8
  }
9
- list() {
10
- return this.client.mailRequest('/mail/audiences');
9
+ list(options = {}) {
10
+ const query = options.brandId ? `?brandId=${encodeURIComponent(options.brandId)}` : '';
11
+ return this.client.mailRequest(`/mail/audiences${query}`);
11
12
  }
12
13
  get(id) {
13
14
  return this.client.mailRequest(`/mail/audiences/${encodeURIComponent(id)}`);
@@ -39,8 +40,9 @@ export class MailCampaignsClient {
39
40
  create(input) {
40
41
  return this.client.mailRequest('/mail/campaigns', { method: 'POST', body: input });
41
42
  }
42
- list() {
43
- return this.client.mailRequest('/mail/campaigns');
43
+ list(options = {}) {
44
+ const query = options.brandId ? `?brandId=${encodeURIComponent(options.brandId)}` : '';
45
+ return this.client.mailRequest(`/mail/campaigns${query}`);
44
46
  }
45
47
  get(id) {
46
48
  return this.client.mailRequest(`/mail/campaigns/${encodeURIComponent(id)}`);
@@ -14,6 +14,7 @@ export interface MailSuppression {
14
14
  export interface MailSuppressionListOptions {
15
15
  email?: string;
16
16
  reason?: MailSuppressionReason;
17
+ brandId?: string;
17
18
  limit?: number;
18
19
  cursor?: string;
19
20
  }
@@ -1,5 +1,5 @@
1
1
  import type { StackShift } from './client.js';
2
- import type { MailEvent, MailEventListOptions, MailEventListResult, MailTimelineItem, MailWebhook, MailWebhookCreateInput, MailWebhookCreateResponse, MailWebhookDelivery, MailWebhookDeliveryDetail, MailWebhookDeliveryListOptions, MailWebhookListOptions, MailWebhookListResult, MailWebhookReplay, MailWebhookReplayInput, MailWebhookUpdateInput } from './mail-webhook-types.js';
2
+ import type { MailEvent, MailEventListOptions, MailEventListResult, MailTimelineItem, MailWebhook, MailWebhookCreateInput, MailWebhookCreateResponse, MailWebhookDelivery, MailWebhookDeliveryDetail, MailWebhookDeliveryListItem, MailWebhookDeliveryListOptions, MailWebhookDetail, MailWebhookDiagnosisResult, MailWebhookListOptions, MailWebhookListResult, MailWebhookReplay, MailWebhookReplayInput, MailWebhookUpdateInput } from './mail-webhook-types.js';
3
3
  export declare class MailEventsClient {
4
4
  private readonly client;
5
5
  constructor(client: StackShift);
@@ -11,14 +11,19 @@ export declare class MailWebhooksClient {
11
11
  constructor(client: StackShift);
12
12
  create(input: MailWebhookCreateInput): Promise<MailWebhookCreateResponse>;
13
13
  list(options?: MailWebhookListOptions): Promise<MailWebhookListResult>;
14
- get(webhookId: string): Promise<MailWebhook>;
14
+ get(webhookId: string): Promise<MailWebhookDetail>;
15
15
  update(webhookId: string, input: MailWebhookUpdateInput): Promise<MailWebhook>;
16
16
  rotateSecret(webhookId: string): Promise<{
17
17
  secret: string;
18
18
  }>;
19
+ revealSecret(webhookId: string): Promise<{
20
+ secret: string;
21
+ }>;
22
+ diagnosis(webhookId: string): Promise<MailWebhookDiagnosisResult>;
23
+ diagnose(webhookId: string): Promise<MailWebhookDiagnosisResult>;
19
24
  delete(webhookId: string): Promise<void>;
20
25
  deliveries(webhookId: string, options?: MailWebhookDeliveryListOptions): Promise<{
21
- data: MailWebhookDelivery[];
26
+ data: MailWebhookDeliveryListItem[];
22
27
  nextCursor?: string | null;
23
28
  }>;
24
29
  getDelivery(deliveryId: string): Promise<MailWebhookDeliveryDetail>;
@@ -39,6 +39,19 @@ export class MailWebhooksClient {
39
39
  method: 'POST',
40
40
  });
41
41
  }
42
+ revealSecret(webhookId) {
43
+ return this.client.mailRequest(`/mail/webhooks/${encodeURIComponent(webhookId)}/reveal-secret`, {
44
+ method: 'POST',
45
+ });
46
+ }
47
+ diagnosis(webhookId) {
48
+ return this.client.mailRequest(`/mail/webhooks/${encodeURIComponent(webhookId)}/diagnosis`);
49
+ }
50
+ diagnose(webhookId) {
51
+ return this.client.mailRequest(`/mail/webhooks/${encodeURIComponent(webhookId)}/diagnosis`, {
52
+ method: 'POST',
53
+ });
54
+ }
42
55
  delete(webhookId) {
43
56
  return this.client.mailRequest(`/mail/webhooks/${encodeURIComponent(webhookId)}`, {
44
57
  method: 'DELETE',
@@ -0,0 +1,358 @@
1
+ import type { StackShift } from './client.js';
2
+ export type MailboxDomainStatus = 'pending' | 'receiving' | 'mx_lost' | 'disabled';
3
+ export type MailboxStatus = 'active' | 'suspended' | 'pending' | 'deleted';
4
+ export type MailboxKind = 'person' | 'shared';
5
+ export type MailboxPlanSlug = 'basic' | 'pro';
6
+ export type MailboxRouteTargetKind = 'mailbox' | 'group' | 'app' | 'support' | 'forward' | 'reject';
7
+ export interface MailboxRouteTarget {
8
+ kind: MailboxRouteTargetKind;
9
+ mailboxId?: string;
10
+ groupId?: string;
11
+ webhookUrl?: string;
12
+ supportChannelId?: string;
13
+ forwardTo?: string;
14
+ }
15
+ export interface MailboxDnsRecord {
16
+ type: string;
17
+ name: string;
18
+ value: string;
19
+ priority?: number;
20
+ status: string;
21
+ required: boolean;
22
+ explanation?: string;
23
+ }
24
+ export interface MailboxDomain {
25
+ id: string;
26
+ workspaceId: string;
27
+ domain: string;
28
+ status: MailboxDomainStatus;
29
+ mxVerifiedAt?: string;
30
+ catchAll?: MailboxRouteTarget;
31
+ retentionDays?: number;
32
+ addonStorageUnits: number;
33
+ quotaPoolBytes: number;
34
+ usedBytes: number;
35
+ verificationToken: string;
36
+ revision: number;
37
+ createdAt: string;
38
+ updatedAt: string;
39
+ records: MailboxDnsRecord[];
40
+ foundMx: string | null;
41
+ dns: {
42
+ cloudflareConnected: boolean;
43
+ lastApplied: {
44
+ at: string;
45
+ byName: string;
46
+ recordCount: number;
47
+ } | null;
48
+ };
49
+ }
50
+ export interface MailboxDomainUpdateInput {
51
+ catchAll?: MailboxRouteTarget | null;
52
+ retentionDays?: number | null;
53
+ addonStorageUnits?: number;
54
+ }
55
+ export interface MailboxInvitation {
56
+ email: string;
57
+ expiresAt: string;
58
+ expired: boolean;
59
+ }
60
+ export interface Mailbox {
61
+ id: string;
62
+ workspaceId: string;
63
+ domainId: string;
64
+ localPart: string;
65
+ address: string;
66
+ displayName: string;
67
+ kind: MailboxKind;
68
+ ownerUserId?: string;
69
+ quotaBytes: number;
70
+ usedBytes: number;
71
+ plan: MailboxPlanSlug;
72
+ status: MailboxStatus;
73
+ aiEnabled: boolean;
74
+ revision: number;
75
+ createdAt: string;
76
+ updatedAt: string;
77
+ invitation: MailboxInvitation | null;
78
+ aiMicrocreditsThisMonth: number | null;
79
+ }
80
+ export interface MailboxCreateInput {
81
+ domainId: string;
82
+ localPart: string;
83
+ displayName?: string;
84
+ kind?: MailboxKind;
85
+ ownerUserId?: string;
86
+ ownerEmail?: string;
87
+ plan?: MailboxPlanSlug;
88
+ quotaBytes?: number;
89
+ aiEnabled?: boolean;
90
+ }
91
+ export interface MailboxUpdateInput {
92
+ displayName?: string;
93
+ quotaBytes?: number;
94
+ aiEnabled?: boolean;
95
+ plan?: MailboxPlanSlug;
96
+ }
97
+ export interface MailboxMember {
98
+ mailboxId: string;
99
+ userId: string;
100
+ role: 'owner' | 'member';
101
+ createdAt: string;
102
+ }
103
+ export interface MailboxAppPassword {
104
+ id: string;
105
+ mailboxId: string;
106
+ label: string;
107
+ lastUsedAt?: string;
108
+ createdAt: string;
109
+ revokedAt?: string;
110
+ }
111
+ export interface MailboxAppPasswordCreated extends MailboxAppPassword {
112
+ secret: string;
113
+ }
114
+ export interface MailboxDevice {
115
+ id: string;
116
+ kind: 'app_password' | 'web';
117
+ label: string;
118
+ lastUsedAt: string | null;
119
+ createdAt: string;
120
+ }
121
+ export interface MailboxPasswordReset {
122
+ password: string;
123
+ appliedNow: boolean;
124
+ }
125
+ export interface MailboxProfileLink {
126
+ url: string;
127
+ expiresAt: string;
128
+ }
129
+ export interface MailboxPlan {
130
+ slug: MailboxPlanSlug;
131
+ quotaBytes: number;
132
+ monthlyPriceKobo: number;
133
+ }
134
+ export interface MailboxPricing {
135
+ plans: MailboxPlan[];
136
+ addonUnitBytes: number;
137
+ addonPriceKobo: number;
138
+ pricesArePlaceholders: boolean;
139
+ }
140
+ export interface MailboxClientEndpoint {
141
+ host: string;
142
+ port: number;
143
+ security: string;
144
+ }
145
+ export interface MailboxClientSettings {
146
+ incoming: MailboxClientEndpoint | null;
147
+ outgoing: MailboxClientEndpoint | null;
148
+ }
149
+ export interface MailboxUsage {
150
+ mailboxLimit: number;
151
+ mailboxesUsed: number;
152
+ ai: {
153
+ availableMicrocredits: number;
154
+ usedThisMonthMicrocredits: number;
155
+ nextReset: string;
156
+ } | null;
157
+ }
158
+ export interface MailboxAlias {
159
+ id: string;
160
+ mailboxId: string;
161
+ address: string;
162
+ sendAs: boolean;
163
+ createdAt: string;
164
+ }
165
+ export interface MailboxAliasCreateInput {
166
+ mailboxId: string;
167
+ localPart: string;
168
+ domainId?: string;
169
+ sendAs?: boolean;
170
+ }
171
+ export interface MailboxGroup {
172
+ id: string;
173
+ domainId: string;
174
+ address: string;
175
+ displayName: string;
176
+ memberIds: string[];
177
+ moderatorId?: string;
178
+ revision: number;
179
+ createdAt: string;
180
+ updatedAt: string;
181
+ }
182
+ export interface MailboxGroupCreateInput {
183
+ domainId: string;
184
+ localPart: string;
185
+ displayName?: string;
186
+ memberIds?: string[];
187
+ moderatorId?: string;
188
+ }
189
+ export interface MailboxGroupUpdateInput {
190
+ displayName?: string;
191
+ moderatorId?: string | null;
192
+ memberIds?: string[];
193
+ }
194
+ export interface MailboxRoute {
195
+ id: string;
196
+ domainId: string;
197
+ pattern: string;
198
+ priority: number;
199
+ targets: MailboxRouteTarget[];
200
+ revision: number;
201
+ createdAt: string;
202
+ updatedAt: string;
203
+ }
204
+ export interface MailboxRouteCreateInput {
205
+ domainId: string;
206
+ pattern: string;
207
+ priority?: number;
208
+ targets: MailboxRouteTarget[];
209
+ }
210
+ export interface MailboxRouteUpdateInput {
211
+ priority?: number;
212
+ targets?: MailboxRouteTarget[];
213
+ }
214
+ export interface MailboxAppHealthIssue {
215
+ routeId: string;
216
+ address: string;
217
+ since: string;
218
+ undeliveredCount: number;
219
+ holderName: string | null;
220
+ url: string;
221
+ lastError: string;
222
+ endpointId: string;
223
+ }
224
+ export type MailboxImportSource = 'google' | 'microsoft' | 'stackshift-hosting' | 'imap';
225
+ export interface MailboxImportAccountInput {
226
+ mailboxId: string;
227
+ username: string;
228
+ password: string;
229
+ }
230
+ export interface MailboxImportStartInput {
231
+ domainId: string;
232
+ source: MailboxImportSource;
233
+ host?: string;
234
+ port?: number;
235
+ accounts: MailboxImportAccountInput[];
236
+ }
237
+ export interface MailboxImportMailbox {
238
+ mailboxId: string;
239
+ address: string;
240
+ sourceUsername: string;
241
+ state: 'pending' | 'copying' | 'copied' | 'refused' | 'skipped' | 'failed' | 'cancelled';
242
+ totalEmails: number;
243
+ copiedEmails: number;
244
+ totalBytes: number;
245
+ copiedBytes: number;
246
+ minutesLeft: number | null;
247
+ message: string | null;
248
+ }
249
+ export interface MailboxImport {
250
+ id: string;
251
+ domainId: string;
252
+ domain: string;
253
+ source: MailboxImportSource;
254
+ sourceLabel: string;
255
+ host: string;
256
+ createdAt: string;
257
+ updatedAt: string;
258
+ stage: 'copy' | 'switch' | 'done' | 'cancelled';
259
+ switch: {
260
+ requestedFor: string | null;
261
+ scheduledAt: string | null;
262
+ switchedAt: string | null;
263
+ };
264
+ mailboxes: MailboxImportMailbox[];
265
+ }
266
+ interface MailboxList<T> {
267
+ data: T[];
268
+ }
269
+ export declare class MailboxDomainsClient {
270
+ private readonly client;
271
+ constructor(client: StackShift);
272
+ create(domain: string): Promise<MailboxDomain>;
273
+ list(): Promise<MailboxList<MailboxDomain>>;
274
+ get(domainId: string): Promise<MailboxDomain>;
275
+ update(domainId: string, input: MailboxDomainUpdateInput): Promise<MailboxDomain>;
276
+ verify(domainId: string): Promise<MailboxDomain>;
277
+ applyDns(domainId: string): Promise<MailboxDomain>;
278
+ dnsApplications(domainId: string): Promise<MailboxList<Record<string, unknown>>>;
279
+ delete(domainId: string): Promise<void>;
280
+ }
281
+ export declare class MailboxesClient {
282
+ private readonly client;
283
+ constructor(client: StackShift);
284
+ plans(): Promise<MailboxPricing>;
285
+ clientSettings(): Promise<MailboxClientSettings>;
286
+ usage(): Promise<MailboxUsage>;
287
+ create(input: MailboxCreateInput): Promise<Mailbox>;
288
+ list(options?: {
289
+ domainId?: string;
290
+ }): Promise<MailboxList<Mailbox>>;
291
+ get(mailboxId: string): Promise<Mailbox>;
292
+ update(mailboxId: string, input: MailboxUpdateInput): Promise<Mailbox>;
293
+ delete(mailboxId: string): Promise<void>;
294
+ suspend(mailboxId: string): Promise<Mailbox>;
295
+ resume(mailboxId: string): Promise<Mailbox>;
296
+ resendInvitation(mailboxId: string): Promise<Mailbox>;
297
+ resetPassword(mailboxId: string): Promise<MailboxPasswordReset>;
298
+ createProfileLink(mailboxId: string): Promise<MailboxProfileLink>;
299
+ listDevices(mailboxId: string): Promise<MailboxList<MailboxDevice>>;
300
+ revokeDevice(mailboxId: string, kind: MailboxDevice['kind'], deviceId: string): Promise<void>;
301
+ listMembers(mailboxId: string): Promise<MailboxList<MailboxMember>>;
302
+ addMember(mailboxId: string, userId: string): Promise<MailboxMember>;
303
+ removeMember(mailboxId: string, userId: string): Promise<void>;
304
+ listAppPasswords(mailboxId: string): Promise<MailboxList<MailboxAppPassword>>;
305
+ createAppPassword(mailboxId: string, label: string): Promise<MailboxAppPasswordCreated>;
306
+ revokeAppPassword(mailboxId: string, passwordId: string): Promise<void>;
307
+ }
308
+ export declare class MailboxAliasesClient {
309
+ private readonly client;
310
+ constructor(client: StackShift);
311
+ create(input: MailboxAliasCreateInput): Promise<MailboxAlias>;
312
+ list(options?: {
313
+ mailboxId?: string;
314
+ }): Promise<MailboxList<MailboxAlias>>;
315
+ update(aliasId: string, input: {
316
+ sendAs: boolean;
317
+ }): Promise<MailboxAlias>;
318
+ delete(aliasId: string): Promise<void>;
319
+ }
320
+ export declare class MailboxGroupsClient {
321
+ private readonly client;
322
+ constructor(client: StackShift);
323
+ create(input: MailboxGroupCreateInput): Promise<MailboxGroup>;
324
+ list(options?: {
325
+ domainId?: string;
326
+ }): Promise<MailboxList<MailboxGroup>>;
327
+ get(groupId: string): Promise<MailboxGroup>;
328
+ update(groupId: string, input: MailboxGroupUpdateInput): Promise<MailboxGroup>;
329
+ delete(groupId: string): Promise<void>;
330
+ }
331
+ export declare class MailboxRoutesClient {
332
+ private readonly client;
333
+ constructor(client: StackShift);
334
+ create(input: MailboxRouteCreateInput): Promise<MailboxRoute>;
335
+ list(options?: {
336
+ domainId?: string;
337
+ }): Promise<MailboxList<MailboxRoute>>;
338
+ get(routeId: string): Promise<MailboxRoute>;
339
+ update(routeId: string, input: MailboxRouteUpdateInput): Promise<MailboxRoute>;
340
+ delete(routeId: string): Promise<void>;
341
+ appHealth(domainId: string): Promise<{
342
+ issue: MailboxAppHealthIssue | null;
343
+ }>;
344
+ retryDeliveries(routeId: string): Promise<{
345
+ retried: number;
346
+ }>;
347
+ }
348
+ export declare class MailboxImportsClient {
349
+ private readonly client;
350
+ constructor(client: StackShift);
351
+ start(input: MailboxImportStartInput): Promise<MailboxImport>;
352
+ list(): Promise<MailboxList<MailboxImport>>;
353
+ get(importId: string): Promise<MailboxImport>;
354
+ cancel(importId: string): Promise<MailboxImport>;
355
+ skip(importId: string, mailboxId: string): Promise<MailboxImport>;
356
+ switch(importId: string, when: 'now' | 'tonight'): Promise<MailboxImport>;
357
+ }
358
+ export {};
@@ -0,0 +1,202 @@
1
+ function path(...parts) {
2
+ return parts.map(encodeURIComponent).join('/');
3
+ }
4
+ function query(params) {
5
+ const search = new URLSearchParams();
6
+ for (const [key, value] of Object.entries(params)) {
7
+ if (value !== undefined) {
8
+ search.append(key, value);
9
+ }
10
+ }
11
+ const suffix = search.toString();
12
+ return suffix ? `?${suffix}` : '';
13
+ }
14
+ export class MailboxDomainsClient {
15
+ client;
16
+ constructor(client) {
17
+ this.client = client;
18
+ }
19
+ create(domain) {
20
+ return this.client.mailRequest('/mail/mailbox-domains', { method: 'POST', body: { domain } });
21
+ }
22
+ list() {
23
+ return this.client.mailRequest('/mail/mailbox-domains');
24
+ }
25
+ get(domainId) {
26
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}`);
27
+ }
28
+ update(domainId, input) {
29
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}`, { method: 'PATCH', body: input });
30
+ }
31
+ verify(domainId) {
32
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}/verify`, { method: 'POST' });
33
+ }
34
+ applyDns(domainId) {
35
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}/dns/apply`, { method: 'POST' });
36
+ }
37
+ dnsApplications(domainId) {
38
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}/dns/applications`);
39
+ }
40
+ delete(domainId) {
41
+ return this.client.mailRequest(`/mail/mailbox-domains/${path(domainId)}`, { method: 'DELETE' });
42
+ }
43
+ }
44
+ export class MailboxesClient {
45
+ client;
46
+ constructor(client) {
47
+ this.client = client;
48
+ }
49
+ plans() {
50
+ return this.client.mailRequest('/mail/mailbox-plans');
51
+ }
52
+ clientSettings() {
53
+ return this.client.mailRequest('/mail/mailbox-client-settings');
54
+ }
55
+ usage() {
56
+ return this.client.mailRequest('/mail/mailbox-usage');
57
+ }
58
+ create(input) {
59
+ return this.client.mailRequest('/mail/mailboxes', { method: 'POST', body: input });
60
+ }
61
+ list(options = {}) {
62
+ return this.client.mailRequest(`/mail/mailboxes${query({ domainId: options.domainId })}`);
63
+ }
64
+ get(mailboxId) {
65
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}`);
66
+ }
67
+ update(mailboxId, input) {
68
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}`, { method: 'PATCH', body: input });
69
+ }
70
+ delete(mailboxId) {
71
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}`, { method: 'DELETE' });
72
+ }
73
+ suspend(mailboxId) {
74
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/suspend`, { method: 'POST' });
75
+ }
76
+ resume(mailboxId) {
77
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/resume`, { method: 'POST' });
78
+ }
79
+ resendInvitation(mailboxId) {
80
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/invitation/resend`, { method: 'POST' });
81
+ }
82
+ resetPassword(mailboxId) {
83
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/password-reset`, { method: 'POST' });
84
+ }
85
+ createProfileLink(mailboxId) {
86
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/mobileconfig`, { method: 'POST' });
87
+ }
88
+ listDevices(mailboxId) {
89
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/devices`);
90
+ }
91
+ revokeDevice(mailboxId, kind, deviceId) {
92
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/devices/${path(kind, deviceId)}`, { method: 'DELETE' });
93
+ }
94
+ listMembers(mailboxId) {
95
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/members`);
96
+ }
97
+ addMember(mailboxId, userId) {
98
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/members`, { method: 'POST', body: { userId } });
99
+ }
100
+ removeMember(mailboxId, userId) {
101
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/members/${path(userId)}`, { method: 'DELETE' });
102
+ }
103
+ listAppPasswords(mailboxId) {
104
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/app-passwords`);
105
+ }
106
+ createAppPassword(mailboxId, label) {
107
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/app-passwords`, { method: 'POST', body: { label } });
108
+ }
109
+ revokeAppPassword(mailboxId, passwordId) {
110
+ return this.client.mailRequest(`/mail/mailboxes/${path(mailboxId)}/app-passwords/${path(passwordId)}`, { method: 'DELETE' });
111
+ }
112
+ }
113
+ export class MailboxAliasesClient {
114
+ client;
115
+ constructor(client) {
116
+ this.client = client;
117
+ }
118
+ create(input) {
119
+ return this.client.mailRequest('/mail/aliases', { method: 'POST', body: input });
120
+ }
121
+ list(options = {}) {
122
+ return this.client.mailRequest(`/mail/aliases${query({ mailboxId: options.mailboxId })}`);
123
+ }
124
+ update(aliasId, input) {
125
+ return this.client.mailRequest(`/mail/aliases/${path(aliasId)}`, { method: 'PATCH', body: input });
126
+ }
127
+ delete(aliasId) {
128
+ return this.client.mailRequest(`/mail/aliases/${path(aliasId)}`, { method: 'DELETE' });
129
+ }
130
+ }
131
+ export class MailboxGroupsClient {
132
+ client;
133
+ constructor(client) {
134
+ this.client = client;
135
+ }
136
+ create(input) {
137
+ return this.client.mailRequest('/mail/groups', { method: 'POST', body: input });
138
+ }
139
+ list(options = {}) {
140
+ return this.client.mailRequest(`/mail/groups${query({ domainId: options.domainId })}`);
141
+ }
142
+ get(groupId) {
143
+ return this.client.mailRequest(`/mail/groups/${path(groupId)}`);
144
+ }
145
+ update(groupId, input) {
146
+ return this.client.mailRequest(`/mail/groups/${path(groupId)}`, { method: 'PATCH', body: input });
147
+ }
148
+ delete(groupId) {
149
+ return this.client.mailRequest(`/mail/groups/${path(groupId)}`, { method: 'DELETE' });
150
+ }
151
+ }
152
+ export class MailboxRoutesClient {
153
+ client;
154
+ constructor(client) {
155
+ this.client = client;
156
+ }
157
+ create(input) {
158
+ return this.client.mailRequest('/mail/routes', { method: 'POST', body: input });
159
+ }
160
+ list(options = {}) {
161
+ return this.client.mailRequest(`/mail/routes${query({ domainId: options.domainId })}`);
162
+ }
163
+ get(routeId) {
164
+ return this.client.mailRequest(`/mail/routes/${path(routeId)}`);
165
+ }
166
+ update(routeId, input) {
167
+ return this.client.mailRequest(`/mail/routes/${path(routeId)}`, { method: 'PATCH', body: input });
168
+ }
169
+ delete(routeId) {
170
+ return this.client.mailRequest(`/mail/routes/${path(routeId)}`, { method: 'DELETE' });
171
+ }
172
+ appHealth(domainId) {
173
+ return this.client.mailRequest(`/mail/routes/app-health${query({ domainId })}`);
174
+ }
175
+ retryDeliveries(routeId) {
176
+ return this.client.mailRequest(`/mail/routes/${path(routeId)}/retry-deliveries`, { method: 'POST' });
177
+ }
178
+ }
179
+ export class MailboxImportsClient {
180
+ client;
181
+ constructor(client) {
182
+ this.client = client;
183
+ }
184
+ start(input) {
185
+ return this.client.mailRequest('/mail/mailbox-imports', { method: 'POST', body: input });
186
+ }
187
+ list() {
188
+ return this.client.mailRequest('/mail/mailbox-imports');
189
+ }
190
+ get(importId) {
191
+ return this.client.mailRequest(`/mail/mailbox-imports/${path(importId)}`);
192
+ }
193
+ cancel(importId) {
194
+ return this.client.mailRequest(`/mail/mailbox-imports/${path(importId)}/cancel`, { method: 'POST' });
195
+ }
196
+ skip(importId, mailboxId) {
197
+ return this.client.mailRequest(`/mail/mailbox-imports/${path(importId)}/mailboxes/${path(mailboxId)}/skip`, { method: 'POST' });
198
+ }
199
+ switch(importId, when) {
200
+ return this.client.mailRequest(`/mail/mailbox-imports/${path(importId)}/switch`, { method: 'POST', body: { when } });
201
+ }
202
+ }