@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/src/index.ts ADDED
@@ -0,0 +1,1561 @@
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
+
13
+ export enum ListPagesStatus {
14
+ NotArchived = 0,
15
+ Published = 1,
16
+ Unpublished = 2,
17
+ Archived = 3,
18
+ All = 4,
19
+ }
20
+
21
+ export enum ListPagesStringFilterType {
22
+ Contains = 0,
23
+ StartsWith = 1,
24
+ EndsWith = 2,
25
+ Regex = 3,
26
+ }
27
+
28
+ export enum ListPagesSort {
29
+ SlugAsc = 0,
30
+ SlugDesc = 1,
31
+ PathAsc = 2,
32
+ PathDesc = 3,
33
+ CreatedAtAsc = 4,
34
+ CreatedAtDesc = 5,
35
+ UpdatedAtAsc = 6,
36
+ UpdatedAtDesc = 7,
37
+ SeoTitleAsc = 8,
38
+ SeoTitleDesc = 9,
39
+ PublishedAsc = 10,
40
+ PublishedDesc = 11,
41
+ StatusAsc = 12,
42
+ StatusDesc = 13,
43
+ LinksInAsc = 14,
44
+ LinksInDesc = 15,
45
+ }
46
+
47
+ export enum PagePathAvailability {
48
+ Available = 0,
49
+ Taken = 1,
50
+ Restricted = 2,
51
+ ParentNotFound = 3,
52
+ CircularParent = 4,
53
+ }
54
+
55
+ export interface PageLifecycleConflict {
56
+ code: string;
57
+ message: string;
58
+ /** @format int32 */
59
+ totalPages: number;
60
+ pages: PageLifecycleConflictPage[];
61
+ /** @format int32 */
62
+ totalMenus: number;
63
+ menus?: UnpublishMenuReference[] | null;
64
+ }
65
+
66
+ export interface PageLifecycleConflictPage {
67
+ /** @format uuid */
68
+ pageId: string;
69
+ path: string;
70
+ }
71
+
72
+ export interface UnpublishMenuReference {
73
+ /** @format uuid */
74
+ menuId: string;
75
+ name: string;
76
+ itemTitle: string;
77
+ }
78
+
79
+ export interface CreatePageResponse {
80
+ /** @format uuid */
81
+ id: string;
82
+ }
83
+
84
+ /** @example {"parentId":null,"slug":"about-us","blocks":[{"blockTypeId":"87654321-4321-4321-4321-210987654321","blockData":"{\"title\": \"About Us\", \"content\": \"Welcome to our website\"}","instanceId":null}],"seo":{"title":"About us","description":"Learn who we are and what we do.","socialImageId":null,"index":true,"follow":true},"publish":true,"navigationMenuId":null} */
85
+ export interface CreatePageRequest {
86
+ /**
87
+ * @format uuid
88
+ * @example null
89
+ */
90
+ parentId?: string | null;
91
+ /**
92
+ * @minLength 1
93
+ * @example "about-us"
94
+ */
95
+ slug: string;
96
+ /** @example [{"blockTypeId":"87654321-4321-4321-4321-210987654321","blockData":"{\"title\": \"About Us\", \"content\": \"Welcome to our website\"}","instanceId":null}] */
97
+ blocks: CreatePageBlock[];
98
+ /** @example {"title":"About us","description":"Learn who we are and what we do.","socialImageId":null,"index":true,"follow":true} */
99
+ seo?: PageSeoRequest | null;
100
+ /** @example true */
101
+ publish: boolean;
102
+ /**
103
+ * @format uuid
104
+ * @example null
105
+ */
106
+ navigationMenuId?: string | null;
107
+ }
108
+
109
+ export interface CreatePageBlock {
110
+ /**
111
+ * @format uuid
112
+ * @minLength 1
113
+ */
114
+ blockTypeId: string;
115
+ /** @minLength 1 */
116
+ blockData: string;
117
+ /** @format uuid */
118
+ instanceId?: string | null;
119
+ }
120
+
121
+ export interface PageSeoRequest {
122
+ /**
123
+ * @minLength 0
124
+ * @maxLength 60
125
+ */
126
+ title?: string | null;
127
+ /**
128
+ * @minLength 0
129
+ * @maxLength 160
130
+ */
131
+ description?: string | null;
132
+ /** @format uuid */
133
+ socialImageId?: string | null;
134
+ index: boolean;
135
+ follow: boolean;
136
+ }
137
+
138
+ /** the dto used to send an error response to the client */
139
+ export interface ErrorResponse {
140
+ /**
141
+ * the http status code sent to the client. default is 400.
142
+ * @format int32
143
+ * @default 400
144
+ */
145
+ statusCode: number;
146
+ /**
147
+ * the message for the error response
148
+ * @default "One or more errors occurred!"
149
+ */
150
+ message: string;
151
+ /** the collection of errors for the current context */
152
+ errors: Record<string, string[]>;
153
+ }
154
+
155
+ export interface GetPageResponse {
156
+ /** @format uuid */
157
+ pageId: string;
158
+ /** @format uuid */
159
+ pageVersionId: string;
160
+ /** @format uuid */
161
+ parentId?: string | null;
162
+ /** @format uuid */
163
+ navigationMenuId?: string | null;
164
+ /** @format uuid */
165
+ effectiveNavigationMenuId?: string | null;
166
+ slug: string;
167
+ path: string;
168
+ version: number;
169
+ seo: PageSeoResponse;
170
+ blocks: GetPageResponseBlock[];
171
+ /** @format date-time */
172
+ createdAt: string;
173
+ /** @format date-time */
174
+ updatedAt: string;
175
+ breadcrumbs?: PageBreadcrumbItem[] | null;
176
+ isPublished: boolean;
177
+ /** @format uuid */
178
+ currentPageVersionId?: string | null;
179
+ /** @format uuid */
180
+ latestPageVersionId?: string | null;
181
+ /** @format date-time */
182
+ archivedAt?: string | null;
183
+ references?: PageReferenceResponse[] | null;
184
+ }
185
+
186
+ export interface PageSeoResponse {
187
+ title?: string | null;
188
+ description?: string | null;
189
+ socialImage?: GetPageResponseBlockImage | null;
190
+ index: boolean;
191
+ follow: boolean;
192
+ }
193
+
194
+ export interface GetPageResponseBlockImage {
195
+ /** @format uuid */
196
+ id: string;
197
+ /** @format int32 */
198
+ width: number;
199
+ /** @format int32 */
200
+ height: number;
201
+ imageUrl: string;
202
+ altText: string;
203
+ }
204
+
205
+ export interface GetPageResponseBlock {
206
+ /** @format uuid */
207
+ id: string;
208
+ /** @format uuid */
209
+ blockTypeId: string;
210
+ blockName: string;
211
+ blockVersion: string;
212
+ blockData: string;
213
+ images: GetPageResponseBlockImage[];
214
+ pages: GetPageResponseBlockPage[];
215
+ /** @format uuid */
216
+ instanceId: string;
217
+ }
218
+
219
+ export interface GetPageResponseBlockPage {
220
+ /** @format uuid */
221
+ id: string;
222
+ slug: string;
223
+ path: string;
224
+ title: string;
225
+ heroImage?: GetPageResponseBlockImage | null;
226
+ }
227
+
228
+ export interface PageBreadcrumbItem {
229
+ /** @format uuid */
230
+ pageId: string;
231
+ slug: string;
232
+ path: string;
233
+ }
234
+
235
+ export interface PageReferenceResponse {
236
+ kind: string;
237
+ /** @format uuid */
238
+ targetId: string;
239
+ }
240
+
241
+ export type GetPageRequest = object;
242
+
243
+ export type GetPageByPathRequest = object;
244
+
245
+ export type GetPageByVersionRequest = object;
246
+
247
+ export interface GetPageHistoryResponse {
248
+ versions: GetPageHistoryResponseItem[];
249
+ page?: PageHistoryMetadata | null;
250
+ }
251
+
252
+ export interface GetPageHistoryResponseItem {
253
+ /** @format uuid */
254
+ pageVersionId: string;
255
+ isCurrent: boolean;
256
+ changeSummary: PageVersionChangeSummary;
257
+ /** @format date-time */
258
+ createdAt: string;
259
+ }
260
+
261
+ export interface PageVersionChangeSummary {
262
+ /** @format int32 */
263
+ schemaVersion: number;
264
+ headline: string;
265
+ changes: string[];
266
+ }
267
+
268
+ export interface PageHistoryMetadata {
269
+ /** @format uuid */
270
+ pageId: string;
271
+ /** @format uuid */
272
+ parentId?: string | null;
273
+ slug: string;
274
+ path: string;
275
+ /** @format uuid */
276
+ navigationMenuId?: string | null;
277
+ /** @format date-time */
278
+ createdAt: string;
279
+ /** @format date-time */
280
+ archivedAt?: string | null;
281
+ navigationMenuName?: string | null;
282
+ }
283
+
284
+ export type GetPageHistoryRequest = object;
285
+
286
+ export interface GetPagePathResponse {
287
+ path: string;
288
+ }
289
+
290
+ export interface GetPagePathAvailabilityResponse {
291
+ path?: string | null;
292
+ status: PagePathAvailability;
293
+ }
294
+
295
+ export type GetPagePathAvailabilityRequest = object;
296
+
297
+ export interface ListPagesResponse {
298
+ /** @format int32 */
299
+ total: number;
300
+ /** @format int32 */
301
+ limit: number;
302
+ /** @format int32 */
303
+ nextOffset?: number | null;
304
+ pages: ListPagesResponseItem[];
305
+ }
306
+
307
+ export interface ListPagesResponseItem {
308
+ /** @format uuid */
309
+ pageId: string;
310
+ /** @format uuid */
311
+ parentPageId?: string | null;
312
+ /** @format uuid */
313
+ currentPageVersionId?: string | null;
314
+ slug: string;
315
+ path: string;
316
+ /** @format int32 */
317
+ versionCount: number;
318
+ /** @format date-time */
319
+ createdAt: string;
320
+ /** @format date-time */
321
+ updatedAt: string;
322
+ isPublished: boolean;
323
+ seoTitle?: string | null;
324
+ /** @format date-time */
325
+ archivedAt?: string | null;
326
+ /** @format int32 */
327
+ linksFromPages: number;
328
+ /** @format int32 */
329
+ linksFromMenus: number;
330
+ }
331
+
332
+ export type ListPagesRequest = object;
333
+
334
+ export interface PagePublicationRequest {
335
+ /** @format uuid */
336
+ expectedCurrentPageVersionId?: string | null;
337
+ expectedIsPublished: boolean;
338
+ }
339
+
340
+ export interface ReparentPageChildrenResponse {
341
+ /** @format int32 */
342
+ movedPages: number;
343
+ }
344
+
345
+ export interface ReparentPageChildrenRequest {
346
+ /** @format uuid */
347
+ parentId?: string | null;
348
+ }
349
+
350
+ export interface UnpublishPageConflict {
351
+ code: string;
352
+ message: string;
353
+ /** @format int32 */
354
+ totalPages: number;
355
+ pages: UnpublishPageReference[];
356
+ /** @format int32 */
357
+ totalMenus: number;
358
+ menus: UnpublishMenuReference[];
359
+ }
360
+
361
+ export interface UnpublishPageReference {
362
+ /** @format uuid */
363
+ pageId: string;
364
+ /** @format uuid */
365
+ pageVersionId: string;
366
+ path: string;
367
+ reason: string;
368
+ }
369
+
370
+ export interface UpdateCurrentPageVersionResponse {
371
+ /** @format uuid */
372
+ previousPageVersionId: string;
373
+ }
374
+
375
+ export interface PageDraftConflict {
376
+ /** @format uuid */
377
+ latestPageVersionId?: string | null;
378
+ }
379
+
380
+ export interface UpdatePageResponse {
381
+ /** @format uuid */
382
+ pageVersionId: string;
383
+ }
384
+
385
+ export interface UpdatePageRequest {
386
+ /**
387
+ * @format uuid
388
+ * @minLength 1
389
+ */
390
+ expectedLatestPageVersionId: string;
391
+ newBlocks: UpdatePageNewBlock[];
392
+ existingBlocks: UpdatePageExistingBlock[];
393
+ seo?: PageSeoRequest | null;
394
+ }
395
+
396
+ export interface UpdatePageNewBlock {
397
+ /** @format uuid */
398
+ blockTypeId: string;
399
+ /**
400
+ * @format int32
401
+ * @min 0
402
+ */
403
+ sortOrder: number;
404
+ blockData: string;
405
+ /** @format uuid */
406
+ instanceId?: string | null;
407
+ }
408
+
409
+ export interface UpdatePageExistingBlock {
410
+ /** @format uuid */
411
+ blockId: string;
412
+ /**
413
+ * @format int32
414
+ * @min 0
415
+ */
416
+ sortOrder: number;
417
+ }
418
+
419
+ export interface ConflictResponse {
420
+ /** @format uuid */
421
+ id: string;
422
+ version: number;
423
+ /** @format date-time */
424
+ updatedAt: string;
425
+ }
426
+
427
+ export interface UpdatePageDetailsRequest {
428
+ /** @format uuid */
429
+ parentId?: string | null;
430
+ /** @minLength 1 */
431
+ slug: string;
432
+ version: number;
433
+ /** @format uuid */
434
+ navigationMenuId?: string | null;
435
+ }
436
+
437
+ export interface NavigationSettingsResponse {
438
+ /** @format uuid */
439
+ defaultMenuId?: string | null;
440
+ /** @format uuid */
441
+ footerMenuId?: string | null;
442
+ version: number;
443
+ }
444
+
445
+ export interface UpdateNavigationSettingsRequest {
446
+ /** @format uuid */
447
+ defaultMenuId?: string | null;
448
+ /** @format uuid */
449
+ footerMenuId?: string | null;
450
+ version: number;
451
+ }
452
+
453
+ export interface CreateCmsTypeDescriptorResponse {
454
+ /** @format uuid */
455
+ id: string;
456
+ }
457
+
458
+ /** @example {"name":"hero-section","version":1,"jsonSchema":"{\"type\": \"object\", \"properties\": {\"title\": {\"type\": \"string\"}, \"subtitle\": {\"type\": \"string\"}}}"} */
459
+ export interface CreateCmsTypeDescriptorRequest {
460
+ /**
461
+ * @minLength 1
462
+ * @pattern ^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$
463
+ * @example "hero-section"
464
+ */
465
+ name: string;
466
+ /**
467
+ * @format int32
468
+ * @min 0
469
+ * @exclusiveMin true
470
+ * @example 1
471
+ */
472
+ version: number;
473
+ /**
474
+ * @minLength 1
475
+ * @example "{"type": "object", "properties": {"title": {"type": "string"}, "subtitle": {"type": "string"}}}"
476
+ */
477
+ jsonSchema: string;
478
+ }
479
+
480
+ export interface CmsTypeDescriptor {
481
+ /** @format uuid */
482
+ id: string;
483
+ name: string;
484
+ /** @format int32 */
485
+ version: number;
486
+ jsonSchema: string;
487
+ /** @format date-time */
488
+ createdAt: string;
489
+ isRetired: boolean;
490
+ }
491
+
492
+ export type GetMenuActionTypeRequest = object;
493
+
494
+ export type GetMenuActionTypeByNameRequest = object;
495
+
496
+ export interface ListMenuActionTypesResponse {
497
+ items: CmsTypeDescriptor[];
498
+ }
499
+
500
+ export interface CreateMenuResponse {
501
+ /** @format uuid */
502
+ id: string;
503
+ }
504
+
505
+ /** @example {"name":"main-navigation","rootItems":[{"title":"Home","actionTypeId":"0e1d6f2a-3b4c-4d5e-8f60-718293a4b5c6","actionData":"{\"pageId\": \"00000000-0000-0000-0000-000000000000\"}","children":null}]} */
506
+ export interface CreateMenuRequest {
507
+ /**
508
+ * @minLength 1
509
+ * @pattern ^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$
510
+ * @example "main-navigation"
511
+ */
512
+ name: string;
513
+ /** @example [{"title":"Home","actionTypeId":"0e1d6f2a-3b4c-4d5e-8f60-718293a4b5c6","actionData":"{\"pageId\": \"00000000-0000-0000-0000-000000000000\"}","children":null}] */
514
+ rootItems?: MenuItem[] | null;
515
+ }
516
+
517
+ export interface MenuItem {
518
+ /**
519
+ * @minLength 0
520
+ * @maxLength 200
521
+ */
522
+ title: string;
523
+ /**
524
+ * @format uuid
525
+ * @minLength 1
526
+ */
527
+ actionTypeId: string;
528
+ /** @minLength 1 */
529
+ actionData: string;
530
+ children?: MenuItem[] | null;
531
+ }
532
+
533
+ export interface GetMenuResponse {
534
+ /** @format uuid */
535
+ id: string;
536
+ name: string;
537
+ version: number;
538
+ /** @format date-time */
539
+ createdAt: string;
540
+ /** @format date-time */
541
+ updatedAt: string;
542
+ rootItems: GetMenuRequestMenuItem[];
543
+ pages: GetMenuResponsePage[];
544
+ }
545
+
546
+ export interface GetMenuRequestMenuItem {
547
+ /** @format uuid */
548
+ id: string;
549
+ title: string;
550
+ actionTypeName: string;
551
+ /** @format int32 */
552
+ actionTypeVersion: number;
553
+ actionData: string;
554
+ children: GetMenuRequestMenuItem[];
555
+ }
556
+
557
+ export interface GetMenuResponsePage {
558
+ /** @format uuid */
559
+ id: string;
560
+ slug: string;
561
+ path: string;
562
+ }
563
+
564
+ export type GetMenuRequest = object;
565
+
566
+ export interface ListMenusResponse {
567
+ items: ListMenusMenuItem[];
568
+ /** @format int32 */
569
+ totalCount: number;
570
+ /** @format int32 */
571
+ limit: number;
572
+ /** @format int32 */
573
+ offset: number;
574
+ }
575
+
576
+ export interface ListMenusMenuItem {
577
+ /** @format uuid */
578
+ id: string;
579
+ name: string;
580
+ /** @format date-time */
581
+ createdAt: string;
582
+ /** @format date-time */
583
+ updatedAt: string;
584
+ }
585
+
586
+ export type ListMenusRequest = object;
587
+
588
+ /** @example {"version":1,"rootItems":[{"title":"Home","actionTypeId":"0e1d6f2a-3b4c-4d5e-8f60-718293a4b5c6","actionData":"{\"pageId\": \"00000000-0000-0000-0000-000000000000\"}","children":[{"title":"About","actionTypeId":"0e1d6f2a-3b4c-4d5e-8f60-718293a4b5c6","actionData":"{\"pageId\": \"00000000-0000-0000-0000-000000000001\"}","children":null}]}]} */
589
+ export interface UpdateMenuRequest {
590
+ /** @example 1 */
591
+ version: number;
592
+ /** @example [{"title":"Home","actionTypeId":"0e1d6f2a-3b4c-4d5e-8f60-718293a4b5c6","actionData":"{\"pageId\": \"00000000-0000-0000-0000-000000000000\"}","children":[{"title":"About","actionTypeId":"0e1d6f2a-3b4c-4d5e-8f60-718293a4b5c6","actionData":"{\"pageId\": \"00000000-0000-0000-0000-000000000001\"}","children":null}]}] */
593
+ rootItems?: MenuItem[] | null;
594
+ }
595
+
596
+ export type GetBlockTypeRequest = object;
597
+
598
+ export type GetBlockTypeByNameRequest = object;
599
+
600
+ export interface ListBlockTypesResponse {
601
+ items: CmsTypeDescriptor[];
602
+ /** @format int32 */
603
+ total: number;
604
+ /** @format int32 */
605
+ nextOffset?: number | null;
606
+ /** @format int32 */
607
+ limit: number;
608
+ }
609
+
610
+ export type ListBlockTypesRequest = object;
611
+
612
+ export type QueryParamsType = Record<string | number, any>;
613
+ export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
614
+
615
+ export interface FullRequestParams extends Omit<RequestInit, "body"> {
616
+ /** set parameter to `true` for call `securityWorker` for this request */
617
+ secure?: boolean;
618
+ /** request path */
619
+ path: string;
620
+ /** content type of request body */
621
+ type?: ContentType;
622
+ /** query params */
623
+ query?: QueryParamsType;
624
+ /** format of response (i.e. response.json() -> format: "json") */
625
+ format?: ResponseFormat;
626
+ /** request body */
627
+ body?: unknown;
628
+ /** base url */
629
+ baseUrl?: string;
630
+ /** request cancellation token */
631
+ cancelToken?: CancelToken;
632
+ }
633
+
634
+ export type RequestParams = Omit<
635
+ FullRequestParams,
636
+ "body" | "method" | "query" | "path"
637
+ >;
638
+
639
+ export interface ApiConfig<SecurityDataType = unknown> {
640
+ baseUrl?: string;
641
+ baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
642
+ securityWorker?: (
643
+ securityData: SecurityDataType | null,
644
+ ) => Promise<RequestParams | void> | RequestParams | void;
645
+ customFetch?: typeof fetch;
646
+ }
647
+
648
+ export interface HttpResponse<D extends unknown, E extends unknown = unknown>
649
+ extends Response {
650
+ data: D;
651
+ error: E;
652
+ }
653
+
654
+ type CancelToken = Symbol | string | number;
655
+
656
+ export enum ContentType {
657
+ Json = "application/json",
658
+ JsonApi = "application/vnd.api+json",
659
+ FormData = "multipart/form-data",
660
+ UrlEncoded = "application/x-www-form-urlencoded",
661
+ Text = "text/plain",
662
+ }
663
+
664
+ export class HttpClient<SecurityDataType = unknown> {
665
+ public baseUrl: string = "";
666
+ private securityData: SecurityDataType | null = null;
667
+ private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
668
+ private abortControllers = new Map<CancelToken, AbortController>();
669
+ private customFetch = (...fetchParams: Parameters<typeof fetch>) =>
670
+ fetch(...fetchParams);
671
+
672
+ private baseApiParams: RequestParams = {
673
+ credentials: "same-origin",
674
+ headers: {},
675
+ redirect: "follow",
676
+ referrerPolicy: "no-referrer",
677
+ };
678
+
679
+ constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
680
+ Object.assign(this, apiConfig);
681
+ }
682
+
683
+ public setSecurityData = (data: SecurityDataType | null) => {
684
+ this.securityData = data;
685
+ };
686
+
687
+ protected encodeQueryParam(key: string, value: any) {
688
+ const encodedKey = encodeURIComponent(key);
689
+ return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`;
690
+ }
691
+
692
+ protected addQueryParam(query: QueryParamsType, key: string) {
693
+ return this.encodeQueryParam(key, query[key]);
694
+ }
695
+
696
+ protected addArrayQueryParam(query: QueryParamsType, key: string) {
697
+ const value = query[key];
698
+ return value.map((v: any) => this.encodeQueryParam(key, v)).join("&");
699
+ }
700
+
701
+ protected toQueryString(rawQuery?: QueryParamsType): string {
702
+ const query = rawQuery || {};
703
+ const keys = Object.keys(query).filter(
704
+ (key) => "undefined" !== typeof query[key],
705
+ );
706
+ return keys
707
+ .map((key) =>
708
+ Array.isArray(query[key])
709
+ ? this.addArrayQueryParam(query, key)
710
+ : this.addQueryParam(query, key),
711
+ )
712
+ .join("&");
713
+ }
714
+
715
+ protected addQueryParams(rawQuery?: QueryParamsType): string {
716
+ const queryString = this.toQueryString(rawQuery);
717
+ return queryString ? `?${queryString}` : "";
718
+ }
719
+
720
+ private contentFormatters: Record<ContentType, (input: any) => any> = {
721
+ [ContentType.Json]: (input: any) =>
722
+ input !== null && (typeof input === "object" || typeof input === "string")
723
+ ? JSON.stringify(input)
724
+ : input,
725
+ [ContentType.JsonApi]: (input: any) =>
726
+ input !== null && (typeof input === "object" || typeof input === "string")
727
+ ? JSON.stringify(input)
728
+ : input,
729
+ [ContentType.Text]: (input: any) =>
730
+ input !== null && typeof input !== "string"
731
+ ? JSON.stringify(input)
732
+ : input,
733
+ [ContentType.FormData]: (input: any) =>
734
+ Object.keys(input || {}).reduce((formData, key) => {
735
+ const property = input[key];
736
+ formData.append(
737
+ key,
738
+ property instanceof Blob
739
+ ? property
740
+ : typeof property === "object" && property !== null
741
+ ? JSON.stringify(property)
742
+ : `${property}`,
743
+ );
744
+ return formData;
745
+ }, new FormData()),
746
+ [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
747
+ };
748
+
749
+ protected mergeRequestParams(
750
+ params1: RequestParams,
751
+ params2?: RequestParams,
752
+ ): RequestParams {
753
+ return {
754
+ ...this.baseApiParams,
755
+ ...params1,
756
+ ...(params2 || {}),
757
+ headers: {
758
+ ...(this.baseApiParams.headers || {}),
759
+ ...(params1.headers || {}),
760
+ ...((params2 && params2.headers) || {}),
761
+ },
762
+ };
763
+ }
764
+
765
+ protected createAbortSignal = (
766
+ cancelToken: CancelToken,
767
+ ): AbortSignal | undefined => {
768
+ if (this.abortControllers.has(cancelToken)) {
769
+ const abortController = this.abortControllers.get(cancelToken);
770
+ if (abortController) {
771
+ return abortController.signal;
772
+ }
773
+ return void 0;
774
+ }
775
+
776
+ const abortController = new AbortController();
777
+ this.abortControllers.set(cancelToken, abortController);
778
+ return abortController.signal;
779
+ };
780
+
781
+ public abortRequest = (cancelToken: CancelToken) => {
782
+ const abortController = this.abortControllers.get(cancelToken);
783
+
784
+ if (abortController) {
785
+ abortController.abort();
786
+ this.abortControllers.delete(cancelToken);
787
+ }
788
+ };
789
+
790
+ public request = async <T = any, E = any>({
791
+ body,
792
+ secure,
793
+ path,
794
+ type,
795
+ query,
796
+ format,
797
+ baseUrl,
798
+ cancelToken,
799
+ ...params
800
+ }: FullRequestParams): Promise<HttpResponse<T, E>> => {
801
+ const secureParams =
802
+ ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) &&
803
+ this.securityWorker &&
804
+ (await this.securityWorker(this.securityData))) ||
805
+ {};
806
+ const requestParams = this.mergeRequestParams(params, secureParams);
807
+ const queryString = query && this.toQueryString(query);
808
+ const payloadFormatter = this.contentFormatters[type || ContentType.Json];
809
+ const responseFormat = format || requestParams.format;
810
+
811
+ return this.customFetch(
812
+ `${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`,
813
+ {
814
+ ...requestParams,
815
+ headers: {
816
+ ...(requestParams.headers || {}),
817
+ ...(type && type !== ContentType.FormData
818
+ ? { "Content-Type": type }
819
+ : {}),
820
+ },
821
+ signal:
822
+ (cancelToken
823
+ ? this.createAbortSignal(cancelToken)
824
+ : requestParams.signal) || null,
825
+ body:
826
+ typeof body === "undefined" || body === null
827
+ ? null
828
+ : payloadFormatter(body),
829
+ },
830
+ ).then(async (response) => {
831
+ const r = response.clone() as HttpResponse<T, E>;
832
+ r.data = null as unknown as T;
833
+ r.error = null as unknown as E;
834
+
835
+ const data = !responseFormat
836
+ ? r
837
+ : await response[responseFormat]()
838
+ .then((data) => {
839
+ if (r.ok) {
840
+ r.data = data;
841
+ } else {
842
+ r.error = data;
843
+ }
844
+ return r;
845
+ })
846
+ .catch((e) => {
847
+ r.error = e;
848
+ return r;
849
+ });
850
+
851
+ if (cancelToken) {
852
+ this.abortControllers.delete(cancelToken);
853
+ }
854
+
855
+ if (!response.ok) throw data;
856
+ return data;
857
+ });
858
+ };
859
+ }
860
+
861
+ /**
862
+ * @title C4M
863
+ * @version v1
864
+ *
865
+ * The C4M engine's endpoints: pages and their versions, block and menu action types, and menus.
866
+ */
867
+ export class Api<
868
+ SecurityDataType extends unknown,
869
+ > extends HttpClient<SecurityDataType> {
870
+ pages = {
871
+ /**
872
+ * No description
873
+ *
874
+ * @tags Pages
875
+ * @name ArchivePage
876
+ * @summary Archives an unpublished page with no unarchived children, retaining its content and history.
877
+ * @request POST:/pages/{id}/archive
878
+ */
879
+ archivePage: (id: string, params: RequestParams = {}) =>
880
+ this.request<void, void | PageLifecycleConflict>({
881
+ path: `/pages/${id}/archive`,
882
+ method: "POST",
883
+ ...params,
884
+ }),
885
+
886
+ /**
887
+ * @description Creates a new page with the specified content blocks, optionally leaving its initial version as a draft.
888
+ *
889
+ * @tags Pages
890
+ * @name CreatePage
891
+ * @summary Creates a new page.
892
+ * @request POST:/pages
893
+ */
894
+ createPage: (data: CreatePageRequest, params: RequestParams = {}) =>
895
+ this.request<CreatePageResponse, void | ErrorResponse>({
896
+ path: `/pages`,
897
+ method: "POST",
898
+ body: data,
899
+ type: ContentType.Json,
900
+ format: "json",
901
+ ...params,
902
+ }),
903
+
904
+ /**
905
+ * @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.
906
+ *
907
+ * @tags Pages
908
+ * @name ListPages
909
+ * @summary Lists pages with pagination, sorting, and filtering.
910
+ * @request GET:/pages
911
+ */
912
+ listPages: (
913
+ query?: {
914
+ /**
915
+ * @format int32
916
+ * @default 20
917
+ */
918
+ limit?: number;
919
+ /**
920
+ * @format int32
921
+ * @default 0
922
+ */
923
+ offset?: number;
924
+ /** @default 0 */
925
+ sort?: ListPagesSort;
926
+ slugFilter?: string | null;
927
+ /** @default 0 */
928
+ slugFilterType?: ListPagesStringFilterType;
929
+ pathFilter?: string | null;
930
+ /** @default 0 */
931
+ pathFilterType?: ListPagesStringFilterType;
932
+ /** @format date-time */
933
+ createdAfter?: string | null;
934
+ /** @format date-time */
935
+ createdBefore?: string | null;
936
+ /** @format date-time */
937
+ updatedAfter?: string | null;
938
+ /** @format date-time */
939
+ updatedBefore?: string | null;
940
+ search?: string | null;
941
+ /** @format uuid */
942
+ parentId?: string | null;
943
+ /** @default false */
944
+ publishedOnly?: boolean;
945
+ /** @default 0 */
946
+ status?: ListPagesStatus;
947
+ },
948
+ params: RequestParams = {},
949
+ ) =>
950
+ this.request<ListPagesResponse, void>({
951
+ path: `/pages`,
952
+ method: "GET",
953
+ query: query,
954
+ format: "json",
955
+ ...params,
956
+ }),
957
+
958
+ /**
959
+ * @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.
960
+ *
961
+ * @tags Pages
962
+ * @name GetPage
963
+ * @summary Gets a page by ID.
964
+ * @request GET:/pages/{id}
965
+ */
966
+ getPage: (
967
+ id: string,
968
+ query?: {
969
+ /** @default false */
970
+ latest?: boolean;
971
+ /** @default false */
972
+ includeBreadcrumbs?: boolean;
973
+ /** @default false */
974
+ includeArchived?: boolean;
975
+ },
976
+ params: RequestParams = {},
977
+ ) =>
978
+ this.request<GetPageResponse, ErrorResponse>({
979
+ path: `/pages/${id}`,
980
+ method: "GET",
981
+ query: query,
982
+ format: "json",
983
+ ...params,
984
+ }),
985
+
986
+ /**
987
+ * No description
988
+ *
989
+ * @tags Pages
990
+ * @name UpdatePage
991
+ * @summary Creates a content and SEO draft without changing page details or publication.
992
+ * @request PUT:/pages/{id}
993
+ */
994
+ updatePage: (
995
+ id: string,
996
+ data: UpdatePageRequest,
997
+ params: RequestParams = {},
998
+ ) =>
999
+ this.request<UpdatePageResponse, ErrorResponse | PageDraftConflict>({
1000
+ path: `/pages/${id}`,
1001
+ method: "PUT",
1002
+ body: data,
1003
+ type: ContentType.Json,
1004
+ format: "json",
1005
+ ...params,
1006
+ }),
1007
+
1008
+ /**
1009
+ * @description Retrieves a specific page by path including all related blocks. Returns the current version of the page.
1010
+ *
1011
+ * @tags Pages
1012
+ * @name GetPageByPath
1013
+ * @summary Gets a page by path.
1014
+ * @request GET:/pages/by-path
1015
+ */
1016
+ getPageByPath: (
1017
+ query: {
1018
+ path: string;
1019
+ },
1020
+ params: RequestParams = {},
1021
+ ) =>
1022
+ this.request<GetPageResponse, ErrorResponse>({
1023
+ path: `/pages/by-path`,
1024
+ method: "GET",
1025
+ query: query,
1026
+ format: "json",
1027
+ ...params,
1028
+ }),
1029
+
1030
+ /**
1031
+ * @description Retrieves a specific page by its version identifier including all related blocks.
1032
+ *
1033
+ * @tags Pages
1034
+ * @name GetPageByVersion
1035
+ * @summary Gets a page by version.
1036
+ * @request GET:/pages/by-version/{id}
1037
+ */
1038
+ getPageByVersion: (
1039
+ id: string,
1040
+ query?: {
1041
+ /** @default false */
1042
+ includeBreadcrumbs?: boolean;
1043
+ /** @default false */
1044
+ includeArchived?: boolean;
1045
+ },
1046
+ params: RequestParams = {},
1047
+ ) =>
1048
+ this.request<GetPageResponse, ErrorResponse>({
1049
+ path: `/pages/by-version/${id}`,
1050
+ method: "GET",
1051
+ query: query,
1052
+ format: "json",
1053
+ ...params,
1054
+ }),
1055
+
1056
+ /**
1057
+ * @description Sets the specified page version as the current version and unsets the previous current version.
1058
+ *
1059
+ * @tags Pages
1060
+ * @name UpdateCurrentPageVersion
1061
+ * @summary Sets a page version as current.
1062
+ * @request PUT:/pages/by-version/{id}
1063
+ */
1064
+ updateCurrentPageVersion: (
1065
+ id: string,
1066
+ data: PagePublicationRequest,
1067
+ params: RequestParams = {},
1068
+ ) =>
1069
+ this.request<UpdateCurrentPageVersionResponse, ErrorResponse>({
1070
+ path: `/pages/by-version/${id}`,
1071
+ method: "PUT",
1072
+ body: data,
1073
+ type: ContentType.Json,
1074
+ format: "json",
1075
+ ...params,
1076
+ }),
1077
+
1078
+ /**
1079
+ * @description Retrieves the complete version history for a specific page, including high-level change summaries.
1080
+ *
1081
+ * @tags Pages
1082
+ * @name GetPageHistory
1083
+ * @summary Gets page version history by page ID.
1084
+ * @request GET:/pages/{id}/history
1085
+ */
1086
+ getPageHistory: (
1087
+ id: string,
1088
+ query?: {
1089
+ /** @default false */
1090
+ includeArchived?: boolean;
1091
+ },
1092
+ params: RequestParams = {},
1093
+ ) =>
1094
+ this.request<GetPageHistoryResponse, ErrorResponse>({
1095
+ path: `/pages/${id}/history`,
1096
+ method: "GET",
1097
+ query: query,
1098
+ format: "json",
1099
+ ...params,
1100
+ }),
1101
+
1102
+ /**
1103
+ * @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.
1104
+ *
1105
+ * @tags Pages
1106
+ * @name GetPagePath
1107
+ * @summary Gets a page path by ID.
1108
+ * @request GET:/pages/{id}/path
1109
+ */
1110
+ getPagePath: (id: string, params: RequestParams = {}) =>
1111
+ this.request<GetPagePathResponse, ErrorResponse>({
1112
+ path: `/pages/${id}/path`,
1113
+ method: "GET",
1114
+ format: "json",
1115
+ ...params,
1116
+ }),
1117
+
1118
+ /**
1119
+ * @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.
1120
+ *
1121
+ * @tags Pages
1122
+ * @name GetPagePathAvailability
1123
+ * @summary Checks whether a page path is available.
1124
+ * @request GET:/pages/path-availability
1125
+ */
1126
+ getPagePathAvailability: (
1127
+ query: {
1128
+ slug: string;
1129
+ /** @format uuid */
1130
+ parentId?: string | null;
1131
+ /** @format uuid */
1132
+ pageId?: string | null;
1133
+ },
1134
+ params: RequestParams = {},
1135
+ ) =>
1136
+ this.request<GetPagePathAvailabilityResponse, void>({
1137
+ path: `/pages/path-availability`,
1138
+ method: "GET",
1139
+ query: query,
1140
+ format: "json",
1141
+ ...params,
1142
+ }),
1143
+
1144
+ /**
1145
+ * No description
1146
+ *
1147
+ * @tags Pages
1148
+ * @name PublishPage
1149
+ * @summary Publishes the saved Current version of a page.
1150
+ * @request POST:/pages/{id}/publish
1151
+ */
1152
+ publishPage: (
1153
+ id: string,
1154
+ data: PagePublicationRequest,
1155
+ params: RequestParams = {},
1156
+ ) =>
1157
+ this.request<void, void>({
1158
+ path: `/pages/${id}/publish`,
1159
+ method: "POST",
1160
+ body: data,
1161
+ type: ContentType.Json,
1162
+ ...params,
1163
+ }),
1164
+
1165
+ /**
1166
+ * No description
1167
+ *
1168
+ * @tags Pages
1169
+ * @name ReparentPageChildren
1170
+ * @summary Moves all unarchived direct children and their subtrees to another parent or the top level.
1171
+ * @request POST:/pages/{id}/reparent-children
1172
+ */
1173
+ reparentPageChildren: (
1174
+ id: string,
1175
+ data: ReparentPageChildrenRequest,
1176
+ params: RequestParams = {},
1177
+ ) =>
1178
+ this.request<ReparentPageChildrenResponse, void | PageLifecycleConflict>({
1179
+ path: `/pages/${id}/reparent-children`,
1180
+ method: "POST",
1181
+ body: data,
1182
+ type: ContentType.Json,
1183
+ format: "json",
1184
+ ...params,
1185
+ }),
1186
+
1187
+ /**
1188
+ * No description
1189
+ *
1190
+ * @tags Pages
1191
+ * @name UnpublishPage
1192
+ * @summary Unpublishes a page unless published pages or menus reference it.
1193
+ * @request POST:/pages/{id}/unpublish
1194
+ */
1195
+ unpublishPage: (
1196
+ id: string,
1197
+ data: PagePublicationRequest,
1198
+ params: RequestParams = {},
1199
+ ) =>
1200
+ this.request<void, void | UnpublishPageConflict>({
1201
+ path: `/pages/${id}/unpublish`,
1202
+ method: "POST",
1203
+ body: data,
1204
+ type: ContentType.Json,
1205
+ ...params,
1206
+ }),
1207
+
1208
+ /**
1209
+ * No description
1210
+ *
1211
+ * @tags Pages
1212
+ * @name UpdatePageDetails
1213
+ * @summary Updates unversioned page details without creating a content version.
1214
+ * @request PUT:/pages/{id}/details
1215
+ */
1216
+ updatePageDetails: (
1217
+ id: string,
1218
+ data: UpdatePageDetailsRequest,
1219
+ params: RequestParams = {},
1220
+ ) =>
1221
+ this.request<GetPageResponse, ErrorResponse | ConflictResponse>({
1222
+ path: `/pages/${id}/details`,
1223
+ method: "PUT",
1224
+ body: data,
1225
+ type: ContentType.Json,
1226
+ format: "json",
1227
+ ...params,
1228
+ }),
1229
+ };
1230
+ navigationSettings = {
1231
+ /**
1232
+ * @description Retrieves the default navigation and footer menu selections.
1233
+ *
1234
+ * @tags Navigation-Settings
1235
+ * @name GetNavigationSettings
1236
+ * @summary Gets navigation settings.
1237
+ * @request GET:/navigation-settings
1238
+ */
1239
+ getNavigationSettings: (params: RequestParams = {}) =>
1240
+ this.request<NavigationSettingsResponse, any>({
1241
+ path: `/navigation-settings`,
1242
+ method: "GET",
1243
+ format: "json",
1244
+ ...params,
1245
+ }),
1246
+
1247
+ /**
1248
+ * @description Changes the default navigation and footer menus immediately.
1249
+ *
1250
+ * @tags Navigation-Settings
1251
+ * @name UpdateNavigationSettings
1252
+ * @summary Updates navigation settings.
1253
+ * @request PUT:/navigation-settings
1254
+ */
1255
+ updateNavigationSettings: (
1256
+ data: UpdateNavigationSettingsRequest,
1257
+ params: RequestParams = {},
1258
+ ) =>
1259
+ this.request<
1260
+ NavigationSettingsResponse,
1261
+ ErrorResponse | ConflictResponse
1262
+ >({
1263
+ path: `/navigation-settings`,
1264
+ method: "PUT",
1265
+ body: data,
1266
+ type: ContentType.Json,
1267
+ format: "json",
1268
+ ...params,
1269
+ }),
1270
+ };
1271
+ menuActionTypes = {
1272
+ /**
1273
+ * @description Adds a new menu action type to the system.
1274
+ *
1275
+ * @tags Menu-Action-Types
1276
+ * @name CreateMenuActionType
1277
+ * @summary Creates a new menu action type.
1278
+ * @request POST:/menu-action-types
1279
+ */
1280
+ createMenuActionType: (
1281
+ data: CreateCmsTypeDescriptorRequest,
1282
+ params: RequestParams = {},
1283
+ ) =>
1284
+ this.request<CreateCmsTypeDescriptorResponse, void | ErrorResponse>({
1285
+ path: `/menu-action-types`,
1286
+ method: "POST",
1287
+ body: data,
1288
+ type: ContentType.Json,
1289
+ format: "json",
1290
+ ...params,
1291
+ }),
1292
+
1293
+ /**
1294
+ * @description Retrieves all available menu action types with their schemas.
1295
+ *
1296
+ * @tags Menu-Action-Types
1297
+ * @name ListMenuActionTypes
1298
+ * @summary Lists all menu action types.
1299
+ * @request GET:/menu-action-types
1300
+ */
1301
+ listMenuActionTypes: (params: RequestParams = {}) =>
1302
+ this.request<ListMenuActionTypesResponse, any>({
1303
+ path: `/menu-action-types`,
1304
+ method: "GET",
1305
+ format: "json",
1306
+ ...params,
1307
+ }),
1308
+
1309
+ /**
1310
+ * @description Retrieves a menu action type including its JSON schema for validation.
1311
+ *
1312
+ * @tags Menu-Action-Types
1313
+ * @name GetMenuActionType
1314
+ * @summary Gets a menu action type by ID.
1315
+ * @request GET:/menu-action-types/{id}
1316
+ */
1317
+ getMenuActionType: (id: string, params: RequestParams = {}) =>
1318
+ this.request<CmsTypeDescriptor, ErrorResponse>({
1319
+ path: `/menu-action-types/${id}`,
1320
+ method: "GET",
1321
+ format: "json",
1322
+ ...params,
1323
+ }),
1324
+
1325
+ /**
1326
+ * @description Retrieves a specific menu action type from the system by its name. If version is not specified, returns the latest version.
1327
+ *
1328
+ * @tags Menu-Action-Types
1329
+ * @name GetMenuActionTypeByName
1330
+ * @summary Gets a menu action type by name.
1331
+ * @request GET:/menu-action-types/by-name/{name}
1332
+ */
1333
+ getMenuActionTypeByName: (
1334
+ name: string,
1335
+ query?: {
1336
+ /** @format int32 */
1337
+ version?: number | null;
1338
+ },
1339
+ params: RequestParams = {},
1340
+ ) =>
1341
+ this.request<CmsTypeDescriptor, void>({
1342
+ path: `/menu-action-types/by-name/${name}`,
1343
+ method: "GET",
1344
+ query: query,
1345
+ format: "json",
1346
+ ...params,
1347
+ }),
1348
+ };
1349
+ menus = {
1350
+ /**
1351
+ * @description Adds a new menu with optional menu items to the system.
1352
+ *
1353
+ * @tags Menus
1354
+ * @name CreateMenu
1355
+ * @summary Creates a new menu.
1356
+ * @request POST:/menus
1357
+ */
1358
+ createMenu: (data: CreateMenuRequest, params: RequestParams = {}) =>
1359
+ this.request<CreateMenuResponse, void | ErrorResponse>({
1360
+ path: `/menus`,
1361
+ method: "POST",
1362
+ body: data,
1363
+ type: ContentType.Json,
1364
+ format: "json",
1365
+ ...params,
1366
+ }),
1367
+
1368
+ /**
1369
+ * @description Retrieves a paginated list of menus.
1370
+ *
1371
+ * @tags Menus
1372
+ * @name ListMenus
1373
+ * @summary Lists menus.
1374
+ * @request GET:/menus
1375
+ */
1376
+ listMenus: (
1377
+ query?: {
1378
+ /**
1379
+ * @format int32
1380
+ * @default 20
1381
+ */
1382
+ limit?: number;
1383
+ /**
1384
+ * @format int32
1385
+ * @default 0
1386
+ */
1387
+ offset?: number;
1388
+ },
1389
+ params: RequestParams = {},
1390
+ ) =>
1391
+ this.request<ListMenusResponse, ErrorResponse>({
1392
+ path: `/menus`,
1393
+ method: "GET",
1394
+ query: query,
1395
+ format: "json",
1396
+ ...params,
1397
+ }),
1398
+
1399
+ /**
1400
+ * @description Retrieves the menu configured as the site-wide navigation fallback.
1401
+ *
1402
+ * @tags Menus
1403
+ * @name GetDefaultMenu
1404
+ * @summary Gets the default navigation menu.
1405
+ * @request GET:/menus/default
1406
+ */
1407
+ getDefaultMenu: (params: RequestParams = {}) =>
1408
+ this.request<GetMenuResponse, ErrorResponse>({
1409
+ path: `/menus/default`,
1410
+ method: "GET",
1411
+ format: "json",
1412
+ ...params,
1413
+ }),
1414
+
1415
+ /**
1416
+ * @description Retrieves the menu configured for the site-wide footer.
1417
+ *
1418
+ * @tags Menus
1419
+ * @name GetFooterMenu
1420
+ * @summary Gets the footer menu.
1421
+ * @request GET:/menus/footer
1422
+ */
1423
+ getFooterMenu: (params: RequestParams = {}) =>
1424
+ this.request<GetMenuResponse, ErrorResponse>({
1425
+ path: `/menus/footer`,
1426
+ method: "GET",
1427
+ format: "json",
1428
+ ...params,
1429
+ }),
1430
+
1431
+ /**
1432
+ * @description Retrieves a menu with its hierarchical structure of menu items.
1433
+ *
1434
+ * @tags Menus
1435
+ * @name GetMenu
1436
+ * @summary Gets a menu by ID.
1437
+ * @request GET:/menus/{id}
1438
+ */
1439
+ getMenu: (id: string, params: RequestParams = {}) =>
1440
+ this.request<GetMenuResponse, ErrorResponse>({
1441
+ path: `/menus/${id}`,
1442
+ method: "GET",
1443
+ format: "json",
1444
+ ...params,
1445
+ }),
1446
+
1447
+ /**
1448
+ * @description Replaces all menu items with the provided tree structure.
1449
+ *
1450
+ * @tags Menus
1451
+ * @name UpdateMenu
1452
+ * @summary Updates an existing menu.
1453
+ * @request PUT:/menus/{menuId}
1454
+ */
1455
+ updateMenu: (
1456
+ menuId: string,
1457
+ data: UpdateMenuRequest,
1458
+ params: RequestParams = {},
1459
+ ) =>
1460
+ this.request<void, void | ErrorResponse>({
1461
+ path: `/menus/${menuId}`,
1462
+ method: "PUT",
1463
+ body: data,
1464
+ type: ContentType.Json,
1465
+ ...params,
1466
+ }),
1467
+ };
1468
+ blockTypes = {
1469
+ /**
1470
+ * @description Adds a new block type to the system.
1471
+ *
1472
+ * @tags Block-Types
1473
+ * @name CreateBlockType
1474
+ * @summary Creates a new block type.
1475
+ * @request POST:/block-types
1476
+ */
1477
+ createBlockType: (
1478
+ data: CreateCmsTypeDescriptorRequest,
1479
+ params: RequestParams = {},
1480
+ ) =>
1481
+ this.request<CreateCmsTypeDescriptorResponse, void | ErrorResponse>({
1482
+ path: `/block-types`,
1483
+ method: "POST",
1484
+ body: data,
1485
+ type: ContentType.Json,
1486
+ format: "json",
1487
+ ...params,
1488
+ }),
1489
+
1490
+ /**
1491
+ * @description Retrieves a paginated list of block types grouped by name. All versions of each block type are included together.
1492
+ *
1493
+ * @tags Block-Types
1494
+ * @name ListBlockTypes
1495
+ * @summary Lists block types with pagination.
1496
+ * @request GET:/block-types
1497
+ */
1498
+ listBlockTypes: (
1499
+ query?: {
1500
+ /**
1501
+ * @format int32
1502
+ * @default 0
1503
+ */
1504
+ offset?: number;
1505
+ /**
1506
+ * @format int32
1507
+ * @default 50
1508
+ */
1509
+ limit?: number;
1510
+ },
1511
+ params: RequestParams = {},
1512
+ ) =>
1513
+ this.request<ListBlockTypesResponse, void>({
1514
+ path: `/block-types`,
1515
+ method: "GET",
1516
+ query: query,
1517
+ format: "json",
1518
+ ...params,
1519
+ }),
1520
+
1521
+ /**
1522
+ * @description Retrieves a specific block type from the system.
1523
+ *
1524
+ * @tags Block-Types
1525
+ * @name GetBlockType
1526
+ * @summary Gets a block type by ID.
1527
+ * @request GET:/block-types/{id}
1528
+ */
1529
+ getBlockType: (id: string, params: RequestParams = {}) =>
1530
+ this.request<CmsTypeDescriptor, void>({
1531
+ path: `/block-types/${id}`,
1532
+ method: "GET",
1533
+ format: "json",
1534
+ ...params,
1535
+ }),
1536
+
1537
+ /**
1538
+ * @description Retrieves a specific block type from the system by its name. If version is not specified, returns the latest version.
1539
+ *
1540
+ * @tags Block-Types
1541
+ * @name GetBlockTypeByName
1542
+ * @summary Gets a block type by name.
1543
+ * @request GET:/block-types/by-name/{name}
1544
+ */
1545
+ getBlockTypeByName: (
1546
+ name: string,
1547
+ query?: {
1548
+ /** @format int32 */
1549
+ version?: number | null;
1550
+ },
1551
+ params: RequestParams = {},
1552
+ ) =>
1553
+ this.request<CmsTypeDescriptor, void>({
1554
+ path: `/block-types/by-name/${name}`,
1555
+ method: "GET",
1556
+ query: query,
1557
+ format: "json",
1558
+ ...params,
1559
+ }),
1560
+ };
1561
+ }