@aurigma/axios-storefront-api-client 2.2.53
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.md +9 -0
- package/README.md +104 -0
- package/dist/cjs/storefront-api-client.d.ts +973 -0
- package/dist/cjs/storefront-api-client.js +2574 -0
- package/dist/cjs/storefront-api-client.js.map +1 -0
- package/dist/esm/storefront-api-client.d.ts +973 -0
- package/dist/esm/storefront-api-client.js +2561 -0
- package/dist/esm/storefront-api-client.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,2561 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
//----------------------
|
|
4
|
+
// <auto-generated>
|
|
5
|
+
// Generated using the NSwag toolchain v13.9.4.0 (NJsonSchema v10.3.1.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org)
|
|
6
|
+
// </auto-generated>
|
|
7
|
+
//----------------------
|
|
8
|
+
// ReSharper disable InconsistentNaming
|
|
9
|
+
import axios from 'axios';
|
|
10
|
+
export class ApiClientConfiguration {
|
|
11
|
+
apiUrl;
|
|
12
|
+
apiKey = '';
|
|
13
|
+
authorizationToken = null;
|
|
14
|
+
async getAuthorizationToken() { return this.authorizationToken; }
|
|
15
|
+
;
|
|
16
|
+
setAuthorizationToken(token) { this.authorizationToken = token; }
|
|
17
|
+
;
|
|
18
|
+
}
|
|
19
|
+
export class ApiClientBase {
|
|
20
|
+
configuration;
|
|
21
|
+
constructor(configuration) {
|
|
22
|
+
this.configuration = configuration;
|
|
23
|
+
}
|
|
24
|
+
async transformOptions(options) {
|
|
25
|
+
const token = await this.configuration.getAuthorizationToken();
|
|
26
|
+
if (token != null) {
|
|
27
|
+
options.headers = { ...options.headers, authorization: ' Bearer ' + token };
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
options.headers = { ...options.headers, 'X-API-Key': this.configuration.apiKey };
|
|
31
|
+
}
|
|
32
|
+
options = { ...options, transformResponse: (res) => res, responseType: 'json' };
|
|
33
|
+
return options;
|
|
34
|
+
}
|
|
35
|
+
getBaseUrl(defultUrl) {
|
|
36
|
+
return this.configuration.apiUrl;
|
|
37
|
+
}
|
|
38
|
+
transformResult(url, res, cb) {
|
|
39
|
+
return cb(res);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export class BuildInfoApiClient extends ApiClientBase {
|
|
43
|
+
instance;
|
|
44
|
+
baseUrl;
|
|
45
|
+
jsonParseReviver = undefined;
|
|
46
|
+
constructor(configuration, baseUrl, instance) {
|
|
47
|
+
super(configuration);
|
|
48
|
+
this.instance = instance ? instance : axios.create();
|
|
49
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Gets assembly build info
|
|
53
|
+
* @return Success
|
|
54
|
+
*/
|
|
55
|
+
headInfo(cancelToken) {
|
|
56
|
+
let url_ = this.baseUrl + "/api/storefront/v1/info";
|
|
57
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
58
|
+
let options_ = {
|
|
59
|
+
method: "HEAD",
|
|
60
|
+
url: url_,
|
|
61
|
+
headers: {},
|
|
62
|
+
cancelToken
|
|
63
|
+
};
|
|
64
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
65
|
+
return this.instance.request(transformedOptions_);
|
|
66
|
+
}).catch((_error) => {
|
|
67
|
+
if (isAxiosError(_error) && _error.response) {
|
|
68
|
+
return _error.response;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
throw _error;
|
|
72
|
+
}
|
|
73
|
+
}).then((_response) => {
|
|
74
|
+
return this.transformResult(url_, _response, (_response) => this.processHeadInfo(_response));
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
processHeadInfo(response) {
|
|
78
|
+
const status = response.status;
|
|
79
|
+
let _headers = {};
|
|
80
|
+
if (response.headers && typeof response.headers === "object") {
|
|
81
|
+
for (let k in response.headers) {
|
|
82
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
83
|
+
_headers[k] = response.headers[k];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (status === 200) {
|
|
88
|
+
const _responseText = response.data;
|
|
89
|
+
return Promise.resolve(null);
|
|
90
|
+
}
|
|
91
|
+
else if (status !== 200 && status !== 204) {
|
|
92
|
+
const _responseText = response.data;
|
|
93
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
94
|
+
}
|
|
95
|
+
return Promise.resolve(null);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Gets assembly build info
|
|
99
|
+
* @return Success
|
|
100
|
+
*/
|
|
101
|
+
getInfo(cancelToken) {
|
|
102
|
+
let url_ = this.baseUrl + "/api/storefront/v1/info";
|
|
103
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
104
|
+
let options_ = {
|
|
105
|
+
method: "GET",
|
|
106
|
+
url: url_,
|
|
107
|
+
headers: {
|
|
108
|
+
"Accept": "text/plain"
|
|
109
|
+
},
|
|
110
|
+
cancelToken
|
|
111
|
+
};
|
|
112
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
113
|
+
return this.instance.request(transformedOptions_);
|
|
114
|
+
}).catch((_error) => {
|
|
115
|
+
if (isAxiosError(_error) && _error.response) {
|
|
116
|
+
return _error.response;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
throw _error;
|
|
120
|
+
}
|
|
121
|
+
}).then((_response) => {
|
|
122
|
+
return this.transformResult(url_, _response, (_response) => this.processGetInfo(_response));
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
processGetInfo(response) {
|
|
126
|
+
const status = response.status;
|
|
127
|
+
let _headers = {};
|
|
128
|
+
if (response.headers && typeof response.headers === "object") {
|
|
129
|
+
for (let k in response.headers) {
|
|
130
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
131
|
+
_headers[k] = response.headers[k];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (status === 200) {
|
|
136
|
+
const _responseText = response.data;
|
|
137
|
+
let result200 = null;
|
|
138
|
+
let resultData200 = _responseText;
|
|
139
|
+
result200 = JSON.parse(resultData200);
|
|
140
|
+
return result200;
|
|
141
|
+
}
|
|
142
|
+
else if (status !== 200 && status !== 204) {
|
|
143
|
+
const _responseText = response.data;
|
|
144
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
145
|
+
}
|
|
146
|
+
return Promise.resolve(null);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
export class ProductReferencesApiClient extends ApiClientBase {
|
|
150
|
+
instance;
|
|
151
|
+
baseUrl;
|
|
152
|
+
jsonParseReviver = undefined;
|
|
153
|
+
constructor(configuration, baseUrl, instance) {
|
|
154
|
+
super(configuration);
|
|
155
|
+
this.instance = instance ? instance : axios.create();
|
|
156
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Gets all storefront product references relevant to specified query parameters
|
|
160
|
+
* @param storefrontId Storefront identifier
|
|
161
|
+
* @param productReference (optional) Product reference filter. Product reference is an external reference to Customer's Canvas product specification, e.g online store product identifier
|
|
162
|
+
* @param productSpecificationId (optional) Cusomer's Canvas product specification filter
|
|
163
|
+
* @param skip (optional) Defines page start offset from beginning of sorted result list
|
|
164
|
+
* @param take (optional) Defines page length (how much consequent items of sorted result list should be taken)
|
|
165
|
+
* @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC"
|
|
166
|
+
* @param search (optional) Search string for partial match
|
|
167
|
+
* @param tenantId (optional) Tenant identifier
|
|
168
|
+
* @param userId (optional) User identifier
|
|
169
|
+
* @return Success
|
|
170
|
+
*/
|
|
171
|
+
getAll(storefrontId, productReference, productSpecificationId, skip, take, sorting, search, tenantId, userId, cancelToken) {
|
|
172
|
+
let url_ = this.baseUrl + "/api/storefront/v1/product-references?";
|
|
173
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
174
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
175
|
+
else
|
|
176
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
177
|
+
if (productReference !== undefined && productReference !== null)
|
|
178
|
+
url_ += "productReference=" + encodeURIComponent("" + productReference) + "&";
|
|
179
|
+
if (productSpecificationId !== undefined && productSpecificationId !== null)
|
|
180
|
+
url_ += "productSpecificationId=" + encodeURIComponent("" + productSpecificationId) + "&";
|
|
181
|
+
if (skip !== undefined && skip !== null)
|
|
182
|
+
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
|
|
183
|
+
if (take !== undefined && take !== null)
|
|
184
|
+
url_ += "take=" + encodeURIComponent("" + take) + "&";
|
|
185
|
+
if (sorting !== undefined && sorting !== null)
|
|
186
|
+
url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
|
|
187
|
+
if (search !== undefined && search !== null)
|
|
188
|
+
url_ += "search=" + encodeURIComponent("" + search) + "&";
|
|
189
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
190
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
191
|
+
if (userId !== undefined && userId !== null)
|
|
192
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
193
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
194
|
+
let options_ = {
|
|
195
|
+
method: "GET",
|
|
196
|
+
url: url_,
|
|
197
|
+
headers: {
|
|
198
|
+
"Accept": "text/plain"
|
|
199
|
+
},
|
|
200
|
+
cancelToken
|
|
201
|
+
};
|
|
202
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
203
|
+
return this.instance.request(transformedOptions_);
|
|
204
|
+
}).catch((_error) => {
|
|
205
|
+
if (isAxiosError(_error) && _error.response) {
|
|
206
|
+
return _error.response;
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
throw _error;
|
|
210
|
+
}
|
|
211
|
+
}).then((_response) => {
|
|
212
|
+
return this.transformResult(url_, _response, (_response) => this.processGetAll(_response));
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
processGetAll(response) {
|
|
216
|
+
const status = response.status;
|
|
217
|
+
let _headers = {};
|
|
218
|
+
if (response.headers && typeof response.headers === "object") {
|
|
219
|
+
for (let k in response.headers) {
|
|
220
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
221
|
+
_headers[k] = response.headers[k];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (status === 200) {
|
|
226
|
+
const _responseText = response.data;
|
|
227
|
+
let result200 = null;
|
|
228
|
+
let resultData200 = _responseText;
|
|
229
|
+
result200 = JSON.parse(resultData200);
|
|
230
|
+
return result200;
|
|
231
|
+
}
|
|
232
|
+
else if (status === 401) {
|
|
233
|
+
const _responseText = response.data;
|
|
234
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
235
|
+
}
|
|
236
|
+
else if (status === 403) {
|
|
237
|
+
const _responseText = response.data;
|
|
238
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
239
|
+
}
|
|
240
|
+
else if (status !== 200 && status !== 204) {
|
|
241
|
+
const _responseText = response.data;
|
|
242
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
243
|
+
}
|
|
244
|
+
return Promise.resolve(null);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Creates new storefront product reference
|
|
248
|
+
* @param storefrontId Storefront identifier
|
|
249
|
+
* @param tenantId (optional) Tenant identifier
|
|
250
|
+
* @param userId (optional) User identifier
|
|
251
|
+
* @param body (optional) Create operation parameters
|
|
252
|
+
* @return Success
|
|
253
|
+
*/
|
|
254
|
+
create(storefrontId, tenantId, userId, body, cancelToken) {
|
|
255
|
+
let url_ = this.baseUrl + "/api/storefront/v1/product-references?";
|
|
256
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
257
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
258
|
+
else
|
|
259
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
260
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
261
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
262
|
+
if (userId !== undefined && userId !== null)
|
|
263
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
264
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
265
|
+
const content_ = JSON.stringify(body);
|
|
266
|
+
let options_ = {
|
|
267
|
+
data: content_,
|
|
268
|
+
method: "POST",
|
|
269
|
+
url: url_,
|
|
270
|
+
headers: {
|
|
271
|
+
"Content-Type": "application/json-patch+json",
|
|
272
|
+
"Accept": "text/plain"
|
|
273
|
+
},
|
|
274
|
+
cancelToken
|
|
275
|
+
};
|
|
276
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
277
|
+
return this.instance.request(transformedOptions_);
|
|
278
|
+
}).catch((_error) => {
|
|
279
|
+
if (isAxiosError(_error) && _error.response) {
|
|
280
|
+
return _error.response;
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
throw _error;
|
|
284
|
+
}
|
|
285
|
+
}).then((_response) => {
|
|
286
|
+
return this.transformResult(url_, _response, (_response) => this.processCreate(_response));
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
processCreate(response) {
|
|
290
|
+
const status = response.status;
|
|
291
|
+
let _headers = {};
|
|
292
|
+
if (response.headers && typeof response.headers === "object") {
|
|
293
|
+
for (let k in response.headers) {
|
|
294
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
295
|
+
_headers[k] = response.headers[k];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (status === 201) {
|
|
300
|
+
const _responseText = response.data;
|
|
301
|
+
let result201 = null;
|
|
302
|
+
let resultData201 = _responseText;
|
|
303
|
+
result201 = JSON.parse(resultData201);
|
|
304
|
+
return result201;
|
|
305
|
+
}
|
|
306
|
+
else if (status === 404) {
|
|
307
|
+
const _responseText = response.data;
|
|
308
|
+
let result404 = null;
|
|
309
|
+
let resultData404 = _responseText;
|
|
310
|
+
result404 = JSON.parse(resultData404);
|
|
311
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
312
|
+
}
|
|
313
|
+
else if (status === 401) {
|
|
314
|
+
const _responseText = response.data;
|
|
315
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
316
|
+
}
|
|
317
|
+
else if (status === 403) {
|
|
318
|
+
const _responseText = response.data;
|
|
319
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
320
|
+
}
|
|
321
|
+
else if (status !== 200 && status !== 204) {
|
|
322
|
+
const _responseText = response.data;
|
|
323
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
324
|
+
}
|
|
325
|
+
return Promise.resolve(null);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Gets storefront product reference
|
|
329
|
+
* @param reference Product reference - external reference to Customer's Canvas product specification, e.g online store product identifier
|
|
330
|
+
* @param storefrontId Storefront identifier
|
|
331
|
+
* @param tenantId (optional) Tenant identifier
|
|
332
|
+
* @param userId (optional) User identifier
|
|
333
|
+
* @return Success
|
|
334
|
+
*/
|
|
335
|
+
get(reference, storefrontId, tenantId, userId, cancelToken) {
|
|
336
|
+
let url_ = this.baseUrl + "/api/storefront/v1/product-references/{reference}?";
|
|
337
|
+
if (reference === undefined || reference === null)
|
|
338
|
+
throw new Error("The parameter 'reference' must be defined.");
|
|
339
|
+
url_ = url_.replace("{reference}", encodeURIComponent("" + reference));
|
|
340
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
341
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
342
|
+
else
|
|
343
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
344
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
345
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
346
|
+
if (userId !== undefined && userId !== null)
|
|
347
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
348
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
349
|
+
let options_ = {
|
|
350
|
+
method: "GET",
|
|
351
|
+
url: url_,
|
|
352
|
+
headers: {
|
|
353
|
+
"Accept": "text/plain"
|
|
354
|
+
},
|
|
355
|
+
cancelToken
|
|
356
|
+
};
|
|
357
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
358
|
+
return this.instance.request(transformedOptions_);
|
|
359
|
+
}).catch((_error) => {
|
|
360
|
+
if (isAxiosError(_error) && _error.response) {
|
|
361
|
+
return _error.response;
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
throw _error;
|
|
365
|
+
}
|
|
366
|
+
}).then((_response) => {
|
|
367
|
+
return this.transformResult(url_, _response, (_response) => this.processGet(_response));
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
processGet(response) {
|
|
371
|
+
const status = response.status;
|
|
372
|
+
let _headers = {};
|
|
373
|
+
if (response.headers && typeof response.headers === "object") {
|
|
374
|
+
for (let k in response.headers) {
|
|
375
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
376
|
+
_headers[k] = response.headers[k];
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (status === 200) {
|
|
381
|
+
const _responseText = response.data;
|
|
382
|
+
let result200 = null;
|
|
383
|
+
let resultData200 = _responseText;
|
|
384
|
+
result200 = JSON.parse(resultData200);
|
|
385
|
+
return result200;
|
|
386
|
+
}
|
|
387
|
+
else if (status === 404) {
|
|
388
|
+
const _responseText = response.data;
|
|
389
|
+
let result404 = null;
|
|
390
|
+
let resultData404 = _responseText;
|
|
391
|
+
result404 = JSON.parse(resultData404);
|
|
392
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
393
|
+
}
|
|
394
|
+
else if (status === 401) {
|
|
395
|
+
const _responseText = response.data;
|
|
396
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
397
|
+
}
|
|
398
|
+
else if (status === 403) {
|
|
399
|
+
const _responseText = response.data;
|
|
400
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
401
|
+
}
|
|
402
|
+
else if (status !== 200 && status !== 204) {
|
|
403
|
+
const _responseText = response.data;
|
|
404
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
405
|
+
}
|
|
406
|
+
return Promise.resolve(null);
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Deletes storefront product reference
|
|
410
|
+
* @param reference Product reference - external reference to Customer's Canvas product specification, e.g online store product identifier
|
|
411
|
+
* @param storefrontId Storefront identifier
|
|
412
|
+
* @param tenantId (optional) Tenant identifier
|
|
413
|
+
* @param userId (optional) User identifier
|
|
414
|
+
* @return Success
|
|
415
|
+
*/
|
|
416
|
+
delete(reference, storefrontId, tenantId, userId, cancelToken) {
|
|
417
|
+
let url_ = this.baseUrl + "/api/storefront/v1/product-references/{reference}?";
|
|
418
|
+
if (reference === undefined || reference === null)
|
|
419
|
+
throw new Error("The parameter 'reference' must be defined.");
|
|
420
|
+
url_ = url_.replace("{reference}", encodeURIComponent("" + reference));
|
|
421
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
422
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
423
|
+
else
|
|
424
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
425
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
426
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
427
|
+
if (userId !== undefined && userId !== null)
|
|
428
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
429
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
430
|
+
let options_ = {
|
|
431
|
+
method: "DELETE",
|
|
432
|
+
url: url_,
|
|
433
|
+
headers: {
|
|
434
|
+
"Accept": "text/plain"
|
|
435
|
+
},
|
|
436
|
+
cancelToken
|
|
437
|
+
};
|
|
438
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
439
|
+
return this.instance.request(transformedOptions_);
|
|
440
|
+
}).catch((_error) => {
|
|
441
|
+
if (isAxiosError(_error) && _error.response) {
|
|
442
|
+
return _error.response;
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
throw _error;
|
|
446
|
+
}
|
|
447
|
+
}).then((_response) => {
|
|
448
|
+
return this.transformResult(url_, _response, (_response) => this.processDelete(_response));
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
processDelete(response) {
|
|
452
|
+
const status = response.status;
|
|
453
|
+
let _headers = {};
|
|
454
|
+
if (response.headers && typeof response.headers === "object") {
|
|
455
|
+
for (let k in response.headers) {
|
|
456
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
457
|
+
_headers[k] = response.headers[k];
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
if (status === 200) {
|
|
462
|
+
const _responseText = response.data;
|
|
463
|
+
let result200 = null;
|
|
464
|
+
let resultData200 = _responseText;
|
|
465
|
+
result200 = JSON.parse(resultData200);
|
|
466
|
+
return result200;
|
|
467
|
+
}
|
|
468
|
+
else if (status === 404) {
|
|
469
|
+
const _responseText = response.data;
|
|
470
|
+
let result404 = null;
|
|
471
|
+
let resultData404 = _responseText;
|
|
472
|
+
result404 = JSON.parse(resultData404);
|
|
473
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
474
|
+
}
|
|
475
|
+
else if (status === 401) {
|
|
476
|
+
const _responseText = response.data;
|
|
477
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
478
|
+
}
|
|
479
|
+
else if (status === 403) {
|
|
480
|
+
const _responseText = response.data;
|
|
481
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
482
|
+
}
|
|
483
|
+
else if (status !== 200 && status !== 204) {
|
|
484
|
+
const _responseText = response.data;
|
|
485
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
486
|
+
}
|
|
487
|
+
return Promise.resolve(null);
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Gets product specification by storefront product reference
|
|
491
|
+
* @param reference Product reference - external reference to Customer's Canvas product specification, e.g online store product identifier
|
|
492
|
+
* @param storefrontId Storefront identifier
|
|
493
|
+
* @param tenantId (optional) Tenant identifier
|
|
494
|
+
* @param userId (optional) User identifier
|
|
495
|
+
* @return Success
|
|
496
|
+
*/
|
|
497
|
+
getProductSpecification(reference, storefrontId, tenantId, userId, cancelToken) {
|
|
498
|
+
let url_ = this.baseUrl + "/api/storefront/v1/product-references/{reference}/product-specification?";
|
|
499
|
+
if (reference === undefined || reference === null)
|
|
500
|
+
throw new Error("The parameter 'reference' must be defined.");
|
|
501
|
+
url_ = url_.replace("{reference}", encodeURIComponent("" + reference));
|
|
502
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
503
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
504
|
+
else
|
|
505
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
506
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
507
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
508
|
+
if (userId !== undefined && userId !== null)
|
|
509
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
510
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
511
|
+
let options_ = {
|
|
512
|
+
method: "GET",
|
|
513
|
+
url: url_,
|
|
514
|
+
headers: {
|
|
515
|
+
"Accept": "text/plain"
|
|
516
|
+
},
|
|
517
|
+
cancelToken
|
|
518
|
+
};
|
|
519
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
520
|
+
return this.instance.request(transformedOptions_);
|
|
521
|
+
}).catch((_error) => {
|
|
522
|
+
if (isAxiosError(_error) && _error.response) {
|
|
523
|
+
return _error.response;
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
throw _error;
|
|
527
|
+
}
|
|
528
|
+
}).then((_response) => {
|
|
529
|
+
return this.transformResult(url_, _response, (_response) => this.processGetProductSpecification(_response));
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
processGetProductSpecification(response) {
|
|
533
|
+
const status = response.status;
|
|
534
|
+
let _headers = {};
|
|
535
|
+
if (response.headers && typeof response.headers === "object") {
|
|
536
|
+
for (let k in response.headers) {
|
|
537
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
538
|
+
_headers[k] = response.headers[k];
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (status === 200) {
|
|
543
|
+
const _responseText = response.data;
|
|
544
|
+
let result200 = null;
|
|
545
|
+
let resultData200 = _responseText;
|
|
546
|
+
result200 = JSON.parse(resultData200);
|
|
547
|
+
return result200;
|
|
548
|
+
}
|
|
549
|
+
else if (status === 404) {
|
|
550
|
+
const _responseText = response.data;
|
|
551
|
+
let result404 = null;
|
|
552
|
+
let resultData404 = _responseText;
|
|
553
|
+
result404 = JSON.parse(resultData404);
|
|
554
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
555
|
+
}
|
|
556
|
+
else if (status === 401) {
|
|
557
|
+
const _responseText = response.data;
|
|
558
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
559
|
+
}
|
|
560
|
+
else if (status === 403) {
|
|
561
|
+
const _responseText = response.data;
|
|
562
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
563
|
+
}
|
|
564
|
+
else if (status !== 200 && status !== 204) {
|
|
565
|
+
const _responseText = response.data;
|
|
566
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
567
|
+
}
|
|
568
|
+
return Promise.resolve(null);
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Gets product configuration information by storefront product reference
|
|
572
|
+
* @param reference Product reference - external reference to Customer's Canvas product specification, e.g online store product identifier
|
|
573
|
+
* @param storefrontId Storefront identifier
|
|
574
|
+
* @param tenantId (optional) Tenant identifier
|
|
575
|
+
* @param userId (optional) User identifier
|
|
576
|
+
* @return Success
|
|
577
|
+
*/
|
|
578
|
+
getProductConfig(reference, storefrontId, tenantId, userId, cancelToken) {
|
|
579
|
+
let url_ = this.baseUrl + "/api/storefront/v1/product-references/{reference}/product-config?";
|
|
580
|
+
if (reference === undefined || reference === null)
|
|
581
|
+
throw new Error("The parameter 'reference' must be defined.");
|
|
582
|
+
url_ = url_.replace("{reference}", encodeURIComponent("" + reference));
|
|
583
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
584
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
585
|
+
else
|
|
586
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
587
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
588
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
589
|
+
if (userId !== undefined && userId !== null)
|
|
590
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
591
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
592
|
+
let options_ = {
|
|
593
|
+
method: "GET",
|
|
594
|
+
url: url_,
|
|
595
|
+
headers: {
|
|
596
|
+
"Accept": "text/plain"
|
|
597
|
+
},
|
|
598
|
+
cancelToken
|
|
599
|
+
};
|
|
600
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
601
|
+
return this.instance.request(transformedOptions_);
|
|
602
|
+
}).catch((_error) => {
|
|
603
|
+
if (isAxiosError(_error) && _error.response) {
|
|
604
|
+
return _error.response;
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
throw _error;
|
|
608
|
+
}
|
|
609
|
+
}).then((_response) => {
|
|
610
|
+
return this.transformResult(url_, _response, (_response) => this.processGetProductConfig(_response));
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
processGetProductConfig(response) {
|
|
614
|
+
const status = response.status;
|
|
615
|
+
let _headers = {};
|
|
616
|
+
if (response.headers && typeof response.headers === "object") {
|
|
617
|
+
for (let k in response.headers) {
|
|
618
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
619
|
+
_headers[k] = response.headers[k];
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
if (status === 200) {
|
|
624
|
+
const _responseText = response.data;
|
|
625
|
+
let result200 = null;
|
|
626
|
+
let resultData200 = _responseText;
|
|
627
|
+
result200 = JSON.parse(resultData200);
|
|
628
|
+
return result200;
|
|
629
|
+
}
|
|
630
|
+
else if (status === 404) {
|
|
631
|
+
const _responseText = response.data;
|
|
632
|
+
let result404 = null;
|
|
633
|
+
let resultData404 = _responseText;
|
|
634
|
+
result404 = JSON.parse(resultData404);
|
|
635
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
636
|
+
}
|
|
637
|
+
else if (status === 401) {
|
|
638
|
+
const _responseText = response.data;
|
|
639
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
640
|
+
}
|
|
641
|
+
else if (status === 403) {
|
|
642
|
+
const _responseText = response.data;
|
|
643
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
644
|
+
}
|
|
645
|
+
else if (status !== 200 && status !== 204) {
|
|
646
|
+
const _responseText = response.data;
|
|
647
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
648
|
+
}
|
|
649
|
+
return Promise.resolve(null);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
export class ProductSpecificationsApiClient extends ApiClientBase {
|
|
653
|
+
instance;
|
|
654
|
+
baseUrl;
|
|
655
|
+
jsonParseReviver = undefined;
|
|
656
|
+
constructor(configuration, baseUrl, instance) {
|
|
657
|
+
super(configuration);
|
|
658
|
+
this.instance = instance ? instance : axios.create();
|
|
659
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Gets all product specifications relevant to specified query parameters
|
|
663
|
+
* @param skip (optional) Defines page start offset from beginning of sorted result list
|
|
664
|
+
* @param take (optional) Defines page length (how much consequent items of sorted result list should be taken)
|
|
665
|
+
* @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC"
|
|
666
|
+
* @param search (optional) Search string for partial match
|
|
667
|
+
* @param tenantId (optional) Tenant identifier
|
|
668
|
+
* @param userId (optional) User identifier
|
|
669
|
+
* @return Success
|
|
670
|
+
*/
|
|
671
|
+
getAll(skip, take, sorting, search, tenantId, userId, cancelToken) {
|
|
672
|
+
let url_ = this.baseUrl + "/api/storefront/v1/product-specifications?";
|
|
673
|
+
if (skip !== undefined && skip !== null)
|
|
674
|
+
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
|
|
675
|
+
if (take !== undefined && take !== null)
|
|
676
|
+
url_ += "take=" + encodeURIComponent("" + take) + "&";
|
|
677
|
+
if (sorting !== undefined && sorting !== null)
|
|
678
|
+
url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
|
|
679
|
+
if (search !== undefined && search !== null)
|
|
680
|
+
url_ += "search=" + encodeURIComponent("" + search) + "&";
|
|
681
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
682
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
683
|
+
if (userId !== undefined && userId !== null)
|
|
684
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
685
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
686
|
+
let options_ = {
|
|
687
|
+
method: "GET",
|
|
688
|
+
url: url_,
|
|
689
|
+
headers: {
|
|
690
|
+
"Accept": "text/plain"
|
|
691
|
+
},
|
|
692
|
+
cancelToken
|
|
693
|
+
};
|
|
694
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
695
|
+
return this.instance.request(transformedOptions_);
|
|
696
|
+
}).catch((_error) => {
|
|
697
|
+
if (isAxiosError(_error) && _error.response) {
|
|
698
|
+
return _error.response;
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
throw _error;
|
|
702
|
+
}
|
|
703
|
+
}).then((_response) => {
|
|
704
|
+
return this.transformResult(url_, _response, (_response) => this.processGetAll(_response));
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
processGetAll(response) {
|
|
708
|
+
const status = response.status;
|
|
709
|
+
let _headers = {};
|
|
710
|
+
if (response.headers && typeof response.headers === "object") {
|
|
711
|
+
for (let k in response.headers) {
|
|
712
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
713
|
+
_headers[k] = response.headers[k];
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
if (status === 200) {
|
|
718
|
+
const _responseText = response.data;
|
|
719
|
+
let result200 = null;
|
|
720
|
+
let resultData200 = _responseText;
|
|
721
|
+
result200 = JSON.parse(resultData200);
|
|
722
|
+
return result200;
|
|
723
|
+
}
|
|
724
|
+
else if (status === 401) {
|
|
725
|
+
const _responseText = response.data;
|
|
726
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
727
|
+
}
|
|
728
|
+
else if (status === 403) {
|
|
729
|
+
const _responseText = response.data;
|
|
730
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
731
|
+
}
|
|
732
|
+
else if (status !== 200 && status !== 204) {
|
|
733
|
+
const _responseText = response.data;
|
|
734
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
735
|
+
}
|
|
736
|
+
return Promise.resolve(null);
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Gets product specification by id
|
|
740
|
+
* @param id Product specification identifier
|
|
741
|
+
* @param tenantId (optional) Tenant identifier
|
|
742
|
+
* @param userId (optional) User identifier
|
|
743
|
+
* @return Success
|
|
744
|
+
*/
|
|
745
|
+
get(id, tenantId, userId, cancelToken) {
|
|
746
|
+
let url_ = this.baseUrl + "/api/storefront/v1/product-specifications/{id}?";
|
|
747
|
+
if (id === undefined || id === null)
|
|
748
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
749
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
750
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
751
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
752
|
+
if (userId !== undefined && userId !== null)
|
|
753
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
754
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
755
|
+
let options_ = {
|
|
756
|
+
method: "GET",
|
|
757
|
+
url: url_,
|
|
758
|
+
headers: {
|
|
759
|
+
"Accept": "text/plain"
|
|
760
|
+
},
|
|
761
|
+
cancelToken
|
|
762
|
+
};
|
|
763
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
764
|
+
return this.instance.request(transformedOptions_);
|
|
765
|
+
}).catch((_error) => {
|
|
766
|
+
if (isAxiosError(_error) && _error.response) {
|
|
767
|
+
return _error.response;
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
throw _error;
|
|
771
|
+
}
|
|
772
|
+
}).then((_response) => {
|
|
773
|
+
return this.transformResult(url_, _response, (_response) => this.processGet(_response));
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
processGet(response) {
|
|
777
|
+
const status = response.status;
|
|
778
|
+
let _headers = {};
|
|
779
|
+
if (response.headers && typeof response.headers === "object") {
|
|
780
|
+
for (let k in response.headers) {
|
|
781
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
782
|
+
_headers[k] = response.headers[k];
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
if (status === 200) {
|
|
787
|
+
const _responseText = response.data;
|
|
788
|
+
let result200 = null;
|
|
789
|
+
let resultData200 = _responseText;
|
|
790
|
+
result200 = JSON.parse(resultData200);
|
|
791
|
+
return result200;
|
|
792
|
+
}
|
|
793
|
+
else if (status === 404) {
|
|
794
|
+
const _responseText = response.data;
|
|
795
|
+
let result404 = null;
|
|
796
|
+
let resultData404 = _responseText;
|
|
797
|
+
result404 = JSON.parse(resultData404);
|
|
798
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
799
|
+
}
|
|
800
|
+
else if (status === 401) {
|
|
801
|
+
const _responseText = response.data;
|
|
802
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
803
|
+
}
|
|
804
|
+
else if (status === 403) {
|
|
805
|
+
const _responseText = response.data;
|
|
806
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
807
|
+
}
|
|
808
|
+
else if (status !== 200 && status !== 204) {
|
|
809
|
+
const _responseText = response.data;
|
|
810
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
811
|
+
}
|
|
812
|
+
return Promise.resolve(null);
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Gets product configuration description by product specification id
|
|
816
|
+
* @param id Product specification identifier
|
|
817
|
+
* @param tenantId (optional) Tenant identifier
|
|
818
|
+
* @param userId (optional) User identifier
|
|
819
|
+
* @return Success
|
|
820
|
+
*/
|
|
821
|
+
getConfiguration(id, tenantId, userId, cancelToken) {
|
|
822
|
+
let url_ = this.baseUrl + "/api/storefront/v1/product-specifications/{id}/config?";
|
|
823
|
+
if (id === undefined || id === null)
|
|
824
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
825
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
826
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
827
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
828
|
+
if (userId !== undefined && userId !== null)
|
|
829
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
830
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
831
|
+
let options_ = {
|
|
832
|
+
method: "GET",
|
|
833
|
+
url: url_,
|
|
834
|
+
headers: {
|
|
835
|
+
"Accept": "text/plain"
|
|
836
|
+
},
|
|
837
|
+
cancelToken
|
|
838
|
+
};
|
|
839
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
840
|
+
return this.instance.request(transformedOptions_);
|
|
841
|
+
}).catch((_error) => {
|
|
842
|
+
if (isAxiosError(_error) && _error.response) {
|
|
843
|
+
return _error.response;
|
|
844
|
+
}
|
|
845
|
+
else {
|
|
846
|
+
throw _error;
|
|
847
|
+
}
|
|
848
|
+
}).then((_response) => {
|
|
849
|
+
return this.transformResult(url_, _response, (_response) => this.processGetConfiguration(_response));
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
processGetConfiguration(response) {
|
|
853
|
+
const status = response.status;
|
|
854
|
+
let _headers = {};
|
|
855
|
+
if (response.headers && typeof response.headers === "object") {
|
|
856
|
+
for (let k in response.headers) {
|
|
857
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
858
|
+
_headers[k] = response.headers[k];
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
if (status === 200) {
|
|
863
|
+
const _responseText = response.data;
|
|
864
|
+
let result200 = null;
|
|
865
|
+
let resultData200 = _responseText;
|
|
866
|
+
result200 = JSON.parse(resultData200);
|
|
867
|
+
return result200;
|
|
868
|
+
}
|
|
869
|
+
else if (status === 404) {
|
|
870
|
+
const _responseText = response.data;
|
|
871
|
+
let result404 = null;
|
|
872
|
+
let resultData404 = _responseText;
|
|
873
|
+
result404 = JSON.parse(resultData404);
|
|
874
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
875
|
+
}
|
|
876
|
+
else if (status === 401) {
|
|
877
|
+
const _responseText = response.data;
|
|
878
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
879
|
+
}
|
|
880
|
+
else if (status === 403) {
|
|
881
|
+
const _responseText = response.data;
|
|
882
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
883
|
+
}
|
|
884
|
+
else if (status !== 200 && status !== 204) {
|
|
885
|
+
const _responseText = response.data;
|
|
886
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
887
|
+
}
|
|
888
|
+
return Promise.resolve(null);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
export class ProjectsApiClient extends ApiClientBase {
|
|
892
|
+
instance;
|
|
893
|
+
baseUrl;
|
|
894
|
+
jsonParseReviver = undefined;
|
|
895
|
+
constructor(configuration, baseUrl, instance) {
|
|
896
|
+
super(configuration);
|
|
897
|
+
this.instance = instance ? instance : axios.create();
|
|
898
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Gets all projects relevant to specified query parameters
|
|
902
|
+
* @param storefrontId Storefront identifier
|
|
903
|
+
* @param ownerId (optional) Project owner (storefront user id) filter
|
|
904
|
+
* @param productReference (optional) Product reference filter
|
|
905
|
+
* @param status (optional) Project status filter
|
|
906
|
+
* @param datePeriod (optional) Project date period filter
|
|
907
|
+
* @param skip (optional) Defines page start offset from beginning of sorted result list
|
|
908
|
+
* @param take (optional) Defines page length (how much consequent items of sorted result list should be taken)
|
|
909
|
+
* @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC"
|
|
910
|
+
* @param search (optional) Search string for partial match
|
|
911
|
+
* @param tenantId (optional) Tenant identifier
|
|
912
|
+
* @param userId (optional) User identifier
|
|
913
|
+
* @return Success
|
|
914
|
+
*/
|
|
915
|
+
getAll(storefrontId, ownerId, productReference, status, datePeriod, skip, take, sorting, search, tenantId, userId, cancelToken) {
|
|
916
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects?";
|
|
917
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
918
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
919
|
+
else
|
|
920
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
921
|
+
if (ownerId !== undefined && ownerId !== null)
|
|
922
|
+
url_ += "ownerId=" + encodeURIComponent("" + ownerId) + "&";
|
|
923
|
+
if (productReference !== undefined && productReference !== null)
|
|
924
|
+
url_ += "productReference=" + encodeURIComponent("" + productReference) + "&";
|
|
925
|
+
if (status !== undefined && status !== null)
|
|
926
|
+
url_ += "status=" + encodeURIComponent("" + status) + "&";
|
|
927
|
+
if (datePeriod === null)
|
|
928
|
+
throw new Error("The parameter 'datePeriod' cannot be null.");
|
|
929
|
+
else if (datePeriod !== undefined)
|
|
930
|
+
url_ += "datePeriod=" + encodeURIComponent("" + datePeriod) + "&";
|
|
931
|
+
if (skip !== undefined && skip !== null)
|
|
932
|
+
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
|
|
933
|
+
if (take !== undefined && take !== null)
|
|
934
|
+
url_ += "take=" + encodeURIComponent("" + take) + "&";
|
|
935
|
+
if (sorting !== undefined && sorting !== null)
|
|
936
|
+
url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
|
|
937
|
+
if (search !== undefined && search !== null)
|
|
938
|
+
url_ += "search=" + encodeURIComponent("" + search) + "&";
|
|
939
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
940
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
941
|
+
if (userId !== undefined && userId !== null)
|
|
942
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
943
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
944
|
+
let options_ = {
|
|
945
|
+
method: "GET",
|
|
946
|
+
url: url_,
|
|
947
|
+
headers: {
|
|
948
|
+
"Accept": "text/plain"
|
|
949
|
+
},
|
|
950
|
+
cancelToken
|
|
951
|
+
};
|
|
952
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
953
|
+
return this.instance.request(transformedOptions_);
|
|
954
|
+
}).catch((_error) => {
|
|
955
|
+
if (isAxiosError(_error) && _error.response) {
|
|
956
|
+
return _error.response;
|
|
957
|
+
}
|
|
958
|
+
else {
|
|
959
|
+
throw _error;
|
|
960
|
+
}
|
|
961
|
+
}).then((_response) => {
|
|
962
|
+
return this.transformResult(url_, _response, (_response) => this.processGetAll(_response));
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
processGetAll(response) {
|
|
966
|
+
const status = response.status;
|
|
967
|
+
let _headers = {};
|
|
968
|
+
if (response.headers && typeof response.headers === "object") {
|
|
969
|
+
for (let k in response.headers) {
|
|
970
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
971
|
+
_headers[k] = response.headers[k];
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
if (status === 200) {
|
|
976
|
+
const _responseText = response.data;
|
|
977
|
+
let result200 = null;
|
|
978
|
+
let resultData200 = _responseText;
|
|
979
|
+
result200 = JSON.parse(resultData200);
|
|
980
|
+
return result200;
|
|
981
|
+
}
|
|
982
|
+
else if (status === 401) {
|
|
983
|
+
const _responseText = response.data;
|
|
984
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
985
|
+
}
|
|
986
|
+
else if (status === 403) {
|
|
987
|
+
const _responseText = response.data;
|
|
988
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
989
|
+
}
|
|
990
|
+
else if (status !== 200 && status !== 204) {
|
|
991
|
+
const _responseText = response.data;
|
|
992
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
993
|
+
}
|
|
994
|
+
return Promise.resolve(null);
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Creates new project
|
|
998
|
+
* @param storefrontId Storefront identifier
|
|
999
|
+
* @param tenantId (optional) Tenant identifier
|
|
1000
|
+
* @param userId (optional) User identifier
|
|
1001
|
+
* @param body (optional) Create operation parameters
|
|
1002
|
+
* @return Success
|
|
1003
|
+
*/
|
|
1004
|
+
create(storefrontId, tenantId, userId, body, cancelToken) {
|
|
1005
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects?";
|
|
1006
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
1007
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
1008
|
+
else
|
|
1009
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
1010
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1011
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1012
|
+
if (userId !== undefined && userId !== null)
|
|
1013
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
1014
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1015
|
+
const content_ = JSON.stringify(body);
|
|
1016
|
+
let options_ = {
|
|
1017
|
+
data: content_,
|
|
1018
|
+
method: "POST",
|
|
1019
|
+
url: url_,
|
|
1020
|
+
headers: {
|
|
1021
|
+
"Content-Type": "application/json-patch+json",
|
|
1022
|
+
"Accept": "text/plain"
|
|
1023
|
+
},
|
|
1024
|
+
cancelToken
|
|
1025
|
+
};
|
|
1026
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1027
|
+
return this.instance.request(transformedOptions_);
|
|
1028
|
+
}).catch((_error) => {
|
|
1029
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1030
|
+
return _error.response;
|
|
1031
|
+
}
|
|
1032
|
+
else {
|
|
1033
|
+
throw _error;
|
|
1034
|
+
}
|
|
1035
|
+
}).then((_response) => {
|
|
1036
|
+
return this.transformResult(url_, _response, (_response) => this.processCreate(_response));
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
processCreate(response) {
|
|
1040
|
+
const status = response.status;
|
|
1041
|
+
let _headers = {};
|
|
1042
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1043
|
+
for (let k in response.headers) {
|
|
1044
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1045
|
+
_headers[k] = response.headers[k];
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
if (status === 201) {
|
|
1050
|
+
const _responseText = response.data;
|
|
1051
|
+
let result201 = null;
|
|
1052
|
+
let resultData201 = _responseText;
|
|
1053
|
+
result201 = JSON.parse(resultData201);
|
|
1054
|
+
return result201;
|
|
1055
|
+
}
|
|
1056
|
+
else if (status === 409) {
|
|
1057
|
+
const _responseText = response.data;
|
|
1058
|
+
let result409 = null;
|
|
1059
|
+
let resultData409 = _responseText;
|
|
1060
|
+
result409 = JSON.parse(resultData409);
|
|
1061
|
+
return throwException("Conflict", status, _responseText, _headers, result409);
|
|
1062
|
+
}
|
|
1063
|
+
else if (status === 401) {
|
|
1064
|
+
const _responseText = response.data;
|
|
1065
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1066
|
+
}
|
|
1067
|
+
else if (status === 403) {
|
|
1068
|
+
const _responseText = response.data;
|
|
1069
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1070
|
+
}
|
|
1071
|
+
else if (status !== 200 && status !== 204) {
|
|
1072
|
+
const _responseText = response.data;
|
|
1073
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1074
|
+
}
|
|
1075
|
+
return Promise.resolve(null);
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Gets project by id
|
|
1079
|
+
* @param id Project identifier
|
|
1080
|
+
* @param tenantId (optional) Tenant identifier
|
|
1081
|
+
* @param userId (optional) User identifier
|
|
1082
|
+
* @return Success
|
|
1083
|
+
*/
|
|
1084
|
+
get(id, tenantId, userId, cancelToken) {
|
|
1085
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}?";
|
|
1086
|
+
if (id === undefined || id === null)
|
|
1087
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
1088
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
1089
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1090
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1091
|
+
if (userId !== undefined && userId !== null)
|
|
1092
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
1093
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1094
|
+
let options_ = {
|
|
1095
|
+
method: "GET",
|
|
1096
|
+
url: url_,
|
|
1097
|
+
headers: {
|
|
1098
|
+
"Accept": "text/plain"
|
|
1099
|
+
},
|
|
1100
|
+
cancelToken
|
|
1101
|
+
};
|
|
1102
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1103
|
+
return this.instance.request(transformedOptions_);
|
|
1104
|
+
}).catch((_error) => {
|
|
1105
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1106
|
+
return _error.response;
|
|
1107
|
+
}
|
|
1108
|
+
else {
|
|
1109
|
+
throw _error;
|
|
1110
|
+
}
|
|
1111
|
+
}).then((_response) => {
|
|
1112
|
+
return this.transformResult(url_, _response, (_response) => this.processGet(_response));
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
processGet(response) {
|
|
1116
|
+
const status = response.status;
|
|
1117
|
+
let _headers = {};
|
|
1118
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1119
|
+
for (let k in response.headers) {
|
|
1120
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1121
|
+
_headers[k] = response.headers[k];
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
if (status === 200) {
|
|
1126
|
+
const _responseText = response.data;
|
|
1127
|
+
let result200 = null;
|
|
1128
|
+
let resultData200 = _responseText;
|
|
1129
|
+
result200 = JSON.parse(resultData200);
|
|
1130
|
+
return result200;
|
|
1131
|
+
}
|
|
1132
|
+
else if (status === 404) {
|
|
1133
|
+
const _responseText = response.data;
|
|
1134
|
+
let result404 = null;
|
|
1135
|
+
let resultData404 = _responseText;
|
|
1136
|
+
result404 = JSON.parse(resultData404);
|
|
1137
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
1138
|
+
}
|
|
1139
|
+
else if (status === 401) {
|
|
1140
|
+
const _responseText = response.data;
|
|
1141
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1142
|
+
}
|
|
1143
|
+
else if (status === 403) {
|
|
1144
|
+
const _responseText = response.data;
|
|
1145
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1146
|
+
}
|
|
1147
|
+
else if (status !== 200 && status !== 204) {
|
|
1148
|
+
const _responseText = response.data;
|
|
1149
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1150
|
+
}
|
|
1151
|
+
return Promise.resolve(null);
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Gets available project transitions
|
|
1155
|
+
* @param id Project identifier
|
|
1156
|
+
* @param tenantId (optional) Tenant identifier
|
|
1157
|
+
* @param userId (optional) User identifier
|
|
1158
|
+
* @return Success
|
|
1159
|
+
*/
|
|
1160
|
+
getAvailableTransitions(id, tenantId, userId, cancelToken) {
|
|
1161
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/transitions?";
|
|
1162
|
+
if (id === undefined || id === null)
|
|
1163
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
1164
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
1165
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1166
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1167
|
+
if (userId !== undefined && userId !== null)
|
|
1168
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
1169
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1170
|
+
let options_ = {
|
|
1171
|
+
method: "GET",
|
|
1172
|
+
url: url_,
|
|
1173
|
+
headers: {
|
|
1174
|
+
"Accept": "text/plain"
|
|
1175
|
+
},
|
|
1176
|
+
cancelToken
|
|
1177
|
+
};
|
|
1178
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1179
|
+
return this.instance.request(transformedOptions_);
|
|
1180
|
+
}).catch((_error) => {
|
|
1181
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1182
|
+
return _error.response;
|
|
1183
|
+
}
|
|
1184
|
+
else {
|
|
1185
|
+
throw _error;
|
|
1186
|
+
}
|
|
1187
|
+
}).then((_response) => {
|
|
1188
|
+
return this.transformResult(url_, _response, (_response) => this.processGetAvailableTransitions(_response));
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
processGetAvailableTransitions(response) {
|
|
1192
|
+
const status = response.status;
|
|
1193
|
+
let _headers = {};
|
|
1194
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1195
|
+
for (let k in response.headers) {
|
|
1196
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1197
|
+
_headers[k] = response.headers[k];
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
if (status === 200) {
|
|
1202
|
+
const _responseText = response.data;
|
|
1203
|
+
let result200 = null;
|
|
1204
|
+
let resultData200 = _responseText;
|
|
1205
|
+
result200 = JSON.parse(resultData200);
|
|
1206
|
+
return result200;
|
|
1207
|
+
}
|
|
1208
|
+
else if (status === 400) {
|
|
1209
|
+
const _responseText = response.data;
|
|
1210
|
+
let result400 = null;
|
|
1211
|
+
let resultData400 = _responseText;
|
|
1212
|
+
result400 = JSON.parse(resultData400);
|
|
1213
|
+
return throwException("Bad Request", status, _responseText, _headers, result400);
|
|
1214
|
+
}
|
|
1215
|
+
else if (status === 404) {
|
|
1216
|
+
const _responseText = response.data;
|
|
1217
|
+
let result404 = null;
|
|
1218
|
+
let resultData404 = _responseText;
|
|
1219
|
+
result404 = JSON.parse(resultData404);
|
|
1220
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
1221
|
+
}
|
|
1222
|
+
else if (status === 409) {
|
|
1223
|
+
const _responseText = response.data;
|
|
1224
|
+
let result409 = null;
|
|
1225
|
+
let resultData409 = _responseText;
|
|
1226
|
+
result409 = JSON.parse(resultData409);
|
|
1227
|
+
return throwException("Conflict", status, _responseText, _headers, result409);
|
|
1228
|
+
}
|
|
1229
|
+
else if (status === 401) {
|
|
1230
|
+
const _responseText = response.data;
|
|
1231
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1232
|
+
}
|
|
1233
|
+
else if (status === 403) {
|
|
1234
|
+
const _responseText = response.data;
|
|
1235
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1236
|
+
}
|
|
1237
|
+
else if (status !== 200 && status !== 204) {
|
|
1238
|
+
const _responseText = response.data;
|
|
1239
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1240
|
+
}
|
|
1241
|
+
return Promise.resolve(null);
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Changes project status
|
|
1245
|
+
* @param id Project identifier
|
|
1246
|
+
* @param transition Transition identifying name
|
|
1247
|
+
* @param tenantId (optional) Tenant identifier
|
|
1248
|
+
* @param userId (optional) User identifier
|
|
1249
|
+
* @return Success
|
|
1250
|
+
*/
|
|
1251
|
+
changeStatus(id, transition, tenantId, userId, cancelToken) {
|
|
1252
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/transitions/{transition}?";
|
|
1253
|
+
if (id === undefined || id === null)
|
|
1254
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
1255
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
1256
|
+
if (transition === undefined || transition === null)
|
|
1257
|
+
throw new Error("The parameter 'transition' must be defined.");
|
|
1258
|
+
url_ = url_.replace("{transition}", encodeURIComponent("" + transition));
|
|
1259
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1260
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1261
|
+
if (userId !== undefined && userId !== null)
|
|
1262
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
1263
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1264
|
+
let options_ = {
|
|
1265
|
+
method: "POST",
|
|
1266
|
+
url: url_,
|
|
1267
|
+
headers: {
|
|
1268
|
+
"Accept": "text/plain"
|
|
1269
|
+
},
|
|
1270
|
+
cancelToken
|
|
1271
|
+
};
|
|
1272
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1273
|
+
return this.instance.request(transformedOptions_);
|
|
1274
|
+
}).catch((_error) => {
|
|
1275
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1276
|
+
return _error.response;
|
|
1277
|
+
}
|
|
1278
|
+
else {
|
|
1279
|
+
throw _error;
|
|
1280
|
+
}
|
|
1281
|
+
}).then((_response) => {
|
|
1282
|
+
return this.transformResult(url_, _response, (_response) => this.processChangeStatus(_response));
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
processChangeStatus(response) {
|
|
1286
|
+
const status = response.status;
|
|
1287
|
+
let _headers = {};
|
|
1288
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1289
|
+
for (let k in response.headers) {
|
|
1290
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1291
|
+
_headers[k] = response.headers[k];
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
if (status === 200) {
|
|
1296
|
+
const _responseText = response.data;
|
|
1297
|
+
let result200 = null;
|
|
1298
|
+
let resultData200 = _responseText;
|
|
1299
|
+
result200 = JSON.parse(resultData200);
|
|
1300
|
+
return result200;
|
|
1301
|
+
}
|
|
1302
|
+
else if (status === 400) {
|
|
1303
|
+
const _responseText = response.data;
|
|
1304
|
+
let result400 = null;
|
|
1305
|
+
let resultData400 = _responseText;
|
|
1306
|
+
result400 = JSON.parse(resultData400);
|
|
1307
|
+
return throwException("Bad Request", status, _responseText, _headers, result400);
|
|
1308
|
+
}
|
|
1309
|
+
else if (status === 404) {
|
|
1310
|
+
const _responseText = response.data;
|
|
1311
|
+
let result404 = null;
|
|
1312
|
+
let resultData404 = _responseText;
|
|
1313
|
+
result404 = JSON.parse(resultData404);
|
|
1314
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
1315
|
+
}
|
|
1316
|
+
else if (status === 409) {
|
|
1317
|
+
const _responseText = response.data;
|
|
1318
|
+
let result409 = null;
|
|
1319
|
+
let resultData409 = _responseText;
|
|
1320
|
+
result409 = JSON.parse(resultData409);
|
|
1321
|
+
return throwException("Conflict", status, _responseText, _headers, result409);
|
|
1322
|
+
}
|
|
1323
|
+
else if (status === 401) {
|
|
1324
|
+
const _responseText = response.data;
|
|
1325
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1326
|
+
}
|
|
1327
|
+
else if (status === 403) {
|
|
1328
|
+
const _responseText = response.data;
|
|
1329
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1330
|
+
}
|
|
1331
|
+
else if (status !== 200 && status !== 204) {
|
|
1332
|
+
const _responseText = response.data;
|
|
1333
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1334
|
+
}
|
|
1335
|
+
return Promise.resolve(null);
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Force changes project status
|
|
1339
|
+
* @param id Project identifier
|
|
1340
|
+
* @param status Project status code
|
|
1341
|
+
* @param tenantId (optional) Tenant identifier
|
|
1342
|
+
* @param userId (optional) User identifier
|
|
1343
|
+
* @return Success
|
|
1344
|
+
*/
|
|
1345
|
+
forceStatus(id, status, tenantId, userId, cancelToken) {
|
|
1346
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/statuses/{status}?";
|
|
1347
|
+
if (id === undefined || id === null)
|
|
1348
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
1349
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
1350
|
+
if (status === undefined || status === null)
|
|
1351
|
+
throw new Error("The parameter 'status' must be defined.");
|
|
1352
|
+
url_ = url_.replace("{status}", encodeURIComponent("" + status));
|
|
1353
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1354
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1355
|
+
if (userId !== undefined && userId !== null)
|
|
1356
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
1357
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1358
|
+
let options_ = {
|
|
1359
|
+
method: "POST",
|
|
1360
|
+
url: url_,
|
|
1361
|
+
headers: {
|
|
1362
|
+
"Accept": "text/plain"
|
|
1363
|
+
},
|
|
1364
|
+
cancelToken
|
|
1365
|
+
};
|
|
1366
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1367
|
+
return this.instance.request(transformedOptions_);
|
|
1368
|
+
}).catch((_error) => {
|
|
1369
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1370
|
+
return _error.response;
|
|
1371
|
+
}
|
|
1372
|
+
else {
|
|
1373
|
+
throw _error;
|
|
1374
|
+
}
|
|
1375
|
+
}).then((_response) => {
|
|
1376
|
+
return this.transformResult(url_, _response, (_response) => this.processForceStatus(_response));
|
|
1377
|
+
});
|
|
1378
|
+
}
|
|
1379
|
+
processForceStatus(response) {
|
|
1380
|
+
const status = response.status;
|
|
1381
|
+
let _headers = {};
|
|
1382
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1383
|
+
for (let k in response.headers) {
|
|
1384
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1385
|
+
_headers[k] = response.headers[k];
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
if (status === 200) {
|
|
1390
|
+
const _responseText = response.data;
|
|
1391
|
+
let result200 = null;
|
|
1392
|
+
let resultData200 = _responseText;
|
|
1393
|
+
result200 = JSON.parse(resultData200);
|
|
1394
|
+
return result200;
|
|
1395
|
+
}
|
|
1396
|
+
else if (status === 400) {
|
|
1397
|
+
const _responseText = response.data;
|
|
1398
|
+
let result400 = null;
|
|
1399
|
+
let resultData400 = _responseText;
|
|
1400
|
+
result400 = JSON.parse(resultData400);
|
|
1401
|
+
return throwException("Bad Request", status, _responseText, _headers, result400);
|
|
1402
|
+
}
|
|
1403
|
+
else if (status === 404) {
|
|
1404
|
+
const _responseText = response.data;
|
|
1405
|
+
let result404 = null;
|
|
1406
|
+
let resultData404 = _responseText;
|
|
1407
|
+
result404 = JSON.parse(resultData404);
|
|
1408
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
1409
|
+
}
|
|
1410
|
+
else if (status === 401) {
|
|
1411
|
+
const _responseText = response.data;
|
|
1412
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1413
|
+
}
|
|
1414
|
+
else if (status === 403) {
|
|
1415
|
+
const _responseText = response.data;
|
|
1416
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1417
|
+
}
|
|
1418
|
+
else if (status !== 200 && status !== 204) {
|
|
1419
|
+
const _responseText = response.data;
|
|
1420
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1421
|
+
}
|
|
1422
|
+
return Promise.resolve(null);
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* Gets all project statuses
|
|
1426
|
+
* @param tenantId (optional) Tenant identifier
|
|
1427
|
+
* @param userId (optional) User identifier
|
|
1428
|
+
* @return Success
|
|
1429
|
+
*/
|
|
1430
|
+
getAllStatuses(tenantId, userId, cancelToken) {
|
|
1431
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects/statuses?";
|
|
1432
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1433
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1434
|
+
if (userId !== undefined && userId !== null)
|
|
1435
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
1436
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1437
|
+
let options_ = {
|
|
1438
|
+
method: "GET",
|
|
1439
|
+
url: url_,
|
|
1440
|
+
headers: {
|
|
1441
|
+
"Accept": "text/plain"
|
|
1442
|
+
},
|
|
1443
|
+
cancelToken
|
|
1444
|
+
};
|
|
1445
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1446
|
+
return this.instance.request(transformedOptions_);
|
|
1447
|
+
}).catch((_error) => {
|
|
1448
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1449
|
+
return _error.response;
|
|
1450
|
+
}
|
|
1451
|
+
else {
|
|
1452
|
+
throw _error;
|
|
1453
|
+
}
|
|
1454
|
+
}).then((_response) => {
|
|
1455
|
+
return this.transformResult(url_, _response, (_response) => this.processGetAllStatuses(_response));
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
processGetAllStatuses(response) {
|
|
1459
|
+
const status = response.status;
|
|
1460
|
+
let _headers = {};
|
|
1461
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1462
|
+
for (let k in response.headers) {
|
|
1463
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1464
|
+
_headers[k] = response.headers[k];
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
if (status === 200) {
|
|
1469
|
+
const _responseText = response.data;
|
|
1470
|
+
let result200 = null;
|
|
1471
|
+
let resultData200 = _responseText;
|
|
1472
|
+
result200 = JSON.parse(resultData200);
|
|
1473
|
+
return result200;
|
|
1474
|
+
}
|
|
1475
|
+
else if (status === 401) {
|
|
1476
|
+
const _responseText = response.data;
|
|
1477
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1478
|
+
}
|
|
1479
|
+
else if (status === 403) {
|
|
1480
|
+
const _responseText = response.data;
|
|
1481
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1482
|
+
}
|
|
1483
|
+
else if (status !== 200 && status !== 204) {
|
|
1484
|
+
const _responseText = response.data;
|
|
1485
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1486
|
+
}
|
|
1487
|
+
return Promise.resolve(null);
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Gets all project transitions
|
|
1491
|
+
* @param tenantId (optional) Tenant identifier
|
|
1492
|
+
* @param userId (optional) User identifier
|
|
1493
|
+
* @return Success
|
|
1494
|
+
*/
|
|
1495
|
+
getAllTransitions(tenantId, userId, cancelToken) {
|
|
1496
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects/transitions?";
|
|
1497
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1498
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1499
|
+
if (userId !== undefined && userId !== null)
|
|
1500
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
1501
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1502
|
+
let options_ = {
|
|
1503
|
+
method: "GET",
|
|
1504
|
+
url: url_,
|
|
1505
|
+
headers: {
|
|
1506
|
+
"Accept": "text/plain"
|
|
1507
|
+
},
|
|
1508
|
+
cancelToken
|
|
1509
|
+
};
|
|
1510
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1511
|
+
return this.instance.request(transformedOptions_);
|
|
1512
|
+
}).catch((_error) => {
|
|
1513
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1514
|
+
return _error.response;
|
|
1515
|
+
}
|
|
1516
|
+
else {
|
|
1517
|
+
throw _error;
|
|
1518
|
+
}
|
|
1519
|
+
}).then((_response) => {
|
|
1520
|
+
return this.transformResult(url_, _response, (_response) => this.processGetAllTransitions(_response));
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
processGetAllTransitions(response) {
|
|
1524
|
+
const status = response.status;
|
|
1525
|
+
let _headers = {};
|
|
1526
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1527
|
+
for (let k in response.headers) {
|
|
1528
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1529
|
+
_headers[k] = response.headers[k];
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
if (status === 200) {
|
|
1534
|
+
const _responseText = response.data;
|
|
1535
|
+
let result200 = null;
|
|
1536
|
+
let resultData200 = _responseText;
|
|
1537
|
+
result200 = JSON.parse(resultData200);
|
|
1538
|
+
return result200;
|
|
1539
|
+
}
|
|
1540
|
+
else if (status === 401) {
|
|
1541
|
+
const _responseText = response.data;
|
|
1542
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1543
|
+
}
|
|
1544
|
+
else if (status === 403) {
|
|
1545
|
+
const _responseText = response.data;
|
|
1546
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1547
|
+
}
|
|
1548
|
+
else if (status !== 200 && status !== 204) {
|
|
1549
|
+
const _responseText = response.data;
|
|
1550
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1551
|
+
}
|
|
1552
|
+
return Promise.resolve(null);
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Gets project pdf url
|
|
1556
|
+
* @param id Project unique identifier
|
|
1557
|
+
* @param designUserId User identifier
|
|
1558
|
+
* @param designId Design identifier
|
|
1559
|
+
* @param tenantId (optional) Tenant identifier
|
|
1560
|
+
* @param userId (optional) User identifier
|
|
1561
|
+
* @return Success
|
|
1562
|
+
*/
|
|
1563
|
+
getProjectPdfUrl(id, designUserId, designId, tenantId, userId, cancelToken) {
|
|
1564
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/project-pdf?";
|
|
1565
|
+
if (id === undefined || id === null)
|
|
1566
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
1567
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
1568
|
+
if (designUserId === undefined || designUserId === null)
|
|
1569
|
+
throw new Error("The parameter 'designUserId' must be defined and cannot be null.");
|
|
1570
|
+
else
|
|
1571
|
+
url_ += "designUserId=" + encodeURIComponent("" + designUserId) + "&";
|
|
1572
|
+
if (designId === undefined || designId === null)
|
|
1573
|
+
throw new Error("The parameter 'designId' must be defined and cannot be null.");
|
|
1574
|
+
else
|
|
1575
|
+
url_ += "designId=" + encodeURIComponent("" + designId) + "&";
|
|
1576
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1577
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1578
|
+
if (userId !== undefined && userId !== null)
|
|
1579
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
1580
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1581
|
+
let options_ = {
|
|
1582
|
+
method: "GET",
|
|
1583
|
+
url: url_,
|
|
1584
|
+
headers: {
|
|
1585
|
+
"Accept": "text/plain"
|
|
1586
|
+
},
|
|
1587
|
+
cancelToken
|
|
1588
|
+
};
|
|
1589
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1590
|
+
return this.instance.request(transformedOptions_);
|
|
1591
|
+
}).catch((_error) => {
|
|
1592
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1593
|
+
return _error.response;
|
|
1594
|
+
}
|
|
1595
|
+
else {
|
|
1596
|
+
throw _error;
|
|
1597
|
+
}
|
|
1598
|
+
}).then((_response) => {
|
|
1599
|
+
return this.transformResult(url_, _response, (_response) => this.processGetProjectPdfUrl(_response));
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1602
|
+
processGetProjectPdfUrl(response) {
|
|
1603
|
+
const status = response.status;
|
|
1604
|
+
let _headers = {};
|
|
1605
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1606
|
+
for (let k in response.headers) {
|
|
1607
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1608
|
+
_headers[k] = response.headers[k];
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
if (status === 200) {
|
|
1613
|
+
const _responseText = response.data;
|
|
1614
|
+
let result200 = null;
|
|
1615
|
+
let resultData200 = _responseText;
|
|
1616
|
+
result200 = JSON.parse(resultData200);
|
|
1617
|
+
return result200;
|
|
1618
|
+
}
|
|
1619
|
+
else if (status === 401) {
|
|
1620
|
+
const _responseText = response.data;
|
|
1621
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1622
|
+
}
|
|
1623
|
+
else if (status === 403) {
|
|
1624
|
+
const _responseText = response.data;
|
|
1625
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1626
|
+
}
|
|
1627
|
+
else if (status !== 200 && status !== 204) {
|
|
1628
|
+
const _responseText = response.data;
|
|
1629
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1630
|
+
}
|
|
1631
|
+
return Promise.resolve(null);
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Gets project pdf files in zip archive
|
|
1635
|
+
* @param id Project unique identifier
|
|
1636
|
+
* @param designUserId User identifier
|
|
1637
|
+
* @param designId Design identifier
|
|
1638
|
+
* @param attachment (optional) If set to 'true', file will be provided as an attachment with proper filename supplied (default value is 'false')
|
|
1639
|
+
* @param tenantId (optional) Tenant identifier
|
|
1640
|
+
* @param userId (optional) User identifier
|
|
1641
|
+
* @return Success
|
|
1642
|
+
*/
|
|
1643
|
+
getProjectPdfZip(id, designUserId, designId, attachment, tenantId, userId, cancelToken) {
|
|
1644
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/project-pdf-zip?";
|
|
1645
|
+
if (id === undefined || id === null)
|
|
1646
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
1647
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
1648
|
+
if (designUserId === undefined || designUserId === null)
|
|
1649
|
+
throw new Error("The parameter 'designUserId' must be defined and cannot be null.");
|
|
1650
|
+
else
|
|
1651
|
+
url_ += "designUserId=" + encodeURIComponent("" + designUserId) + "&";
|
|
1652
|
+
if (designId === undefined || designId === null)
|
|
1653
|
+
throw new Error("The parameter 'designId' must be defined and cannot be null.");
|
|
1654
|
+
else
|
|
1655
|
+
url_ += "designId=" + encodeURIComponent("" + designId) + "&";
|
|
1656
|
+
if (attachment !== undefined && attachment !== null)
|
|
1657
|
+
url_ += "attachment=" + encodeURIComponent("" + attachment) + "&";
|
|
1658
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1659
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1660
|
+
if (userId !== undefined && userId !== null)
|
|
1661
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
1662
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1663
|
+
let options_ = {
|
|
1664
|
+
responseType: "blob",
|
|
1665
|
+
method: "GET",
|
|
1666
|
+
url: url_,
|
|
1667
|
+
headers: {
|
|
1668
|
+
"Accept": "application/octet-stream"
|
|
1669
|
+
},
|
|
1670
|
+
cancelToken
|
|
1671
|
+
};
|
|
1672
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1673
|
+
return this.instance.request(transformedOptions_);
|
|
1674
|
+
}).catch((_error) => {
|
|
1675
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1676
|
+
return _error.response;
|
|
1677
|
+
}
|
|
1678
|
+
else {
|
|
1679
|
+
throw _error;
|
|
1680
|
+
}
|
|
1681
|
+
}).then((_response) => {
|
|
1682
|
+
return this.transformResult(url_, _response, (_response) => this.processGetProjectPdfZip(_response));
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
processGetProjectPdfZip(response) {
|
|
1686
|
+
const status = response.status;
|
|
1687
|
+
let _headers = {};
|
|
1688
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1689
|
+
for (let k in response.headers) {
|
|
1690
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1691
|
+
_headers[k] = response.headers[k];
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
if (status === 200 || status === 206) {
|
|
1696
|
+
const contentDisposition = response.headers ? response.headers["content-disposition"] : undefined;
|
|
1697
|
+
const fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
|
|
1698
|
+
const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
|
|
1699
|
+
return Promise.resolve({ fileName: fileName, status: status, data: response.data, headers: _headers });
|
|
1700
|
+
}
|
|
1701
|
+
else if (status === 404) {
|
|
1702
|
+
const _responseText = response.data;
|
|
1703
|
+
let result404 = null;
|
|
1704
|
+
let resultData404 = _responseText;
|
|
1705
|
+
result404 = JSON.parse(resultData404);
|
|
1706
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
1707
|
+
}
|
|
1708
|
+
else if (status === 401) {
|
|
1709
|
+
const _responseText = response.data;
|
|
1710
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1711
|
+
}
|
|
1712
|
+
else if (status === 403) {
|
|
1713
|
+
const _responseText = response.data;
|
|
1714
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1715
|
+
}
|
|
1716
|
+
else if (status !== 200 && status !== 204) {
|
|
1717
|
+
const _responseText = response.data;
|
|
1718
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1719
|
+
}
|
|
1720
|
+
return Promise.resolve(null);
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Gets project order data from ecommerce system
|
|
1724
|
+
* @param id Project identifier
|
|
1725
|
+
* @return Success
|
|
1726
|
+
*/
|
|
1727
|
+
getProjectOrder(id, cancelToken) {
|
|
1728
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/order";
|
|
1729
|
+
if (id === undefined || id === null)
|
|
1730
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
1731
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
1732
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1733
|
+
let options_ = {
|
|
1734
|
+
method: "GET",
|
|
1735
|
+
url: url_,
|
|
1736
|
+
headers: {
|
|
1737
|
+
"Accept": "application/json"
|
|
1738
|
+
},
|
|
1739
|
+
cancelToken
|
|
1740
|
+
};
|
|
1741
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1742
|
+
return this.instance.request(transformedOptions_);
|
|
1743
|
+
}).catch((_error) => {
|
|
1744
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1745
|
+
return _error.response;
|
|
1746
|
+
}
|
|
1747
|
+
else {
|
|
1748
|
+
throw _error;
|
|
1749
|
+
}
|
|
1750
|
+
}).then((_response) => {
|
|
1751
|
+
return this.transformResult(url_, _response, (_response) => this.processGetProjectOrder(_response));
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
processGetProjectOrder(response) {
|
|
1755
|
+
const status = response.status;
|
|
1756
|
+
let _headers = {};
|
|
1757
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1758
|
+
for (let k in response.headers) {
|
|
1759
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1760
|
+
_headers[k] = response.headers[k];
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
if (status === 200) {
|
|
1765
|
+
const _responseText = response.data;
|
|
1766
|
+
let result200 = null;
|
|
1767
|
+
let resultData200 = _responseText;
|
|
1768
|
+
result200 = JSON.parse(resultData200);
|
|
1769
|
+
return result200;
|
|
1770
|
+
}
|
|
1771
|
+
else if (status === 404) {
|
|
1772
|
+
const _responseText = response.data;
|
|
1773
|
+
let result404 = null;
|
|
1774
|
+
let resultData404 = _responseText;
|
|
1775
|
+
result404 = JSON.parse(resultData404);
|
|
1776
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
1777
|
+
}
|
|
1778
|
+
else if (status === 401) {
|
|
1779
|
+
const _responseText = response.data;
|
|
1780
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1781
|
+
}
|
|
1782
|
+
else if (status === 403) {
|
|
1783
|
+
const _responseText = response.data;
|
|
1784
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1785
|
+
}
|
|
1786
|
+
else if (status !== 200 && status !== 204) {
|
|
1787
|
+
const _responseText = response.data;
|
|
1788
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1789
|
+
}
|
|
1790
|
+
return Promise.resolve(null);
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
export class StorefrontsApiClient extends ApiClientBase {
|
|
1794
|
+
instance;
|
|
1795
|
+
baseUrl;
|
|
1796
|
+
jsonParseReviver = undefined;
|
|
1797
|
+
constructor(configuration, baseUrl, instance) {
|
|
1798
|
+
super(configuration);
|
|
1799
|
+
this.instance = instance ? instance : axios.create();
|
|
1800
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
|
|
1801
|
+
}
|
|
1802
|
+
/**
|
|
1803
|
+
* Gets all storefronts relevant to specified query parameters
|
|
1804
|
+
* @param types (optional) Storefront type filter
|
|
1805
|
+
* @param skip (optional) Defines page start offset from beginning of sorted result list
|
|
1806
|
+
* @param take (optional) Defines page length (how much consequent items of sorted result list should be taken)
|
|
1807
|
+
* @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC"
|
|
1808
|
+
* @param search (optional) Search string for partial match
|
|
1809
|
+
* @param tenantId (optional) Tenant identifier
|
|
1810
|
+
* @param userId (optional) User identifier
|
|
1811
|
+
* @return Success
|
|
1812
|
+
*/
|
|
1813
|
+
getAll(types, skip, take, sorting, search, tenantId, userId, cancelToken) {
|
|
1814
|
+
let url_ = this.baseUrl + "/api/storefront/v1/storefronts?";
|
|
1815
|
+
if (types !== undefined && types !== null)
|
|
1816
|
+
types && types.forEach(item => { url_ += "types=" + encodeURIComponent("" + item) + "&"; });
|
|
1817
|
+
if (skip !== undefined && skip !== null)
|
|
1818
|
+
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
|
|
1819
|
+
if (take !== undefined && take !== null)
|
|
1820
|
+
url_ += "take=" + encodeURIComponent("" + take) + "&";
|
|
1821
|
+
if (sorting !== undefined && sorting !== null)
|
|
1822
|
+
url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
|
|
1823
|
+
if (search !== undefined && search !== null)
|
|
1824
|
+
url_ += "search=" + encodeURIComponent("" + search) + "&";
|
|
1825
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1826
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1827
|
+
if (userId !== undefined && userId !== null)
|
|
1828
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
1829
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1830
|
+
let options_ = {
|
|
1831
|
+
method: "GET",
|
|
1832
|
+
url: url_,
|
|
1833
|
+
headers: {
|
|
1834
|
+
"Accept": "text/plain"
|
|
1835
|
+
},
|
|
1836
|
+
cancelToken
|
|
1837
|
+
};
|
|
1838
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1839
|
+
return this.instance.request(transformedOptions_);
|
|
1840
|
+
}).catch((_error) => {
|
|
1841
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1842
|
+
return _error.response;
|
|
1843
|
+
}
|
|
1844
|
+
else {
|
|
1845
|
+
throw _error;
|
|
1846
|
+
}
|
|
1847
|
+
}).then((_response) => {
|
|
1848
|
+
return this.transformResult(url_, _response, (_response) => this.processGetAll(_response));
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
processGetAll(response) {
|
|
1852
|
+
const status = response.status;
|
|
1853
|
+
let _headers = {};
|
|
1854
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1855
|
+
for (let k in response.headers) {
|
|
1856
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1857
|
+
_headers[k] = response.headers[k];
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
if (status === 200) {
|
|
1862
|
+
const _responseText = response.data;
|
|
1863
|
+
let result200 = null;
|
|
1864
|
+
let resultData200 = _responseText;
|
|
1865
|
+
result200 = JSON.parse(resultData200);
|
|
1866
|
+
return result200;
|
|
1867
|
+
}
|
|
1868
|
+
else if (status === 401) {
|
|
1869
|
+
const _responseText = response.data;
|
|
1870
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1871
|
+
}
|
|
1872
|
+
else if (status === 403) {
|
|
1873
|
+
const _responseText = response.data;
|
|
1874
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1875
|
+
}
|
|
1876
|
+
else if (status !== 200 && status !== 204) {
|
|
1877
|
+
const _responseText = response.data;
|
|
1878
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1879
|
+
}
|
|
1880
|
+
return Promise.resolve(null);
|
|
1881
|
+
}
|
|
1882
|
+
/**
|
|
1883
|
+
* Gets storefront
|
|
1884
|
+
* @param id Storefront identifier
|
|
1885
|
+
* @param tenantId (optional) Tenant identifier
|
|
1886
|
+
* @param userId (optional) User identifier
|
|
1887
|
+
* @return Success
|
|
1888
|
+
*/
|
|
1889
|
+
get(id, tenantId, userId, cancelToken) {
|
|
1890
|
+
let url_ = this.baseUrl + "/api/storefront/v1/storefronts/{id}?";
|
|
1891
|
+
if (id === undefined || id === null)
|
|
1892
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
1893
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
1894
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1895
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1896
|
+
if (userId !== undefined && userId !== null)
|
|
1897
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
1898
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1899
|
+
let options_ = {
|
|
1900
|
+
method: "GET",
|
|
1901
|
+
url: url_,
|
|
1902
|
+
headers: {
|
|
1903
|
+
"Accept": "text/plain"
|
|
1904
|
+
},
|
|
1905
|
+
cancelToken
|
|
1906
|
+
};
|
|
1907
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1908
|
+
return this.instance.request(transformedOptions_);
|
|
1909
|
+
}).catch((_error) => {
|
|
1910
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1911
|
+
return _error.response;
|
|
1912
|
+
}
|
|
1913
|
+
else {
|
|
1914
|
+
throw _error;
|
|
1915
|
+
}
|
|
1916
|
+
}).then((_response) => {
|
|
1917
|
+
return this.transformResult(url_, _response, (_response) => this.processGet(_response));
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
processGet(response) {
|
|
1921
|
+
const status = response.status;
|
|
1922
|
+
let _headers = {};
|
|
1923
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1924
|
+
for (let k in response.headers) {
|
|
1925
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1926
|
+
_headers[k] = response.headers[k];
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
if (status === 200) {
|
|
1931
|
+
const _responseText = response.data;
|
|
1932
|
+
let result200 = null;
|
|
1933
|
+
let resultData200 = _responseText;
|
|
1934
|
+
result200 = JSON.parse(resultData200);
|
|
1935
|
+
return result200;
|
|
1936
|
+
}
|
|
1937
|
+
else if (status === 404) {
|
|
1938
|
+
const _responseText = response.data;
|
|
1939
|
+
let result404 = null;
|
|
1940
|
+
let resultData404 = _responseText;
|
|
1941
|
+
result404 = JSON.parse(resultData404);
|
|
1942
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
1943
|
+
}
|
|
1944
|
+
else if (status === 401) {
|
|
1945
|
+
const _responseText = response.data;
|
|
1946
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1947
|
+
}
|
|
1948
|
+
else if (status === 403) {
|
|
1949
|
+
const _responseText = response.data;
|
|
1950
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1951
|
+
}
|
|
1952
|
+
else if (status !== 200 && status !== 204) {
|
|
1953
|
+
const _responseText = response.data;
|
|
1954
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1955
|
+
}
|
|
1956
|
+
return Promise.resolve(null);
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
export class StorefrontUsersApiClient extends ApiClientBase {
|
|
1960
|
+
instance;
|
|
1961
|
+
baseUrl;
|
|
1962
|
+
jsonParseReviver = undefined;
|
|
1963
|
+
constructor(configuration, baseUrl, instance) {
|
|
1964
|
+
super(configuration);
|
|
1965
|
+
this.instance = instance ? instance : axios.create();
|
|
1966
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
|
|
1967
|
+
}
|
|
1968
|
+
/**
|
|
1969
|
+
* Gets all storefront users relevant to specified query parameters
|
|
1970
|
+
* @param storefrontId Storefront identifier
|
|
1971
|
+
* @param storefrontUserId (optional) Storefront user identifier
|
|
1972
|
+
* @param skip (optional) Defines page start offset from beginning of sorted result list
|
|
1973
|
+
* @param take (optional) Defines page length (how much consequent items of sorted result list should be taken)
|
|
1974
|
+
* @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC"
|
|
1975
|
+
* @param search (optional) Search string for partial match
|
|
1976
|
+
* @param tenantId (optional) Tenant identifier
|
|
1977
|
+
* @param userId (optional) User identifier
|
|
1978
|
+
* @return Success
|
|
1979
|
+
*/
|
|
1980
|
+
getAll(storefrontId, storefrontUserId, skip, take, sorting, search, tenantId, userId, cancelToken) {
|
|
1981
|
+
let url_ = this.baseUrl + "/api/storefront/v1/storefront-users?";
|
|
1982
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
1983
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
1984
|
+
else
|
|
1985
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
1986
|
+
if (storefrontUserId !== undefined && storefrontUserId !== null)
|
|
1987
|
+
url_ += "storefrontUserId=" + encodeURIComponent("" + storefrontUserId) + "&";
|
|
1988
|
+
if (skip !== undefined && skip !== null)
|
|
1989
|
+
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
|
|
1990
|
+
if (take !== undefined && take !== null)
|
|
1991
|
+
url_ += "take=" + encodeURIComponent("" + take) + "&";
|
|
1992
|
+
if (sorting !== undefined && sorting !== null)
|
|
1993
|
+
url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
|
|
1994
|
+
if (search !== undefined && search !== null)
|
|
1995
|
+
url_ += "search=" + encodeURIComponent("" + search) + "&";
|
|
1996
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1997
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1998
|
+
if (userId !== undefined && userId !== null)
|
|
1999
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
2000
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
2001
|
+
let options_ = {
|
|
2002
|
+
method: "GET",
|
|
2003
|
+
url: url_,
|
|
2004
|
+
headers: {
|
|
2005
|
+
"Accept": "text/plain"
|
|
2006
|
+
},
|
|
2007
|
+
cancelToken
|
|
2008
|
+
};
|
|
2009
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
2010
|
+
return this.instance.request(transformedOptions_);
|
|
2011
|
+
}).catch((_error) => {
|
|
2012
|
+
if (isAxiosError(_error) && _error.response) {
|
|
2013
|
+
return _error.response;
|
|
2014
|
+
}
|
|
2015
|
+
else {
|
|
2016
|
+
throw _error;
|
|
2017
|
+
}
|
|
2018
|
+
}).then((_response) => {
|
|
2019
|
+
return this.transformResult(url_, _response, (_response) => this.processGetAll(_response));
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
processGetAll(response) {
|
|
2023
|
+
const status = response.status;
|
|
2024
|
+
let _headers = {};
|
|
2025
|
+
if (response.headers && typeof response.headers === "object") {
|
|
2026
|
+
for (let k in response.headers) {
|
|
2027
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
2028
|
+
_headers[k] = response.headers[k];
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
if (status === 200) {
|
|
2033
|
+
const _responseText = response.data;
|
|
2034
|
+
let result200 = null;
|
|
2035
|
+
let resultData200 = _responseText;
|
|
2036
|
+
result200 = JSON.parse(resultData200);
|
|
2037
|
+
return result200;
|
|
2038
|
+
}
|
|
2039
|
+
else if (status === 401) {
|
|
2040
|
+
const _responseText = response.data;
|
|
2041
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
2042
|
+
}
|
|
2043
|
+
else if (status === 403) {
|
|
2044
|
+
const _responseText = response.data;
|
|
2045
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
2046
|
+
}
|
|
2047
|
+
else if (status !== 200 && status !== 204) {
|
|
2048
|
+
const _responseText = response.data;
|
|
2049
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
2050
|
+
}
|
|
2051
|
+
return Promise.resolve(null);
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Creates new storefront user
|
|
2055
|
+
* @param storefrontId Storefront identifier
|
|
2056
|
+
* @param tenantId (optional) Tenant identifier
|
|
2057
|
+
* @param userId (optional) User identifier
|
|
2058
|
+
* @param body (optional) Create operation parameters
|
|
2059
|
+
* @return Success
|
|
2060
|
+
*/
|
|
2061
|
+
create(storefrontId, tenantId, userId, body, cancelToken) {
|
|
2062
|
+
let url_ = this.baseUrl + "/api/storefront/v1/storefront-users?";
|
|
2063
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
2064
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
2065
|
+
else
|
|
2066
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
2067
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
2068
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
2069
|
+
if (userId !== undefined && userId !== null)
|
|
2070
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
2071
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
2072
|
+
const content_ = JSON.stringify(body);
|
|
2073
|
+
let options_ = {
|
|
2074
|
+
data: content_,
|
|
2075
|
+
method: "POST",
|
|
2076
|
+
url: url_,
|
|
2077
|
+
headers: {
|
|
2078
|
+
"Content-Type": "application/json-patch+json",
|
|
2079
|
+
"Accept": "text/plain"
|
|
2080
|
+
},
|
|
2081
|
+
cancelToken
|
|
2082
|
+
};
|
|
2083
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
2084
|
+
return this.instance.request(transformedOptions_);
|
|
2085
|
+
}).catch((_error) => {
|
|
2086
|
+
if (isAxiosError(_error) && _error.response) {
|
|
2087
|
+
return _error.response;
|
|
2088
|
+
}
|
|
2089
|
+
else {
|
|
2090
|
+
throw _error;
|
|
2091
|
+
}
|
|
2092
|
+
}).then((_response) => {
|
|
2093
|
+
return this.transformResult(url_, _response, (_response) => this.processCreate(_response));
|
|
2094
|
+
});
|
|
2095
|
+
}
|
|
2096
|
+
processCreate(response) {
|
|
2097
|
+
const status = response.status;
|
|
2098
|
+
let _headers = {};
|
|
2099
|
+
if (response.headers && typeof response.headers === "object") {
|
|
2100
|
+
for (let k in response.headers) {
|
|
2101
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
2102
|
+
_headers[k] = response.headers[k];
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
if (status === 201) {
|
|
2107
|
+
const _responseText = response.data;
|
|
2108
|
+
let result201 = null;
|
|
2109
|
+
let resultData201 = _responseText;
|
|
2110
|
+
result201 = JSON.parse(resultData201);
|
|
2111
|
+
return result201;
|
|
2112
|
+
}
|
|
2113
|
+
else if (status === 401) {
|
|
2114
|
+
const _responseText = response.data;
|
|
2115
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
2116
|
+
}
|
|
2117
|
+
else if (status === 403) {
|
|
2118
|
+
const _responseText = response.data;
|
|
2119
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
2120
|
+
}
|
|
2121
|
+
else if (status !== 200 && status !== 204) {
|
|
2122
|
+
const _responseText = response.data;
|
|
2123
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
2124
|
+
}
|
|
2125
|
+
return Promise.resolve(null);
|
|
2126
|
+
}
|
|
2127
|
+
/**
|
|
2128
|
+
* Gets storefront user by id
|
|
2129
|
+
* @param id Storefront user identifier
|
|
2130
|
+
* @param storefrontId Storefront identifier
|
|
2131
|
+
* @param tenantId (optional) Tenant identifier
|
|
2132
|
+
* @param userId (optional) User identifier
|
|
2133
|
+
* @return Success
|
|
2134
|
+
*/
|
|
2135
|
+
get(id, storefrontId, tenantId, userId, cancelToken) {
|
|
2136
|
+
let url_ = this.baseUrl + "/api/storefront/v1/storefront-users/{id}?";
|
|
2137
|
+
if (id === undefined || id === null)
|
|
2138
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
2139
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
2140
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
2141
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
2142
|
+
else
|
|
2143
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
2144
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
2145
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
2146
|
+
if (userId !== undefined && userId !== null)
|
|
2147
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
2148
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
2149
|
+
let options_ = {
|
|
2150
|
+
method: "GET",
|
|
2151
|
+
url: url_,
|
|
2152
|
+
headers: {
|
|
2153
|
+
"Accept": "text/plain"
|
|
2154
|
+
},
|
|
2155
|
+
cancelToken
|
|
2156
|
+
};
|
|
2157
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
2158
|
+
return this.instance.request(transformedOptions_);
|
|
2159
|
+
}).catch((_error) => {
|
|
2160
|
+
if (isAxiosError(_error) && _error.response) {
|
|
2161
|
+
return _error.response;
|
|
2162
|
+
}
|
|
2163
|
+
else {
|
|
2164
|
+
throw _error;
|
|
2165
|
+
}
|
|
2166
|
+
}).then((_response) => {
|
|
2167
|
+
return this.transformResult(url_, _response, (_response) => this.processGet(_response));
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2170
|
+
processGet(response) {
|
|
2171
|
+
const status = response.status;
|
|
2172
|
+
let _headers = {};
|
|
2173
|
+
if (response.headers && typeof response.headers === "object") {
|
|
2174
|
+
for (let k in response.headers) {
|
|
2175
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
2176
|
+
_headers[k] = response.headers[k];
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
if (status === 200) {
|
|
2181
|
+
const _responseText = response.data;
|
|
2182
|
+
let result200 = null;
|
|
2183
|
+
let resultData200 = _responseText;
|
|
2184
|
+
result200 = JSON.parse(resultData200);
|
|
2185
|
+
return result200;
|
|
2186
|
+
}
|
|
2187
|
+
else if (status === 404) {
|
|
2188
|
+
const _responseText = response.data;
|
|
2189
|
+
let result404 = null;
|
|
2190
|
+
let resultData404 = _responseText;
|
|
2191
|
+
result404 = JSON.parse(resultData404);
|
|
2192
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
2193
|
+
}
|
|
2194
|
+
else if (status === 401) {
|
|
2195
|
+
const _responseText = response.data;
|
|
2196
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
2197
|
+
}
|
|
2198
|
+
else if (status === 403) {
|
|
2199
|
+
const _responseText = response.data;
|
|
2200
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
2201
|
+
}
|
|
2202
|
+
else if (status !== 200 && status !== 204) {
|
|
2203
|
+
const _responseText = response.data;
|
|
2204
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
2205
|
+
}
|
|
2206
|
+
return Promise.resolve(null);
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* Merges anonymous storefront user data to regular storefront user account
|
|
2210
|
+
* @param storefrontId Storefront identifier
|
|
2211
|
+
* @param tenantId (optional) Tenant identifier
|
|
2212
|
+
* @param userId (optional) User identifier
|
|
2213
|
+
* @param body (optional) Merge operation parameters
|
|
2214
|
+
* @return Success
|
|
2215
|
+
*/
|
|
2216
|
+
mergeAnonymous(storefrontId, tenantId, userId, body, cancelToken) {
|
|
2217
|
+
let url_ = this.baseUrl + "/api/storefront/v1/storefront-users/merge-anonymous?";
|
|
2218
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
2219
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
2220
|
+
else
|
|
2221
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
2222
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
2223
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
2224
|
+
if (userId !== undefined && userId !== null)
|
|
2225
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
2226
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
2227
|
+
const content_ = JSON.stringify(body);
|
|
2228
|
+
let options_ = {
|
|
2229
|
+
data: content_,
|
|
2230
|
+
method: "POST",
|
|
2231
|
+
url: url_,
|
|
2232
|
+
headers: {
|
|
2233
|
+
"Content-Type": "application/json-patch+json",
|
|
2234
|
+
},
|
|
2235
|
+
cancelToken
|
|
2236
|
+
};
|
|
2237
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
2238
|
+
return this.instance.request(transformedOptions_);
|
|
2239
|
+
}).catch((_error) => {
|
|
2240
|
+
if (isAxiosError(_error) && _error.response) {
|
|
2241
|
+
return _error.response;
|
|
2242
|
+
}
|
|
2243
|
+
else {
|
|
2244
|
+
throw _error;
|
|
2245
|
+
}
|
|
2246
|
+
}).then((_response) => {
|
|
2247
|
+
return this.transformResult(url_, _response, (_response) => this.processMergeAnonymous(_response));
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
processMergeAnonymous(response) {
|
|
2251
|
+
const status = response.status;
|
|
2252
|
+
let _headers = {};
|
|
2253
|
+
if (response.headers && typeof response.headers === "object") {
|
|
2254
|
+
for (let k in response.headers) {
|
|
2255
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
2256
|
+
_headers[k] = response.headers[k];
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
if (status === 200) {
|
|
2261
|
+
const _responseText = response.data;
|
|
2262
|
+
return Promise.resolve(null);
|
|
2263
|
+
}
|
|
2264
|
+
else if (status === 404) {
|
|
2265
|
+
const _responseText = response.data;
|
|
2266
|
+
let result404 = null;
|
|
2267
|
+
let resultData404 = _responseText;
|
|
2268
|
+
result404 = JSON.parse(resultData404);
|
|
2269
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
2270
|
+
}
|
|
2271
|
+
else if (status === 409) {
|
|
2272
|
+
const _responseText = response.data;
|
|
2273
|
+
let result409 = null;
|
|
2274
|
+
let resultData409 = _responseText;
|
|
2275
|
+
result409 = JSON.parse(resultData409);
|
|
2276
|
+
return throwException("Conflict", status, _responseText, _headers, result409);
|
|
2277
|
+
}
|
|
2278
|
+
else if (status === 401) {
|
|
2279
|
+
const _responseText = response.data;
|
|
2280
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
2281
|
+
}
|
|
2282
|
+
else if (status === 403) {
|
|
2283
|
+
const _responseText = response.data;
|
|
2284
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
2285
|
+
}
|
|
2286
|
+
else if (status !== 200 && status !== 204) {
|
|
2287
|
+
const _responseText = response.data;
|
|
2288
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
2289
|
+
}
|
|
2290
|
+
return Promise.resolve(null);
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Gets storefront user token
|
|
2294
|
+
* @param storefrontUserId Storefront user identifier
|
|
2295
|
+
* @param storefrontId Storefront identifier
|
|
2296
|
+
* @param tenantId (optional) Tenant identifier
|
|
2297
|
+
* @param userId (optional) User identifier
|
|
2298
|
+
* @return Success
|
|
2299
|
+
*/
|
|
2300
|
+
getToken(storefrontUserId, storefrontId, tenantId, userId, cancelToken) {
|
|
2301
|
+
let url_ = this.baseUrl + "/api/storefront/v1/storefront-users/token?";
|
|
2302
|
+
if (storefrontUserId === undefined || storefrontUserId === null)
|
|
2303
|
+
throw new Error("The parameter 'storefrontUserId' must be defined and cannot be null.");
|
|
2304
|
+
else
|
|
2305
|
+
url_ += "storefrontUserId=" + encodeURIComponent("" + storefrontUserId) + "&";
|
|
2306
|
+
if (storefrontId === undefined || storefrontId === null)
|
|
2307
|
+
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
|
|
2308
|
+
else
|
|
2309
|
+
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
|
|
2310
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
2311
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
2312
|
+
if (userId !== undefined && userId !== null)
|
|
2313
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
2314
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
2315
|
+
let options_ = {
|
|
2316
|
+
method: "GET",
|
|
2317
|
+
url: url_,
|
|
2318
|
+
headers: {},
|
|
2319
|
+
cancelToken
|
|
2320
|
+
};
|
|
2321
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
2322
|
+
return this.instance.request(transformedOptions_);
|
|
2323
|
+
}).catch((_error) => {
|
|
2324
|
+
if (isAxiosError(_error) && _error.response) {
|
|
2325
|
+
return _error.response;
|
|
2326
|
+
}
|
|
2327
|
+
else {
|
|
2328
|
+
throw _error;
|
|
2329
|
+
}
|
|
2330
|
+
}).then((_response) => {
|
|
2331
|
+
return this.transformResult(url_, _response, (_response) => this.processGetToken(_response));
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
processGetToken(response) {
|
|
2335
|
+
const status = response.status;
|
|
2336
|
+
let _headers = {};
|
|
2337
|
+
if (response.headers && typeof response.headers === "object") {
|
|
2338
|
+
for (let k in response.headers) {
|
|
2339
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
2340
|
+
_headers[k] = response.headers[k];
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
if (status === 201) {
|
|
2345
|
+
const _responseText = response.data;
|
|
2346
|
+
return Promise.resolve(null);
|
|
2347
|
+
}
|
|
2348
|
+
else if (status === 404) {
|
|
2349
|
+
const _responseText = response.data;
|
|
2350
|
+
let result404 = null;
|
|
2351
|
+
let resultData404 = _responseText;
|
|
2352
|
+
result404 = JSON.parse(resultData404);
|
|
2353
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
2354
|
+
}
|
|
2355
|
+
else if (status === 409) {
|
|
2356
|
+
const _responseText = response.data;
|
|
2357
|
+
let result409 = null;
|
|
2358
|
+
let resultData409 = _responseText;
|
|
2359
|
+
result409 = JSON.parse(resultData409);
|
|
2360
|
+
return throwException("Conflict", status, _responseText, _headers, result409);
|
|
2361
|
+
}
|
|
2362
|
+
else if (status === 401) {
|
|
2363
|
+
const _responseText = response.data;
|
|
2364
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
2365
|
+
}
|
|
2366
|
+
else if (status === 403) {
|
|
2367
|
+
const _responseText = response.data;
|
|
2368
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
2369
|
+
}
|
|
2370
|
+
else if (status !== 200 && status !== 204) {
|
|
2371
|
+
const _responseText = response.data;
|
|
2372
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
2373
|
+
}
|
|
2374
|
+
return Promise.resolve(null);
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
export class TenantInfoApiClient extends ApiClientBase {
|
|
2378
|
+
instance;
|
|
2379
|
+
baseUrl;
|
|
2380
|
+
jsonParseReviver = undefined;
|
|
2381
|
+
constructor(configuration, baseUrl, instance) {
|
|
2382
|
+
super(configuration);
|
|
2383
|
+
this.instance = instance ? instance : axios.create();
|
|
2384
|
+
this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
|
|
2385
|
+
}
|
|
2386
|
+
/**
|
|
2387
|
+
* Gets information about tenant applications
|
|
2388
|
+
* @param tenantId (optional) Tenant identifier
|
|
2389
|
+
* @param userId (optional) User identifier
|
|
2390
|
+
* @return Success
|
|
2391
|
+
*/
|
|
2392
|
+
getApplicationsInfo(tenantId, userId, cancelToken) {
|
|
2393
|
+
let url_ = this.baseUrl + "/api/storefront/v1/tenant-info/applications?";
|
|
2394
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
2395
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
2396
|
+
if (userId !== undefined && userId !== null)
|
|
2397
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
2398
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
2399
|
+
let options_ = {
|
|
2400
|
+
method: "GET",
|
|
2401
|
+
url: url_,
|
|
2402
|
+
headers: {
|
|
2403
|
+
"Accept": "text/plain"
|
|
2404
|
+
},
|
|
2405
|
+
cancelToken
|
|
2406
|
+
};
|
|
2407
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
2408
|
+
return this.instance.request(transformedOptions_);
|
|
2409
|
+
}).catch((_error) => {
|
|
2410
|
+
if (isAxiosError(_error) && _error.response) {
|
|
2411
|
+
return _error.response;
|
|
2412
|
+
}
|
|
2413
|
+
else {
|
|
2414
|
+
throw _error;
|
|
2415
|
+
}
|
|
2416
|
+
}).then((_response) => {
|
|
2417
|
+
return this.transformResult(url_, _response, (_response) => this.processGetApplicationsInfo(_response));
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
processGetApplicationsInfo(response) {
|
|
2421
|
+
const status = response.status;
|
|
2422
|
+
let _headers = {};
|
|
2423
|
+
if (response.headers && typeof response.headers === "object") {
|
|
2424
|
+
for (let k in response.headers) {
|
|
2425
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
2426
|
+
_headers[k] = response.headers[k];
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
if (status === 200) {
|
|
2431
|
+
const _responseText = response.data;
|
|
2432
|
+
let result200 = null;
|
|
2433
|
+
let resultData200 = _responseText;
|
|
2434
|
+
result200 = JSON.parse(resultData200);
|
|
2435
|
+
return result200;
|
|
2436
|
+
}
|
|
2437
|
+
else if (status === 401) {
|
|
2438
|
+
const _responseText = response.data;
|
|
2439
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
2440
|
+
}
|
|
2441
|
+
else if (status === 403) {
|
|
2442
|
+
const _responseText = response.data;
|
|
2443
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
2444
|
+
}
|
|
2445
|
+
else if (status !== 200 && status !== 204) {
|
|
2446
|
+
const _responseText = response.data;
|
|
2447
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
2448
|
+
}
|
|
2449
|
+
return Promise.resolve(null);
|
|
2450
|
+
}
|
|
2451
|
+
/**
|
|
2452
|
+
* Gets information about tenant
|
|
2453
|
+
* @param tenantId (optional) Tenant identifier
|
|
2454
|
+
* @param userId (optional) User identifier
|
|
2455
|
+
* @return Success
|
|
2456
|
+
*/
|
|
2457
|
+
getInfo(tenantId, userId, cancelToken) {
|
|
2458
|
+
let url_ = this.baseUrl + "/api/storefront/v1/tenant-info?";
|
|
2459
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
2460
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
2461
|
+
if (userId !== undefined && userId !== null)
|
|
2462
|
+
url_ += "userId=" + encodeURIComponent("" + userId) + "&";
|
|
2463
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
2464
|
+
let options_ = {
|
|
2465
|
+
method: "GET",
|
|
2466
|
+
url: url_,
|
|
2467
|
+
headers: {
|
|
2468
|
+
"Accept": "text/plain"
|
|
2469
|
+
},
|
|
2470
|
+
cancelToken
|
|
2471
|
+
};
|
|
2472
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
2473
|
+
return this.instance.request(transformedOptions_);
|
|
2474
|
+
}).catch((_error) => {
|
|
2475
|
+
if (isAxiosError(_error) && _error.response) {
|
|
2476
|
+
return _error.response;
|
|
2477
|
+
}
|
|
2478
|
+
else {
|
|
2479
|
+
throw _error;
|
|
2480
|
+
}
|
|
2481
|
+
}).then((_response) => {
|
|
2482
|
+
return this.transformResult(url_, _response, (_response) => this.processGetInfo(_response));
|
|
2483
|
+
});
|
|
2484
|
+
}
|
|
2485
|
+
processGetInfo(response) {
|
|
2486
|
+
const status = response.status;
|
|
2487
|
+
let _headers = {};
|
|
2488
|
+
if (response.headers && typeof response.headers === "object") {
|
|
2489
|
+
for (let k in response.headers) {
|
|
2490
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
2491
|
+
_headers[k] = response.headers[k];
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
if (status === 200) {
|
|
2496
|
+
const _responseText = response.data;
|
|
2497
|
+
let result200 = null;
|
|
2498
|
+
let resultData200 = _responseText;
|
|
2499
|
+
result200 = JSON.parse(resultData200);
|
|
2500
|
+
return result200;
|
|
2501
|
+
}
|
|
2502
|
+
else if (status === 401) {
|
|
2503
|
+
const _responseText = response.data;
|
|
2504
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
2505
|
+
}
|
|
2506
|
+
else if (status === 403) {
|
|
2507
|
+
const _responseText = response.data;
|
|
2508
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
2509
|
+
}
|
|
2510
|
+
else if (status !== 200 && status !== 204) {
|
|
2511
|
+
const _responseText = response.data;
|
|
2512
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
2513
|
+
}
|
|
2514
|
+
return Promise.resolve(null);
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
/** Available date period filter values for queries */
|
|
2518
|
+
export var DatePeriod;
|
|
2519
|
+
(function (DatePeriod) {
|
|
2520
|
+
DatePeriod["All"] = "All";
|
|
2521
|
+
DatePeriod["Today"] = "Today";
|
|
2522
|
+
DatePeriod["Last7Days"] = "Last7Days";
|
|
2523
|
+
DatePeriod["Last30Days"] = "Last30Days";
|
|
2524
|
+
})(DatePeriod || (DatePeriod = {}));
|
|
2525
|
+
/** Storefront types */
|
|
2526
|
+
export var StorefrontType;
|
|
2527
|
+
(function (StorefrontType) {
|
|
2528
|
+
StorefrontType["Custom"] = "Custom";
|
|
2529
|
+
StorefrontType["Shopify"] = "Shopify";
|
|
2530
|
+
StorefrontType["DocketManager"] = "DocketManager";
|
|
2531
|
+
StorefrontType["Auth0Saml"] = "Auth0Saml";
|
|
2532
|
+
})(StorefrontType || (StorefrontType = {}));
|
|
2533
|
+
export class ApiException extends Error {
|
|
2534
|
+
message;
|
|
2535
|
+
status;
|
|
2536
|
+
response;
|
|
2537
|
+
headers;
|
|
2538
|
+
result;
|
|
2539
|
+
constructor(message, status, response, headers, result) {
|
|
2540
|
+
super();
|
|
2541
|
+
this.message = message;
|
|
2542
|
+
this.status = status;
|
|
2543
|
+
this.response = response;
|
|
2544
|
+
this.headers = headers;
|
|
2545
|
+
this.result = result;
|
|
2546
|
+
}
|
|
2547
|
+
isApiException = true;
|
|
2548
|
+
static isApiException(obj) {
|
|
2549
|
+
return obj.isApiException === true;
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
function throwException(message, status, response, headers, result) {
|
|
2553
|
+
if (result !== null && result !== undefined)
|
|
2554
|
+
throw result;
|
|
2555
|
+
else
|
|
2556
|
+
throw new ApiException(message, status, response, headers, null);
|
|
2557
|
+
}
|
|
2558
|
+
function isAxiosError(obj) {
|
|
2559
|
+
return obj && obj.isAxiosError === true;
|
|
2560
|
+
}
|
|
2561
|
+
//# sourceMappingURL=storefront-api-client.js.map
|