@andesine/sdk 0.4.0 → 0.5.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/CHANGELOG.md +17 -0
- package/dist/{index-moj3WP71.d.ts → client-C8wt7f3o.d.ts} +59 -445
- package/dist/client-DioqVOxl.js +1424 -0
- package/dist/client-DioqVOxl.js.map +1 -0
- package/dist/extensions.d.ts +87 -0
- package/dist/extensions.js +220 -0
- package/dist/extensions.js.map +1 -0
- package/dist/index-B5qefVRv.d.ts +473 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -1325
- package/dist/index.js.map +1 -1
- package/dist/{schema-BcVop8NH.d.ts → schema-CrquN_J6.d.ts} +2830 -2
- package/dist/streaming.d.ts +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/openapi.json +4316 -0
- package/package.json +5 -1
package/dist/index.js
CHANGED
|
@@ -1,1329 +1,6 @@
|
|
|
1
|
-
import { i as AndesineStreamProtocolError, n as AndesineAPIError, r as AndesineStreamError
|
|
1
|
+
import { i as AndesineStreamProtocolError, n as AndesineAPIError, r as AndesineStreamError } from "./answer-stream-7N_gLhVS.js";
|
|
2
|
+
import { n as paginate, r as paginatePages, t as createClient } from "./client-DioqVOxl.js";
|
|
2
3
|
import { toContentSlug } from "./content-slug.js";
|
|
3
|
-
import createFetchClient from "openapi-fetch";
|
|
4
|
-
//#region src/paginate.ts
|
|
5
|
-
/**
|
|
6
|
-
* Iterate cursor-paginated pages, retaining their metadata.
|
|
7
|
-
*
|
|
8
|
-
* @param getPage - Fetch one page for the supplied cursor. The first cursor is undefined unless supplied.
|
|
9
|
-
* Keep filters stable. This generic helper does not bind snapshots; use content.paginateEntryPages()
|
|
10
|
-
* or content.paginateCollectionPages() for automatic published snapshot handling.
|
|
11
|
-
* @param options - Optional cursor from an earlier page to resume processing.
|
|
12
|
-
* @returns A lazy iterator that requests the next page only after the previous page is consumed.
|
|
13
|
-
* Save pagination.nextCursor after processing a page. Break the loop to stop further requests.
|
|
14
|
-
* @throws Error for a missing or repeated next cursor. Callback failures pass through unchanged.
|
|
15
|
-
*/
|
|
16
|
-
const paginatePages = async function* (getPage, options = {}) {
|
|
17
|
-
const seen = new Set(options.cursor ? [options.cursor] : []);
|
|
18
|
-
let cursor = options.cursor;
|
|
19
|
-
do {
|
|
20
|
-
const page = await getPage(cursor);
|
|
21
|
-
const next = page.pagination.nextCursor;
|
|
22
|
-
if (page.pagination.hasMore && (!next || seen.has(next))) throw new Error("Pagination returned a missing or repeated cursor");
|
|
23
|
-
yield page;
|
|
24
|
-
if (!page.pagination.hasMore) return;
|
|
25
|
-
seen.add(next);
|
|
26
|
-
cursor = next;
|
|
27
|
-
} while (cursor);
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Iterate items across cursor-paginated pages without collecting them in memory.
|
|
31
|
-
*
|
|
32
|
-
* @param getPage - Fetch one page using the cursor. Keep scope and filters stable in this callback.
|
|
33
|
-
* This generic helper does not bind snapshots; content.paginateEntries() and
|
|
34
|
-
* content.paginateCollections() do that automatically for published content.
|
|
35
|
-
* @param options - Optional starting cursor; retain its matching scope and snapshot yourself.
|
|
36
|
-
* @returns Items in API order. Break the loop to prevent further page requests.
|
|
37
|
-
* @throws Pagination errors from paginatePages(), or the original callback error.
|
|
38
|
-
*/
|
|
39
|
-
const paginate = async function* (getPage, options = {}) {
|
|
40
|
-
for await (const page of paginatePages(getPage, options)) yield* page.data;
|
|
41
|
-
};
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/content-client.ts
|
|
44
|
-
const paginateSnapshotPages = async function* (list, input, options = {}) {
|
|
45
|
-
let query = { ...input };
|
|
46
|
-
yield* paginatePages(async (cursor) => {
|
|
47
|
-
const page = await list({
|
|
48
|
-
...query,
|
|
49
|
-
cursor
|
|
50
|
-
}, {
|
|
51
|
-
...options,
|
|
52
|
-
response: "data"
|
|
53
|
-
});
|
|
54
|
-
if (query.snapshotID !== void 0 && page.snapshotID !== query.snapshotID) throw new Error("Pagination returned a different snapshot");
|
|
55
|
-
query = {
|
|
56
|
-
...query,
|
|
57
|
-
channel: void 0,
|
|
58
|
-
snapshotID: page.snapshotID
|
|
59
|
-
};
|
|
60
|
-
return page;
|
|
61
|
-
}, { cursor: input.cursor });
|
|
62
|
-
};
|
|
63
|
-
const createContentClient = (content) => {
|
|
64
|
-
const paginateEntryPages = (input = {}, options) => paginateSnapshotPages((query, requestOptions) => content.listEntries(query, requestOptions), input, options);
|
|
65
|
-
const paginateCollectionPages = (input = {}, options) => paginateSnapshotPages((query, requestOptions) => content.listCollections(query, requestOptions), input, options);
|
|
66
|
-
return {
|
|
67
|
-
...content,
|
|
68
|
-
paginateEntryPages,
|
|
69
|
-
async *paginateEntries(input, options) {
|
|
70
|
-
for await (const page of paginateEntryPages(input, options)) yield* page.data;
|
|
71
|
-
},
|
|
72
|
-
paginateCollectionPages,
|
|
73
|
-
async *paginateCollections(input, options) {
|
|
74
|
-
for await (const page of paginateCollectionPages(input, options)) yield* page.data;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
//#endregion
|
|
79
|
-
//#region src/query.ts
|
|
80
|
-
const serializeQuery = (query) => {
|
|
81
|
-
const parameters = new URLSearchParams();
|
|
82
|
-
const escapeKey = (key) => key.replace(/[\\[\]]/g, (character) => `\\${character}`);
|
|
83
|
-
const append = (path, value) => {
|
|
84
|
-
if (value === void 0 || value === null) return;
|
|
85
|
-
if (Array.isArray(value)) value.forEach((item, index) => append(`${path}[${index}]`, item));
|
|
86
|
-
else if (typeof value === "object") for (const [key, item] of Object.entries(value)) append(`${path}[${escapeKey(key)}]`, item);
|
|
87
|
-
else parameters.append(path, String(value));
|
|
88
|
-
};
|
|
89
|
-
for (const [key, value] of Object.entries(query)) append(escapeKey(key), value);
|
|
90
|
-
return parameters.toString();
|
|
91
|
-
};
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region src/operation.ts
|
|
94
|
-
const operation = (request, definition) => {
|
|
95
|
-
return ((input, options) => {
|
|
96
|
-
return request(definition, input || {}, options);
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
//#endregion
|
|
100
|
-
//#region src/generated/resources.ts
|
|
101
|
-
const createResources = (request) => ({
|
|
102
|
-
assets: {
|
|
103
|
-
search: operation(request, {
|
|
104
|
-
method: "get",
|
|
105
|
-
path: "/assets/search",
|
|
106
|
-
pathParams: [],
|
|
107
|
-
queryParams: [
|
|
108
|
-
"query",
|
|
109
|
-
"checksum",
|
|
110
|
-
"semantic",
|
|
111
|
-
"limit"
|
|
112
|
-
],
|
|
113
|
-
body: false,
|
|
114
|
-
multipart: false,
|
|
115
|
-
binary: false,
|
|
116
|
-
anonymous: false
|
|
117
|
-
}),
|
|
118
|
-
importURL: operation(request, {
|
|
119
|
-
method: "post",
|
|
120
|
-
path: "/assets/imports",
|
|
121
|
-
pathParams: [],
|
|
122
|
-
queryParams: [],
|
|
123
|
-
body: true,
|
|
124
|
-
multipart: false,
|
|
125
|
-
binary: false,
|
|
126
|
-
anonymous: false
|
|
127
|
-
}),
|
|
128
|
-
attach: operation(request, {
|
|
129
|
-
method: "post",
|
|
130
|
-
path: "/assets/{assetID}/attachments",
|
|
131
|
-
pathParams: ["assetID"],
|
|
132
|
-
queryParams: [],
|
|
133
|
-
body: true,
|
|
134
|
-
multipart: false,
|
|
135
|
-
binary: false,
|
|
136
|
-
anonymous: false
|
|
137
|
-
}),
|
|
138
|
-
register: operation(request, {
|
|
139
|
-
method: "post",
|
|
140
|
-
path: "/assets/uploads",
|
|
141
|
-
pathParams: [],
|
|
142
|
-
queryParams: [],
|
|
143
|
-
body: true,
|
|
144
|
-
multipart: false,
|
|
145
|
-
binary: false,
|
|
146
|
-
anonymous: false
|
|
147
|
-
}),
|
|
148
|
-
upload: operation(request, {
|
|
149
|
-
method: "put",
|
|
150
|
-
path: "/assets/{assetID}/upload",
|
|
151
|
-
pathParams: ["assetID"],
|
|
152
|
-
queryParams: [],
|
|
153
|
-
body: true,
|
|
154
|
-
multipart: true,
|
|
155
|
-
binary: false,
|
|
156
|
-
anonymous: false
|
|
157
|
-
}),
|
|
158
|
-
get: operation(request, {
|
|
159
|
-
method: "get",
|
|
160
|
-
path: "/assets/{assetID}",
|
|
161
|
-
pathParams: ["assetID"],
|
|
162
|
-
queryParams: ["entryID"],
|
|
163
|
-
body: false,
|
|
164
|
-
multipart: false,
|
|
165
|
-
binary: false,
|
|
166
|
-
anonymous: false
|
|
167
|
-
})
|
|
168
|
-
},
|
|
169
|
-
auth: { getIdentity: operation(request, {
|
|
170
|
-
method: "get",
|
|
171
|
-
path: "/identity",
|
|
172
|
-
pathParams: [],
|
|
173
|
-
queryParams: [],
|
|
174
|
-
body: false,
|
|
175
|
-
multipart: false,
|
|
176
|
-
binary: false,
|
|
177
|
-
anonymous: false
|
|
178
|
-
}) },
|
|
179
|
-
instance: { get: operation(request, {
|
|
180
|
-
method: "get",
|
|
181
|
-
path: "/instance",
|
|
182
|
-
pathParams: [],
|
|
183
|
-
queryParams: [],
|
|
184
|
-
body: false,
|
|
185
|
-
multipart: false,
|
|
186
|
-
binary: false,
|
|
187
|
-
anonymous: false
|
|
188
|
-
}) },
|
|
189
|
-
entries: {
|
|
190
|
-
create: operation(request, {
|
|
191
|
-
method: "post",
|
|
192
|
-
path: "/entries",
|
|
193
|
-
pathParams: [],
|
|
194
|
-
queryParams: [],
|
|
195
|
-
body: true,
|
|
196
|
-
multipart: false,
|
|
197
|
-
binary: false,
|
|
198
|
-
anonymous: false
|
|
199
|
-
}),
|
|
200
|
-
bulkDelete: operation(request, {
|
|
201
|
-
method: "post",
|
|
202
|
-
path: "/entries/bulk/delete",
|
|
203
|
-
pathParams: [],
|
|
204
|
-
queryParams: [],
|
|
205
|
-
body: true,
|
|
206
|
-
multipart: false,
|
|
207
|
-
binary: false,
|
|
208
|
-
anonymous: false
|
|
209
|
-
}),
|
|
210
|
-
delete: operation(request, {
|
|
211
|
-
method: "delete",
|
|
212
|
-
path: "/entries/{id}",
|
|
213
|
-
pathParams: ["id"],
|
|
214
|
-
queryParams: [],
|
|
215
|
-
body: false,
|
|
216
|
-
multipart: false,
|
|
217
|
-
binary: false,
|
|
218
|
-
anonymous: false
|
|
219
|
-
}),
|
|
220
|
-
update: operation(request, {
|
|
221
|
-
method: "put",
|
|
222
|
-
path: "/entries/{id}",
|
|
223
|
-
pathParams: ["id"],
|
|
224
|
-
queryParams: [],
|
|
225
|
-
body: true,
|
|
226
|
-
multipart: false,
|
|
227
|
-
binary: false,
|
|
228
|
-
anonymous: false
|
|
229
|
-
}),
|
|
230
|
-
get: operation(request, {
|
|
231
|
-
method: "get",
|
|
232
|
-
path: "/entries/get",
|
|
233
|
-
pathParams: [],
|
|
234
|
-
queryParams: [
|
|
235
|
-
"id",
|
|
236
|
-
"path",
|
|
237
|
-
"slugPath",
|
|
238
|
-
"expectedSchemaHash"
|
|
239
|
-
],
|
|
240
|
-
body: false,
|
|
241
|
-
multipart: false,
|
|
242
|
-
binary: false,
|
|
243
|
-
anonymous: false
|
|
244
|
-
}),
|
|
245
|
-
list: operation(request, {
|
|
246
|
-
method: "get",
|
|
247
|
-
path: "/entries/list",
|
|
248
|
-
pathParams: [],
|
|
249
|
-
queryParams: [
|
|
250
|
-
"collectionID",
|
|
251
|
-
"collectionPath",
|
|
252
|
-
"collectionSlugPath",
|
|
253
|
-
"cursor",
|
|
254
|
-
"limit"
|
|
255
|
-
],
|
|
256
|
-
body: false,
|
|
257
|
-
multipart: false,
|
|
258
|
-
binary: false,
|
|
259
|
-
anonymous: false
|
|
260
|
-
})
|
|
261
|
-
},
|
|
262
|
-
collections: {
|
|
263
|
-
create: operation(request, {
|
|
264
|
-
method: "post",
|
|
265
|
-
path: "/collections",
|
|
266
|
-
pathParams: [],
|
|
267
|
-
queryParams: [],
|
|
268
|
-
body: true,
|
|
269
|
-
multipart: false,
|
|
270
|
-
binary: false,
|
|
271
|
-
anonymous: false
|
|
272
|
-
}),
|
|
273
|
-
bulkDelete: operation(request, {
|
|
274
|
-
method: "post",
|
|
275
|
-
path: "/collections/bulk/delete",
|
|
276
|
-
pathParams: [],
|
|
277
|
-
queryParams: [],
|
|
278
|
-
body: true,
|
|
279
|
-
multipart: false,
|
|
280
|
-
binary: false,
|
|
281
|
-
anonymous: false
|
|
282
|
-
}),
|
|
283
|
-
delete: operation(request, {
|
|
284
|
-
method: "delete",
|
|
285
|
-
path: "/collections/{id}",
|
|
286
|
-
pathParams: ["id"],
|
|
287
|
-
queryParams: [],
|
|
288
|
-
body: false,
|
|
289
|
-
multipart: false,
|
|
290
|
-
binary: false,
|
|
291
|
-
anonymous: false
|
|
292
|
-
}),
|
|
293
|
-
update: operation(request, {
|
|
294
|
-
method: "put",
|
|
295
|
-
path: "/collections/{id}",
|
|
296
|
-
pathParams: ["id"],
|
|
297
|
-
queryParams: [],
|
|
298
|
-
body: true,
|
|
299
|
-
multipart: false,
|
|
300
|
-
binary: false,
|
|
301
|
-
anonymous: false
|
|
302
|
-
}),
|
|
303
|
-
list: operation(request, {
|
|
304
|
-
method: "get",
|
|
305
|
-
path: "/collections/list",
|
|
306
|
-
pathParams: [],
|
|
307
|
-
queryParams: [
|
|
308
|
-
"collectionID",
|
|
309
|
-
"collectionPath",
|
|
310
|
-
"collectionSlugPath",
|
|
311
|
-
"cursor",
|
|
312
|
-
"limit"
|
|
313
|
-
],
|
|
314
|
-
body: false,
|
|
315
|
-
multipart: false,
|
|
316
|
-
binary: false,
|
|
317
|
-
anonymous: false
|
|
318
|
-
})
|
|
319
|
-
},
|
|
320
|
-
content: {
|
|
321
|
-
listCollections: operation(request, {
|
|
322
|
-
method: "get",
|
|
323
|
-
path: "/content/collections",
|
|
324
|
-
pathParams: [],
|
|
325
|
-
queryParams: [
|
|
326
|
-
"cursor",
|
|
327
|
-
"limit",
|
|
328
|
-
"collectionID",
|
|
329
|
-
"collectionPath",
|
|
330
|
-
"collectionSlugPath",
|
|
331
|
-
"channel",
|
|
332
|
-
"snapshotID"
|
|
333
|
-
],
|
|
334
|
-
body: false,
|
|
335
|
-
multipart: false,
|
|
336
|
-
binary: false,
|
|
337
|
-
anonymous: false
|
|
338
|
-
}),
|
|
339
|
-
listEntries: operation(request, {
|
|
340
|
-
method: "get",
|
|
341
|
-
path: "/content/entries",
|
|
342
|
-
pathParams: [],
|
|
343
|
-
queryParams: [
|
|
344
|
-
"cursor",
|
|
345
|
-
"limit",
|
|
346
|
-
"collectionID",
|
|
347
|
-
"collectionPath",
|
|
348
|
-
"collectionSlugPath",
|
|
349
|
-
"channel",
|
|
350
|
-
"snapshotID",
|
|
351
|
-
"descendants",
|
|
352
|
-
"includeContent",
|
|
353
|
-
"filters"
|
|
354
|
-
],
|
|
355
|
-
body: false,
|
|
356
|
-
multipart: false,
|
|
357
|
-
binary: false,
|
|
358
|
-
anonymous: false
|
|
359
|
-
}),
|
|
360
|
-
getSchema: operation(request, {
|
|
361
|
-
method: "get",
|
|
362
|
-
path: "/content/entries/schema",
|
|
363
|
-
pathParams: [],
|
|
364
|
-
queryParams: [
|
|
365
|
-
"entryID",
|
|
366
|
-
"path",
|
|
367
|
-
"slugPath",
|
|
368
|
-
"channel",
|
|
369
|
-
"snapshotID"
|
|
370
|
-
],
|
|
371
|
-
body: false,
|
|
372
|
-
multipart: false,
|
|
373
|
-
binary: false,
|
|
374
|
-
anonymous: false
|
|
375
|
-
}),
|
|
376
|
-
getAsset: operation(request, {
|
|
377
|
-
method: "get",
|
|
378
|
-
path: "/content/assets/{workspaceID}/{snapshotID}/{entryID}/{assetID}/{variant}",
|
|
379
|
-
pathParams: [
|
|
380
|
-
"workspaceID",
|
|
381
|
-
"snapshotID",
|
|
382
|
-
"entryID",
|
|
383
|
-
"assetID",
|
|
384
|
-
"variant"
|
|
385
|
-
],
|
|
386
|
-
queryParams: [],
|
|
387
|
-
body: false,
|
|
388
|
-
multipart: false,
|
|
389
|
-
binary: true,
|
|
390
|
-
anonymous: true
|
|
391
|
-
}),
|
|
392
|
-
get: operation(request, {
|
|
393
|
-
method: "get",
|
|
394
|
-
path: "/content/entries/get",
|
|
395
|
-
pathParams: [],
|
|
396
|
-
queryParams: [
|
|
397
|
-
"entryID",
|
|
398
|
-
"path",
|
|
399
|
-
"slugPath",
|
|
400
|
-
"expectedSchemaHash",
|
|
401
|
-
"channel",
|
|
402
|
-
"snapshotID"
|
|
403
|
-
],
|
|
404
|
-
body: false,
|
|
405
|
-
multipart: false,
|
|
406
|
-
binary: false,
|
|
407
|
-
anonymous: false
|
|
408
|
-
}),
|
|
409
|
-
getTree: operation(request, {
|
|
410
|
-
method: "get",
|
|
411
|
-
path: "/content/tree",
|
|
412
|
-
pathParams: [],
|
|
413
|
-
queryParams: [
|
|
414
|
-
"collectionID",
|
|
415
|
-
"collectionPath",
|
|
416
|
-
"collectionSlugPath",
|
|
417
|
-
"channel",
|
|
418
|
-
"snapshotID"
|
|
419
|
-
],
|
|
420
|
-
body: false,
|
|
421
|
-
multipart: false,
|
|
422
|
-
binary: false,
|
|
423
|
-
anonymous: false
|
|
424
|
-
})
|
|
425
|
-
},
|
|
426
|
-
webhooks: {
|
|
427
|
-
list: operation(request, {
|
|
428
|
-
method: "get",
|
|
429
|
-
path: "/webhooks",
|
|
430
|
-
pathParams: [],
|
|
431
|
-
queryParams: ["cursor", "limit"],
|
|
432
|
-
body: false,
|
|
433
|
-
multipart: false,
|
|
434
|
-
binary: false,
|
|
435
|
-
anonymous: false
|
|
436
|
-
}),
|
|
437
|
-
create: operation(request, {
|
|
438
|
-
method: "post",
|
|
439
|
-
path: "/webhooks",
|
|
440
|
-
pathParams: [],
|
|
441
|
-
queryParams: [],
|
|
442
|
-
body: true,
|
|
443
|
-
multipart: false,
|
|
444
|
-
binary: false,
|
|
445
|
-
anonymous: false
|
|
446
|
-
}),
|
|
447
|
-
get: operation(request, {
|
|
448
|
-
method: "get",
|
|
449
|
-
path: "/webhooks/{id}",
|
|
450
|
-
pathParams: ["id"],
|
|
451
|
-
queryParams: [],
|
|
452
|
-
body: false,
|
|
453
|
-
multipart: false,
|
|
454
|
-
binary: false,
|
|
455
|
-
anonymous: false
|
|
456
|
-
}),
|
|
457
|
-
update: operation(request, {
|
|
458
|
-
method: "put",
|
|
459
|
-
path: "/webhooks/{id}",
|
|
460
|
-
pathParams: ["id"],
|
|
461
|
-
queryParams: [],
|
|
462
|
-
body: true,
|
|
463
|
-
multipart: false,
|
|
464
|
-
binary: false,
|
|
465
|
-
anonymous: false
|
|
466
|
-
}),
|
|
467
|
-
delete: operation(request, {
|
|
468
|
-
method: "delete",
|
|
469
|
-
path: "/webhooks/{id}",
|
|
470
|
-
pathParams: ["id"],
|
|
471
|
-
queryParams: [],
|
|
472
|
-
body: true,
|
|
473
|
-
multipart: false,
|
|
474
|
-
binary: false,
|
|
475
|
-
anonymous: false
|
|
476
|
-
}),
|
|
477
|
-
bulkSetEnabled: operation(request, {
|
|
478
|
-
method: "post",
|
|
479
|
-
path: "/webhooks/bulk/set-enabled",
|
|
480
|
-
pathParams: [],
|
|
481
|
-
queryParams: [],
|
|
482
|
-
body: true,
|
|
483
|
-
multipart: false,
|
|
484
|
-
binary: false,
|
|
485
|
-
anonymous: false
|
|
486
|
-
}),
|
|
487
|
-
bulkDelete: operation(request, {
|
|
488
|
-
method: "post",
|
|
489
|
-
path: "/webhooks/bulk/delete",
|
|
490
|
-
pathParams: [],
|
|
491
|
-
queryParams: [],
|
|
492
|
-
body: true,
|
|
493
|
-
multipart: false,
|
|
494
|
-
binary: false,
|
|
495
|
-
anonymous: false
|
|
496
|
-
}),
|
|
497
|
-
rotateSecret: operation(request, {
|
|
498
|
-
method: "post",
|
|
499
|
-
path: "/webhooks/{id}/rotate-secret",
|
|
500
|
-
pathParams: ["id"],
|
|
501
|
-
queryParams: [],
|
|
502
|
-
body: true,
|
|
503
|
-
multipart: false,
|
|
504
|
-
binary: false,
|
|
505
|
-
anonymous: false
|
|
506
|
-
}),
|
|
507
|
-
sendTest: operation(request, {
|
|
508
|
-
method: "post",
|
|
509
|
-
path: "/webhooks/{id}/test",
|
|
510
|
-
pathParams: ["id"],
|
|
511
|
-
queryParams: [],
|
|
512
|
-
body: true,
|
|
513
|
-
multipart: false,
|
|
514
|
-
binary: false,
|
|
515
|
-
anonymous: false
|
|
516
|
-
}),
|
|
517
|
-
listDeliveries: operation(request, {
|
|
518
|
-
method: "get",
|
|
519
|
-
path: "/webhooks/{id}/deliveries",
|
|
520
|
-
pathParams: ["id"],
|
|
521
|
-
queryParams: [
|
|
522
|
-
"cursor",
|
|
523
|
-
"limit",
|
|
524
|
-
"type",
|
|
525
|
-
"state",
|
|
526
|
-
"createdAfter",
|
|
527
|
-
"createdBefore"
|
|
528
|
-
],
|
|
529
|
-
body: false,
|
|
530
|
-
multipart: false,
|
|
531
|
-
binary: false,
|
|
532
|
-
anonymous: false
|
|
533
|
-
}),
|
|
534
|
-
getDelivery: operation(request, {
|
|
535
|
-
method: "get",
|
|
536
|
-
path: "/webhooks/{id}/deliveries/{deliveryID}",
|
|
537
|
-
pathParams: ["id", "deliveryID"],
|
|
538
|
-
queryParams: [],
|
|
539
|
-
body: false,
|
|
540
|
-
multipart: false,
|
|
541
|
-
binary: false,
|
|
542
|
-
anonymous: false
|
|
543
|
-
}),
|
|
544
|
-
listRuns: operation(request, {
|
|
545
|
-
method: "get",
|
|
546
|
-
path: "/webhooks/{id}/deliveries/{deliveryID}/runs",
|
|
547
|
-
pathParams: ["id", "deliveryID"],
|
|
548
|
-
queryParams: ["cursor", "limit"],
|
|
549
|
-
body: false,
|
|
550
|
-
multipart: false,
|
|
551
|
-
binary: false,
|
|
552
|
-
anonymous: false
|
|
553
|
-
}),
|
|
554
|
-
listAttempts: operation(request, {
|
|
555
|
-
method: "get",
|
|
556
|
-
path: "/webhooks/{id}/deliveries/{deliveryID}/runs/{runID}/attempts",
|
|
557
|
-
pathParams: [
|
|
558
|
-
"id",
|
|
559
|
-
"deliveryID",
|
|
560
|
-
"runID"
|
|
561
|
-
],
|
|
562
|
-
queryParams: ["cursor", "limit"],
|
|
563
|
-
body: false,
|
|
564
|
-
multipart: false,
|
|
565
|
-
binary: false,
|
|
566
|
-
anonymous: false
|
|
567
|
-
}),
|
|
568
|
-
redeliver: operation(request, {
|
|
569
|
-
method: "post",
|
|
570
|
-
path: "/webhooks/{id}/deliveries/{deliveryID}/redeliver",
|
|
571
|
-
pathParams: ["id", "deliveryID"],
|
|
572
|
-
queryParams: [],
|
|
573
|
-
body: true,
|
|
574
|
-
multipart: false,
|
|
575
|
-
binary: false,
|
|
576
|
-
anonymous: false
|
|
577
|
-
}),
|
|
578
|
-
bulkRedeliver: operation(request, {
|
|
579
|
-
method: "post",
|
|
580
|
-
path: "/webhooks/{id}/deliveries/bulk/redeliver",
|
|
581
|
-
pathParams: ["id"],
|
|
582
|
-
queryParams: [],
|
|
583
|
-
body: true,
|
|
584
|
-
multipart: false,
|
|
585
|
-
binary: false,
|
|
586
|
-
anonymous: false
|
|
587
|
-
})
|
|
588
|
-
},
|
|
589
|
-
roles: {
|
|
590
|
-
list: operation(request, {
|
|
591
|
-
method: "get",
|
|
592
|
-
path: "/roles",
|
|
593
|
-
pathParams: [],
|
|
594
|
-
queryParams: [],
|
|
595
|
-
body: false,
|
|
596
|
-
multipart: false,
|
|
597
|
-
binary: false,
|
|
598
|
-
anonymous: false
|
|
599
|
-
}),
|
|
600
|
-
create: operation(request, {
|
|
601
|
-
method: "post",
|
|
602
|
-
path: "/roles",
|
|
603
|
-
pathParams: [],
|
|
604
|
-
queryParams: [],
|
|
605
|
-
body: true,
|
|
606
|
-
multipart: false,
|
|
607
|
-
binary: false,
|
|
608
|
-
anonymous: false
|
|
609
|
-
}),
|
|
610
|
-
update: operation(request, {
|
|
611
|
-
method: "put",
|
|
612
|
-
path: "/roles/{id}",
|
|
613
|
-
pathParams: ["id"],
|
|
614
|
-
queryParams: [],
|
|
615
|
-
body: true,
|
|
616
|
-
multipart: false,
|
|
617
|
-
binary: false,
|
|
618
|
-
anonymous: false
|
|
619
|
-
}),
|
|
620
|
-
delete: operation(request, {
|
|
621
|
-
method: "delete",
|
|
622
|
-
path: "/roles/{id}",
|
|
623
|
-
pathParams: ["id"],
|
|
624
|
-
queryParams: [],
|
|
625
|
-
body: false,
|
|
626
|
-
multipart: false,
|
|
627
|
-
binary: false,
|
|
628
|
-
anonymous: false
|
|
629
|
-
})
|
|
630
|
-
},
|
|
631
|
-
search: {
|
|
632
|
-
current: operation(request, {
|
|
633
|
-
method: "post",
|
|
634
|
-
path: "/search/current",
|
|
635
|
-
pathParams: [],
|
|
636
|
-
queryParams: [],
|
|
637
|
-
body: true,
|
|
638
|
-
multipart: false,
|
|
639
|
-
binary: false,
|
|
640
|
-
anonymous: false
|
|
641
|
-
}),
|
|
642
|
-
published: operation(request, {
|
|
643
|
-
method: "post",
|
|
644
|
-
path: "/search/published",
|
|
645
|
-
pathParams: [],
|
|
646
|
-
queryParams: [],
|
|
647
|
-
body: true,
|
|
648
|
-
multipart: false,
|
|
649
|
-
binary: false,
|
|
650
|
-
anonymous: false
|
|
651
|
-
}),
|
|
652
|
-
askCurrent: operation(request, {
|
|
653
|
-
method: "post",
|
|
654
|
-
path: "/search/current/ask",
|
|
655
|
-
pathParams: [],
|
|
656
|
-
queryParams: [],
|
|
657
|
-
body: true,
|
|
658
|
-
multipart: false,
|
|
659
|
-
binary: false,
|
|
660
|
-
anonymous: false
|
|
661
|
-
}),
|
|
662
|
-
askPublished: operation(request, {
|
|
663
|
-
method: "post",
|
|
664
|
-
path: "/search/published/ask",
|
|
665
|
-
pathParams: [],
|
|
666
|
-
queryParams: [],
|
|
667
|
-
body: true,
|
|
668
|
-
multipart: false,
|
|
669
|
-
binary: false,
|
|
670
|
-
anonymous: false
|
|
671
|
-
}),
|
|
672
|
-
askCurrentStream: operation(request, {
|
|
673
|
-
streaming: true,
|
|
674
|
-
method: "post",
|
|
675
|
-
path: "/search/current/ask/stream",
|
|
676
|
-
pathParams: [],
|
|
677
|
-
queryParams: [],
|
|
678
|
-
body: true,
|
|
679
|
-
multipart: false,
|
|
680
|
-
binary: false,
|
|
681
|
-
anonymous: false
|
|
682
|
-
}),
|
|
683
|
-
askPublishedStream: operation(request, {
|
|
684
|
-
streaming: true,
|
|
685
|
-
method: "post",
|
|
686
|
-
path: "/search/published/ask/stream",
|
|
687
|
-
pathParams: [],
|
|
688
|
-
queryParams: [],
|
|
689
|
-
body: true,
|
|
690
|
-
multipart: false,
|
|
691
|
-
binary: false,
|
|
692
|
-
anonymous: false
|
|
693
|
-
})
|
|
694
|
-
},
|
|
695
|
-
schemas: {
|
|
696
|
-
create: operation(request, {
|
|
697
|
-
method: "post",
|
|
698
|
-
path: "/collections/{collectionID}/schema",
|
|
699
|
-
pathParams: ["collectionID"],
|
|
700
|
-
queryParams: [],
|
|
701
|
-
body: false,
|
|
702
|
-
multipart: false,
|
|
703
|
-
binary: false,
|
|
704
|
-
anonymous: false
|
|
705
|
-
}),
|
|
706
|
-
delete: operation(request, {
|
|
707
|
-
method: "delete",
|
|
708
|
-
path: "/schemas/{schemaID}",
|
|
709
|
-
pathParams: ["schemaID"],
|
|
710
|
-
queryParams: [],
|
|
711
|
-
body: true,
|
|
712
|
-
multipart: false,
|
|
713
|
-
binary: false,
|
|
714
|
-
anonymous: false
|
|
715
|
-
}),
|
|
716
|
-
getRevision: operation(request, {
|
|
717
|
-
method: "get",
|
|
718
|
-
path: "/schema-revisions/{revisionID}",
|
|
719
|
-
pathParams: ["revisionID"],
|
|
720
|
-
queryParams: [],
|
|
721
|
-
body: false,
|
|
722
|
-
multipart: false,
|
|
723
|
-
binary: false,
|
|
724
|
-
anonymous: false
|
|
725
|
-
}),
|
|
726
|
-
get: operation(request, {
|
|
727
|
-
method: "get",
|
|
728
|
-
path: "/schemas/collection",
|
|
729
|
-
pathParams: [],
|
|
730
|
-
queryParams: [
|
|
731
|
-
"collectionID",
|
|
732
|
-
"collectionPath",
|
|
733
|
-
"collectionSlugPath"
|
|
734
|
-
],
|
|
735
|
-
body: false,
|
|
736
|
-
multipart: false,
|
|
737
|
-
binary: false,
|
|
738
|
-
anonymous: false
|
|
739
|
-
}),
|
|
740
|
-
apply: operation(request, {
|
|
741
|
-
method: "post",
|
|
742
|
-
path: "/schemas/{schemaID}/apply",
|
|
743
|
-
pathParams: ["schemaID"],
|
|
744
|
-
queryParams: [],
|
|
745
|
-
body: true,
|
|
746
|
-
multipart: false,
|
|
747
|
-
binary: false,
|
|
748
|
-
anonymous: false
|
|
749
|
-
})
|
|
750
|
-
},
|
|
751
|
-
schemaMigrations: {
|
|
752
|
-
listContentLossEntries: operation(request, {
|
|
753
|
-
method: "get",
|
|
754
|
-
path: "/schema-migrations/{id}/content-loss-entries",
|
|
755
|
-
pathParams: ["id"],
|
|
756
|
-
queryParams: ["cursor", "limit"],
|
|
757
|
-
body: false,
|
|
758
|
-
multipart: false,
|
|
759
|
-
binary: false,
|
|
760
|
-
anonymous: false
|
|
761
|
-
}),
|
|
762
|
-
getActive: operation(request, {
|
|
763
|
-
method: "get",
|
|
764
|
-
path: "/collections/{collectionID}/schema-migration",
|
|
765
|
-
pathParams: ["collectionID"],
|
|
766
|
-
queryParams: [],
|
|
767
|
-
body: false,
|
|
768
|
-
multipart: false,
|
|
769
|
-
binary: false,
|
|
770
|
-
anonymous: false
|
|
771
|
-
}),
|
|
772
|
-
get: operation(request, {
|
|
773
|
-
method: "get",
|
|
774
|
-
path: "/schema-migrations/{id}",
|
|
775
|
-
pathParams: ["id"],
|
|
776
|
-
queryParams: [],
|
|
777
|
-
body: false,
|
|
778
|
-
multipart: false,
|
|
779
|
-
binary: false,
|
|
780
|
-
anonymous: false
|
|
781
|
-
})
|
|
782
|
-
},
|
|
783
|
-
schemaVersions: {
|
|
784
|
-
list: operation(request, {
|
|
785
|
-
method: "get",
|
|
786
|
-
path: "/schemas/{schemaID}/versions",
|
|
787
|
-
pathParams: ["schemaID"],
|
|
788
|
-
queryParams: ["cursor", "limit"],
|
|
789
|
-
body: false,
|
|
790
|
-
multipart: false,
|
|
791
|
-
binary: false,
|
|
792
|
-
anonymous: false
|
|
793
|
-
}),
|
|
794
|
-
get: operation(request, {
|
|
795
|
-
method: "get",
|
|
796
|
-
path: "/schema-versions/{id}",
|
|
797
|
-
pathParams: ["id"],
|
|
798
|
-
queryParams: [],
|
|
799
|
-
body: false,
|
|
800
|
-
multipart: false,
|
|
801
|
-
binary: false,
|
|
802
|
-
anonymous: false
|
|
803
|
-
}),
|
|
804
|
-
update: operation(request, {
|
|
805
|
-
method: "patch",
|
|
806
|
-
path: "/schema-versions/{id}",
|
|
807
|
-
pathParams: ["id"],
|
|
808
|
-
queryParams: [],
|
|
809
|
-
body: true,
|
|
810
|
-
multipart: false,
|
|
811
|
-
binary: false,
|
|
812
|
-
anonymous: false
|
|
813
|
-
}),
|
|
814
|
-
revert: operation(request, {
|
|
815
|
-
method: "post",
|
|
816
|
-
path: "/schema-versions/{id}/revert",
|
|
817
|
-
pathParams: ["id"],
|
|
818
|
-
queryParams: [],
|
|
819
|
-
body: true,
|
|
820
|
-
multipart: false,
|
|
821
|
-
binary: false,
|
|
822
|
-
anonymous: false
|
|
823
|
-
})
|
|
824
|
-
},
|
|
825
|
-
memberships: {
|
|
826
|
-
list: operation(request, {
|
|
827
|
-
method: "get",
|
|
828
|
-
path: "/memberships",
|
|
829
|
-
pathParams: [],
|
|
830
|
-
queryParams: ["cursor", "limit"],
|
|
831
|
-
body: false,
|
|
832
|
-
multipart: false,
|
|
833
|
-
binary: false,
|
|
834
|
-
anonymous: false
|
|
835
|
-
}),
|
|
836
|
-
invite: operation(request, {
|
|
837
|
-
method: "post",
|
|
838
|
-
path: "/memberships",
|
|
839
|
-
pathParams: [],
|
|
840
|
-
queryParams: [],
|
|
841
|
-
body: true,
|
|
842
|
-
multipart: false,
|
|
843
|
-
binary: false,
|
|
844
|
-
anonymous: false
|
|
845
|
-
}),
|
|
846
|
-
update: operation(request, {
|
|
847
|
-
method: "patch",
|
|
848
|
-
path: "/memberships/{id}",
|
|
849
|
-
pathParams: ["id"],
|
|
850
|
-
queryParams: [],
|
|
851
|
-
body: true,
|
|
852
|
-
multipart: false,
|
|
853
|
-
binary: false,
|
|
854
|
-
anonymous: false
|
|
855
|
-
}),
|
|
856
|
-
remove: operation(request, {
|
|
857
|
-
method: "delete",
|
|
858
|
-
path: "/memberships/{id}",
|
|
859
|
-
pathParams: ["id"],
|
|
860
|
-
queryParams: [],
|
|
861
|
-
body: false,
|
|
862
|
-
multipart: false,
|
|
863
|
-
binary: false,
|
|
864
|
-
anonymous: false
|
|
865
|
-
}),
|
|
866
|
-
listInvites: operation(request, {
|
|
867
|
-
method: "get",
|
|
868
|
-
path: "/memberships/invites",
|
|
869
|
-
pathParams: [],
|
|
870
|
-
queryParams: ["cursor", "limit"],
|
|
871
|
-
body: false,
|
|
872
|
-
multipart: false,
|
|
873
|
-
binary: false,
|
|
874
|
-
anonymous: false
|
|
875
|
-
}),
|
|
876
|
-
resendInvite: operation(request, {
|
|
877
|
-
method: "post",
|
|
878
|
-
path: "/memberships/invites/{id}/resend",
|
|
879
|
-
pathParams: ["id"],
|
|
880
|
-
queryParams: [],
|
|
881
|
-
body: false,
|
|
882
|
-
multipart: false,
|
|
883
|
-
binary: false,
|
|
884
|
-
anonymous: false
|
|
885
|
-
}),
|
|
886
|
-
revokeInvite: operation(request, {
|
|
887
|
-
method: "delete",
|
|
888
|
-
path: "/memberships/invites/{id}",
|
|
889
|
-
pathParams: ["id"],
|
|
890
|
-
queryParams: [],
|
|
891
|
-
body: false,
|
|
892
|
-
multipart: false,
|
|
893
|
-
binary: false,
|
|
894
|
-
anonymous: false
|
|
895
|
-
})
|
|
896
|
-
},
|
|
897
|
-
publishing: {
|
|
898
|
-
setCollection: operation(request, {
|
|
899
|
-
method: "put",
|
|
900
|
-
path: "/publishing/collections/{collectionID}",
|
|
901
|
-
pathParams: ["collectionID"],
|
|
902
|
-
queryParams: [],
|
|
903
|
-
body: true,
|
|
904
|
-
multipart: false,
|
|
905
|
-
binary: false,
|
|
906
|
-
anonymous: false
|
|
907
|
-
}),
|
|
908
|
-
publishCollection: operation(request, {
|
|
909
|
-
method: "post",
|
|
910
|
-
path: "/publishing/collections/{collectionID}",
|
|
911
|
-
pathParams: ["collectionID"],
|
|
912
|
-
queryParams: [],
|
|
913
|
-
body: true,
|
|
914
|
-
multipart: false,
|
|
915
|
-
binary: false,
|
|
916
|
-
anonymous: false
|
|
917
|
-
}),
|
|
918
|
-
unpublishCollection: operation(request, {
|
|
919
|
-
method: "delete",
|
|
920
|
-
path: "/publishing/collections/{collectionID}",
|
|
921
|
-
pathParams: ["collectionID"],
|
|
922
|
-
queryParams: [],
|
|
923
|
-
body: true,
|
|
924
|
-
multipart: false,
|
|
925
|
-
binary: false,
|
|
926
|
-
anonymous: false
|
|
927
|
-
}),
|
|
928
|
-
bulkSetCollections: operation(request, {
|
|
929
|
-
method: "post",
|
|
930
|
-
path: "/publishing/collections/bulk/set",
|
|
931
|
-
pathParams: [],
|
|
932
|
-
queryParams: [],
|
|
933
|
-
body: true,
|
|
934
|
-
multipart: false,
|
|
935
|
-
binary: false,
|
|
936
|
-
anonymous: false
|
|
937
|
-
}),
|
|
938
|
-
bulkPublishCollections: operation(request, {
|
|
939
|
-
method: "post",
|
|
940
|
-
path: "/publishing/collections/bulk/publish",
|
|
941
|
-
pathParams: [],
|
|
942
|
-
queryParams: [],
|
|
943
|
-
body: true,
|
|
944
|
-
multipart: false,
|
|
945
|
-
binary: false,
|
|
946
|
-
anonymous: false
|
|
947
|
-
}),
|
|
948
|
-
bulkUnpublishCollections: operation(request, {
|
|
949
|
-
method: "post",
|
|
950
|
-
path: "/publishing/collections/bulk/unpublish",
|
|
951
|
-
pathParams: [],
|
|
952
|
-
queryParams: [],
|
|
953
|
-
body: true,
|
|
954
|
-
multipart: false,
|
|
955
|
-
binary: false,
|
|
956
|
-
anonymous: false
|
|
957
|
-
}),
|
|
958
|
-
publishEntry: operation(request, {
|
|
959
|
-
method: "post",
|
|
960
|
-
path: "/publishing/entries/{entryID}",
|
|
961
|
-
pathParams: ["entryID"],
|
|
962
|
-
queryParams: [],
|
|
963
|
-
body: true,
|
|
964
|
-
multipart: false,
|
|
965
|
-
binary: false,
|
|
966
|
-
anonymous: false
|
|
967
|
-
}),
|
|
968
|
-
unpublishEntry: operation(request, {
|
|
969
|
-
method: "delete",
|
|
970
|
-
path: "/publishing/entries/{entryID}",
|
|
971
|
-
pathParams: ["entryID"],
|
|
972
|
-
queryParams: [],
|
|
973
|
-
body: true,
|
|
974
|
-
multipart: false,
|
|
975
|
-
binary: false,
|
|
976
|
-
anonymous: false
|
|
977
|
-
}),
|
|
978
|
-
bulkPublishEntries: operation(request, {
|
|
979
|
-
method: "post",
|
|
980
|
-
path: "/publishing/entries/bulk/publish",
|
|
981
|
-
pathParams: [],
|
|
982
|
-
queryParams: [],
|
|
983
|
-
body: true,
|
|
984
|
-
multipart: false,
|
|
985
|
-
binary: false,
|
|
986
|
-
anonymous: false
|
|
987
|
-
}),
|
|
988
|
-
bulkUnpublishEntries: operation(request, {
|
|
989
|
-
method: "post",
|
|
990
|
-
path: "/publishing/entries/bulk/unpublish",
|
|
991
|
-
pathParams: [],
|
|
992
|
-
queryParams: [],
|
|
993
|
-
body: true,
|
|
994
|
-
multipart: false,
|
|
995
|
-
binary: false,
|
|
996
|
-
anonymous: false
|
|
997
|
-
}),
|
|
998
|
-
revertChanges: operation(request, {
|
|
999
|
-
method: "post",
|
|
1000
|
-
path: "/publishing/changes/revert",
|
|
1001
|
-
pathParams: [],
|
|
1002
|
-
queryParams: [],
|
|
1003
|
-
body: true,
|
|
1004
|
-
multipart: false,
|
|
1005
|
-
binary: false,
|
|
1006
|
-
anonymous: false
|
|
1007
|
-
}),
|
|
1008
|
-
getEntryVersion: operation(request, {
|
|
1009
|
-
method: "get",
|
|
1010
|
-
path: "/publishing/entries/{entryID}/version",
|
|
1011
|
-
pathParams: ["entryID"],
|
|
1012
|
-
queryParams: [
|
|
1013
|
-
"channel",
|
|
1014
|
-
"expectedSchemaHash",
|
|
1015
|
-
"snapshotID"
|
|
1016
|
-
],
|
|
1017
|
-
body: false,
|
|
1018
|
-
multipart: false,
|
|
1019
|
-
binary: false,
|
|
1020
|
-
anonymous: false
|
|
1021
|
-
}),
|
|
1022
|
-
listEntryPublications: operation(request, {
|
|
1023
|
-
method: "get",
|
|
1024
|
-
path: "/publishing/entries/{entryID}/publications",
|
|
1025
|
-
pathParams: ["entryID"],
|
|
1026
|
-
queryParams: [],
|
|
1027
|
-
body: false,
|
|
1028
|
-
multipart: false,
|
|
1029
|
-
binary: false,
|
|
1030
|
-
anonymous: false
|
|
1031
|
-
}),
|
|
1032
|
-
listChannels: operation(request, {
|
|
1033
|
-
method: "get",
|
|
1034
|
-
path: "/publishing/channels",
|
|
1035
|
-
pathParams: [],
|
|
1036
|
-
queryParams: ["includeAssignmentCount"],
|
|
1037
|
-
body: false,
|
|
1038
|
-
multipart: false,
|
|
1039
|
-
binary: false,
|
|
1040
|
-
anonymous: false
|
|
1041
|
-
}),
|
|
1042
|
-
createChannel: operation(request, {
|
|
1043
|
-
method: "post",
|
|
1044
|
-
path: "/publishing/channels",
|
|
1045
|
-
pathParams: [],
|
|
1046
|
-
queryParams: [],
|
|
1047
|
-
body: true,
|
|
1048
|
-
multipart: false,
|
|
1049
|
-
binary: false,
|
|
1050
|
-
anonymous: false
|
|
1051
|
-
}),
|
|
1052
|
-
getChannelContent: operation(request, {
|
|
1053
|
-
method: "get",
|
|
1054
|
-
path: "/publishing/channels/{channel}/content",
|
|
1055
|
-
pathParams: ["channel"],
|
|
1056
|
-
queryParams: ["collectionID"],
|
|
1057
|
-
body: false,
|
|
1058
|
-
multipart: false,
|
|
1059
|
-
binary: false,
|
|
1060
|
-
anonymous: false
|
|
1061
|
-
}),
|
|
1062
|
-
deleteChannel: operation(request, {
|
|
1063
|
-
method: "delete",
|
|
1064
|
-
path: "/publishing/channels/{code}",
|
|
1065
|
-
pathParams: ["code"],
|
|
1066
|
-
queryParams: [],
|
|
1067
|
-
body: true,
|
|
1068
|
-
multipart: false,
|
|
1069
|
-
binary: false,
|
|
1070
|
-
anonymous: false
|
|
1071
|
-
})
|
|
1072
|
-
},
|
|
1073
|
-
workspaces: { list: operation(request, {
|
|
1074
|
-
method: "get",
|
|
1075
|
-
path: "/workspaces",
|
|
1076
|
-
pathParams: [],
|
|
1077
|
-
queryParams: [],
|
|
1078
|
-
body: false,
|
|
1079
|
-
multipart: false,
|
|
1080
|
-
binary: false,
|
|
1081
|
-
anonymous: false
|
|
1082
|
-
}) },
|
|
1083
|
-
versions: {
|
|
1084
|
-
create: operation(request, {
|
|
1085
|
-
method: "post",
|
|
1086
|
-
path: "/entries/{entryID}/versions",
|
|
1087
|
-
pathParams: ["entryID"],
|
|
1088
|
-
queryParams: [],
|
|
1089
|
-
body: true,
|
|
1090
|
-
multipart: false,
|
|
1091
|
-
binary: false,
|
|
1092
|
-
anonymous: false
|
|
1093
|
-
}),
|
|
1094
|
-
list: operation(request, {
|
|
1095
|
-
method: "get",
|
|
1096
|
-
path: "/entries/{entryID}/versions",
|
|
1097
|
-
pathParams: ["entryID"],
|
|
1098
|
-
queryParams: ["cursor", "limit"],
|
|
1099
|
-
body: false,
|
|
1100
|
-
multipart: false,
|
|
1101
|
-
binary: false,
|
|
1102
|
-
anonymous: false
|
|
1103
|
-
}),
|
|
1104
|
-
get: operation(request, {
|
|
1105
|
-
method: "get",
|
|
1106
|
-
path: "/versions/{id}",
|
|
1107
|
-
pathParams: ["id"],
|
|
1108
|
-
queryParams: ["expectedSchemaHash"],
|
|
1109
|
-
body: false,
|
|
1110
|
-
multipart: false,
|
|
1111
|
-
binary: false,
|
|
1112
|
-
anonymous: false
|
|
1113
|
-
}),
|
|
1114
|
-
update: operation(request, {
|
|
1115
|
-
method: "patch",
|
|
1116
|
-
path: "/versions/{id}",
|
|
1117
|
-
pathParams: ["id"],
|
|
1118
|
-
queryParams: [],
|
|
1119
|
-
body: true,
|
|
1120
|
-
multipart: false,
|
|
1121
|
-
binary: false,
|
|
1122
|
-
anonymous: false
|
|
1123
|
-
}),
|
|
1124
|
-
revert: operation(request, {
|
|
1125
|
-
method: "post",
|
|
1126
|
-
path: "/versions/{id}/revert",
|
|
1127
|
-
pathParams: ["id"],
|
|
1128
|
-
queryParams: [],
|
|
1129
|
-
body: false,
|
|
1130
|
-
multipart: false,
|
|
1131
|
-
binary: false,
|
|
1132
|
-
anonymous: false
|
|
1133
|
-
})
|
|
1134
|
-
},
|
|
1135
|
-
typeMetadata: {
|
|
1136
|
-
getCurrent: operation(request, {
|
|
1137
|
-
method: "post",
|
|
1138
|
-
path: "/type-metadata/current",
|
|
1139
|
-
pathParams: [],
|
|
1140
|
-
queryParams: [],
|
|
1141
|
-
body: true,
|
|
1142
|
-
multipart: false,
|
|
1143
|
-
binary: false,
|
|
1144
|
-
anonymous: false
|
|
1145
|
-
}),
|
|
1146
|
-
getPublished: operation(request, {
|
|
1147
|
-
method: "post",
|
|
1148
|
-
path: "/type-metadata/published",
|
|
1149
|
-
pathParams: [],
|
|
1150
|
-
queryParams: [],
|
|
1151
|
-
body: true,
|
|
1152
|
-
multipart: false,
|
|
1153
|
-
binary: false,
|
|
1154
|
-
anonymous: false
|
|
1155
|
-
})
|
|
1156
|
-
}
|
|
1157
|
-
});
|
|
1158
|
-
//#endregion
|
|
1159
|
-
//#region src/retry.ts
|
|
1160
|
-
const wait = (delay, signal) => {
|
|
1161
|
-
signal.throwIfAborted();
|
|
1162
|
-
return new Promise((resolve, reject) => {
|
|
1163
|
-
const abort = () => {
|
|
1164
|
-
clearTimeout(timer);
|
|
1165
|
-
reject(signal.reason);
|
|
1166
|
-
};
|
|
1167
|
-
const timer = setTimeout(() => {
|
|
1168
|
-
signal.removeEventListener("abort", abort);
|
|
1169
|
-
resolve();
|
|
1170
|
-
}, delay);
|
|
1171
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
1172
|
-
});
|
|
1173
|
-
};
|
|
1174
|
-
const retryDelay = (attempt, response) => {
|
|
1175
|
-
const value = response?.headers.get("Retry-After");
|
|
1176
|
-
const seconds = value === null || value === void 0 ? NaN : Number(value);
|
|
1177
|
-
const date = value ? Date.parse(value) : NaN;
|
|
1178
|
-
if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
|
|
1179
|
-
if (Number.isFinite(date)) return Math.max(0, date - Date.now());
|
|
1180
|
-
return Math.min(1e3 * 2 ** attempt, 3e4) + Math.random() * 250;
|
|
1181
|
-
};
|
|
1182
|
-
const fetchWithRetries = async (fetcher, request, retries) => {
|
|
1183
|
-
const signal = request.signal;
|
|
1184
|
-
for (let attempt = 0;; attempt += 1) {
|
|
1185
|
-
let response;
|
|
1186
|
-
signal.throwIfAborted();
|
|
1187
|
-
try {
|
|
1188
|
-
response = await fetcher(request.clone());
|
|
1189
|
-
} catch (error) {
|
|
1190
|
-
if (signal.aborted || attempt >= retries || !(error instanceof TypeError)) throw error;
|
|
1191
|
-
await wait(retryDelay(attempt), signal);
|
|
1192
|
-
continue;
|
|
1193
|
-
}
|
|
1194
|
-
if (attempt >= retries || ![
|
|
1195
|
-
429,
|
|
1196
|
-
500,
|
|
1197
|
-
502,
|
|
1198
|
-
503,
|
|
1199
|
-
504
|
|
1200
|
-
].includes(response.status)) return response;
|
|
1201
|
-
const delay = retryDelay(attempt, response);
|
|
1202
|
-
await response.body?.cancel();
|
|
1203
|
-
await wait(delay, signal);
|
|
1204
|
-
}
|
|
1205
|
-
};
|
|
1206
|
-
//#endregion
|
|
1207
|
-
//#region src/client.ts
|
|
1208
|
-
/**
|
|
1209
|
-
* Create a typed API client for a hosted or self-hosted Andesine instance.
|
|
1210
|
-
*
|
|
1211
|
-
* Methods return response data by default. Use response: "full" for status and headers,
|
|
1212
|
-
* including conditional reads that can return 304. Creation does not make a request.
|
|
1213
|
-
* An optional Workspace type map narrows known content selectors at compile time only.
|
|
1214
|
-
* It does not choose credentials, a workspace, a channel, or a snapshot, or check response schemas.
|
|
1215
|
-
* @param config - Optional API root, credentials, transport, and request defaults.
|
|
1216
|
-
* Defaults to https://api.andesine.app and process.env.ANDESINE_API_KEY when available.
|
|
1217
|
-
* Runtimes without process.env use no default key. No environment files are loaded.
|
|
1218
|
-
* @returns API resources and helpers for published-content snapshots and pagination.
|
|
1219
|
-
* @throws TypeError if both credential options are set, or if baseURL is not HTTP(S) or includes credentials, a query, or a fragment.
|
|
1220
|
-
* Request failures throw AndesineAPIError; abort and timeout reasons are preserved.
|
|
1221
|
-
* @example
|
|
1222
|
-
* const client = createClient();
|
|
1223
|
-
* const page = await client.content.get({ path: "/Docs/Welcome" });
|
|
1224
|
-
*/
|
|
1225
|
-
const createClient = (config = {}) => {
|
|
1226
|
-
const baseURL = (config.baseURL ?? "https://api.andesine.app").replace(/\/+$/, "");
|
|
1227
|
-
const credential = config.accessToken ?? config.apiKey ?? globalThis.process?.env?.ANDESINE_API_KEY;
|
|
1228
|
-
const url = new URL(baseURL);
|
|
1229
|
-
const fetcher = config.fetch ?? globalThis.fetch;
|
|
1230
|
-
if (config.accessToken !== void 0 && config.apiKey !== void 0) throw new TypeError("Use either accessToken or apiKey, not both");
|
|
1231
|
-
if (!["http:", "https:"].includes(url.protocol) || url.search || url.hash || url.username || url.password) throw new TypeError("baseURL must be an HTTP(S) URL without credentials, query, or fragment");
|
|
1232
|
-
const request = async (definition, input, options = {}) => {
|
|
1233
|
-
const controller = new AbortController();
|
|
1234
|
-
const signal = options.signal ? AbortSignal.any([controller.signal, options.signal]) : controller.signal;
|
|
1235
|
-
const timeout = options.timeout ?? config.timeout ?? 3e4;
|
|
1236
|
-
const retries = options.retries ?? config.retries ?? 0;
|
|
1237
|
-
const headers = new Headers(config.headers);
|
|
1238
|
-
const path = Object.fromEntries(definition.pathParams.map((key) => [key, input[key]]));
|
|
1239
|
-
const query = Object.fromEntries(definition.queryParams.map((key) => [key, input[key]]));
|
|
1240
|
-
const body = Object.fromEntries(Object.entries(input).filter(([key]) => !definition.pathParams.includes(key) && !definition.queryParams.includes(key)));
|
|
1241
|
-
const client = createFetchClient({
|
|
1242
|
-
baseUrl: baseURL,
|
|
1243
|
-
querySerializer: serializeQuery
|
|
1244
|
-
});
|
|
1245
|
-
if (!Number.isFinite(timeout) || timeout < 0 || !Number.isInteger(retries) || retries < 0) throw new TypeError("timeout and retries must be nonnegative; retries must be an integer");
|
|
1246
|
-
if (query.channel !== void 0 && query.snapshotID !== void 0) throw new TypeError("Use either channel or snapshotID, not both");
|
|
1247
|
-
for (const key of definition.pathParams) if (input[key] === void 0 || input[key] === null) throw new TypeError(`Missing path parameter: ${key}`);
|
|
1248
|
-
new Headers(options.headers).forEach((value, key) => headers.set(key, value));
|
|
1249
|
-
if (definition.streaming && !headers.has("Accept")) headers.set("Accept", "text/event-stream");
|
|
1250
|
-
if (credential && !definition.anonymous) headers.set("Authorization", `Bearer ${credential}`);
|
|
1251
|
-
const timer = timeout > 0 ? setTimeout(() => controller.abort(new DOMException("Request timed out", "TimeoutError")), timeout) : void 0;
|
|
1252
|
-
let streamOwnsRequest = false;
|
|
1253
|
-
try {
|
|
1254
|
-
const result = await client.request(definition.method, definition.path, {
|
|
1255
|
-
params: {
|
|
1256
|
-
path,
|
|
1257
|
-
query
|
|
1258
|
-
},
|
|
1259
|
-
headers,
|
|
1260
|
-
signal,
|
|
1261
|
-
body: definition.body ? body : void 0,
|
|
1262
|
-
parseAs: "stream",
|
|
1263
|
-
bodySerializer: definition.multipart ? (value) => {
|
|
1264
|
-
const form = new FormData();
|
|
1265
|
-
for (const [key, item] of Object.entries(value)) if (item instanceof Blob) form.append(key, item);
|
|
1266
|
-
else if (item !== void 0) form.append(key, typeof item === "string" ? item : JSON.stringify(item));
|
|
1267
|
-
return form;
|
|
1268
|
-
} : void 0,
|
|
1269
|
-
fetch: (request) => fetchWithRetries(fetcher, request, definition.method === "get" ? retries : 0)
|
|
1270
|
-
});
|
|
1271
|
-
const response = result.response;
|
|
1272
|
-
if (response.status === 304) {
|
|
1273
|
-
if (options.response !== "full") throw new TypeError("Use response: 'full' for conditional requests that can return 304");
|
|
1274
|
-
return {
|
|
1275
|
-
status: 304,
|
|
1276
|
-
headers: response.headers,
|
|
1277
|
-
data: void 0,
|
|
1278
|
-
notModified: true
|
|
1279
|
-
};
|
|
1280
|
-
}
|
|
1281
|
-
if (!response.ok) throw new AndesineAPIError(response, result.error);
|
|
1282
|
-
if (definition.streaming) {
|
|
1283
|
-
const data = createAnswerStream(response, {
|
|
1284
|
-
signal,
|
|
1285
|
-
cancel: () => controller.abort(),
|
|
1286
|
-
cleanup: () => {
|
|
1287
|
-
if (timer !== void 0) clearTimeout(timer);
|
|
1288
|
-
}
|
|
1289
|
-
});
|
|
1290
|
-
streamOwnsRequest = true;
|
|
1291
|
-
return options.response === "full" ? {
|
|
1292
|
-
status: response.status,
|
|
1293
|
-
headers: response.headers,
|
|
1294
|
-
data,
|
|
1295
|
-
notModified: false
|
|
1296
|
-
} : data;
|
|
1297
|
-
}
|
|
1298
|
-
const text = definition.binary || response.status === 204 ? void 0 : await response.text();
|
|
1299
|
-
const data = definition.binary ? await response.blob() : text ? JSON.parse(text) : void 0;
|
|
1300
|
-
return options.response === "full" ? {
|
|
1301
|
-
status: response.status,
|
|
1302
|
-
headers: response.headers,
|
|
1303
|
-
data,
|
|
1304
|
-
notModified: false
|
|
1305
|
-
} : data;
|
|
1306
|
-
} finally {
|
|
1307
|
-
if (!streamOwnsRequest && timer !== void 0) clearTimeout(timer);
|
|
1308
|
-
}
|
|
1309
|
-
};
|
|
1310
|
-
const resources = createResources(request);
|
|
1311
|
-
return {
|
|
1312
|
-
...resources,
|
|
1313
|
-
content: createContentClient(resources.content),
|
|
1314
|
-
atSnapshot(snapshotID) {
|
|
1315
|
-
return createContentClient(createResources((definition, input, options) => {
|
|
1316
|
-
const pinned = definition.path.startsWith("/content/") && definition.queryParams.includes("snapshotID");
|
|
1317
|
-
if (pinned && (input.channel !== void 0 || input.snapshotID !== void 0 && input.snapshotID !== snapshotID)) throw new TypeError("Cannot override a pinned snapshot");
|
|
1318
|
-
return request(definition, pinned ? {
|
|
1319
|
-
...input,
|
|
1320
|
-
snapshotID
|
|
1321
|
-
} : input, options);
|
|
1322
|
-
}).content);
|
|
1323
|
-
}
|
|
1324
|
-
};
|
|
1325
|
-
};
|
|
1326
|
-
//#endregion
|
|
1327
4
|
//#region src/content-url.ts
|
|
1328
5
|
/**
|
|
1329
6
|
* Convert a canonical Andesine path or search/citation location to a website URL.
|