@aurigma/axios-design-atoms-api-client 2.28.1 → 2.30.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.
@@ -480,13 +480,23 @@ export interface IDesignAtomsServiceApiClient {
480
480
  */
481
481
  createPrivateDesignFromResource(resourceId?: string | null | undefined, privateDesignId?: string | null | undefined, privateStorageOwner?: string | null | undefined, tenantId?: number | undefined): Promise<void>;
482
482
  /**
483
- * Renders a design with the specified parameters.
484
- * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied (default value is 'false').
483
+ * Renders a design preview with the specified parameters.
484
+ * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied
485
+ (default value is 'false').
485
486
  * @param tenantId (optional) Tenant identifier
486
487
  * @param body (optional) Render model with preview parameters.
487
488
  * @return Success
488
489
  */
489
- renderDesign(attachment?: boolean | null | undefined, tenantId?: number | undefined, body?: RenderDesignModel | null | undefined): Promise<FileResponse>;
490
+ renderDesignPreview(attachment?: boolean | null | undefined, tenantId?: number | undefined, body?: RenderDesignPreviewModel | null | undefined): Promise<FileResponse>;
491
+ /**
492
+ * Renders a design proof with the specified parameters.
493
+ * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied
494
+ (default value is 'false').
495
+ * @param tenantId (optional) Tenant identifier
496
+ * @param body (optional) Render model with proof parameters.
497
+ * @return Success
498
+ */
499
+ renderDesignProof(attachment?: boolean | null | undefined, tenantId?: number | undefined, body?: RenderDesignProofModel | null | undefined): Promise<FileResponse>;
490
500
  /**
491
501
  * Render product proof image with specified parameters.
492
502
  * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied (default value is 'false').
@@ -666,14 +676,25 @@ export declare class DesignAtomsServiceApiClient extends ApiClientBase implement
666
676
  createPrivateDesignFromResource(resourceId?: string | null | undefined, privateDesignId?: string | null | undefined, privateStorageOwner?: string | null | undefined, tenantId?: number | undefined, cancelToken?: CancelToken | undefined): Promise<void>;
667
677
  protected processCreatePrivateDesignFromResource(response: AxiosResponse): Promise<void>;
668
678
  /**
669
- * Renders a design with the specified parameters.
670
- * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied (default value is 'false').
679
+ * Renders a design preview with the specified parameters.
680
+ * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied
681
+ (default value is 'false').
671
682
  * @param tenantId (optional) Tenant identifier
672
683
  * @param body (optional) Render model with preview parameters.
673
684
  * @return Success
674
685
  */
675
- renderDesign(attachment?: boolean | null | undefined, tenantId?: number | undefined, body?: RenderDesignModel | null | undefined, cancelToken?: CancelToken | undefined): Promise<FileResponse>;
676
- protected processRenderDesign(response: AxiosResponse): Promise<FileResponse>;
686
+ renderDesignPreview(attachment?: boolean | null | undefined, tenantId?: number | undefined, body?: RenderDesignPreviewModel | null | undefined, cancelToken?: CancelToken | undefined): Promise<FileResponse>;
687
+ protected processRenderDesignPreview(response: AxiosResponse): Promise<FileResponse>;
688
+ /**
689
+ * Renders a design proof with the specified parameters.
690
+ * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied
691
+ (default value is 'false').
692
+ * @param tenantId (optional) Tenant identifier
693
+ * @param body (optional) Render model with proof parameters.
694
+ * @return Success
695
+ */
696
+ renderDesignProof(attachment?: boolean | null | undefined, tenantId?: number | undefined, body?: RenderDesignProofModel | null | undefined, cancelToken?: CancelToken | undefined): Promise<FileResponse>;
697
+ protected processRenderDesignProof(response: AxiosResponse): Promise<FileResponse>;
677
698
  /**
678
699
  * Render product proof image with specified parameters.
679
700
  * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied (default value is 'false').
@@ -1200,7 +1221,7 @@ export interface ProductPreviewRenderingConfig {
1200
1221
  height?: number;
1201
1222
  fileFormat?: ProductPreviewFormat | null;
1202
1223
  }
1203
- export interface RenderDesignModel {
1224
+ export interface RenderDesignPreviewModel {
1204
1225
  /** Design ID.
1205
1226
  Used to get design file from public or private storage. */
1206
1227
  designId?: string | null;
@@ -1253,6 +1274,17 @@ export interface ProductProofRenderingConfig {
1253
1274
  /** Defines whether watermark should be repeated */
1254
1275
  watermarkRepeat?: boolean | null;
1255
1276
  }
1277
+ export interface RenderDesignProofModel {
1278
+ /** Design ID.
1279
+ Used to get design file from public or private storage. */
1280
+ designId?: string | null;
1281
+ /** ID of the design owner. */
1282
+ ownerId?: string | null;
1283
+ /** Rendering configuration for getting a preview of design. */
1284
+ renderingConfig?: ProductProofRenderingConfig | null;
1285
+ /** Variable (user) data of design. */
1286
+ variableData?: VariableInfo[] | null;
1287
+ }
1256
1288
  /** Render product parameters */
1257
1289
  export interface RenderProductModel {
1258
1290
  /** Serialized product description */
@@ -3152,13 +3152,14 @@ class DesignAtomsServiceApiClient extends ApiClientBase {
3152
3152
  return Promise.resolve(null);
3153
3153
  }
3154
3154
  /**
3155
- * Renders a design with the specified parameters.
3156
- * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied (default value is 'false').
3155
+ * Renders a design preview with the specified parameters.
3156
+ * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied
3157
+ (default value is 'false').
3157
3158
  * @param tenantId (optional) Tenant identifier
3158
3159
  * @param body (optional) Render model with preview parameters.
3159
3160
  * @return Success
3160
3161
  */
3161
- renderDesign(attachment, tenantId, body, cancelToken) {
3162
+ renderDesignPreview(attachment, tenantId, body, cancelToken) {
3162
3163
  let url_ = this.baseUrl + "/api/atoms/v1/render-design-preview?";
3163
3164
  if (attachment !== undefined && attachment !== null)
3164
3165
  url_ += "attachment=" + encodeURIComponent("" + attachment) + "&";
@@ -3189,10 +3190,89 @@ class DesignAtomsServiceApiClient extends ApiClientBase {
3189
3190
  throw _error;
3190
3191
  }
3191
3192
  }).then((_response) => {
3192
- return this.transformResult(url_, _response, (_response) => this.processRenderDesign(_response));
3193
+ return this.transformResult(url_, _response, (_response) => this.processRenderDesignPreview(_response));
3194
+ });
3195
+ }
3196
+ processRenderDesignPreview(response) {
3197
+ const status = response.status;
3198
+ let _headers = {};
3199
+ if (response.headers && typeof response.headers === "object") {
3200
+ for (let k in response.headers) {
3201
+ if (response.headers.hasOwnProperty(k)) {
3202
+ _headers[k] = response.headers[k];
3203
+ }
3204
+ }
3205
+ }
3206
+ if (status === 200 || status === 206) {
3207
+ const contentDisposition = response.headers ? response.headers["content-disposition"] : undefined;
3208
+ const fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
3209
+ const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
3210
+ return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });
3211
+ }
3212
+ else if (status === 401) {
3213
+ const _responseText = response.data;
3214
+ return throwException("Unauthorized", status, _responseText, _headers);
3215
+ }
3216
+ else if (status === 403) {
3217
+ const _responseText = response.data;
3218
+ return throwException("Forbidden", status, _responseText, _headers);
3219
+ }
3220
+ else if (status === 500) {
3221
+ const _responseText = response.data;
3222
+ let result500 = null;
3223
+ let resultData500 = _responseText;
3224
+ result500 = JSON.parse(resultData500);
3225
+ return throwException("Internal server error", status, _responseText, _headers, result500);
3226
+ }
3227
+ else if (status !== 200 && status !== 204) {
3228
+ const _responseText = response.data;
3229
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
3230
+ }
3231
+ return Promise.resolve(null);
3232
+ }
3233
+ /**
3234
+ * Renders a design proof with the specified parameters.
3235
+ * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied
3236
+ (default value is 'false').
3237
+ * @param tenantId (optional) Tenant identifier
3238
+ * @param body (optional) Render model with proof parameters.
3239
+ * @return Success
3240
+ */
3241
+ renderDesignProof(attachment, tenantId, body, cancelToken) {
3242
+ let url_ = this.baseUrl + "/api/atoms/v1/render-design-proof?";
3243
+ if (attachment !== undefined && attachment !== null)
3244
+ url_ += "attachment=" + encodeURIComponent("" + attachment) + "&";
3245
+ if (tenantId === null)
3246
+ throw new Error("The parameter 'tenantId' cannot be null.");
3247
+ else if (tenantId !== undefined)
3248
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
3249
+ url_ = url_.replace(/[?&]$/, "");
3250
+ const content_ = JSON.stringify(body);
3251
+ let options_ = {
3252
+ data: content_,
3253
+ responseType: "blob",
3254
+ method: "POST",
3255
+ url: url_,
3256
+ headers: {
3257
+ "Content-Type": "application/json",
3258
+ "Accept": "application/octet-stream"
3259
+ },
3260
+ cancelToken
3261
+ };
3262
+ return this.transformOptions(options_).then(transformedOptions_ => {
3263
+ return this.instance.request(transformedOptions_);
3264
+ }).catch((_error) => {
3265
+ if (isAxiosError(_error) && _error.response) {
3266
+ return _error.response;
3267
+ }
3268
+ else {
3269
+ throw _error;
3270
+ }
3271
+ }).then((_response) => {
3272
+ return this.transformResult(url_, _response, (_response) => this.processRenderDesignProof(_response));
3193
3273
  });
3194
3274
  }
3195
- processRenderDesign(response) {
3275
+ processRenderDesignProof(response) {
3196
3276
  const status = response.status;
3197
3277
  let _headers = {};
3198
3278
  if (response.headers && typeof response.headers === "object") {