@adukilabs/sdk 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,319 @@
1
+ import type { Api } from './api.js';
2
+ import type * as model from './model.js';
3
+ import type { Page, PageQuery } from './model.js';
4
+ /** The workspace: profile, members, audits, usage and the mail admin routes. */
5
+ export declare class Tenant {
6
+ #private;
7
+ readonly members: TenantMembers;
8
+ readonly audits: TenantAudits;
9
+ readonly usage: TenantUsage;
10
+ readonly domains: TenantDomains;
11
+ readonly aliases: TenantAliases;
12
+ readonly quotas: TenantQuotas;
13
+ readonly rules: TenantRules;
14
+ readonly webhooks: TenantWebhooks;
15
+ readonly holidays: TenantHolidays;
16
+ readonly schedule: TenantSchedule;
17
+ constructor(api: Api);
18
+ /** `GET /v1/tenant`: the workspace's profile (scope `tenants:read`). */
19
+ get(): Promise<model.TenantProfile>;
20
+ /** `GET /v1/tenant/view/slug/{slug}` (`tenants:read`; another workspace's slug is `403`). */
21
+ bySlug(slug: string): Promise<model.TenantProfile>;
22
+ /** `GET /v1/tenant/security`: MTA-STS, TLSA, BIMI and the DMARC/TLS reports (`security:read`). */
23
+ security(): Promise<model.SecurityStatus>;
24
+ /** `GET /v1/tenant/mail/services`: the mail services and whether this workspace may use each (`mailservices:read`). */
25
+ services(): Promise<{
26
+ services: model.MailService[];
27
+ }>;
28
+ }
29
+ /**
30
+ * The members as Aduki Mail sees them. Listing all needs `tenants:read`, the
31
+ * filtered lists `members:read`; removing `tenants:write`. Inviting, roles
32
+ * and closing an account are Aduki ID's and need a signed-in person.
33
+ */
34
+ export declare class TenantMembers {
35
+ #private;
36
+ constructor(api: Api);
37
+ /** `GET /v1/tenant/members`, `.../active` or `.../owners`. */
38
+ list(query?: PageQuery & {
39
+ state?: 'active' | 'owners';
40
+ }): Promise<Page<model.MemberRow>>;
41
+ /** `GET /v1/tenant/members/search/{q}`. */
42
+ search(text: string, query?: PageQuery): Promise<Page<model.MemberRow>>;
43
+ /** `DELETE /v1/tenant/members/{user}`: removes the member's mail account from the workspace (`404` for a non-member). */
44
+ remove(user: string): Promise<void>;
45
+ }
46
+ /** The workspace's audit trail (`audits:read`; one record by hex: `tenants:read`). */
47
+ export declare class TenantAudits {
48
+ #private;
49
+ constructor(api: Api);
50
+ /**
51
+ * `GET /v1/tenant/audits[/user/{user}][/action/{action} | /failed |
52
+ * /successful | /ip/{ip}]`: one filter besides `user` at a time (the
53
+ * server has no route for two).
54
+ */
55
+ list(query?: PageQuery & {
56
+ user?: string;
57
+ action?: string;
58
+ outcome?: 'failed' | 'successful';
59
+ ip?: string;
60
+ }): Promise<Page<model.AuditRow>>;
61
+ /** `GET /v1/tenant/view/audit/{hex}`: one record with its `meta` (`tenants:read`). */
62
+ get(hex: string): Promise<model.AuditDetail>;
63
+ }
64
+ /** Metered usage (`usage:read`). */
65
+ export declare class TenantUsage {
66
+ #private;
67
+ constructor(api: Api);
68
+ /** `GET /v1/tenant/usage`. */
69
+ list(query?: PageQuery): Promise<Page<model.UsageRow>>;
70
+ /** `GET /v1/tenant/usage/summary`: one row per metric, no paging. */
71
+ summary(): Promise<model.UsageRow[]>;
72
+ /** `GET /v1/tenant/usage/metric/{metric}`. */
73
+ metric(metric: string, query?: PageQuery): Promise<Page<model.UsageRow>>;
74
+ }
75
+ /**
76
+ * Mail domains: `domains:read`, `domains:write` to change. The DNS records
77
+ * to publish are on the domain (`dkim`, and `pending` of a DKIM rotation).
78
+ */
79
+ export declare class TenantDomains {
80
+ #private;
81
+ readonly dkim: TenantDkim;
82
+ constructor(api: Api);
83
+ /** `POST /v1/tenant/domains`: registers a domain (status `pending`); returns its hex. */
84
+ add(input: model.DomainCreate): Promise<string>;
85
+ /** `GET /v1/tenant/domains`, `.../active` or `.../pending`. */
86
+ list(query?: PageQuery & {
87
+ state?: 'active' | 'pending';
88
+ }): Promise<Page<model.DomainRow>>;
89
+ /** `GET /v1/tenant/domains/{hex}`: the full record with its DNS snapshots. */
90
+ get(hex: string): Promise<model.Domain>;
91
+ /** `GET /v1/tenant/domains/lookup/name?name=`: a domain by name (`404` when none). */
92
+ byName(name: string): Promise<model.Domain>;
93
+ /** `PATCH /v1/tenant/domains/{hex}/name`. */
94
+ rename(hex: string, name: string): Promise<void>;
95
+ /** `PATCH /v1/tenant/domains/{hex}/kind`: `primary`, `sending`, `receiving` or `alias`. */
96
+ kind(hex: string, kind: string): Promise<void>;
97
+ /** `PATCH /v1/tenant/domains/{hex}/selector`: the DKIM selector, before the domain has a key (`409` after). */
98
+ selector(hex: string, selector: string): Promise<void>;
99
+ /** `PATCH /v1/tenant/domains/{hex}/auth`: the SPF, DMARC, MTA-STS and BIMI settings, all four. */
100
+ auth(hex: string, input: {
101
+ spf: unknown;
102
+ dmarc: unknown;
103
+ mta_sts: unknown;
104
+ bimi: unknown;
105
+ }): Promise<void>;
106
+ /** `PATCH /v1/tenant/domains/{hex}/meta`. */
107
+ meta(hex: string, meta: Record<string, unknown>): Promise<void>;
108
+ /** `DELETE /v1/tenant/domains/{hex}`. */
109
+ delete(hex: string): Promise<void>;
110
+ }
111
+ /**
112
+ * DKIM key rotation without a gap: stage a key the server makes, publish its
113
+ * TXT record, check, confirm. No private key is sent or returned.
114
+ */
115
+ export declare class TenantDkim {
116
+ #private;
117
+ constructor(api: Api);
118
+ /** `GET /v1/tenant/domains/{hex}/dkim/rotation`: the active, staged and retired records (`domains:read`). */
119
+ state(hex: string): Promise<model.DkimRotation>;
120
+ /** `POST .../dkim/rotation`: stages the next key (a retry returns the same one); publish `pending.value` at `pending.name`. */
121
+ stage(hex: string, input?: {
122
+ selector?: string;
123
+ }): Promise<model.DkimRotation>;
124
+ /** `POST .../dkim/rotation/check`: whether DNS carries the staged record; changes nothing (`domains:read`). */
125
+ check(hex: string): Promise<{
126
+ ready: boolean;
127
+ reason?: string;
128
+ pending?: unknown;
129
+ [field: string]: unknown;
130
+ }>;
131
+ /** `POST .../dkim/rotation/confirm`: switches signing to the staged key (`409` while DNS does not carry it). */
132
+ confirm(hex: string): Promise<model.DkimRotation>;
133
+ /** `DELETE .../dkim/rotation`: drops the staged key (`404` when none). */
134
+ cancel(hex: string): Promise<void>;
135
+ }
136
+ /** Members' extra addresses on the workspace's verified domains: `aliases:read`, `aliases:write`. */
137
+ export declare class TenantAliases {
138
+ #private;
139
+ constructor(api: Api);
140
+ /** `POST /v1/tenant/aliases`: `created` is false when the member already had it. */
141
+ add(user: string, address: string): Promise<model.Alias & {
142
+ created: boolean;
143
+ }>;
144
+ /** `GET /v1/tenant/aliases[?user=]`: at most 1000, by address. */
145
+ list(query?: {
146
+ user?: string;
147
+ }): Promise<{
148
+ items: model.Alias[];
149
+ }>;
150
+ /** `DELETE /v1/tenant/aliases/{address}`. */
151
+ remove(address: string): Promise<void>;
152
+ }
153
+ /** The workspace's own usage ceilings per metric: `quotas:read`, `quotas:write`. */
154
+ export declare class TenantQuotas {
155
+ #private;
156
+ constructor(api: Api);
157
+ /** `POST /v1/tenant/quotas`. */
158
+ add(input: {
159
+ metric: string;
160
+ ceiling: number;
161
+ reason?: string;
162
+ expires?: string;
163
+ }): Promise<model.Quota>;
164
+ /** `GET /v1/tenant/quotas`. */
165
+ list(query?: PageQuery): Promise<Page<model.QuotaRow>>;
166
+ /** `GET /v1/tenant/quotas/{metric}`. */
167
+ get(metric: string): Promise<model.Quota>;
168
+ /** `PATCH /v1/tenant/quotas/{metric}/ceiling`, `/expires`, `/reason`: the fields given, one call each. */
169
+ edit(metric: string, change: {
170
+ ceiling?: number;
171
+ expires?: string;
172
+ reason?: string;
173
+ }): Promise<void>;
174
+ /** `DELETE /v1/tenant/quotas/{metric}`. */
175
+ delete(metric: string): Promise<void>;
176
+ }
177
+ /** Spam rules of the workspace: `rules:read`, `rules:write`. */
178
+ export declare class TenantRules {
179
+ #private;
180
+ constructor(api: Api);
181
+ /** `POST /v1/tenant/rules`. */
182
+ add(input: model.RuleCreate): Promise<model.Rule>;
183
+ /** `GET /v1/tenant/rules`, `.../active`, or `.../target/{target}`. */
184
+ list(query?: PageQuery & {
185
+ active?: boolean;
186
+ target?: string;
187
+ }): Promise<Page<model.RuleRow>>;
188
+ /** `GET /v1/tenant/rules/{hex}/detail`: the rule with its `meta`. */
189
+ get(hex: string): Promise<model.Rule>;
190
+ /** `GET /v1/tenant/rules/name/{name}`. */
191
+ byName(name: string): Promise<model.Rule>;
192
+ /**
193
+ * `PATCH /v1/tenant/rules/{hex}/{field}` for each field given (`regex` is
194
+ * sent after `pattern`, so a new pattern and `regex: true` go together).
195
+ */
196
+ edit(hex: string, change: {
197
+ name?: string;
198
+ target?: string;
199
+ pattern?: string;
200
+ regex?: boolean;
201
+ score?: number;
202
+ active?: boolean;
203
+ }): Promise<void>;
204
+ /** `DELETE /v1/tenant/rules/{hex}`. */
205
+ delete(hex: string): Promise<void>;
206
+ }
207
+ /** Delivery-event webhooks: `webhooks:read`, `webhooks:write`. */
208
+ export declare class TenantWebhooks {
209
+ #private;
210
+ constructor(api: Api);
211
+ /** `POST /v1/tenant/webhooks`: returns the hex and the signing secret, shown this once. */
212
+ add(input: model.WebhookCreate): Promise<{
213
+ hex: string;
214
+ secret: string;
215
+ }>;
216
+ /** `GET /v1/tenant/webhooks`, `.../active`, or `.../subscribers/{event}`. */
217
+ list(query?: PageQuery & {
218
+ active?: boolean;
219
+ event?: string;
220
+ }): Promise<Page<model.WebhookRow>>;
221
+ /** `GET /v1/tenant/webhooks/{hex}`: the record, never the secret. */
222
+ get(hex: string): Promise<model.Webhook>;
223
+ /** `PATCH /v1/tenant/webhooks/{hex}/{field}` for each field given (`url` is checked again: `https`, a public host). */
224
+ edit(hex: string, change: {
225
+ url?: string;
226
+ events?: string[];
227
+ domains?: string[];
228
+ active?: boolean;
229
+ secret?: string;
230
+ }): Promise<void>;
231
+ /** `POST /v1/tenant/webhooks/{hex}/secret/rotate`: a new secret made by the server, returned once. */
232
+ rotate(hex: string): Promise<string>;
233
+ /** `DELETE /v1/tenant/webhooks/{hex}`. */
234
+ delete(hex: string): Promise<void>;
235
+ }
236
+ /** The workspace's holidays and closures: reading `tenant:read`, writing `tenants:write`. */
237
+ export declare class TenantHolidays {
238
+ #private;
239
+ constructor(api: Api);
240
+ /** `GET /v1/tenant/holidays?region&year`: the effective days (`region` defaults to the workspace's). */
241
+ list(query?: {
242
+ region?: string;
243
+ year?: number;
244
+ }): Promise<model.Holiday[]>;
245
+ /**
246
+ * `POST /v1/tenant/holidays`: a day or range of the workspace's own
247
+ * (`kind` `closure` by default, or `observance`), or `{exclude: true,
248
+ * region, date}` to drop the platform's day on that date.
249
+ */
250
+ add(input: {
251
+ date: string;
252
+ until?: string;
253
+ name: string;
254
+ kind?: 'closure' | 'observance';
255
+ region?: string;
256
+ } | {
257
+ exclude: true;
258
+ region: string;
259
+ date: string;
260
+ }): Promise<model.Holiday>;
261
+ /** `DELETE /v1/tenant/holidays/{hex}`: one of the workspace's own rows. */
262
+ remove(hex: string): Promise<void>;
263
+ /** `GET /v1/tenant/holidays/region`: the default region, or null. */
264
+ region(): Promise<{
265
+ region: string;
266
+ subdivision?: string | null;
267
+ updated: string;
268
+ } | null>;
269
+ /** `PUT /v1/tenant/holidays/region` (`422` for a region with no data); `null` clears it (`DELETE`). */
270
+ setRegion(region: {
271
+ region: string;
272
+ subdivision?: string;
273
+ } | null): Promise<void>;
274
+ }
275
+ /** Scheduling templates and resources: reading `tenant:read`, writing `tenants:write`. */
276
+ export declare class TenantSchedule {
277
+ #private;
278
+ constructor(api: Api);
279
+ /** `GET /v1/tenant/schedule/templates`. */
280
+ templates(): Promise<model.ScheduleTemplate[]>;
281
+ /** `GET /v1/tenant/schedule/templates/{hex}`. */
282
+ template(hex: string): Promise<model.ScheduleTemplate>;
283
+ /** `POST /v1/tenant/schedule/templates` (rules default to weekdays 09:00-17:00, zone to UTC). */
284
+ addTemplate(input: {
285
+ name: string;
286
+ zone?: string;
287
+ rules?: unknown[];
288
+ }): Promise<model.ScheduleTemplate>;
289
+ /** `PATCH /v1/tenant/schedule/templates/{hex}`: name and zone. */
290
+ editTemplate(hex: string, change: {
291
+ name?: string;
292
+ zone?: string;
293
+ }): Promise<model.ScheduleTemplate>;
294
+ /** `PUT /v1/tenant/schedule/templates/{hex}/rules`: replaces the weekly rules. */
295
+ setRules(hex: string, rules: unknown[]): Promise<model.ScheduleTemplate>;
296
+ /** `DELETE /v1/tenant/schedule/templates/{hex}` (`409` while followed or used). */
297
+ deleteTemplate(hex: string): Promise<void>;
298
+ /** `GET /v1/tenant/schedule/resources`: rooms and equipment, live ones first. */
299
+ resources(): Promise<model.ScheduleResource[]>;
300
+ /** `GET /v1/tenant/schedule/resources/{hex}`. */
301
+ resource(hex: string): Promise<model.ScheduleResource>;
302
+ /** `POST /v1/tenant/schedule/resources` (`409` for a name in use). */
303
+ addResource(input: {
304
+ name: string;
305
+ kind: 'room' | 'equipment';
306
+ capacity?: number;
307
+ schedule?: string;
308
+ }): Promise<model.ScheduleResource>;
309
+ /** `PATCH /v1/tenant/schedule/resources/{hex}`: `null` clears `capacity` and `schedule`; `retired` stops offering it. */
310
+ editResource(hex: string, change: {
311
+ name?: string;
312
+ kind?: 'room' | 'equipment';
313
+ capacity?: number | null;
314
+ schedule?: string | null;
315
+ retired?: boolean;
316
+ }): Promise<model.ScheduleResource>;
317
+ /** `DELETE /v1/tenant/schedule/resources/{hex}` (`409` once booked: retire it instead). */
318
+ deleteResource(hex: string): Promise<void>;
319
+ }