@aurigma/axios-storefront-api-client 2.30.6 → 2.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/storefront-api-client.d.ts +32 -0
- package/dist/cjs/storefront-api-client.js +146 -0
- package/dist/cjs/storefront-api-client.js.map +1 -1
- package/dist/esm/storefront-api-client.d.ts +32 -0
- package/dist/esm/storefront-api-client.js +146 -0
- package/dist/esm/storefront-api-client.js.map +1 -1
- package/package.json +1 -1
|
@@ -1286,6 +1286,152 @@ export class ProjectsApiClient extends ApiClientBase {
|
|
|
1286
1286
|
}
|
|
1287
1287
|
return Promise.resolve(null);
|
|
1288
1288
|
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Returns a project preview file by project identifier.
|
|
1291
|
+
* @param id Project identifier.
|
|
1292
|
+
* @param tenantId (optional) Tenant identifier.
|
|
1293
|
+
* @return Success
|
|
1294
|
+
*/
|
|
1295
|
+
getPreview(id, tenantId, cancelToken) {
|
|
1296
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/preview?";
|
|
1297
|
+
if (id === undefined || id === null)
|
|
1298
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
1299
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
1300
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1301
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1302
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1303
|
+
let options_ = {
|
|
1304
|
+
responseType: "blob",
|
|
1305
|
+
method: "GET",
|
|
1306
|
+
url: url_,
|
|
1307
|
+
headers: {
|
|
1308
|
+
"Accept": "text/plain"
|
|
1309
|
+
},
|
|
1310
|
+
cancelToken
|
|
1311
|
+
};
|
|
1312
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1313
|
+
return this.instance.request(transformedOptions_);
|
|
1314
|
+
}).catch((_error) => {
|
|
1315
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1316
|
+
return _error.response;
|
|
1317
|
+
}
|
|
1318
|
+
else {
|
|
1319
|
+
throw _error;
|
|
1320
|
+
}
|
|
1321
|
+
}).then((_response) => {
|
|
1322
|
+
return this.transformResult(url_, _response, (_response) => this.processGetPreview(_response));
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
processGetPreview(response) {
|
|
1326
|
+
const status = response.status;
|
|
1327
|
+
let _headers = {};
|
|
1328
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1329
|
+
for (let k in response.headers) {
|
|
1330
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1331
|
+
_headers[k] = response.headers[k];
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
if (status === 200 || status === 206) {
|
|
1336
|
+
const contentDisposition = response.headers ? response.headers["content-disposition"] : undefined;
|
|
1337
|
+
const fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
|
|
1338
|
+
const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
|
|
1339
|
+
return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });
|
|
1340
|
+
}
|
|
1341
|
+
else if (status === 404) {
|
|
1342
|
+
const _responseText = response.data;
|
|
1343
|
+
let result404 = null;
|
|
1344
|
+
let resultData404 = _responseText;
|
|
1345
|
+
result404 = JSON.parse(resultData404);
|
|
1346
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
1347
|
+
}
|
|
1348
|
+
else if (status === 401) {
|
|
1349
|
+
const _responseText = response.data;
|
|
1350
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1351
|
+
}
|
|
1352
|
+
else if (status === 403) {
|
|
1353
|
+
const _responseText = response.data;
|
|
1354
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1355
|
+
}
|
|
1356
|
+
else if (status !== 200 && status !== 204) {
|
|
1357
|
+
const _responseText = response.data;
|
|
1358
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1359
|
+
}
|
|
1360
|
+
return Promise.resolve(null);
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* Returns a project preview URL by project identifier.
|
|
1364
|
+
* @param id Project identifier.
|
|
1365
|
+
* @param tenantId (optional) Tenant identifier.
|
|
1366
|
+
* @return Success
|
|
1367
|
+
*/
|
|
1368
|
+
getPreviewUrl(id, tenantId, cancelToken) {
|
|
1369
|
+
let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/preview-url?";
|
|
1370
|
+
if (id === undefined || id === null)
|
|
1371
|
+
throw new Error("The parameter 'id' must be defined.");
|
|
1372
|
+
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
|
1373
|
+
if (tenantId !== undefined && tenantId !== null)
|
|
1374
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
1375
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
1376
|
+
let options_ = {
|
|
1377
|
+
method: "GET",
|
|
1378
|
+
url: url_,
|
|
1379
|
+
headers: {
|
|
1380
|
+
"Accept": "text/plain"
|
|
1381
|
+
},
|
|
1382
|
+
cancelToken
|
|
1383
|
+
};
|
|
1384
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
1385
|
+
return this.instance.request(transformedOptions_);
|
|
1386
|
+
}).catch((_error) => {
|
|
1387
|
+
if (isAxiosError(_error) && _error.response) {
|
|
1388
|
+
return _error.response;
|
|
1389
|
+
}
|
|
1390
|
+
else {
|
|
1391
|
+
throw _error;
|
|
1392
|
+
}
|
|
1393
|
+
}).then((_response) => {
|
|
1394
|
+
return this.transformResult(url_, _response, (_response) => this.processGetPreviewUrl(_response));
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
processGetPreviewUrl(response) {
|
|
1398
|
+
const status = response.status;
|
|
1399
|
+
let _headers = {};
|
|
1400
|
+
if (response.headers && typeof response.headers === "object") {
|
|
1401
|
+
for (let k in response.headers) {
|
|
1402
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
1403
|
+
_headers[k] = response.headers[k];
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
if (status === 200) {
|
|
1408
|
+
const _responseText = response.data;
|
|
1409
|
+
let result200 = null;
|
|
1410
|
+
let resultData200 = _responseText;
|
|
1411
|
+
result200 = JSON.parse(resultData200);
|
|
1412
|
+
return Promise.resolve(result200);
|
|
1413
|
+
}
|
|
1414
|
+
else if (status === 404) {
|
|
1415
|
+
const _responseText = response.data;
|
|
1416
|
+
let result404 = null;
|
|
1417
|
+
let resultData404 = _responseText;
|
|
1418
|
+
result404 = JSON.parse(resultData404);
|
|
1419
|
+
return throwException("Not Found", status, _responseText, _headers, result404);
|
|
1420
|
+
}
|
|
1421
|
+
else if (status === 401) {
|
|
1422
|
+
const _responseText = response.data;
|
|
1423
|
+
return throwException("Unauthorized", status, _responseText, _headers);
|
|
1424
|
+
}
|
|
1425
|
+
else if (status === 403) {
|
|
1426
|
+
const _responseText = response.data;
|
|
1427
|
+
return throwException("Forbidden", status, _responseText, _headers);
|
|
1428
|
+
}
|
|
1429
|
+
else if (status !== 200 && status !== 204) {
|
|
1430
|
+
const _responseText = response.data;
|
|
1431
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
1432
|
+
}
|
|
1433
|
+
return Promise.resolve(null);
|
|
1434
|
+
}
|
|
1289
1435
|
/**
|
|
1290
1436
|
* Creates a new project by 'Render HiRes' scenario.
|
|
1291
1437
|
* @param storefrontId Storefront identifier.
|