@conradsix/c4m-client 0.0.0-stage → 0.1.0-preview.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.
- package/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/index.d.ts +973 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +690 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -3
- package/src/index.ts +1561 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
/*
|
|
5
|
+
* ---------------------------------------------------------------
|
|
6
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
7
|
+
* ## ##
|
|
8
|
+
* ## AUTHOR: acacode ##
|
|
9
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
10
|
+
* ---------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
export var ListPagesStatus;
|
|
13
|
+
(function (ListPagesStatus) {
|
|
14
|
+
ListPagesStatus[ListPagesStatus["NotArchived"] = 0] = "NotArchived";
|
|
15
|
+
ListPagesStatus[ListPagesStatus["Published"] = 1] = "Published";
|
|
16
|
+
ListPagesStatus[ListPagesStatus["Unpublished"] = 2] = "Unpublished";
|
|
17
|
+
ListPagesStatus[ListPagesStatus["Archived"] = 3] = "Archived";
|
|
18
|
+
ListPagesStatus[ListPagesStatus["All"] = 4] = "All";
|
|
19
|
+
})(ListPagesStatus || (ListPagesStatus = {}));
|
|
20
|
+
export var ListPagesStringFilterType;
|
|
21
|
+
(function (ListPagesStringFilterType) {
|
|
22
|
+
ListPagesStringFilterType[ListPagesStringFilterType["Contains"] = 0] = "Contains";
|
|
23
|
+
ListPagesStringFilterType[ListPagesStringFilterType["StartsWith"] = 1] = "StartsWith";
|
|
24
|
+
ListPagesStringFilterType[ListPagesStringFilterType["EndsWith"] = 2] = "EndsWith";
|
|
25
|
+
ListPagesStringFilterType[ListPagesStringFilterType["Regex"] = 3] = "Regex";
|
|
26
|
+
})(ListPagesStringFilterType || (ListPagesStringFilterType = {}));
|
|
27
|
+
export var ListPagesSort;
|
|
28
|
+
(function (ListPagesSort) {
|
|
29
|
+
ListPagesSort[ListPagesSort["SlugAsc"] = 0] = "SlugAsc";
|
|
30
|
+
ListPagesSort[ListPagesSort["SlugDesc"] = 1] = "SlugDesc";
|
|
31
|
+
ListPagesSort[ListPagesSort["PathAsc"] = 2] = "PathAsc";
|
|
32
|
+
ListPagesSort[ListPagesSort["PathDesc"] = 3] = "PathDesc";
|
|
33
|
+
ListPagesSort[ListPagesSort["CreatedAtAsc"] = 4] = "CreatedAtAsc";
|
|
34
|
+
ListPagesSort[ListPagesSort["CreatedAtDesc"] = 5] = "CreatedAtDesc";
|
|
35
|
+
ListPagesSort[ListPagesSort["UpdatedAtAsc"] = 6] = "UpdatedAtAsc";
|
|
36
|
+
ListPagesSort[ListPagesSort["UpdatedAtDesc"] = 7] = "UpdatedAtDesc";
|
|
37
|
+
ListPagesSort[ListPagesSort["SeoTitleAsc"] = 8] = "SeoTitleAsc";
|
|
38
|
+
ListPagesSort[ListPagesSort["SeoTitleDesc"] = 9] = "SeoTitleDesc";
|
|
39
|
+
ListPagesSort[ListPagesSort["PublishedAsc"] = 10] = "PublishedAsc";
|
|
40
|
+
ListPagesSort[ListPagesSort["PublishedDesc"] = 11] = "PublishedDesc";
|
|
41
|
+
ListPagesSort[ListPagesSort["StatusAsc"] = 12] = "StatusAsc";
|
|
42
|
+
ListPagesSort[ListPagesSort["StatusDesc"] = 13] = "StatusDesc";
|
|
43
|
+
ListPagesSort[ListPagesSort["LinksInAsc"] = 14] = "LinksInAsc";
|
|
44
|
+
ListPagesSort[ListPagesSort["LinksInDesc"] = 15] = "LinksInDesc";
|
|
45
|
+
})(ListPagesSort || (ListPagesSort = {}));
|
|
46
|
+
export var PagePathAvailability;
|
|
47
|
+
(function (PagePathAvailability) {
|
|
48
|
+
PagePathAvailability[PagePathAvailability["Available"] = 0] = "Available";
|
|
49
|
+
PagePathAvailability[PagePathAvailability["Taken"] = 1] = "Taken";
|
|
50
|
+
PagePathAvailability[PagePathAvailability["Restricted"] = 2] = "Restricted";
|
|
51
|
+
PagePathAvailability[PagePathAvailability["ParentNotFound"] = 3] = "ParentNotFound";
|
|
52
|
+
PagePathAvailability[PagePathAvailability["CircularParent"] = 4] = "CircularParent";
|
|
53
|
+
})(PagePathAvailability || (PagePathAvailability = {}));
|
|
54
|
+
export var ContentType;
|
|
55
|
+
(function (ContentType) {
|
|
56
|
+
ContentType["Json"] = "application/json";
|
|
57
|
+
ContentType["JsonApi"] = "application/vnd.api+json";
|
|
58
|
+
ContentType["FormData"] = "multipart/form-data";
|
|
59
|
+
ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
|
|
60
|
+
ContentType["Text"] = "text/plain";
|
|
61
|
+
})(ContentType || (ContentType = {}));
|
|
62
|
+
export class HttpClient {
|
|
63
|
+
baseUrl = "";
|
|
64
|
+
securityData = null;
|
|
65
|
+
securityWorker;
|
|
66
|
+
abortControllers = new Map();
|
|
67
|
+
customFetch = (...fetchParams) => fetch(...fetchParams);
|
|
68
|
+
baseApiParams = {
|
|
69
|
+
credentials: "same-origin",
|
|
70
|
+
headers: {},
|
|
71
|
+
redirect: "follow",
|
|
72
|
+
referrerPolicy: "no-referrer",
|
|
73
|
+
};
|
|
74
|
+
constructor(apiConfig = {}) {
|
|
75
|
+
Object.assign(this, apiConfig);
|
|
76
|
+
}
|
|
77
|
+
setSecurityData = (data) => {
|
|
78
|
+
this.securityData = data;
|
|
79
|
+
};
|
|
80
|
+
encodeQueryParam(key, value) {
|
|
81
|
+
const encodedKey = encodeURIComponent(key);
|
|
82
|
+
return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`;
|
|
83
|
+
}
|
|
84
|
+
addQueryParam(query, key) {
|
|
85
|
+
return this.encodeQueryParam(key, query[key]);
|
|
86
|
+
}
|
|
87
|
+
addArrayQueryParam(query, key) {
|
|
88
|
+
const value = query[key];
|
|
89
|
+
return value.map((v) => this.encodeQueryParam(key, v)).join("&");
|
|
90
|
+
}
|
|
91
|
+
toQueryString(rawQuery) {
|
|
92
|
+
const query = rawQuery || {};
|
|
93
|
+
const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
|
|
94
|
+
return keys
|
|
95
|
+
.map((key) => Array.isArray(query[key])
|
|
96
|
+
? this.addArrayQueryParam(query, key)
|
|
97
|
+
: this.addQueryParam(query, key))
|
|
98
|
+
.join("&");
|
|
99
|
+
}
|
|
100
|
+
addQueryParams(rawQuery) {
|
|
101
|
+
const queryString = this.toQueryString(rawQuery);
|
|
102
|
+
return queryString ? `?${queryString}` : "";
|
|
103
|
+
}
|
|
104
|
+
contentFormatters = {
|
|
105
|
+
[ContentType.Json]: (input) => input !== null && (typeof input === "object" || typeof input === "string")
|
|
106
|
+
? JSON.stringify(input)
|
|
107
|
+
: input,
|
|
108
|
+
[ContentType.JsonApi]: (input) => input !== null && (typeof input === "object" || typeof input === "string")
|
|
109
|
+
? JSON.stringify(input)
|
|
110
|
+
: input,
|
|
111
|
+
[ContentType.Text]: (input) => input !== null && typeof input !== "string"
|
|
112
|
+
? JSON.stringify(input)
|
|
113
|
+
: input,
|
|
114
|
+
[ContentType.FormData]: (input) => Object.keys(input || {}).reduce((formData, key) => {
|
|
115
|
+
const property = input[key];
|
|
116
|
+
formData.append(key, property instanceof Blob
|
|
117
|
+
? property
|
|
118
|
+
: typeof property === "object" && property !== null
|
|
119
|
+
? JSON.stringify(property)
|
|
120
|
+
: `${property}`);
|
|
121
|
+
return formData;
|
|
122
|
+
}, new FormData()),
|
|
123
|
+
[ContentType.UrlEncoded]: (input) => this.toQueryString(input),
|
|
124
|
+
};
|
|
125
|
+
mergeRequestParams(params1, params2) {
|
|
126
|
+
return {
|
|
127
|
+
...this.baseApiParams,
|
|
128
|
+
...params1,
|
|
129
|
+
...(params2 || {}),
|
|
130
|
+
headers: {
|
|
131
|
+
...(this.baseApiParams.headers || {}),
|
|
132
|
+
...(params1.headers || {}),
|
|
133
|
+
...((params2 && params2.headers) || {}),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
createAbortSignal = (cancelToken) => {
|
|
138
|
+
if (this.abortControllers.has(cancelToken)) {
|
|
139
|
+
const abortController = this.abortControllers.get(cancelToken);
|
|
140
|
+
if (abortController) {
|
|
141
|
+
return abortController.signal;
|
|
142
|
+
}
|
|
143
|
+
return void 0;
|
|
144
|
+
}
|
|
145
|
+
const abortController = new AbortController();
|
|
146
|
+
this.abortControllers.set(cancelToken, abortController);
|
|
147
|
+
return abortController.signal;
|
|
148
|
+
};
|
|
149
|
+
abortRequest = (cancelToken) => {
|
|
150
|
+
const abortController = this.abortControllers.get(cancelToken);
|
|
151
|
+
if (abortController) {
|
|
152
|
+
abortController.abort();
|
|
153
|
+
this.abortControllers.delete(cancelToken);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
request = async ({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }) => {
|
|
157
|
+
const secureParams = ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) &&
|
|
158
|
+
this.securityWorker &&
|
|
159
|
+
(await this.securityWorker(this.securityData))) ||
|
|
160
|
+
{};
|
|
161
|
+
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
162
|
+
const queryString = query && this.toQueryString(query);
|
|
163
|
+
const payloadFormatter = this.contentFormatters[type || ContentType.Json];
|
|
164
|
+
const responseFormat = format || requestParams.format;
|
|
165
|
+
return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
|
|
166
|
+
...requestParams,
|
|
167
|
+
headers: {
|
|
168
|
+
...(requestParams.headers || {}),
|
|
169
|
+
...(type && type !== ContentType.FormData
|
|
170
|
+
? { "Content-Type": type }
|
|
171
|
+
: {}),
|
|
172
|
+
},
|
|
173
|
+
signal: (cancelToken
|
|
174
|
+
? this.createAbortSignal(cancelToken)
|
|
175
|
+
: requestParams.signal) || null,
|
|
176
|
+
body: typeof body === "undefined" || body === null
|
|
177
|
+
? null
|
|
178
|
+
: payloadFormatter(body),
|
|
179
|
+
}).then(async (response) => {
|
|
180
|
+
const r = response.clone();
|
|
181
|
+
r.data = null;
|
|
182
|
+
r.error = null;
|
|
183
|
+
const data = !responseFormat
|
|
184
|
+
? r
|
|
185
|
+
: await response[responseFormat]()
|
|
186
|
+
.then((data) => {
|
|
187
|
+
if (r.ok) {
|
|
188
|
+
r.data = data;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
r.error = data;
|
|
192
|
+
}
|
|
193
|
+
return r;
|
|
194
|
+
})
|
|
195
|
+
.catch((e) => {
|
|
196
|
+
r.error = e;
|
|
197
|
+
return r;
|
|
198
|
+
});
|
|
199
|
+
if (cancelToken) {
|
|
200
|
+
this.abortControllers.delete(cancelToken);
|
|
201
|
+
}
|
|
202
|
+
if (!response.ok)
|
|
203
|
+
throw data;
|
|
204
|
+
return data;
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* @title C4M
|
|
210
|
+
* @version v1
|
|
211
|
+
*
|
|
212
|
+
* The C4M engine's endpoints: pages and their versions, block and menu action types, and menus.
|
|
213
|
+
*/
|
|
214
|
+
export class Api extends HttpClient {
|
|
215
|
+
pages = {
|
|
216
|
+
/**
|
|
217
|
+
* No description
|
|
218
|
+
*
|
|
219
|
+
* @tags Pages
|
|
220
|
+
* @name ArchivePage
|
|
221
|
+
* @summary Archives an unpublished page with no unarchived children, retaining its content and history.
|
|
222
|
+
* @request POST:/pages/{id}/archive
|
|
223
|
+
*/
|
|
224
|
+
archivePage: (id, params = {}) => this.request({
|
|
225
|
+
path: `/pages/${id}/archive`,
|
|
226
|
+
method: "POST",
|
|
227
|
+
...params,
|
|
228
|
+
}),
|
|
229
|
+
/**
|
|
230
|
+
* @description Creates a new page with the specified content blocks, optionally leaving its initial version as a draft.
|
|
231
|
+
*
|
|
232
|
+
* @tags Pages
|
|
233
|
+
* @name CreatePage
|
|
234
|
+
* @summary Creates a new page.
|
|
235
|
+
* @request POST:/pages
|
|
236
|
+
*/
|
|
237
|
+
createPage: (data, params = {}) => this.request({
|
|
238
|
+
path: `/pages`,
|
|
239
|
+
method: "POST",
|
|
240
|
+
body: data,
|
|
241
|
+
type: ContentType.Json,
|
|
242
|
+
format: "json",
|
|
243
|
+
...params,
|
|
244
|
+
}),
|
|
245
|
+
/**
|
|
246
|
+
* @description Retrieves a paginated list of pages with support for sorting, searching by SEO title or path, and filtering by slug, path, and creation/update dates.
|
|
247
|
+
*
|
|
248
|
+
* @tags Pages
|
|
249
|
+
* @name ListPages
|
|
250
|
+
* @summary Lists pages with pagination, sorting, and filtering.
|
|
251
|
+
* @request GET:/pages
|
|
252
|
+
*/
|
|
253
|
+
listPages: (query, params = {}) => this.request({
|
|
254
|
+
path: `/pages`,
|
|
255
|
+
method: "GET",
|
|
256
|
+
query: query,
|
|
257
|
+
format: "json",
|
|
258
|
+
...params,
|
|
259
|
+
}),
|
|
260
|
+
/**
|
|
261
|
+
* @description Retrieves a specific page by its unique identifier including all related blocks. Optionally specify a version ID to get a specific version, otherwise returns the current version.
|
|
262
|
+
*
|
|
263
|
+
* @tags Pages
|
|
264
|
+
* @name GetPage
|
|
265
|
+
* @summary Gets a page by ID.
|
|
266
|
+
* @request GET:/pages/{id}
|
|
267
|
+
*/
|
|
268
|
+
getPage: (id, query, params = {}) => this.request({
|
|
269
|
+
path: `/pages/${id}`,
|
|
270
|
+
method: "GET",
|
|
271
|
+
query: query,
|
|
272
|
+
format: "json",
|
|
273
|
+
...params,
|
|
274
|
+
}),
|
|
275
|
+
/**
|
|
276
|
+
* No description
|
|
277
|
+
*
|
|
278
|
+
* @tags Pages
|
|
279
|
+
* @name UpdatePage
|
|
280
|
+
* @summary Creates a content and SEO draft without changing page details or publication.
|
|
281
|
+
* @request PUT:/pages/{id}
|
|
282
|
+
*/
|
|
283
|
+
updatePage: (id, data, params = {}) => this.request({
|
|
284
|
+
path: `/pages/${id}`,
|
|
285
|
+
method: "PUT",
|
|
286
|
+
body: data,
|
|
287
|
+
type: ContentType.Json,
|
|
288
|
+
format: "json",
|
|
289
|
+
...params,
|
|
290
|
+
}),
|
|
291
|
+
/**
|
|
292
|
+
* @description Retrieves a specific page by path including all related blocks. Returns the current version of the page.
|
|
293
|
+
*
|
|
294
|
+
* @tags Pages
|
|
295
|
+
* @name GetPageByPath
|
|
296
|
+
* @summary Gets a page by path.
|
|
297
|
+
* @request GET:/pages/by-path
|
|
298
|
+
*/
|
|
299
|
+
getPageByPath: (query, params = {}) => this.request({
|
|
300
|
+
path: `/pages/by-path`,
|
|
301
|
+
method: "GET",
|
|
302
|
+
query: query,
|
|
303
|
+
format: "json",
|
|
304
|
+
...params,
|
|
305
|
+
}),
|
|
306
|
+
/**
|
|
307
|
+
* @description Retrieves a specific page by its version identifier including all related blocks.
|
|
308
|
+
*
|
|
309
|
+
* @tags Pages
|
|
310
|
+
* @name GetPageByVersion
|
|
311
|
+
* @summary Gets a page by version.
|
|
312
|
+
* @request GET:/pages/by-version/{id}
|
|
313
|
+
*/
|
|
314
|
+
getPageByVersion: (id, query, params = {}) => this.request({
|
|
315
|
+
path: `/pages/by-version/${id}`,
|
|
316
|
+
method: "GET",
|
|
317
|
+
query: query,
|
|
318
|
+
format: "json",
|
|
319
|
+
...params,
|
|
320
|
+
}),
|
|
321
|
+
/**
|
|
322
|
+
* @description Sets the specified page version as the current version and unsets the previous current version.
|
|
323
|
+
*
|
|
324
|
+
* @tags Pages
|
|
325
|
+
* @name UpdateCurrentPageVersion
|
|
326
|
+
* @summary Sets a page version as current.
|
|
327
|
+
* @request PUT:/pages/by-version/{id}
|
|
328
|
+
*/
|
|
329
|
+
updateCurrentPageVersion: (id, data, params = {}) => this.request({
|
|
330
|
+
path: `/pages/by-version/${id}`,
|
|
331
|
+
method: "PUT",
|
|
332
|
+
body: data,
|
|
333
|
+
type: ContentType.Json,
|
|
334
|
+
format: "json",
|
|
335
|
+
...params,
|
|
336
|
+
}),
|
|
337
|
+
/**
|
|
338
|
+
* @description Retrieves the complete version history for a specific page, including high-level change summaries.
|
|
339
|
+
*
|
|
340
|
+
* @tags Pages
|
|
341
|
+
* @name GetPageHistory
|
|
342
|
+
* @summary Gets page version history by page ID.
|
|
343
|
+
* @request GET:/pages/{id}/history
|
|
344
|
+
*/
|
|
345
|
+
getPageHistory: (id, query, params = {}) => this.request({
|
|
346
|
+
path: `/pages/${id}/history`,
|
|
347
|
+
method: "GET",
|
|
348
|
+
query: query,
|
|
349
|
+
format: "json",
|
|
350
|
+
...params,
|
|
351
|
+
}),
|
|
352
|
+
/**
|
|
353
|
+
* @description Retrieves just the path of a specific page by its unique identifier. This is a performance-optimized endpoint that returns only the path without loading the full page data.
|
|
354
|
+
*
|
|
355
|
+
* @tags Pages
|
|
356
|
+
* @name GetPagePath
|
|
357
|
+
* @summary Gets a page path by ID.
|
|
358
|
+
* @request GET:/pages/{id}/path
|
|
359
|
+
*/
|
|
360
|
+
getPagePath: (id, params = {}) => this.request({
|
|
361
|
+
path: `/pages/${id}/path`,
|
|
362
|
+
method: "GET",
|
|
363
|
+
format: "json",
|
|
364
|
+
...params,
|
|
365
|
+
}),
|
|
366
|
+
/**
|
|
367
|
+
* @description Resolves the path a page would have with the given parent and slug, and reports whether that path can be used. Pass the ID of a page being edited to exclude it from the check.
|
|
368
|
+
*
|
|
369
|
+
* @tags Pages
|
|
370
|
+
* @name GetPagePathAvailability
|
|
371
|
+
* @summary Checks whether a page path is available.
|
|
372
|
+
* @request GET:/pages/path-availability
|
|
373
|
+
*/
|
|
374
|
+
getPagePathAvailability: (query, params = {}) => this.request({
|
|
375
|
+
path: `/pages/path-availability`,
|
|
376
|
+
method: "GET",
|
|
377
|
+
query: query,
|
|
378
|
+
format: "json",
|
|
379
|
+
...params,
|
|
380
|
+
}),
|
|
381
|
+
/**
|
|
382
|
+
* No description
|
|
383
|
+
*
|
|
384
|
+
* @tags Pages
|
|
385
|
+
* @name PublishPage
|
|
386
|
+
* @summary Publishes the saved Current version of a page.
|
|
387
|
+
* @request POST:/pages/{id}/publish
|
|
388
|
+
*/
|
|
389
|
+
publishPage: (id, data, params = {}) => this.request({
|
|
390
|
+
path: `/pages/${id}/publish`,
|
|
391
|
+
method: "POST",
|
|
392
|
+
body: data,
|
|
393
|
+
type: ContentType.Json,
|
|
394
|
+
...params,
|
|
395
|
+
}),
|
|
396
|
+
/**
|
|
397
|
+
* No description
|
|
398
|
+
*
|
|
399
|
+
* @tags Pages
|
|
400
|
+
* @name ReparentPageChildren
|
|
401
|
+
* @summary Moves all unarchived direct children and their subtrees to another parent or the top level.
|
|
402
|
+
* @request POST:/pages/{id}/reparent-children
|
|
403
|
+
*/
|
|
404
|
+
reparentPageChildren: (id, data, params = {}) => this.request({
|
|
405
|
+
path: `/pages/${id}/reparent-children`,
|
|
406
|
+
method: "POST",
|
|
407
|
+
body: data,
|
|
408
|
+
type: ContentType.Json,
|
|
409
|
+
format: "json",
|
|
410
|
+
...params,
|
|
411
|
+
}),
|
|
412
|
+
/**
|
|
413
|
+
* No description
|
|
414
|
+
*
|
|
415
|
+
* @tags Pages
|
|
416
|
+
* @name UnpublishPage
|
|
417
|
+
* @summary Unpublishes a page unless published pages or menus reference it.
|
|
418
|
+
* @request POST:/pages/{id}/unpublish
|
|
419
|
+
*/
|
|
420
|
+
unpublishPage: (id, data, params = {}) => this.request({
|
|
421
|
+
path: `/pages/${id}/unpublish`,
|
|
422
|
+
method: "POST",
|
|
423
|
+
body: data,
|
|
424
|
+
type: ContentType.Json,
|
|
425
|
+
...params,
|
|
426
|
+
}),
|
|
427
|
+
/**
|
|
428
|
+
* No description
|
|
429
|
+
*
|
|
430
|
+
* @tags Pages
|
|
431
|
+
* @name UpdatePageDetails
|
|
432
|
+
* @summary Updates unversioned page details without creating a content version.
|
|
433
|
+
* @request PUT:/pages/{id}/details
|
|
434
|
+
*/
|
|
435
|
+
updatePageDetails: (id, data, params = {}) => this.request({
|
|
436
|
+
path: `/pages/${id}/details`,
|
|
437
|
+
method: "PUT",
|
|
438
|
+
body: data,
|
|
439
|
+
type: ContentType.Json,
|
|
440
|
+
format: "json",
|
|
441
|
+
...params,
|
|
442
|
+
}),
|
|
443
|
+
};
|
|
444
|
+
navigationSettings = {
|
|
445
|
+
/**
|
|
446
|
+
* @description Retrieves the default navigation and footer menu selections.
|
|
447
|
+
*
|
|
448
|
+
* @tags Navigation-Settings
|
|
449
|
+
* @name GetNavigationSettings
|
|
450
|
+
* @summary Gets navigation settings.
|
|
451
|
+
* @request GET:/navigation-settings
|
|
452
|
+
*/
|
|
453
|
+
getNavigationSettings: (params = {}) => this.request({
|
|
454
|
+
path: `/navigation-settings`,
|
|
455
|
+
method: "GET",
|
|
456
|
+
format: "json",
|
|
457
|
+
...params,
|
|
458
|
+
}),
|
|
459
|
+
/**
|
|
460
|
+
* @description Changes the default navigation and footer menus immediately.
|
|
461
|
+
*
|
|
462
|
+
* @tags Navigation-Settings
|
|
463
|
+
* @name UpdateNavigationSettings
|
|
464
|
+
* @summary Updates navigation settings.
|
|
465
|
+
* @request PUT:/navigation-settings
|
|
466
|
+
*/
|
|
467
|
+
updateNavigationSettings: (data, params = {}) => this.request({
|
|
468
|
+
path: `/navigation-settings`,
|
|
469
|
+
method: "PUT",
|
|
470
|
+
body: data,
|
|
471
|
+
type: ContentType.Json,
|
|
472
|
+
format: "json",
|
|
473
|
+
...params,
|
|
474
|
+
}),
|
|
475
|
+
};
|
|
476
|
+
menuActionTypes = {
|
|
477
|
+
/**
|
|
478
|
+
* @description Adds a new menu action type to the system.
|
|
479
|
+
*
|
|
480
|
+
* @tags Menu-Action-Types
|
|
481
|
+
* @name CreateMenuActionType
|
|
482
|
+
* @summary Creates a new menu action type.
|
|
483
|
+
* @request POST:/menu-action-types
|
|
484
|
+
*/
|
|
485
|
+
createMenuActionType: (data, params = {}) => this.request({
|
|
486
|
+
path: `/menu-action-types`,
|
|
487
|
+
method: "POST",
|
|
488
|
+
body: data,
|
|
489
|
+
type: ContentType.Json,
|
|
490
|
+
format: "json",
|
|
491
|
+
...params,
|
|
492
|
+
}),
|
|
493
|
+
/**
|
|
494
|
+
* @description Retrieves all available menu action types with their schemas.
|
|
495
|
+
*
|
|
496
|
+
* @tags Menu-Action-Types
|
|
497
|
+
* @name ListMenuActionTypes
|
|
498
|
+
* @summary Lists all menu action types.
|
|
499
|
+
* @request GET:/menu-action-types
|
|
500
|
+
*/
|
|
501
|
+
listMenuActionTypes: (params = {}) => this.request({
|
|
502
|
+
path: `/menu-action-types`,
|
|
503
|
+
method: "GET",
|
|
504
|
+
format: "json",
|
|
505
|
+
...params,
|
|
506
|
+
}),
|
|
507
|
+
/**
|
|
508
|
+
* @description Retrieves a menu action type including its JSON schema for validation.
|
|
509
|
+
*
|
|
510
|
+
* @tags Menu-Action-Types
|
|
511
|
+
* @name GetMenuActionType
|
|
512
|
+
* @summary Gets a menu action type by ID.
|
|
513
|
+
* @request GET:/menu-action-types/{id}
|
|
514
|
+
*/
|
|
515
|
+
getMenuActionType: (id, params = {}) => this.request({
|
|
516
|
+
path: `/menu-action-types/${id}`,
|
|
517
|
+
method: "GET",
|
|
518
|
+
format: "json",
|
|
519
|
+
...params,
|
|
520
|
+
}),
|
|
521
|
+
/**
|
|
522
|
+
* @description Retrieves a specific menu action type from the system by its name. If version is not specified, returns the latest version.
|
|
523
|
+
*
|
|
524
|
+
* @tags Menu-Action-Types
|
|
525
|
+
* @name GetMenuActionTypeByName
|
|
526
|
+
* @summary Gets a menu action type by name.
|
|
527
|
+
* @request GET:/menu-action-types/by-name/{name}
|
|
528
|
+
*/
|
|
529
|
+
getMenuActionTypeByName: (name, query, params = {}) => this.request({
|
|
530
|
+
path: `/menu-action-types/by-name/${name}`,
|
|
531
|
+
method: "GET",
|
|
532
|
+
query: query,
|
|
533
|
+
format: "json",
|
|
534
|
+
...params,
|
|
535
|
+
}),
|
|
536
|
+
};
|
|
537
|
+
menus = {
|
|
538
|
+
/**
|
|
539
|
+
* @description Adds a new menu with optional menu items to the system.
|
|
540
|
+
*
|
|
541
|
+
* @tags Menus
|
|
542
|
+
* @name CreateMenu
|
|
543
|
+
* @summary Creates a new menu.
|
|
544
|
+
* @request POST:/menus
|
|
545
|
+
*/
|
|
546
|
+
createMenu: (data, params = {}) => this.request({
|
|
547
|
+
path: `/menus`,
|
|
548
|
+
method: "POST",
|
|
549
|
+
body: data,
|
|
550
|
+
type: ContentType.Json,
|
|
551
|
+
format: "json",
|
|
552
|
+
...params,
|
|
553
|
+
}),
|
|
554
|
+
/**
|
|
555
|
+
* @description Retrieves a paginated list of menus.
|
|
556
|
+
*
|
|
557
|
+
* @tags Menus
|
|
558
|
+
* @name ListMenus
|
|
559
|
+
* @summary Lists menus.
|
|
560
|
+
* @request GET:/menus
|
|
561
|
+
*/
|
|
562
|
+
listMenus: (query, params = {}) => this.request({
|
|
563
|
+
path: `/menus`,
|
|
564
|
+
method: "GET",
|
|
565
|
+
query: query,
|
|
566
|
+
format: "json",
|
|
567
|
+
...params,
|
|
568
|
+
}),
|
|
569
|
+
/**
|
|
570
|
+
* @description Retrieves the menu configured as the site-wide navigation fallback.
|
|
571
|
+
*
|
|
572
|
+
* @tags Menus
|
|
573
|
+
* @name GetDefaultMenu
|
|
574
|
+
* @summary Gets the default navigation menu.
|
|
575
|
+
* @request GET:/menus/default
|
|
576
|
+
*/
|
|
577
|
+
getDefaultMenu: (params = {}) => this.request({
|
|
578
|
+
path: `/menus/default`,
|
|
579
|
+
method: "GET",
|
|
580
|
+
format: "json",
|
|
581
|
+
...params,
|
|
582
|
+
}),
|
|
583
|
+
/**
|
|
584
|
+
* @description Retrieves the menu configured for the site-wide footer.
|
|
585
|
+
*
|
|
586
|
+
* @tags Menus
|
|
587
|
+
* @name GetFooterMenu
|
|
588
|
+
* @summary Gets the footer menu.
|
|
589
|
+
* @request GET:/menus/footer
|
|
590
|
+
*/
|
|
591
|
+
getFooterMenu: (params = {}) => this.request({
|
|
592
|
+
path: `/menus/footer`,
|
|
593
|
+
method: "GET",
|
|
594
|
+
format: "json",
|
|
595
|
+
...params,
|
|
596
|
+
}),
|
|
597
|
+
/**
|
|
598
|
+
* @description Retrieves a menu with its hierarchical structure of menu items.
|
|
599
|
+
*
|
|
600
|
+
* @tags Menus
|
|
601
|
+
* @name GetMenu
|
|
602
|
+
* @summary Gets a menu by ID.
|
|
603
|
+
* @request GET:/menus/{id}
|
|
604
|
+
*/
|
|
605
|
+
getMenu: (id, params = {}) => this.request({
|
|
606
|
+
path: `/menus/${id}`,
|
|
607
|
+
method: "GET",
|
|
608
|
+
format: "json",
|
|
609
|
+
...params,
|
|
610
|
+
}),
|
|
611
|
+
/**
|
|
612
|
+
* @description Replaces all menu items with the provided tree structure.
|
|
613
|
+
*
|
|
614
|
+
* @tags Menus
|
|
615
|
+
* @name UpdateMenu
|
|
616
|
+
* @summary Updates an existing menu.
|
|
617
|
+
* @request PUT:/menus/{menuId}
|
|
618
|
+
*/
|
|
619
|
+
updateMenu: (menuId, data, params = {}) => this.request({
|
|
620
|
+
path: `/menus/${menuId}`,
|
|
621
|
+
method: "PUT",
|
|
622
|
+
body: data,
|
|
623
|
+
type: ContentType.Json,
|
|
624
|
+
...params,
|
|
625
|
+
}),
|
|
626
|
+
};
|
|
627
|
+
blockTypes = {
|
|
628
|
+
/**
|
|
629
|
+
* @description Adds a new block type to the system.
|
|
630
|
+
*
|
|
631
|
+
* @tags Block-Types
|
|
632
|
+
* @name CreateBlockType
|
|
633
|
+
* @summary Creates a new block type.
|
|
634
|
+
* @request POST:/block-types
|
|
635
|
+
*/
|
|
636
|
+
createBlockType: (data, params = {}) => this.request({
|
|
637
|
+
path: `/block-types`,
|
|
638
|
+
method: "POST",
|
|
639
|
+
body: data,
|
|
640
|
+
type: ContentType.Json,
|
|
641
|
+
format: "json",
|
|
642
|
+
...params,
|
|
643
|
+
}),
|
|
644
|
+
/**
|
|
645
|
+
* @description Retrieves a paginated list of block types grouped by name. All versions of each block type are included together.
|
|
646
|
+
*
|
|
647
|
+
* @tags Block-Types
|
|
648
|
+
* @name ListBlockTypes
|
|
649
|
+
* @summary Lists block types with pagination.
|
|
650
|
+
* @request GET:/block-types
|
|
651
|
+
*/
|
|
652
|
+
listBlockTypes: (query, params = {}) => this.request({
|
|
653
|
+
path: `/block-types`,
|
|
654
|
+
method: "GET",
|
|
655
|
+
query: query,
|
|
656
|
+
format: "json",
|
|
657
|
+
...params,
|
|
658
|
+
}),
|
|
659
|
+
/**
|
|
660
|
+
* @description Retrieves a specific block type from the system.
|
|
661
|
+
*
|
|
662
|
+
* @tags Block-Types
|
|
663
|
+
* @name GetBlockType
|
|
664
|
+
* @summary Gets a block type by ID.
|
|
665
|
+
* @request GET:/block-types/{id}
|
|
666
|
+
*/
|
|
667
|
+
getBlockType: (id, params = {}) => this.request({
|
|
668
|
+
path: `/block-types/${id}`,
|
|
669
|
+
method: "GET",
|
|
670
|
+
format: "json",
|
|
671
|
+
...params,
|
|
672
|
+
}),
|
|
673
|
+
/**
|
|
674
|
+
* @description Retrieves a specific block type from the system by its name. If version is not specified, returns the latest version.
|
|
675
|
+
*
|
|
676
|
+
* @tags Block-Types
|
|
677
|
+
* @name GetBlockTypeByName
|
|
678
|
+
* @summary Gets a block type by name.
|
|
679
|
+
* @request GET:/block-types/by-name/{name}
|
|
680
|
+
*/
|
|
681
|
+
getBlockTypeByName: (name, query, params = {}) => this.request({
|
|
682
|
+
path: `/block-types/by-name/${name}`,
|
|
683
|
+
method: "GET",
|
|
684
|
+
query: query,
|
|
685
|
+
format: "json",
|
|
686
|
+
...params,
|
|
687
|
+
}),
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
//# sourceMappingURL=index.js.map
|