@aurigma/axios-design-atoms-api-client 2.28.1 → 2.29.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 */
@@ -3145,13 +3145,14 @@ export class DesignAtomsServiceApiClient extends ApiClientBase {
3145
3145
  return Promise.resolve(null);
3146
3146
  }
3147
3147
  /**
3148
- * Renders a design with the specified parameters.
3149
- * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied (default value is 'false').
3148
+ * Renders a design preview with the specified parameters.
3149
+ * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied
3150
+ (default value is 'false').
3150
3151
  * @param tenantId (optional) Tenant identifier
3151
3152
  * @param body (optional) Render model with preview parameters.
3152
3153
  * @return Success
3153
3154
  */
3154
- renderDesign(attachment, tenantId, body, cancelToken) {
3155
+ renderDesignPreview(attachment, tenantId, body, cancelToken) {
3155
3156
  let url_ = this.baseUrl + "/api/atoms/v1/render-design-preview?";
3156
3157
  if (attachment !== undefined && attachment !== null)
3157
3158
  url_ += "attachment=" + encodeURIComponent("" + attachment) + "&";
@@ -3182,10 +3183,89 @@ export class DesignAtomsServiceApiClient extends ApiClientBase {
3182
3183
  throw _error;
3183
3184
  }
3184
3185
  }).then((_response) => {
3185
- return this.transformResult(url_, _response, (_response) => this.processRenderDesign(_response));
3186
+ return this.transformResult(url_, _response, (_response) => this.processRenderDesignPreview(_response));
3187
+ });
3188
+ }
3189
+ processRenderDesignPreview(response) {
3190
+ const status = response.status;
3191
+ let _headers = {};
3192
+ if (response.headers && typeof response.headers === "object") {
3193
+ for (let k in response.headers) {
3194
+ if (response.headers.hasOwnProperty(k)) {
3195
+ _headers[k] = response.headers[k];
3196
+ }
3197
+ }
3198
+ }
3199
+ if (status === 200 || status === 206) {
3200
+ const contentDisposition = response.headers ? response.headers["content-disposition"] : undefined;
3201
+ const fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
3202
+ const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
3203
+ return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });
3204
+ }
3205
+ else if (status === 401) {
3206
+ const _responseText = response.data;
3207
+ return throwException("Unauthorized", status, _responseText, _headers);
3208
+ }
3209
+ else if (status === 403) {
3210
+ const _responseText = response.data;
3211
+ return throwException("Forbidden", status, _responseText, _headers);
3212
+ }
3213
+ else if (status === 500) {
3214
+ const _responseText = response.data;
3215
+ let result500 = null;
3216
+ let resultData500 = _responseText;
3217
+ result500 = JSON.parse(resultData500);
3218
+ return throwException("Internal server error", status, _responseText, _headers, result500);
3219
+ }
3220
+ else if (status !== 200 && status !== 204) {
3221
+ const _responseText = response.data;
3222
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
3223
+ }
3224
+ return Promise.resolve(null);
3225
+ }
3226
+ /**
3227
+ * Renders a design proof with the specified parameters.
3228
+ * @param attachment (optional) If set to 'true', file will be provided as an attachment with unique filename supplied
3229
+ (default value is 'false').
3230
+ * @param tenantId (optional) Tenant identifier
3231
+ * @param body (optional) Render model with proof parameters.
3232
+ * @return Success
3233
+ */
3234
+ renderDesignProof(attachment, tenantId, body, cancelToken) {
3235
+ let url_ = this.baseUrl + "/api/atoms/v1/render-design-proof?";
3236
+ if (attachment !== undefined && attachment !== null)
3237
+ url_ += "attachment=" + encodeURIComponent("" + attachment) + "&";
3238
+ if (tenantId === null)
3239
+ throw new Error("The parameter 'tenantId' cannot be null.");
3240
+ else if (tenantId !== undefined)
3241
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
3242
+ url_ = url_.replace(/[?&]$/, "");
3243
+ const content_ = JSON.stringify(body);
3244
+ let options_ = {
3245
+ data: content_,
3246
+ responseType: "blob",
3247
+ method: "POST",
3248
+ url: url_,
3249
+ headers: {
3250
+ "Content-Type": "application/json",
3251
+ "Accept": "application/octet-stream"
3252
+ },
3253
+ cancelToken
3254
+ };
3255
+ return this.transformOptions(options_).then(transformedOptions_ => {
3256
+ return this.instance.request(transformedOptions_);
3257
+ }).catch((_error) => {
3258
+ if (isAxiosError(_error) && _error.response) {
3259
+ return _error.response;
3260
+ }
3261
+ else {
3262
+ throw _error;
3263
+ }
3264
+ }).then((_response) => {
3265
+ return this.transformResult(url_, _response, (_response) => this.processRenderDesignProof(_response));
3186
3266
  });
3187
3267
  }
3188
- processRenderDesign(response) {
3268
+ processRenderDesignProof(response) {
3189
3269
  const status = response.status;
3190
3270
  let _headers = {};
3191
3271
  if (response.headers && typeof response.headers === "object") {