@remkoj/optimizely-cms-api 5.1.0 → 6.0.0-pre1
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/dist/api-client.d.ts +53 -10
- package/dist/api-client.js +142 -42
- package/dist/client/client/client.d.ts +2 -0
- package/dist/client/client/client.js +147 -0
- package/dist/client/client/index.d.ts +7 -0
- package/dist/client/client/index.js +14 -0
- package/dist/client/client/types.d.ts +119 -0
- package/dist/client/client/utils.d.ts +45 -0
- package/dist/client/client/utils.js +296 -0
- package/dist/client/client.gen.d.ts +12 -0
- package/dist/client/client.gen.js +9 -0
- package/dist/client/core/auth.d.ts +18 -0
- package/dist/client/core/auth.js +17 -0
- package/dist/client/core/bodySerializer.d.ts +17 -0
- package/dist/client/core/bodySerializer.js +56 -0
- package/dist/client/core/params.d.ts +23 -0
- package/dist/client/core/params.js +91 -0
- package/dist/client/core/pathSerializer.d.ts +33 -0
- package/dist/client/core/pathSerializer.js +122 -0
- package/dist/client/core/types.d.ts +73 -0
- package/dist/client/index.d.ts +4 -78
- package/dist/client/index.js +19 -46
- package/dist/client/sdk.gen.d.ts +256 -0
- package/dist/client/sdk.gen.js +638 -0
- package/dist/client/transformers.gen.d.ts +34 -0
- package/dist/client/transformers.gen.js +273 -0
- package/dist/client/types.gen.d.ts +2941 -0
- package/dist/client/types.gen.js +87 -0
- package/dist/client-config.d.ts +2 -0
- package/dist/client-config.js +27 -0
- package/dist/config.js +1 -2
- package/dist/getaccesstoken.js +1 -2
- package/dist/index.d.ts +3 -5
- package/dist/index.js +6 -8
- package/dist/version.json +2 -2
- package/package.json +18 -9
- package/dist/client/CmsIntegrationApiClient.d.ts +0 -22
- package/dist/client/CmsIntegrationApiClient.js +0 -34
- package/dist/client/core/ApiError.d.ts +0 -10
- package/dist/client/core/ApiError.js +0 -15
- package/dist/client/core/ApiRequestOptions.d.ts +0 -13
- package/dist/client/core/ApiResult.d.ts +0 -7
- package/dist/client/core/BaseHttpRequest.d.ts +0 -8
- package/dist/client/core/BaseHttpRequest.js +0 -9
- package/dist/client/core/CancelablePromise.d.ts +0 -20
- package/dist/client/core/CancelablePromise.js +0 -116
- package/dist/client/core/FetchHttpRequest.d.ts +0 -14
- package/dist/client/core/FetchHttpRequest.js +0 -20
- package/dist/client/core/OpenAPI.d.ts +0 -16
- package/dist/client/core/OpenAPI.js +0 -14
- package/dist/client/core/request.d.ts +0 -30
- package/dist/client/core/request.js +0 -294
- package/dist/client/models/BinaryProperty.d.ts +0 -8
- package/dist/client/models/BinaryProperty.js +0 -2
- package/dist/client/models/BooleanProperty.d.ts +0 -5
- package/dist/client/models/BooleanProperty.js +0 -2
- package/dist/client/models/Changeset.d.ts +0 -26
- package/dist/client/models/Changeset.js +0 -2
- package/dist/client/models/ChangesetItem.d.ts +0 -11
- package/dist/client/models/ChangesetItem.js +0 -2
- package/dist/client/models/ChangesetItemPage.d.ts +0 -19
- package/dist/client/models/ChangesetItemPage.js +0 -2
- package/dist/client/models/ChangesetPage.d.ts +0 -19
- package/dist/client/models/ChangesetPage.js +0 -2
- package/dist/client/models/ComponentListItem.d.ts +0 -10
- package/dist/client/models/ComponentListItem.js +0 -2
- package/dist/client/models/ComponentProperty.d.ts +0 -10
- package/dist/client/models/ComponentProperty.js +0 -2
- package/dist/client/models/CompositionBehavior.d.ts +0 -7
- package/dist/client/models/CompositionBehavior.js +0 -15
- package/dist/client/models/ContentBaseType.d.ts +0 -14
- package/dist/client/models/ContentBaseType.js +0 -22
- package/dist/client/models/ContentComponent.d.ts +0 -30
- package/dist/client/models/ContentComponent.js +0 -2
- package/dist/client/models/ContentItem.d.ts +0 -60
- package/dist/client/models/ContentItem.js +0 -2
- package/dist/client/models/ContentItemListWithContentTypes.d.ts +0 -27
- package/dist/client/models/ContentItemListWithContentTypes.js +0 -2
- package/dist/client/models/ContentItemPage.d.ts +0 -19
- package/dist/client/models/ContentItemPage.js +0 -2
- package/dist/client/models/ContentItemWithContentTypes.d.ts +0 -12
- package/dist/client/models/ContentItemWithContentTypes.js +0 -2
- package/dist/client/models/ContentListItem.d.ts +0 -14
- package/dist/client/models/ContentListItem.js +0 -2
- package/dist/client/models/ContentLocaleInfo.d.ts +0 -19
- package/dist/client/models/ContentLocaleInfo.js +0 -2
- package/dist/client/models/ContentMetadata.d.ts +0 -38
- package/dist/client/models/ContentMetadata.js +0 -2
- package/dist/client/models/ContentMetadataPage.d.ts +0 -19
- package/dist/client/models/ContentMetadataPage.js +0 -2
- package/dist/client/models/ContentProperty.d.ts +0 -14
- package/dist/client/models/ContentProperty.js +0 -2
- package/dist/client/models/ContentReference.d.ts +0 -17
- package/dist/client/models/ContentReference.js +0 -2
- package/dist/client/models/ContentReferenceListItem.d.ts +0 -14
- package/dist/client/models/ContentReferenceListItem.js +0 -2
- package/dist/client/models/ContentReferenceProperty.d.ts +0 -14
- package/dist/client/models/ContentReferenceProperty.js +0 -2
- package/dist/client/models/ContentType.d.ts +0 -84
- package/dist/client/models/ContentType.js +0 -2
- package/dist/client/models/ContentTypeFeature.d.ts +0 -10
- package/dist/client/models/ContentTypeFeature.js +0 -18
- package/dist/client/models/ContentTypePage.d.ts +0 -19
- package/dist/client/models/ContentTypePage.js +0 -2
- package/dist/client/models/ContentTypeProperty.d.ts +0 -47
- package/dist/client/models/ContentTypeProperty.js +0 -2
- package/dist/client/models/ContentTypeUsage.d.ts +0 -7
- package/dist/client/models/ContentTypeUsage.js +0 -15
- package/dist/client/models/CopyContentOptions.d.ts +0 -21
- package/dist/client/models/CopyContentOptions.js +0 -2
- package/dist/client/models/DateTimeListItem.d.ts +0 -14
- package/dist/client/models/DateTimeListItem.js +0 -2
- package/dist/client/models/DateTimeProperty.d.ts +0 -14
- package/dist/client/models/DateTimeProperty.js +0 -2
- package/dist/client/models/DisplaySetting.d.ts +0 -22
- package/dist/client/models/DisplaySetting.js +0 -2
- package/dist/client/models/DisplaySettingChoice.d.ts +0 -13
- package/dist/client/models/DisplaySettingChoice.js +0 -2
- package/dist/client/models/DisplayTemplate.d.ts +0 -49
- package/dist/client/models/DisplayTemplate.js +0 -2
- package/dist/client/models/DisplayTemplatePage.d.ts +0 -19
- package/dist/client/models/DisplayTemplatePage.js +0 -2
- package/dist/client/models/DoubleEnumerationSettings.d.ts +0 -10
- package/dist/client/models/DoubleEnumerationSettings.js +0 -2
- package/dist/client/models/DoubleEnumerationValue.d.ts +0 -13
- package/dist/client/models/DoubleEnumerationValue.js +0 -2
- package/dist/client/models/FloatListItem.d.ts +0 -16
- package/dist/client/models/FloatListItem.js +0 -2
- package/dist/client/models/FloatProperty.d.ts +0 -16
- package/dist/client/models/FloatProperty.js +0 -2
- package/dist/client/models/ImageDescriptor.d.ts +0 -17
- package/dist/client/models/ImageDescriptor.js +0 -2
- package/dist/client/models/IndexingType.d.ts +0 -8
- package/dist/client/models/IndexingType.js +0 -16
- package/dist/client/models/Int32EnumerationSettings.d.ts +0 -10
- package/dist/client/models/Int32EnumerationSettings.js +0 -2
- package/dist/client/models/Int32EnumerationValue.d.ts +0 -13
- package/dist/client/models/Int32EnumerationValue.js +0 -2
- package/dist/client/models/IntegerListItem.d.ts +0 -16
- package/dist/client/models/IntegerListItem.js +0 -2
- package/dist/client/models/IntegerProperty.d.ts +0 -16
- package/dist/client/models/IntegerProperty.js +0 -2
- package/dist/client/models/JsonStringProperty.d.ts +0 -5
- package/dist/client/models/JsonStringProperty.js +0 -2
- package/dist/client/models/ListProperty.d.ts +0 -26
- package/dist/client/models/ListProperty.js +0 -2
- package/dist/client/models/ListPropertyItem.d.ts +0 -11
- package/dist/client/models/ListPropertyItem.js +0 -2
- package/dist/client/models/LocaleStatus.d.ts +0 -7
- package/dist/client/models/LocaleStatus.js +0 -15
- package/dist/client/models/OauthToken.d.ts +0 -18
- package/dist/client/models/OauthToken.js +0 -2
- package/dist/client/models/OauthTokenError.d.ts +0 -13
- package/dist/client/models/OauthTokenError.js +0 -2
- package/dist/client/models/OauthTokenRequest.d.ts +0 -21
- package/dist/client/models/OauthTokenRequest.js +0 -2
- package/dist/client/models/ProblemDetails.d.ts +0 -1
- package/dist/client/models/ProblemDetails.js +0 -2
- package/dist/client/models/PropertyDataType.d.ts +0 -18
- package/dist/client/models/PropertyDataType.js +0 -26
- package/dist/client/models/PropertyFormat.d.ts +0 -37
- package/dist/client/models/PropertyFormat.js +0 -2
- package/dist/client/models/PropertyFormatPage.d.ts +0 -19
- package/dist/client/models/PropertyFormatPage.js +0 -2
- package/dist/client/models/PropertyGroup.d.ts +0 -21
- package/dist/client/models/PropertyGroup.js +0 -2
- package/dist/client/models/PropertyGroupPage.d.ts +0 -19
- package/dist/client/models/PropertyGroupPage.js +0 -2
- package/dist/client/models/StringEnumerationSettings.d.ts +0 -10
- package/dist/client/models/StringEnumerationSettings.js +0 -2
- package/dist/client/models/StringEnumerationValue.d.ts +0 -13
- package/dist/client/models/StringEnumerationValue.js +0 -2
- package/dist/client/models/StringListItem.d.ts +0 -20
- package/dist/client/models/StringListItem.js +0 -2
- package/dist/client/models/StringProperty.d.ts +0 -20
- package/dist/client/models/StringProperty.js +0 -2
- package/dist/client/models/UrlListItem.d.ts +0 -5
- package/dist/client/models/UrlListItem.js +0 -2
- package/dist/client/models/UrlProperty.d.ts +0 -5
- package/dist/client/models/UrlProperty.js +0 -2
- package/dist/client/models/VersionStatus.d.ts +0 -12
- package/dist/client/models/VersionStatus.js +0 -20
- package/dist/client/services/ChangesetsService.d.ts +0 -105
- package/dist/client/services/ChangesetsService.js +0 -239
- package/dist/client/services/ContentService.d.ts +0 -172
- package/dist/client/services/ContentService.js +0 -409
- package/dist/client/services/ContentTypesService.d.ts +0 -66
- package/dist/client/services/ContentTypesService.js +0 -149
- package/dist/client/services/DisplayTemplatesService.d.ts +0 -60
- package/dist/client/services/DisplayTemplatesService.js +0 -135
- package/dist/client/services/OauthService.d.ts +0 -17
- package/dist/client/services/OauthService.js +0 -28
- package/dist/client/services/PropertyFormatsService.d.ts +0 -26
- package/dist/client/services/PropertyFormatsService.js +0 -53
- package/dist/client/services/PropertyGroupsService.d.ts +0 -61
- package/dist/client/services/PropertyGroupsService.js +0 -135
- /package/dist/client/{core/ApiRequestOptions.js → client/types.js} +0 -0
- /package/dist/client/core/{ApiResult.js → types.js} +0 -0
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.request = exports.catchErrorCodes = exports.getResponseBody = exports.getResponseHeader = exports.sendRequest = exports.getRequestBody = exports.getHeaders = exports.resolve = exports.getFormData = exports.getQueryString = exports.base64 = exports.isFormData = exports.isBlob = exports.isStringWithValue = exports.isString = exports.isDefined = void 0;
|
|
4
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
5
|
-
/* istanbul ignore file */
|
|
6
|
-
/* tslint:disable */
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
const ApiError_1 = require("./ApiError");
|
|
9
|
-
const CancelablePromise_1 = require("./CancelablePromise");
|
|
10
|
-
const isDefined = (value) => {
|
|
11
|
-
return value !== undefined && value !== null;
|
|
12
|
-
};
|
|
13
|
-
exports.isDefined = isDefined;
|
|
14
|
-
const isString = (value) => {
|
|
15
|
-
return typeof value === 'string';
|
|
16
|
-
};
|
|
17
|
-
exports.isString = isString;
|
|
18
|
-
const isStringWithValue = (value) => {
|
|
19
|
-
return (0, exports.isString)(value) && value !== '';
|
|
20
|
-
};
|
|
21
|
-
exports.isStringWithValue = isStringWithValue;
|
|
22
|
-
const isBlob = (value) => {
|
|
23
|
-
return (typeof value === 'object' &&
|
|
24
|
-
typeof value.type === 'string' &&
|
|
25
|
-
typeof value.stream === 'function' &&
|
|
26
|
-
typeof value.arrayBuffer === 'function' &&
|
|
27
|
-
typeof value.constructor === 'function' &&
|
|
28
|
-
typeof value.constructor.name === 'string' &&
|
|
29
|
-
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
30
|
-
/^(Blob|File)$/.test(value[Symbol.toStringTag]));
|
|
31
|
-
};
|
|
32
|
-
exports.isBlob = isBlob;
|
|
33
|
-
const isFormData = (value) => {
|
|
34
|
-
return value instanceof FormData;
|
|
35
|
-
};
|
|
36
|
-
exports.isFormData = isFormData;
|
|
37
|
-
const base64 = (str) => {
|
|
38
|
-
try {
|
|
39
|
-
return btoa(str);
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
// @ts-ignore
|
|
43
|
-
return Buffer.from(str).toString('base64');
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
exports.base64 = base64;
|
|
47
|
-
const getQueryString = (params) => {
|
|
48
|
-
const qs = [];
|
|
49
|
-
const append = (key, value) => {
|
|
50
|
-
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
51
|
-
};
|
|
52
|
-
const process = (key, value) => {
|
|
53
|
-
if ((0, exports.isDefined)(value)) {
|
|
54
|
-
if (Array.isArray(value)) {
|
|
55
|
-
value.forEach(v => {
|
|
56
|
-
process(key, v);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
else if (typeof value === 'object') {
|
|
60
|
-
Object.entries(value).forEach(([k, v]) => {
|
|
61
|
-
process(`${key}[${k}]`, v);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
append(key, value);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
70
|
-
process(key, value);
|
|
71
|
-
});
|
|
72
|
-
if (qs.length > 0) {
|
|
73
|
-
return `?${qs.join('&')}`;
|
|
74
|
-
}
|
|
75
|
-
return '';
|
|
76
|
-
};
|
|
77
|
-
exports.getQueryString = getQueryString;
|
|
78
|
-
const getUrl = (config, options) => {
|
|
79
|
-
const encoder = config.ENCODE_PATH || encodeURI;
|
|
80
|
-
const path = options.url
|
|
81
|
-
.replace('{api-version}', config.VERSION)
|
|
82
|
-
.replace(/{(.*?)}/g, (substring, group) => {
|
|
83
|
-
if (options.path?.hasOwnProperty(group)) {
|
|
84
|
-
return encoder(String(options.path[group]));
|
|
85
|
-
}
|
|
86
|
-
return substring;
|
|
87
|
-
});
|
|
88
|
-
const url = `${config.BASE}${path}`;
|
|
89
|
-
if (options.query) {
|
|
90
|
-
return `${url}${(0, exports.getQueryString)(options.query)}`;
|
|
91
|
-
}
|
|
92
|
-
return url;
|
|
93
|
-
};
|
|
94
|
-
const getFormData = (options) => {
|
|
95
|
-
if (options.formData) {
|
|
96
|
-
const formData = new FormData();
|
|
97
|
-
const process = (key, value) => {
|
|
98
|
-
if ((0, exports.isString)(value) || (0, exports.isBlob)(value)) {
|
|
99
|
-
formData.append(key, value);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
formData.append(key, JSON.stringify(value));
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
Object.entries(options.formData)
|
|
106
|
-
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
107
|
-
.forEach(([key, value]) => {
|
|
108
|
-
if (Array.isArray(value)) {
|
|
109
|
-
value.forEach(v => process(key, v));
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
process(key, value);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
return formData;
|
|
116
|
-
}
|
|
117
|
-
return undefined;
|
|
118
|
-
};
|
|
119
|
-
exports.getFormData = getFormData;
|
|
120
|
-
const resolve = async (options, resolver) => {
|
|
121
|
-
if (typeof resolver === 'function') {
|
|
122
|
-
return resolver(options);
|
|
123
|
-
}
|
|
124
|
-
return resolver;
|
|
125
|
-
};
|
|
126
|
-
exports.resolve = resolve;
|
|
127
|
-
const getHeaders = async (config, options) => {
|
|
128
|
-
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
129
|
-
(0, exports.resolve)(options, config.TOKEN),
|
|
130
|
-
(0, exports.resolve)(options, config.USERNAME),
|
|
131
|
-
(0, exports.resolve)(options, config.PASSWORD),
|
|
132
|
-
(0, exports.resolve)(options, config.HEADERS),
|
|
133
|
-
]);
|
|
134
|
-
const headers = Object.entries({
|
|
135
|
-
Accept: 'application/json',
|
|
136
|
-
...additionalHeaders,
|
|
137
|
-
...options.headers,
|
|
138
|
-
})
|
|
139
|
-
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
140
|
-
.reduce((headers, [key, value]) => ({
|
|
141
|
-
...headers,
|
|
142
|
-
[key]: String(value),
|
|
143
|
-
}), {});
|
|
144
|
-
if ((0, exports.isStringWithValue)(token)) {
|
|
145
|
-
headers['Authorization'] = `Bearer ${token}`;
|
|
146
|
-
}
|
|
147
|
-
if ((0, exports.isStringWithValue)(username) && (0, exports.isStringWithValue)(password)) {
|
|
148
|
-
const credentials = (0, exports.base64)(`${username}:${password}`);
|
|
149
|
-
headers['Authorization'] = `Basic ${credentials}`;
|
|
150
|
-
}
|
|
151
|
-
if (options.body !== undefined) {
|
|
152
|
-
if (options.mediaType) {
|
|
153
|
-
headers['Content-Type'] = options.mediaType;
|
|
154
|
-
}
|
|
155
|
-
else if ((0, exports.isBlob)(options.body)) {
|
|
156
|
-
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
157
|
-
}
|
|
158
|
-
else if ((0, exports.isString)(options.body)) {
|
|
159
|
-
headers['Content-Type'] = 'text/plain';
|
|
160
|
-
}
|
|
161
|
-
else if (!(0, exports.isFormData)(options.body)) {
|
|
162
|
-
headers['Content-Type'] = 'application/json';
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return new Headers(headers);
|
|
166
|
-
};
|
|
167
|
-
exports.getHeaders = getHeaders;
|
|
168
|
-
const getRequestBody = (options) => {
|
|
169
|
-
if (options.body !== undefined) {
|
|
170
|
-
if (options.mediaType?.includes('/json')) {
|
|
171
|
-
return JSON.stringify(options.body);
|
|
172
|
-
}
|
|
173
|
-
else if ((0, exports.isString)(options.body) || (0, exports.isBlob)(options.body) || (0, exports.isFormData)(options.body)) {
|
|
174
|
-
return options.body;
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
return JSON.stringify(options.body);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return undefined;
|
|
181
|
-
};
|
|
182
|
-
exports.getRequestBody = getRequestBody;
|
|
183
|
-
const sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
|
|
184
|
-
const controller = new AbortController();
|
|
185
|
-
const request = {
|
|
186
|
-
headers,
|
|
187
|
-
body: body ?? formData,
|
|
188
|
-
method: options.method,
|
|
189
|
-
signal: controller.signal,
|
|
190
|
-
};
|
|
191
|
-
if (config.WITH_CREDENTIALS) {
|
|
192
|
-
request.credentials = config.CREDENTIALS;
|
|
193
|
-
}
|
|
194
|
-
onCancel(() => controller.abort());
|
|
195
|
-
return await fetch(url, request);
|
|
196
|
-
};
|
|
197
|
-
exports.sendRequest = sendRequest;
|
|
198
|
-
const getResponseHeader = (response, responseHeader) => {
|
|
199
|
-
if (responseHeader) {
|
|
200
|
-
const content = response.headers.get(responseHeader);
|
|
201
|
-
if ((0, exports.isString)(content)) {
|
|
202
|
-
return content;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return undefined;
|
|
206
|
-
};
|
|
207
|
-
exports.getResponseHeader = getResponseHeader;
|
|
208
|
-
const getResponseBody = async (response) => {
|
|
209
|
-
if (response.status !== 204) {
|
|
210
|
-
try {
|
|
211
|
-
const contentType = response.headers.get('Content-Type');
|
|
212
|
-
if (contentType) {
|
|
213
|
-
const jsonTypes = ['application/json', 'application/problem+json'];
|
|
214
|
-
const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
|
|
215
|
-
if (isJSON) {
|
|
216
|
-
return await response.json();
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
return await response.text();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
catch (error) {
|
|
224
|
-
console.error(error);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
return undefined;
|
|
228
|
-
};
|
|
229
|
-
exports.getResponseBody = getResponseBody;
|
|
230
|
-
const catchErrorCodes = (options, result) => {
|
|
231
|
-
const errors = {
|
|
232
|
-
400: 'Bad Request',
|
|
233
|
-
401: 'Unauthorized',
|
|
234
|
-
403: 'Forbidden',
|
|
235
|
-
404: 'Not Found',
|
|
236
|
-
500: 'Internal Server Error',
|
|
237
|
-
502: 'Bad Gateway',
|
|
238
|
-
503: 'Service Unavailable',
|
|
239
|
-
...options.errors,
|
|
240
|
-
};
|
|
241
|
-
const error = errors[result.status];
|
|
242
|
-
if (error) {
|
|
243
|
-
throw new ApiError_1.ApiError(options, result, error);
|
|
244
|
-
}
|
|
245
|
-
if (!result.ok) {
|
|
246
|
-
const errorStatus = result.status ?? 'unknown';
|
|
247
|
-
const errorStatusText = result.statusText ?? 'unknown';
|
|
248
|
-
const errorBody = (() => {
|
|
249
|
-
try {
|
|
250
|
-
return JSON.stringify(result.body, null, 2);
|
|
251
|
-
}
|
|
252
|
-
catch (e) {
|
|
253
|
-
return undefined;
|
|
254
|
-
}
|
|
255
|
-
})();
|
|
256
|
-
throw new ApiError_1.ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
exports.catchErrorCodes = catchErrorCodes;
|
|
260
|
-
/**
|
|
261
|
-
* Request method
|
|
262
|
-
* @param config The OpenAPI configuration object
|
|
263
|
-
* @param options The request options from the service
|
|
264
|
-
* @returns CancelablePromise<T>
|
|
265
|
-
* @throws ApiError
|
|
266
|
-
*/
|
|
267
|
-
const request = (config, options) => {
|
|
268
|
-
return new CancelablePromise_1.CancelablePromise(async (resolve, reject, onCancel) => {
|
|
269
|
-
try {
|
|
270
|
-
const url = getUrl(config, options);
|
|
271
|
-
const formData = (0, exports.getFormData)(options);
|
|
272
|
-
const body = (0, exports.getRequestBody)(options);
|
|
273
|
-
const headers = await (0, exports.getHeaders)(config, options);
|
|
274
|
-
if (!onCancel.isCancelled) {
|
|
275
|
-
const response = await (0, exports.sendRequest)(config, options, url, body, formData, headers, onCancel);
|
|
276
|
-
const responseBody = await (0, exports.getResponseBody)(response);
|
|
277
|
-
const responseHeader = (0, exports.getResponseHeader)(response, options.responseHeader);
|
|
278
|
-
const result = {
|
|
279
|
-
url,
|
|
280
|
-
ok: response.ok,
|
|
281
|
-
status: response.status,
|
|
282
|
-
statusText: response.statusText,
|
|
283
|
-
body: responseHeader ?? responseBody,
|
|
284
|
-
};
|
|
285
|
-
(0, exports.catchErrorCodes)(options, result);
|
|
286
|
-
resolve(result.body);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
catch (error) {
|
|
290
|
-
reject(error);
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
exports.request = request;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ContentTypeProperty } from './ContentTypeProperty';
|
|
2
|
-
import type { ImageDescriptor } from './ImageDescriptor';
|
|
3
|
-
/**
|
|
4
|
-
* Describes a property that can contain a reference to binary data.
|
|
5
|
-
*/
|
|
6
|
-
export type BinaryProperty = (ContentTypeProperty & {
|
|
7
|
-
imageDescriptor?: ImageDescriptor;
|
|
8
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Changesets are used to group work on several content items together.
|
|
3
|
-
*/
|
|
4
|
-
export type Changeset = {
|
|
5
|
-
/**
|
|
6
|
-
* The unique key of this Changeset.
|
|
7
|
-
*/
|
|
8
|
-
key: string;
|
|
9
|
-
/**
|
|
10
|
-
* The source of this Changeset
|
|
11
|
-
*/
|
|
12
|
-
source?: string;
|
|
13
|
-
/**
|
|
14
|
-
* The name of this Changeset.
|
|
15
|
-
*/
|
|
16
|
-
displayName: string;
|
|
17
|
-
/**
|
|
18
|
-
* A timestamp indicating when this changeset was first created.
|
|
19
|
-
*/
|
|
20
|
-
readonly created?: string;
|
|
21
|
-
/**
|
|
22
|
-
* The username of the user that created this changeset.
|
|
23
|
-
*/
|
|
24
|
-
readonly createdBy?: string;
|
|
25
|
-
lastModified?: string;
|
|
26
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ContentReference } from './ContentReference';
|
|
2
|
-
/**
|
|
3
|
-
* Items in an changeset that contains a link to the specific content version.
|
|
4
|
-
*/
|
|
5
|
-
export type ChangesetItem = {
|
|
6
|
-
reference: ContentReference;
|
|
7
|
-
/**
|
|
8
|
-
* Gets/sets the changeset item category.
|
|
9
|
-
*/
|
|
10
|
-
category?: string;
|
|
11
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ChangesetItem } from './ChangesetItem';
|
|
2
|
-
export type ChangesetItemPage = {
|
|
3
|
-
/**
|
|
4
|
-
* The items in this paged collection.
|
|
5
|
-
*/
|
|
6
|
-
readonly items?: Array<ChangesetItem>;
|
|
7
|
-
/**
|
|
8
|
-
* The zero-based index of the current page.
|
|
9
|
-
*/
|
|
10
|
-
readonly pageIndex?: number;
|
|
11
|
-
/**
|
|
12
|
-
* The number of item in each page. Not necessarily the same as the number of items in this page.
|
|
13
|
-
*/
|
|
14
|
-
readonly pageSize?: number;
|
|
15
|
-
/**
|
|
16
|
-
* The estimated total number of items in the collection. May be omitted if the total item count is unknown.
|
|
17
|
-
*/
|
|
18
|
-
readonly totalItemCount?: number;
|
|
19
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Changeset } from './Changeset';
|
|
2
|
-
export type ChangesetPage = {
|
|
3
|
-
/**
|
|
4
|
-
* The items in this paged collection.
|
|
5
|
-
*/
|
|
6
|
-
readonly items?: Array<Changeset>;
|
|
7
|
-
/**
|
|
8
|
-
* The zero-based index of the current page.
|
|
9
|
-
*/
|
|
10
|
-
readonly pageIndex?: number;
|
|
11
|
-
/**
|
|
12
|
-
* The number of item in each page. Not necessarily the same as the number of items in this page.
|
|
13
|
-
*/
|
|
14
|
-
readonly pageSize?: number;
|
|
15
|
-
/**
|
|
16
|
-
* The estimated total number of items in the collection. May be omitted if the total item count is unknown.
|
|
17
|
-
*/
|
|
18
|
-
readonly totalItemCount?: number;
|
|
19
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ListPropertyItem } from './ListPropertyItem';
|
|
2
|
-
/**
|
|
3
|
-
* Describes a property list item that can contain a component instance of a specific type.
|
|
4
|
-
*/
|
|
5
|
-
export type ComponentListItem = (ListPropertyItem & {
|
|
6
|
-
/**
|
|
7
|
-
* The key of the ContentType that this ComponentListItem can contain.
|
|
8
|
-
*/
|
|
9
|
-
contentType: string;
|
|
10
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ContentTypeProperty } from './ContentTypeProperty';
|
|
2
|
-
/**
|
|
3
|
-
* Describes a property that can contain a component instance of a specific type.
|
|
4
|
-
*/
|
|
5
|
-
export type ComponentProperty = (ContentTypeProperty & {
|
|
6
|
-
/**
|
|
7
|
-
* The key of the ContentType that this ComponentProperty can contain.
|
|
8
|
-
*/
|
|
9
|
-
contentType: string;
|
|
10
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompositionBehavior = void 0;
|
|
4
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
5
|
-
/* istanbul ignore file */
|
|
6
|
-
/* tslint:disable */
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
/**
|
|
9
|
-
* Represent a Composition behavior for a ContentType.
|
|
10
|
-
*/
|
|
11
|
-
var CompositionBehavior;
|
|
12
|
-
(function (CompositionBehavior) {
|
|
13
|
-
CompositionBehavior["SECTION_ENABLED"] = "sectionEnabled";
|
|
14
|
-
CompositionBehavior["ELEMENT_ENABLED"] = "elementEnabled";
|
|
15
|
-
})(CompositionBehavior || (exports.CompositionBehavior = CompositionBehavior = {}));
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represent the base type of a ContentType.
|
|
3
|
-
*/
|
|
4
|
-
export declare enum ContentBaseType {
|
|
5
|
-
PAGE = "page",
|
|
6
|
-
COMPONENT = "component",
|
|
7
|
-
MEDIA = "media",
|
|
8
|
-
IMAGE = "image",
|
|
9
|
-
VIDEO = "video",
|
|
10
|
-
FOLDER = "folder",
|
|
11
|
-
EXPERIENCE = "experience",
|
|
12
|
-
SECTION = "section",
|
|
13
|
-
ELEMENT = "element"
|
|
14
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContentBaseType = void 0;
|
|
4
|
-
/* generated using openapi-typescript-codegen -- do not edit */
|
|
5
|
-
/* istanbul ignore file */
|
|
6
|
-
/* tslint:disable */
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
/**
|
|
9
|
-
* Represent the base type of a ContentType.
|
|
10
|
-
*/
|
|
11
|
-
var ContentBaseType;
|
|
12
|
-
(function (ContentBaseType) {
|
|
13
|
-
ContentBaseType["PAGE"] = "page";
|
|
14
|
-
ContentBaseType["COMPONENT"] = "component";
|
|
15
|
-
ContentBaseType["MEDIA"] = "media";
|
|
16
|
-
ContentBaseType["IMAGE"] = "image";
|
|
17
|
-
ContentBaseType["VIDEO"] = "video";
|
|
18
|
-
ContentBaseType["FOLDER"] = "folder";
|
|
19
|
-
ContentBaseType["EXPERIENCE"] = "experience";
|
|
20
|
-
ContentBaseType["SECTION"] = "section";
|
|
21
|
-
ContentBaseType["ELEMENT"] = "element";
|
|
22
|
-
})(ContentBaseType || (exports.ContentBaseType = ContentBaseType = {}));
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a content component.
|
|
3
|
-
*/
|
|
4
|
-
export type ContentComponent = {
|
|
5
|
-
/**
|
|
6
|
-
* The name of the content component. If Reference is set, the name is automatically set to the name of the referenced content.
|
|
7
|
-
*/
|
|
8
|
-
name?: string;
|
|
9
|
-
/**
|
|
10
|
-
* An optional display option for the content component.
|
|
11
|
-
*/
|
|
12
|
-
displayOption?: string;
|
|
13
|
-
/**
|
|
14
|
-
* An optional group for the personalizable component.
|
|
15
|
-
*/
|
|
16
|
-
segmentationGroup?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Specifies the settings for the content component.
|
|
19
|
-
*/
|
|
20
|
-
segments?: Array<string>;
|
|
21
|
-
reference?: string;
|
|
22
|
-
/**
|
|
23
|
-
* The key of the content type that this is an embedded instance of.
|
|
24
|
-
*/
|
|
25
|
-
contentType?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Dictionary with all custom properties as specified by associated ContentType
|
|
28
|
-
*/
|
|
29
|
-
content?: any;
|
|
30
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { VersionStatus } from './VersionStatus';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a version of a content item.
|
|
4
|
-
*/
|
|
5
|
-
export type ContentItem = {
|
|
6
|
-
/**
|
|
7
|
-
* Properties as they are defined by corresponding component or content type.
|
|
8
|
-
*/
|
|
9
|
-
properties?: Record<string, any>;
|
|
10
|
-
/**
|
|
11
|
-
* The key that identifies this content item.
|
|
12
|
-
*/
|
|
13
|
-
readonly key: string;
|
|
14
|
-
/**
|
|
15
|
-
* The locale of this content instance.
|
|
16
|
-
*/
|
|
17
|
-
readonly locale?: string;
|
|
18
|
-
/**
|
|
19
|
-
* The version identifier of this content instance.
|
|
20
|
-
*/
|
|
21
|
-
readonly version?: string;
|
|
22
|
-
/**
|
|
23
|
-
* The content type of this content item.
|
|
24
|
-
*/
|
|
25
|
-
readonly contentType?: string;
|
|
26
|
-
/**
|
|
27
|
-
* The display name of this content item.
|
|
28
|
-
*/
|
|
29
|
-
displayName: string;
|
|
30
|
-
/**
|
|
31
|
-
* Indicates a time when this content was published or should be published.
|
|
32
|
-
*/
|
|
33
|
-
published?: string | null;
|
|
34
|
-
/**
|
|
35
|
-
* Indicates a time when this content expired or should expire.
|
|
36
|
-
*/
|
|
37
|
-
expired?: string | null;
|
|
38
|
-
status?: VersionStatus;
|
|
39
|
-
/**
|
|
40
|
-
* Indicates a time when this content version should transition to published status. Must only be assigned when Status is set to Scheduled.
|
|
41
|
-
*/
|
|
42
|
-
delayPublishUntil?: string | null;
|
|
43
|
-
/**
|
|
44
|
-
* The key that identifies the container content that this content item belongs to.
|
|
45
|
-
*/
|
|
46
|
-
container?: string | null;
|
|
47
|
-
/**
|
|
48
|
-
* The key that identifies the owner of this content. Content that is own by another content is also known as an asset.
|
|
49
|
-
*/
|
|
50
|
-
owner?: string | null;
|
|
51
|
-
/**
|
|
52
|
-
* A string that represents the segment that should be used when routing or generate routes to the current content instance.
|
|
53
|
-
*/
|
|
54
|
-
routeSegment?: string | null;
|
|
55
|
-
lastModified?: string;
|
|
56
|
-
/**
|
|
57
|
-
* The username of the user that made the latest modification to this content instance.
|
|
58
|
-
*/
|
|
59
|
-
readonly lastModifiedBy?: string;
|
|
60
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ContentItem } from './ContentItem';
|
|
2
|
-
import type { ContentType } from './ContentType';
|
|
3
|
-
/**
|
|
4
|
-
* The response object for Page`1 when used ContentType are included.
|
|
5
|
-
*/
|
|
6
|
-
export type ContentItemListWithContentTypes = {
|
|
7
|
-
/**
|
|
8
|
-
* The content types that are used by the content items in the response.
|
|
9
|
-
*/
|
|
10
|
-
readonly contentTypes?: Array<ContentType>;
|
|
11
|
-
/**
|
|
12
|
-
* The content items in this paged collection.
|
|
13
|
-
*/
|
|
14
|
-
readonly items?: Array<ContentItem>;
|
|
15
|
-
/**
|
|
16
|
-
* The zero-based index of the current page.
|
|
17
|
-
*/
|
|
18
|
-
readonly pageIndex?: number;
|
|
19
|
-
/**
|
|
20
|
-
* The number of item in each page. Not necessarily the same as the number of items in this page.
|
|
21
|
-
*/
|
|
22
|
-
readonly pageSize?: number;
|
|
23
|
-
/**
|
|
24
|
-
* The estimated total number of items in the collection. May be omitted if the total item count is unknown.
|
|
25
|
-
*/
|
|
26
|
-
readonly totalItemCount?: number;
|
|
27
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ContentItem } from './ContentItem';
|
|
2
|
-
export type ContentItemPage = {
|
|
3
|
-
/**
|
|
4
|
-
* The items in this paged collection.
|
|
5
|
-
*/
|
|
6
|
-
readonly items?: Array<ContentItem>;
|
|
7
|
-
/**
|
|
8
|
-
* The zero-based index of the current page.
|
|
9
|
-
*/
|
|
10
|
-
readonly pageIndex?: number;
|
|
11
|
-
/**
|
|
12
|
-
* The number of item in each page. Not necessarily the same as the number of items in this page.
|
|
13
|
-
*/
|
|
14
|
-
readonly pageSize?: number;
|
|
15
|
-
/**
|
|
16
|
-
* The estimated total number of items in the collection. May be omitted if the total item count is unknown.
|
|
17
|
-
*/
|
|
18
|
-
readonly totalItemCount?: number;
|
|
19
|
-
};
|