@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.
@@ -286,6 +286,20 @@ export interface IProjectsApiClient {
286
286
  * @return Success
287
287
  */
288
288
  delete(id: number, tenantId?: number | null | undefined): Promise<void>;
289
+ /**
290
+ * Returns a project preview file by project identifier.
291
+ * @param id Project identifier.
292
+ * @param tenantId (optional) Tenant identifier.
293
+ * @return Success
294
+ */
295
+ getPreview(id: number, tenantId?: number | null | undefined): Promise<FileResponse>;
296
+ /**
297
+ * Returns a project preview URL by project identifier.
298
+ * @param id Project identifier.
299
+ * @param tenantId (optional) Tenant identifier.
300
+ * @return Success
301
+ */
302
+ getPreviewUrl(id: number, tenantId?: number | null | undefined): Promise<string>;
289
303
  /**
290
304
  * Creates a new project by 'Render HiRes' scenario.
291
305
  * @param storefrontId Storefront identifier.
@@ -434,6 +448,22 @@ export declare class ProjectsApiClient extends ApiClientBase implements IProject
434
448
  */
435
449
  delete(id: number, tenantId?: number | null | undefined, cancelToken?: CancelToken | undefined): Promise<void>;
436
450
  protected processDelete(response: AxiosResponse): Promise<void>;
451
+ /**
452
+ * Returns a project preview file by project identifier.
453
+ * @param id Project identifier.
454
+ * @param tenantId (optional) Tenant identifier.
455
+ * @return Success
456
+ */
457
+ getPreview(id: number, tenantId?: number | null | undefined, cancelToken?: CancelToken | undefined): Promise<FileResponse>;
458
+ protected processGetPreview(response: AxiosResponse): Promise<FileResponse>;
459
+ /**
460
+ * Returns a project preview URL by project identifier.
461
+ * @param id Project identifier.
462
+ * @param tenantId (optional) Tenant identifier.
463
+ * @return Success
464
+ */
465
+ getPreviewUrl(id: number, tenantId?: number | null | undefined, cancelToken?: CancelToken | undefined): Promise<string>;
466
+ protected processGetPreviewUrl(response: AxiosResponse): Promise<string>;
437
467
  /**
438
468
  * Creates a new project by 'Render HiRes' scenario.
439
469
  * @param storefrontId Storefront identifier.
@@ -949,6 +979,8 @@ export interface ProjectItemResourceParametersDto {
949
979
  name?: string | null;
950
980
  /** Resource type. */
951
981
  type?: ProjectItemResourceType;
982
+ /** Original resource identifier. */
983
+ resourceId?: string | null;
952
984
  }
953
985
  /** Dto class, containing create operation paramters for a project item. */
954
986
  export interface ProjectItemParametersDto {
@@ -1294,6 +1294,152 @@ class ProjectsApiClient extends ApiClientBase {
1294
1294
  }
1295
1295
  return Promise.resolve(null);
1296
1296
  }
1297
+ /**
1298
+ * Returns a project preview file by project identifier.
1299
+ * @param id Project identifier.
1300
+ * @param tenantId (optional) Tenant identifier.
1301
+ * @return Success
1302
+ */
1303
+ getPreview(id, tenantId, cancelToken) {
1304
+ let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/preview?";
1305
+ if (id === undefined || id === null)
1306
+ throw new Error("The parameter 'id' must be defined.");
1307
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
1308
+ if (tenantId !== undefined && tenantId !== null)
1309
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1310
+ url_ = url_.replace(/[?&]$/, "");
1311
+ let options_ = {
1312
+ responseType: "blob",
1313
+ method: "GET",
1314
+ url: url_,
1315
+ headers: {
1316
+ "Accept": "text/plain"
1317
+ },
1318
+ cancelToken
1319
+ };
1320
+ return this.transformOptions(options_).then(transformedOptions_ => {
1321
+ return this.instance.request(transformedOptions_);
1322
+ }).catch((_error) => {
1323
+ if (isAxiosError(_error) && _error.response) {
1324
+ return _error.response;
1325
+ }
1326
+ else {
1327
+ throw _error;
1328
+ }
1329
+ }).then((_response) => {
1330
+ return this.transformResult(url_, _response, (_response) => this.processGetPreview(_response));
1331
+ });
1332
+ }
1333
+ processGetPreview(response) {
1334
+ const status = response.status;
1335
+ let _headers = {};
1336
+ if (response.headers && typeof response.headers === "object") {
1337
+ for (let k in response.headers) {
1338
+ if (response.headers.hasOwnProperty(k)) {
1339
+ _headers[k] = response.headers[k];
1340
+ }
1341
+ }
1342
+ }
1343
+ if (status === 200 || status === 206) {
1344
+ const contentDisposition = response.headers ? response.headers["content-disposition"] : undefined;
1345
+ const fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
1346
+ const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
1347
+ return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });
1348
+ }
1349
+ else if (status === 404) {
1350
+ const _responseText = response.data;
1351
+ let result404 = null;
1352
+ let resultData404 = _responseText;
1353
+ result404 = JSON.parse(resultData404);
1354
+ return throwException("Not Found", status, _responseText, _headers, result404);
1355
+ }
1356
+ else if (status === 401) {
1357
+ const _responseText = response.data;
1358
+ return throwException("Unauthorized", status, _responseText, _headers);
1359
+ }
1360
+ else if (status === 403) {
1361
+ const _responseText = response.data;
1362
+ return throwException("Forbidden", status, _responseText, _headers);
1363
+ }
1364
+ else if (status !== 200 && status !== 204) {
1365
+ const _responseText = response.data;
1366
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1367
+ }
1368
+ return Promise.resolve(null);
1369
+ }
1370
+ /**
1371
+ * Returns a project preview URL by project identifier.
1372
+ * @param id Project identifier.
1373
+ * @param tenantId (optional) Tenant identifier.
1374
+ * @return Success
1375
+ */
1376
+ getPreviewUrl(id, tenantId, cancelToken) {
1377
+ let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/preview-url?";
1378
+ if (id === undefined || id === null)
1379
+ throw new Error("The parameter 'id' must be defined.");
1380
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
1381
+ if (tenantId !== undefined && tenantId !== null)
1382
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1383
+ url_ = url_.replace(/[?&]$/, "");
1384
+ let options_ = {
1385
+ method: "GET",
1386
+ url: url_,
1387
+ headers: {
1388
+ "Accept": "text/plain"
1389
+ },
1390
+ cancelToken
1391
+ };
1392
+ return this.transformOptions(options_).then(transformedOptions_ => {
1393
+ return this.instance.request(transformedOptions_);
1394
+ }).catch((_error) => {
1395
+ if (isAxiosError(_error) && _error.response) {
1396
+ return _error.response;
1397
+ }
1398
+ else {
1399
+ throw _error;
1400
+ }
1401
+ }).then((_response) => {
1402
+ return this.transformResult(url_, _response, (_response) => this.processGetPreviewUrl(_response));
1403
+ });
1404
+ }
1405
+ processGetPreviewUrl(response) {
1406
+ const status = response.status;
1407
+ let _headers = {};
1408
+ if (response.headers && typeof response.headers === "object") {
1409
+ for (let k in response.headers) {
1410
+ if (response.headers.hasOwnProperty(k)) {
1411
+ _headers[k] = response.headers[k];
1412
+ }
1413
+ }
1414
+ }
1415
+ if (status === 200) {
1416
+ const _responseText = response.data;
1417
+ let result200 = null;
1418
+ let resultData200 = _responseText;
1419
+ result200 = JSON.parse(resultData200);
1420
+ return Promise.resolve(result200);
1421
+ }
1422
+ else if (status === 404) {
1423
+ const _responseText = response.data;
1424
+ let result404 = null;
1425
+ let resultData404 = _responseText;
1426
+ result404 = JSON.parse(resultData404);
1427
+ return throwException("Not Found", status, _responseText, _headers, result404);
1428
+ }
1429
+ else if (status === 401) {
1430
+ const _responseText = response.data;
1431
+ return throwException("Unauthorized", status, _responseText, _headers);
1432
+ }
1433
+ else if (status === 403) {
1434
+ const _responseText = response.data;
1435
+ return throwException("Forbidden", status, _responseText, _headers);
1436
+ }
1437
+ else if (status !== 200 && status !== 204) {
1438
+ const _responseText = response.data;
1439
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1440
+ }
1441
+ return Promise.resolve(null);
1442
+ }
1297
1443
  /**
1298
1444
  * Creates a new project by 'Render HiRes' scenario.
1299
1445
  * @param storefrontId Storefront identifier.