@aurigma/axios-backoffice-api-client 2.60.2 → 2.62.12

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.
@@ -188,6 +188,14 @@ export declare module BackOfficeApiClient {
188
188
  * @return Success
189
189
  */
190
190
  getProductOptions(id: number, productVersionId?: number | null | undefined, tenantId?: number | null | undefined): Promise<PagedOfProductOptionDto>;
191
+ /**
192
+ * Set product options and returns updated options list.
193
+ * @param id Product identifier.
194
+ * @param tenantId (optional) Tenant identifier.
195
+ * @param body (optional)
196
+ * @return Success
197
+ */
198
+ setProductOptions(id: number, tenantId?: number | null | undefined, body?: SetProductOptionsDto | null | undefined): Promise<PagedOfProductOptionDto>;
191
199
  /**
192
200
  * Returns a list of product variants.
193
201
  * @param id Product identifier.
@@ -425,6 +433,15 @@ export declare module BackOfficeApiClient {
425
433
  */
426
434
  getProductOptions(id: number, productVersionId?: number | null | undefined, tenantId?: number | null | undefined, cancelToken?: CancelToken | undefined): Promise<PagedOfProductOptionDto>;
427
435
  protected processGetProductOptions(response: AxiosResponse): Promise<PagedOfProductOptionDto>;
436
+ /**
437
+ * Set product options and returns updated options list.
438
+ * @param id Product identifier.
439
+ * @param tenantId (optional) Tenant identifier.
440
+ * @param body (optional)
441
+ * @return Success
442
+ */
443
+ setProductOptions(id: number, tenantId?: number | null | undefined, body?: SetProductOptionsDto | null | undefined, cancelToken?: CancelToken | undefined): Promise<PagedOfProductOptionDto>;
444
+ protected processSetProductOptions(response: AxiosResponse): Promise<PagedOfProductOptionDto>;
428
445
  /**
429
446
  * Returns a list of product variants.
430
447
  * @param id Product identifier.
@@ -1227,6 +1244,47 @@ export declare module BackOfficeApiClient {
1227
1244
  total?: number;
1228
1245
  items?: ProductOptionDto[] | null;
1229
1246
  }
1247
+ /** Product option value create or update operation parameters. */
1248
+ interface SetProductOptionValueDto {
1249
+ /** Product option value UID. */
1250
+ uid?: string | null;
1251
+ /** Product option value description. */
1252
+ description?: string | null;
1253
+ /** Product option value sort index. */
1254
+ sortIndex?: number;
1255
+ /** Indicates if product option value is used as a default value. */
1256
+ isDefault?: boolean;
1257
+ /** Product option value. */
1258
+ value?: string | null;
1259
+ /** Product option value colors. */
1260
+ colors?: string[] | null;
1261
+ }
1262
+ /** Product option create or update operation parameters. */
1263
+ interface SetProductOptionDto {
1264
+ /** Product option UID. */
1265
+ uid?: string | null;
1266
+ /** Product option title. */
1267
+ title?: string | null;
1268
+ /** Product option description. */
1269
+ description?: string | null;
1270
+ /** Product option tooltip. */
1271
+ tooltip?: string | null;
1272
+ /** Product option sort index. */
1273
+ sortIndex?: number;
1274
+ /** Specifies if the option is used for design binding. */
1275
+ useForDesignBinding?: boolean;
1276
+ /** Specifies if the option is used for mockup binding. */
1277
+ useForMockupBinding?: boolean;
1278
+ /** Specifies if the option is used for document binding. */
1279
+ useForDocumentBinding?: boolean;
1280
+ /** A list of product option values. */
1281
+ values?: SetProductOptionValueDto[] | null;
1282
+ }
1283
+ /** Product options setting operation parameters. */
1284
+ interface SetProductOptionsDto {
1285
+ /** Product options create or update parameters. */
1286
+ options?: SetProductOptionDto[] | null;
1287
+ }
1230
1288
  /** Dto class, containing information about a product variant option. */
1231
1289
  interface ProductVariantOptionDto {
1232
1290
  /** Product option identifier. */
@@ -938,6 +938,90 @@ var BackOfficeApiClient;
938
938
  }
939
939
  return Promise.resolve(null);
940
940
  }
941
+ /**
942
+ * Set product options and returns updated options list.
943
+ * @param id Product identifier.
944
+ * @param tenantId (optional) Tenant identifier.
945
+ * @param body (optional)
946
+ * @return Success
947
+ */
948
+ setProductOptions(id, tenantId, body, cancelToken) {
949
+ let url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/options?";
950
+ if (id === undefined || id === null)
951
+ throw new Error("The parameter 'id' must be defined.");
952
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
953
+ if (tenantId !== undefined && tenantId !== null)
954
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
955
+ url_ = url_.replace(/[?&]$/, "");
956
+ const content_ = JSON.stringify(body);
957
+ let options_ = {
958
+ data: content_,
959
+ method: "PUT",
960
+ url: url_,
961
+ headers: {
962
+ "Content-Type": "application/json",
963
+ "Accept": "application/json"
964
+ },
965
+ cancelToken
966
+ };
967
+ return this.transformOptions(options_).then(transformedOptions_ => {
968
+ return this.instance.request(transformedOptions_);
969
+ }).catch((_error) => {
970
+ if (isAxiosError(_error) && _error.response) {
971
+ return _error.response;
972
+ }
973
+ else {
974
+ throw _error;
975
+ }
976
+ }).then((_response) => {
977
+ return this.transformResult(url_, _response, (_response) => this.processSetProductOptions(_response));
978
+ });
979
+ }
980
+ processSetProductOptions(response) {
981
+ const status = response.status;
982
+ let _headers = {};
983
+ if (response.headers && typeof response.headers === "object") {
984
+ for (let k in response.headers) {
985
+ if (response.headers.hasOwnProperty(k)) {
986
+ _headers[k] = response.headers[k];
987
+ }
988
+ }
989
+ }
990
+ if (status === 200) {
991
+ const _responseText = response.data;
992
+ let result200 = null;
993
+ let resultData200 = _responseText;
994
+ result200 = JSON.parse(resultData200);
995
+ return Promise.resolve(result200);
996
+ }
997
+ else if (status === 404) {
998
+ const _responseText = response.data;
999
+ let result404 = null;
1000
+ let resultData404 = _responseText;
1001
+ result404 = JSON.parse(resultData404);
1002
+ return throwException("Not Found", status, _responseText, _headers, result404);
1003
+ }
1004
+ else if (status === 409) {
1005
+ const _responseText = response.data;
1006
+ let result409 = null;
1007
+ let resultData409 = _responseText;
1008
+ result409 = JSON.parse(resultData409);
1009
+ return throwException("Conflict", status, _responseText, _headers, result409);
1010
+ }
1011
+ else if (status === 401) {
1012
+ const _responseText = response.data;
1013
+ return throwException("Unauthorized", status, _responseText, _headers);
1014
+ }
1015
+ else if (status === 403) {
1016
+ const _responseText = response.data;
1017
+ return throwException("Forbidden", status, _responseText, _headers);
1018
+ }
1019
+ else if (status !== 200 && status !== 204) {
1020
+ const _responseText = response.data;
1021
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1022
+ }
1023
+ return Promise.resolve(null);
1024
+ }
941
1025
  /**
942
1026
  * Returns a list of product variants.
943
1027
  * @param id Product identifier.