@bemaestro/sdk 0.1.0
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/LICENSE +193 -0
- package/README.md +78 -0
- package/dist/generator/generate-sdk.d.ts +14 -0
- package/dist/generator/generate-sdk.d.ts.map +1 -0
- package/dist/generator/generate-sdk.js +64 -0
- package/dist/generator/generate-sdk.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/openapi/build-openapi.d.ts +3 -0
- package/dist/openapi/build-openapi.d.ts.map +1 -0
- package/dist/openapi/build-openapi.js +386 -0
- package/dist/openapi/build-openapi.js.map +1 -0
- package/dist/openapi/schema-mapping.d.ts +9 -0
- package/dist/openapi/schema-mapping.d.ts.map +1 -0
- package/dist/openapi/schema-mapping.js +120 -0
- package/dist/openapi/schema-mapping.js.map +1 -0
- package/dist/openapi/types.d.ts +37 -0
- package/dist/openapi/types.d.ts.map +1 -0
- package/dist/openapi/types.js +2 -0
- package/dist/openapi/types.js.map +1 -0
- package/dist/runtime/client.d.ts +495 -0
- package/dist/runtime/client.d.ts.map +1 -0
- package/dist/runtime/client.js +46 -0
- package/dist/runtime/client.js.map +1 -0
- package/dist/runtime/http.d.ts +11 -0
- package/dist/runtime/http.d.ts.map +1 -0
- package/dist/runtime/http.js +120 -0
- package/dist/runtime/http.js.map +1 -0
- package/dist/runtime/index.d.ts +7 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/modules.d.ts +623 -0
- package/dist/runtime/modules.d.ts.map +1 -0
- package/dist/runtime/modules.js +694 -0
- package/dist/runtime/modules.js.map +1 -0
- package/dist/runtime/types.d.ts +72 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +11 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/webhook-verify.d.ts +31 -0
- package/dist/runtime/webhook-verify.d.ts.map +1 -0
- package/dist/runtime/webhook-verify.js +51 -0
- package/dist/runtime/webhook-verify.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
function asQuery(params) {
|
|
2
|
+
return params;
|
|
3
|
+
}
|
|
4
|
+
export function createAuthModule(http, app) {
|
|
5
|
+
return {
|
|
6
|
+
login(input) {
|
|
7
|
+
return http.request({
|
|
8
|
+
method: 'POST',
|
|
9
|
+
path: `/v1/${app}/auth/login`,
|
|
10
|
+
body: input,
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
async refresh(refreshToken) {
|
|
14
|
+
const tokens = await http.request({
|
|
15
|
+
method: 'POST',
|
|
16
|
+
path: `/v1/${app}/auth/refresh`,
|
|
17
|
+
body: { refreshToken },
|
|
18
|
+
});
|
|
19
|
+
http.setTokens(tokens);
|
|
20
|
+
return tokens;
|
|
21
|
+
},
|
|
22
|
+
logout(refreshToken) {
|
|
23
|
+
return http.request({
|
|
24
|
+
method: 'POST',
|
|
25
|
+
path: `/v1/${app}/auth/logout`,
|
|
26
|
+
body: { refreshToken },
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
async switchOrg(orgId) {
|
|
30
|
+
const result = await http.request({
|
|
31
|
+
method: 'POST',
|
|
32
|
+
path: `/v1/${app}/auth/switch-org`,
|
|
33
|
+
body: { orgId },
|
|
34
|
+
});
|
|
35
|
+
// Keep the client in sync so subsequent requests use the new org's JWT
|
|
36
|
+
// (org context is carried by the token) and X-Org-Id header.
|
|
37
|
+
http.setTokens({ accessToken: result.accessToken, refreshToken: result.refreshToken });
|
|
38
|
+
http.setOrgId(orgId);
|
|
39
|
+
return result;
|
|
40
|
+
},
|
|
41
|
+
register(input) {
|
|
42
|
+
return http.request({
|
|
43
|
+
method: 'POST',
|
|
44
|
+
path: `/v1/${app}/auth/register`,
|
|
45
|
+
body: input,
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
forgotPassword(email) {
|
|
49
|
+
return http.request({
|
|
50
|
+
method: 'POST',
|
|
51
|
+
path: `/v1/${app}/auth/forgot`,
|
|
52
|
+
body: { email },
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
resetPassword(input) {
|
|
56
|
+
return http.request({
|
|
57
|
+
method: 'POST',
|
|
58
|
+
path: `/v1/${app}/auth/reset`,
|
|
59
|
+
body: input,
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
verifyEmail(token) {
|
|
63
|
+
return http.request({
|
|
64
|
+
method: 'POST',
|
|
65
|
+
path: `/v1/${app}/auth/verify-email`,
|
|
66
|
+
body: { token },
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export function createOrgsModule(http, app) {
|
|
72
|
+
return {
|
|
73
|
+
me() {
|
|
74
|
+
return http.request({
|
|
75
|
+
method: 'GET',
|
|
76
|
+
path: `/v1/${app}/me`,
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
myOrgs() {
|
|
80
|
+
return http.request({
|
|
81
|
+
method: 'GET',
|
|
82
|
+
path: `/v1/${app}/me/orgs`,
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
create(input) {
|
|
86
|
+
const body = typeof input === 'string' ? { name: input } : input;
|
|
87
|
+
return http.request({
|
|
88
|
+
method: 'POST',
|
|
89
|
+
path: `/v1/${app}/orgs`,
|
|
90
|
+
body,
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
get(orgId) {
|
|
94
|
+
return http.request({
|
|
95
|
+
method: 'GET',
|
|
96
|
+
path: `/v1/${app}/orgs/${orgId}`,
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
rename(orgId, name) {
|
|
100
|
+
return http.request({
|
|
101
|
+
method: 'PATCH',
|
|
102
|
+
path: `/v1/${app}/orgs/${orgId}`,
|
|
103
|
+
body: { name },
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
listMembers(orgId) {
|
|
107
|
+
return http.request({
|
|
108
|
+
method: 'GET',
|
|
109
|
+
path: `/v1/${app}/orgs/${orgId}/members`,
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
inviteMember(orgId, input) {
|
|
113
|
+
return http.request({
|
|
114
|
+
method: 'POST',
|
|
115
|
+
path: `/v1/${app}/orgs/${orgId}/invitations`,
|
|
116
|
+
body: input,
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
updateMemberRole(orgId, userId, role) {
|
|
120
|
+
return http.request({
|
|
121
|
+
method: 'PATCH',
|
|
122
|
+
path: `/v1/${app}/orgs/${orgId}/members/${userId}`,
|
|
123
|
+
body: { role },
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
removeMember(orgId, userId) {
|
|
127
|
+
return http.request({
|
|
128
|
+
method: 'DELETE',
|
|
129
|
+
path: `/v1/${app}/orgs/${orgId}/members/${userId}`,
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
acceptInvitation(token) {
|
|
133
|
+
return http.request({
|
|
134
|
+
method: 'POST',
|
|
135
|
+
path: `/v1/${app}/invitations/${token}/accept`,
|
|
136
|
+
body: {},
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
export function createApiKeysModule(http, app) {
|
|
142
|
+
return {
|
|
143
|
+
list() {
|
|
144
|
+
return http.request({
|
|
145
|
+
method: 'GET',
|
|
146
|
+
path: `/v1/${app}/api-keys`,
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
issue(input) {
|
|
150
|
+
return http.request({
|
|
151
|
+
method: 'POST',
|
|
152
|
+
path: `/v1/${app}/api-keys`,
|
|
153
|
+
body: input,
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
revoke(id) {
|
|
157
|
+
return http.request({
|
|
158
|
+
method: 'DELETE',
|
|
159
|
+
path: `/v1/${app}/api-keys/${id}`,
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export function createMcpModule(http, app) {
|
|
165
|
+
return {
|
|
166
|
+
listTools() {
|
|
167
|
+
return http.request({
|
|
168
|
+
method: 'GET',
|
|
169
|
+
path: `/v1/${app}/mcp/tools`,
|
|
170
|
+
});
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export function createCapabilitiesModule(http, app) {
|
|
175
|
+
return {
|
|
176
|
+
get() {
|
|
177
|
+
return http.request({
|
|
178
|
+
method: 'GET',
|
|
179
|
+
path: `/v1/${app}/capabilities`,
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
export function createEventsModule(http, app) {
|
|
185
|
+
return {
|
|
186
|
+
list(params) {
|
|
187
|
+
return http.request({
|
|
188
|
+
method: 'GET',
|
|
189
|
+
path: `/v1/${app}/events`,
|
|
190
|
+
query: params,
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export function createBillingModule(http, app) {
|
|
196
|
+
return {
|
|
197
|
+
listPlans() {
|
|
198
|
+
return http.request({
|
|
199
|
+
method: 'GET',
|
|
200
|
+
path: `/v1/${app}/plans`,
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
usage(orgId) {
|
|
204
|
+
return http.request({
|
|
205
|
+
method: 'GET',
|
|
206
|
+
path: `/v1/${app}/orgs/${orgId}/usage`,
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
subscribe(orgId, planKey) {
|
|
210
|
+
return http.request({
|
|
211
|
+
method: 'POST',
|
|
212
|
+
path: `/v1/${app}/orgs/${orgId}/subscription`,
|
|
213
|
+
body: { planKey },
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
portal(orgId) {
|
|
217
|
+
return http.request({
|
|
218
|
+
method: 'POST',
|
|
219
|
+
path: `/v1/${app}/orgs/${orgId}/subscription/portal`,
|
|
220
|
+
body: {},
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
export function createAiModule(http, app) {
|
|
226
|
+
return {
|
|
227
|
+
proposeSchema(prompt, collectionKey) {
|
|
228
|
+
return http.request({
|
|
229
|
+
method: 'POST',
|
|
230
|
+
path: `/v1/${app}/ai/schema:propose`,
|
|
231
|
+
query: collectionKey ? { collection: collectionKey } : undefined,
|
|
232
|
+
body: { prompt },
|
|
233
|
+
});
|
|
234
|
+
},
|
|
235
|
+
applySchema(definition, options) {
|
|
236
|
+
return http.request({
|
|
237
|
+
method: 'POST',
|
|
238
|
+
path: `/v1/${app}/ai/schema:apply`,
|
|
239
|
+
query: options?.confirmDestructive ? { confirm: 'destructive' } : undefined,
|
|
240
|
+
body: { definition },
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
listAssistants() {
|
|
244
|
+
return http.request({
|
|
245
|
+
method: 'GET',
|
|
246
|
+
path: `/v1/${app}/ai/assistants`,
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
upsertAssistant(input) {
|
|
250
|
+
return http.request({
|
|
251
|
+
method: 'POST',
|
|
252
|
+
path: `/v1/${app}/ai/assistants`,
|
|
253
|
+
body: input,
|
|
254
|
+
});
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
export function createConversationsModule(http, app) {
|
|
259
|
+
return {
|
|
260
|
+
list(params) {
|
|
261
|
+
return http.request({
|
|
262
|
+
method: 'GET',
|
|
263
|
+
path: `/v1/${app}/conversations`,
|
|
264
|
+
query: asQuery(params),
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
get(id) {
|
|
268
|
+
return http.request({
|
|
269
|
+
method: 'GET',
|
|
270
|
+
path: `/v1/${app}/conversations/${id}`,
|
|
271
|
+
});
|
|
272
|
+
},
|
|
273
|
+
remove(id) {
|
|
274
|
+
return http.request({
|
|
275
|
+
method: 'DELETE',
|
|
276
|
+
path: `/v1/${app}/conversations/${id}`,
|
|
277
|
+
});
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
export function createSchemaModule(http, app) {
|
|
282
|
+
return {
|
|
283
|
+
listCollections() {
|
|
284
|
+
return http.request({
|
|
285
|
+
method: 'GET',
|
|
286
|
+
path: `/v1/${app}/schema/collections`,
|
|
287
|
+
});
|
|
288
|
+
},
|
|
289
|
+
getCollection(key) {
|
|
290
|
+
return http.request({
|
|
291
|
+
method: 'GET',
|
|
292
|
+
path: `/v1/${app}/schema/collections/${key}`,
|
|
293
|
+
});
|
|
294
|
+
},
|
|
295
|
+
createCollection(input) {
|
|
296
|
+
return http.request({
|
|
297
|
+
method: 'POST',
|
|
298
|
+
path: `/v1/${app}/schema/collections`,
|
|
299
|
+
body: input,
|
|
300
|
+
});
|
|
301
|
+
},
|
|
302
|
+
patchCollection(key, input, options) {
|
|
303
|
+
return http.request({
|
|
304
|
+
method: 'PATCH',
|
|
305
|
+
path: `/v1/${app}/schema/collections/${key}`,
|
|
306
|
+
query: options?.confirmDestructive ? { confirm: 'destructive' } : undefined,
|
|
307
|
+
body: input,
|
|
308
|
+
});
|
|
309
|
+
},
|
|
310
|
+
planChange(key, input) {
|
|
311
|
+
return http.request({
|
|
312
|
+
method: 'POST',
|
|
313
|
+
path: `/v1/${app}/schema/collections/${key}:plan`,
|
|
314
|
+
body: input,
|
|
315
|
+
});
|
|
316
|
+
},
|
|
317
|
+
deleteCollection(key, options) {
|
|
318
|
+
return http.request({
|
|
319
|
+
method: 'DELETE',
|
|
320
|
+
path: `/v1/${app}/schema/collections/${key}`,
|
|
321
|
+
query: options?.confirmDestructive ? { confirm: 'destructive' } : undefined,
|
|
322
|
+
});
|
|
323
|
+
},
|
|
324
|
+
listMigrationStatus() {
|
|
325
|
+
return http.request({
|
|
326
|
+
method: 'GET',
|
|
327
|
+
path: `/v1/${app}/schema/status`,
|
|
328
|
+
});
|
|
329
|
+
},
|
|
330
|
+
reconcile() {
|
|
331
|
+
return http.request({
|
|
332
|
+
method: 'POST',
|
|
333
|
+
path: `/v1/${app}/schema:reconcile`,
|
|
334
|
+
body: {},
|
|
335
|
+
});
|
|
336
|
+
},
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
export function createWebhooksModule(http, app) {
|
|
340
|
+
return {
|
|
341
|
+
list(params) {
|
|
342
|
+
return http.request({
|
|
343
|
+
method: 'GET',
|
|
344
|
+
path: `/v1/${app}/webhooks`,
|
|
345
|
+
query: asQuery(params),
|
|
346
|
+
});
|
|
347
|
+
},
|
|
348
|
+
create(input) {
|
|
349
|
+
return http.request({
|
|
350
|
+
method: 'POST',
|
|
351
|
+
path: `/v1/${app}/webhooks`,
|
|
352
|
+
body: input,
|
|
353
|
+
});
|
|
354
|
+
},
|
|
355
|
+
get(id) {
|
|
356
|
+
return http.request({
|
|
357
|
+
method: 'GET',
|
|
358
|
+
path: `/v1/${app}/webhooks/${id}`,
|
|
359
|
+
});
|
|
360
|
+
},
|
|
361
|
+
patch(id, input) {
|
|
362
|
+
return http.request({
|
|
363
|
+
method: 'PATCH',
|
|
364
|
+
path: `/v1/${app}/webhooks/${id}`,
|
|
365
|
+
body: input,
|
|
366
|
+
});
|
|
367
|
+
},
|
|
368
|
+
remove(id) {
|
|
369
|
+
return http.request({
|
|
370
|
+
method: 'DELETE',
|
|
371
|
+
path: `/v1/${app}/webhooks/${id}`,
|
|
372
|
+
});
|
|
373
|
+
},
|
|
374
|
+
listDeliveries(id, params) {
|
|
375
|
+
return http.request({
|
|
376
|
+
method: 'GET',
|
|
377
|
+
path: `/v1/${app}/webhooks/${id}/deliveries`,
|
|
378
|
+
query: asQuery(params),
|
|
379
|
+
});
|
|
380
|
+
},
|
|
381
|
+
replayDelivery(webhookId, deliveryId) {
|
|
382
|
+
return http.request({
|
|
383
|
+
method: 'POST',
|
|
384
|
+
path: `/v1/${app}/webhooks/${webhookId}/deliveries/${deliveryId}:replay`,
|
|
385
|
+
body: {},
|
|
386
|
+
});
|
|
387
|
+
},
|
|
388
|
+
sendTest(id) {
|
|
389
|
+
return http.request({
|
|
390
|
+
method: 'POST',
|
|
391
|
+
path: `/v1/${app}/webhooks/${id}:test`,
|
|
392
|
+
body: {},
|
|
393
|
+
});
|
|
394
|
+
},
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
export const FLOW_ACTION_TYPES = [
|
|
398
|
+
'send_message',
|
|
399
|
+
'send_notification',
|
|
400
|
+
'http_request',
|
|
401
|
+
'ai_task',
|
|
402
|
+
'create_record',
|
|
403
|
+
'update_record',
|
|
404
|
+
'enqueue_webhook',
|
|
405
|
+
];
|
|
406
|
+
export function createFlowsModule(http, app) {
|
|
407
|
+
return {
|
|
408
|
+
list(params) {
|
|
409
|
+
return http.request({
|
|
410
|
+
method: 'GET',
|
|
411
|
+
path: `/v1/${app}/flows`,
|
|
412
|
+
query: asQuery(params),
|
|
413
|
+
});
|
|
414
|
+
},
|
|
415
|
+
create(input) {
|
|
416
|
+
return http.request({
|
|
417
|
+
method: 'POST',
|
|
418
|
+
path: `/v1/${app}/flows`,
|
|
419
|
+
body: input,
|
|
420
|
+
});
|
|
421
|
+
},
|
|
422
|
+
get(id) {
|
|
423
|
+
return http.request({
|
|
424
|
+
method: 'GET',
|
|
425
|
+
path: `/v1/${app}/flows/${id}`,
|
|
426
|
+
});
|
|
427
|
+
},
|
|
428
|
+
patch(id, input) {
|
|
429
|
+
return http.request({
|
|
430
|
+
method: 'PATCH',
|
|
431
|
+
path: `/v1/${app}/flows/${id}`,
|
|
432
|
+
body: input,
|
|
433
|
+
});
|
|
434
|
+
},
|
|
435
|
+
remove(id) {
|
|
436
|
+
return http.request({
|
|
437
|
+
method: 'DELETE',
|
|
438
|
+
path: `/v1/${app}/flows/${id}`,
|
|
439
|
+
});
|
|
440
|
+
},
|
|
441
|
+
listRuns(id, params) {
|
|
442
|
+
return http.request({
|
|
443
|
+
method: 'GET',
|
|
444
|
+
path: `/v1/${app}/flows/${id}/runs`,
|
|
445
|
+
query: asQuery(params),
|
|
446
|
+
});
|
|
447
|
+
},
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
export function createFilesModule(http, app) {
|
|
451
|
+
return {
|
|
452
|
+
sign(input) {
|
|
453
|
+
return http.request({
|
|
454
|
+
method: 'POST',
|
|
455
|
+
path: `/v1/${app}/files:sign`,
|
|
456
|
+
body: input,
|
|
457
|
+
});
|
|
458
|
+
},
|
|
459
|
+
list(params) {
|
|
460
|
+
return http.request({
|
|
461
|
+
method: 'GET',
|
|
462
|
+
path: `/v1/${app}/files`,
|
|
463
|
+
query: asQuery(params),
|
|
464
|
+
});
|
|
465
|
+
},
|
|
466
|
+
get(id) {
|
|
467
|
+
return http.request({
|
|
468
|
+
method: 'GET',
|
|
469
|
+
path: `/v1/${app}/files/${id}`,
|
|
470
|
+
});
|
|
471
|
+
},
|
|
472
|
+
remove(id, force = false) {
|
|
473
|
+
return http.request({
|
|
474
|
+
method: 'DELETE',
|
|
475
|
+
path: `/v1/${app}/files/${id}`,
|
|
476
|
+
query: force ? { force: 1 } : undefined,
|
|
477
|
+
});
|
|
478
|
+
},
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
export const VIEW_TYPES = [
|
|
482
|
+
'table',
|
|
483
|
+
'calendar',
|
|
484
|
+
'kanban',
|
|
485
|
+
'gallery',
|
|
486
|
+
'detail',
|
|
487
|
+
'form',
|
|
488
|
+
'dashboard',
|
|
489
|
+
];
|
|
490
|
+
export const SURFACE_AUDIENCES = ['back_office', 'client', 'public'];
|
|
491
|
+
export const SURFACE_DELIVERIES = ['admin_runtime', 'pwa', 'web', 'site'];
|
|
492
|
+
export const SITE_SUBTYPES = ['landing', 'one_page', 'multipage', 'ecommerce'];
|
|
493
|
+
export function createViewsModule(http, app) {
|
|
494
|
+
return {
|
|
495
|
+
list(params) {
|
|
496
|
+
return http.request({
|
|
497
|
+
method: 'GET',
|
|
498
|
+
path: `/v1/${app}/views`,
|
|
499
|
+
query: asQuery(params),
|
|
500
|
+
});
|
|
501
|
+
},
|
|
502
|
+
create(input) {
|
|
503
|
+
return http.request({
|
|
504
|
+
method: 'POST',
|
|
505
|
+
path: `/v1/${app}/views`,
|
|
506
|
+
body: input,
|
|
507
|
+
});
|
|
508
|
+
},
|
|
509
|
+
get(key) {
|
|
510
|
+
return http.request({
|
|
511
|
+
method: 'GET',
|
|
512
|
+
path: `/v1/${app}/views/${key}`,
|
|
513
|
+
});
|
|
514
|
+
},
|
|
515
|
+
patch(key, input) {
|
|
516
|
+
return http.request({
|
|
517
|
+
method: 'PATCH',
|
|
518
|
+
path: `/v1/${app}/views/${key}`,
|
|
519
|
+
body: input,
|
|
520
|
+
});
|
|
521
|
+
},
|
|
522
|
+
remove(key) {
|
|
523
|
+
return http.request({
|
|
524
|
+
method: 'DELETE',
|
|
525
|
+
path: `/v1/${app}/views/${key}`,
|
|
526
|
+
});
|
|
527
|
+
},
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
export function createSurfacesModule(http, app) {
|
|
531
|
+
return {
|
|
532
|
+
list(params) {
|
|
533
|
+
return http.request({
|
|
534
|
+
method: 'GET',
|
|
535
|
+
path: `/v1/${app}/surfaces`,
|
|
536
|
+
query: asQuery(params),
|
|
537
|
+
});
|
|
538
|
+
},
|
|
539
|
+
create(input) {
|
|
540
|
+
return http.request({
|
|
541
|
+
method: 'POST',
|
|
542
|
+
path: `/v1/${app}/surfaces`,
|
|
543
|
+
body: input,
|
|
544
|
+
});
|
|
545
|
+
},
|
|
546
|
+
get(key) {
|
|
547
|
+
return http.request({
|
|
548
|
+
method: 'GET',
|
|
549
|
+
path: `/v1/${app}/surfaces/${key}`,
|
|
550
|
+
});
|
|
551
|
+
},
|
|
552
|
+
patch(key, input) {
|
|
553
|
+
return http.request({
|
|
554
|
+
method: 'PATCH',
|
|
555
|
+
path: `/v1/${app}/surfaces/${key}`,
|
|
556
|
+
body: input,
|
|
557
|
+
});
|
|
558
|
+
},
|
|
559
|
+
remove(key) {
|
|
560
|
+
return http.request({
|
|
561
|
+
method: 'DELETE',
|
|
562
|
+
path: `/v1/${app}/surfaces/${key}`,
|
|
563
|
+
});
|
|
564
|
+
},
|
|
565
|
+
/** The single call the shell makes on load (spec 17 US-17.2/17.4). */
|
|
566
|
+
runtime() {
|
|
567
|
+
return http.request({
|
|
568
|
+
method: 'GET',
|
|
569
|
+
path: `/v1/${app}/runtime`,
|
|
570
|
+
});
|
|
571
|
+
},
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
export function createCollectionModule(http, app, collectionKey) {
|
|
575
|
+
const base = `/v1/${app}/${collectionKey}`;
|
|
576
|
+
return {
|
|
577
|
+
list(params) {
|
|
578
|
+
return http.request({
|
|
579
|
+
method: 'GET',
|
|
580
|
+
path: base,
|
|
581
|
+
query: asQuery(params),
|
|
582
|
+
});
|
|
583
|
+
},
|
|
584
|
+
get(id, params) {
|
|
585
|
+
return http.request({
|
|
586
|
+
method: 'GET',
|
|
587
|
+
path: `${base}/${id}`,
|
|
588
|
+
query: asQuery(params),
|
|
589
|
+
});
|
|
590
|
+
},
|
|
591
|
+
create(body) {
|
|
592
|
+
return http.request({
|
|
593
|
+
method: 'POST',
|
|
594
|
+
path: base,
|
|
595
|
+
body,
|
|
596
|
+
});
|
|
597
|
+
},
|
|
598
|
+
patch(id, body) {
|
|
599
|
+
return http.request({
|
|
600
|
+
method: 'PATCH',
|
|
601
|
+
path: `${base}/${id}`,
|
|
602
|
+
body,
|
|
603
|
+
});
|
|
604
|
+
},
|
|
605
|
+
put(id, body) {
|
|
606
|
+
return http.request({
|
|
607
|
+
method: 'PUT',
|
|
608
|
+
path: `${base}/${id}`,
|
|
609
|
+
body,
|
|
610
|
+
});
|
|
611
|
+
},
|
|
612
|
+
delete(id) {
|
|
613
|
+
return http.request({
|
|
614
|
+
method: 'DELETE',
|
|
615
|
+
path: `${base}/${id}`,
|
|
616
|
+
});
|
|
617
|
+
},
|
|
618
|
+
search(query, params) {
|
|
619
|
+
return http.request({
|
|
620
|
+
method: 'GET',
|
|
621
|
+
path: base,
|
|
622
|
+
query: { ...asQuery(params), search: query },
|
|
623
|
+
});
|
|
624
|
+
},
|
|
625
|
+
bulk(items, partial = false) {
|
|
626
|
+
return http.request({
|
|
627
|
+
method: 'POST',
|
|
628
|
+
path: `${base}:bulk`,
|
|
629
|
+
query: partial ? { partial: 1 } : undefined,
|
|
630
|
+
body: { items },
|
|
631
|
+
});
|
|
632
|
+
},
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
/** Unauthenticated public-read (spec 03 US-03.8) — no Authorization header. */
|
|
636
|
+
export function createPublicModule(http, app) {
|
|
637
|
+
return {
|
|
638
|
+
collection(orgId, collectionKey) {
|
|
639
|
+
const base = `/v1/${app}/public/${orgId}/${collectionKey}`;
|
|
640
|
+
return {
|
|
641
|
+
list(params) {
|
|
642
|
+
return http.request({
|
|
643
|
+
method: 'GET',
|
|
644
|
+
path: base,
|
|
645
|
+
query: asQuery(params),
|
|
646
|
+
});
|
|
647
|
+
},
|
|
648
|
+
get(id, params) {
|
|
649
|
+
return http.request({
|
|
650
|
+
method: 'GET',
|
|
651
|
+
path: `${base}/${id}`,
|
|
652
|
+
query: asQuery(params),
|
|
653
|
+
});
|
|
654
|
+
},
|
|
655
|
+
};
|
|
656
|
+
},
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
export function createNotificationsModule(http, app) {
|
|
660
|
+
return {
|
|
661
|
+
list(params) {
|
|
662
|
+
return http.request({
|
|
663
|
+
method: 'GET',
|
|
664
|
+
path: `/v1/${app}/notifications`,
|
|
665
|
+
query: {
|
|
666
|
+
unread: params?.unread ? 1 : undefined,
|
|
667
|
+
limit: params?.limit,
|
|
668
|
+
offset: params?.offset,
|
|
669
|
+
},
|
|
670
|
+
});
|
|
671
|
+
},
|
|
672
|
+
markRead(id) {
|
|
673
|
+
return http.request({
|
|
674
|
+
method: 'PATCH',
|
|
675
|
+
path: `/v1/${app}/notifications/${id}`,
|
|
676
|
+
body: {},
|
|
677
|
+
});
|
|
678
|
+
},
|
|
679
|
+
preferences() {
|
|
680
|
+
return http.request({
|
|
681
|
+
method: 'GET',
|
|
682
|
+
path: `/v1/${app}/notifications/preferences`,
|
|
683
|
+
});
|
|
684
|
+
},
|
|
685
|
+
setPreference(body) {
|
|
686
|
+
return http.request({
|
|
687
|
+
method: 'PATCH',
|
|
688
|
+
path: `/v1/${app}/notifications/preferences`,
|
|
689
|
+
body,
|
|
690
|
+
});
|
|
691
|
+
},
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
//# sourceMappingURL=modules.js.map
|