@aurigma/axios-storefront-api-client 2.16.1 → 2.17.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.
@@ -97,6 +97,18 @@ export interface IProductReferencesApiClient {
97
97
  * @return Success
98
98
  */
99
99
  getProductConfig(reference: string | null, storefrontId: number, tenantId?: number | null | undefined): Promise<string>;
100
+ /**
101
+ * Returns a product cost details from ecommerce system.
102
+ * @param reference Product reference - external reference to Customer's Canvas product product specification, e.g online store product identifier.
103
+ * @param sku Product SKU.
104
+ * @param storefrontId Storefront identifier.
105
+ * @param storefrontUserId (optional) Storefront user identifier.
106
+ * @param currencyCode (optional) Product cost currency code.
107
+ * @param quantity (optional) Product quantity.
108
+ * @param tenantId (optional) Tenant identifier.
109
+ * @return Success
110
+ */
111
+ getProductCostDetails(reference: string | null, sku: string, storefrontId: number, storefrontUserId?: string | null | undefined, currencyCode?: string | null | undefined, quantity?: number | undefined, tenantId?: number | null | undefined): Promise<ProductCostDetailsDto>;
100
112
  }
101
113
  export declare class ProductReferencesApiClient extends ApiClientBase implements IProductReferencesApiClient {
102
114
  private instance;
@@ -162,6 +174,19 @@ export declare class ProductReferencesApiClient extends ApiClientBase implements
162
174
  */
163
175
  getProductConfig(reference: string | null, storefrontId: number, tenantId?: number | null | undefined, cancelToken?: CancelToken | undefined): Promise<string>;
164
176
  protected processGetProductConfig(response: AxiosResponse): Promise<string>;
177
+ /**
178
+ * Returns a product cost details from ecommerce system.
179
+ * @param reference Product reference - external reference to Customer's Canvas product product specification, e.g online store product identifier.
180
+ * @param sku Product SKU.
181
+ * @param storefrontId Storefront identifier.
182
+ * @param storefrontUserId (optional) Storefront user identifier.
183
+ * @param currencyCode (optional) Product cost currency code.
184
+ * @param quantity (optional) Product quantity.
185
+ * @param tenantId (optional) Tenant identifier.
186
+ * @return Success
187
+ */
188
+ getProductCostDetails(reference: string | null, sku: string, storefrontId: number, storefrontUserId?: string | null | undefined, currencyCode?: string | null | undefined, quantity?: number | undefined, tenantId?: number | null | undefined, cancelToken?: CancelToken | undefined): Promise<ProductCostDetailsDto>;
189
+ protected processGetProductCostDetails(response: AxiosResponse): Promise<ProductCostDetailsDto>;
165
190
  }
166
191
  export interface IProductSpecificationsApiClient {
167
192
  /**
@@ -703,6 +728,25 @@ export interface ProductSpecificationDto {
703
728
  /** Product specification modification time. */
704
729
  lastModified?: string | null;
705
730
  }
731
+ /** Dto class, containing information about storefront product cost details. */
732
+ export interface ProductCostDetailsDto {
733
+ /** Product reference is an external reference to Customer's Canvas product specification, e.g online store product identifier. */
734
+ productReference?: string | null;
735
+ /** Product SKU. */
736
+ productSku?: string | null;
737
+ /** Product quantity. */
738
+ productQuantity?: number;
739
+ /** Product price. */
740
+ productPrice?: number;
741
+ /** Product cost. */
742
+ productCost?: number;
743
+ /** Product discount. */
744
+ productDiscount?: number;
745
+ /** Currency code. */
746
+ currencyCode?: string | null;
747
+ /** Tenant identifier. */
748
+ tenantId?: number;
749
+ }
706
750
  /** Paged list of items. */
707
751
  export interface PagedOfProductSpecificationDto {
708
752
  /** Items count. */
@@ -717,6 +761,20 @@ export declare enum DatePeriod {
717
761
  Last7Days = "Last7Days",
718
762
  Last30Days = "Last30Days"
719
763
  }
764
+ /** Available product resource types */
765
+ export declare enum ProjectProductResourceType {
766
+ _0 = 0,
767
+ _1 = 1,
768
+ _2 = 2
769
+ }
770
+ /** Dto class, containing information about a project item resource. */
771
+ export interface ProjectItemResourceDto {
772
+ /** Resource ID. */
773
+ resourceId?: string | null;
774
+ /** Resource name. */
775
+ name?: string | null;
776
+ type?: ProjectProductResourceType;
777
+ }
720
778
  /** Dto class, containing information about a project item. */
721
779
  export interface ProjectItemDto {
722
780
  /** Item name. */
@@ -733,6 +791,8 @@ export interface ProjectItemDto {
733
791
  designIds?: string[] | null;
734
792
  /** SKU. */
735
793
  sku?: string | null;
794
+ /** External resources descriptions. */
795
+ resources?: ProjectItemResourceDto[] | null;
736
796
  }
737
797
  /** Dto class, containing information about a project. */
738
798
  export interface ProjectDto {
@@ -780,6 +840,33 @@ export interface PagedOfProjectDto {
780
840
  /** Items list. */
781
841
  items?: ProjectDto[] | null;
782
842
  }
843
+ /** Dto class, containing create operation paramters for a project item resource. */
844
+ export interface ProjectItemResourceParametersDto {
845
+ /** Resource URL. */
846
+ url?: string | null;
847
+ /** Resource name. */
848
+ name?: string | null;
849
+ type?: ProjectProductResourceType;
850
+ }
851
+ /** Dto class, containing create operation paramters for a project item. */
852
+ export interface ProjectItemParametersDto {
853
+ /** Item name. */
854
+ name?: string | null;
855
+ /** Item quantity information. */
856
+ quantity?: number | null;
857
+ /** Item information. */
858
+ fields?: {
859
+ [key: string]: any;
860
+ } | null;
861
+ /** Additional item information. */
862
+ hidden?: any | null;
863
+ /** A list of design identifiers associated to the item. */
864
+ designIds?: string[] | null;
865
+ /** SKU. */
866
+ sku?: string | null;
867
+ /** External resources descriptions. */
868
+ resources?: ProjectItemResourceParametersDto[] | null;
869
+ }
783
870
  /** Dto class, containing create operation parameters for project entity. */
784
871
  export interface CreateProjectDto {
785
872
  /** Product reference (i.e external reference to Customer's Canvas product specification - main subject of this project). */
@@ -803,7 +890,7 @@ export interface CreateProjectDto {
803
890
  /** Project owner identifier. */
804
891
  ownerId: string;
805
892
  /** List of project items. */
806
- items?: ProjectItemDto[] | null;
893
+ items?: ProjectItemParametersDto[] | null;
807
894
  /** Description of the project. */
808
895
  description?: string | null;
809
896
  }
@@ -8,7 +8,7 @@
8
8
  //----------------------
9
9
  // ReSharper disable InconsistentNaming
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.ApiException = exports.StorefrontType = exports.DatePeriod = exports.TenantInfoApiClient = exports.StorefrontUsersApiClient = exports.StorefrontsApiClient = exports.ProjectsApiClient = exports.ProductSpecificationsApiClient = exports.ProductReferencesApiClient = exports.BuildInfoApiClient = exports.ApiClientBase = exports.ApiClientConfiguration = void 0;
11
+ exports.ApiException = exports.StorefrontType = exports.ProjectProductResourceType = exports.DatePeriod = exports.TenantInfoApiClient = exports.StorefrontUsersApiClient = exports.StorefrontsApiClient = exports.ProjectsApiClient = exports.ProductSpecificationsApiClient = exports.ProductReferencesApiClient = exports.BuildInfoApiClient = exports.ApiClientBase = exports.ApiClientConfiguration = void 0;
12
12
  const axios_1 = require("axios");
13
13
  class ApiClientConfiguration {
14
14
  apiUrl;
@@ -636,6 +636,100 @@ class ProductReferencesApiClient extends ApiClientBase {
636
636
  }
637
637
  return Promise.resolve(null);
638
638
  }
639
+ /**
640
+ * Returns a product cost details from ecommerce system.
641
+ * @param reference Product reference - external reference to Customer's Canvas product product specification, e.g online store product identifier.
642
+ * @param sku Product SKU.
643
+ * @param storefrontId Storefront identifier.
644
+ * @param storefrontUserId (optional) Storefront user identifier.
645
+ * @param currencyCode (optional) Product cost currency code.
646
+ * @param quantity (optional) Product quantity.
647
+ * @param tenantId (optional) Tenant identifier.
648
+ * @return Success
649
+ */
650
+ getProductCostDetails(reference, sku, storefrontId, storefrontUserId, currencyCode, quantity, tenantId, cancelToken) {
651
+ let url_ = this.baseUrl + "/api/storefront/v1/product-references/{reference}/product-cost-details?";
652
+ if (reference === undefined || reference === null)
653
+ throw new Error("The parameter 'reference' must be defined.");
654
+ url_ = url_.replace("{reference}", encodeURIComponent("" + reference));
655
+ if (sku === undefined || sku === null)
656
+ throw new Error("The parameter 'sku' must be defined and cannot be null.");
657
+ else
658
+ url_ += "sku=" + encodeURIComponent("" + sku) + "&";
659
+ if (storefrontId === undefined || storefrontId === null)
660
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
661
+ else
662
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
663
+ if (storefrontUserId !== undefined && storefrontUserId !== null)
664
+ url_ += "storefrontUserId=" + encodeURIComponent("" + storefrontUserId) + "&";
665
+ if (currencyCode !== undefined && currencyCode !== null)
666
+ url_ += "currencyCode=" + encodeURIComponent("" + currencyCode) + "&";
667
+ if (quantity === null)
668
+ throw new Error("The parameter 'quantity' cannot be null.");
669
+ else if (quantity !== undefined)
670
+ url_ += "quantity=" + encodeURIComponent("" + quantity) + "&";
671
+ if (tenantId !== undefined && tenantId !== null)
672
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
673
+ url_ = url_.replace(/[?&]$/, "");
674
+ let options_ = {
675
+ method: "GET",
676
+ url: url_,
677
+ headers: {
678
+ "Accept": "text/plain"
679
+ },
680
+ cancelToken
681
+ };
682
+ return this.transformOptions(options_).then(transformedOptions_ => {
683
+ return this.instance.request(transformedOptions_);
684
+ }).catch((_error) => {
685
+ if (isAxiosError(_error) && _error.response) {
686
+ return _error.response;
687
+ }
688
+ else {
689
+ throw _error;
690
+ }
691
+ }).then((_response) => {
692
+ return this.transformResult(url_, _response, (_response) => this.processGetProductCostDetails(_response));
693
+ });
694
+ }
695
+ processGetProductCostDetails(response) {
696
+ const status = response.status;
697
+ let _headers = {};
698
+ if (response.headers && typeof response.headers === "object") {
699
+ for (let k in response.headers) {
700
+ if (response.headers.hasOwnProperty(k)) {
701
+ _headers[k] = response.headers[k];
702
+ }
703
+ }
704
+ }
705
+ if (status === 200) {
706
+ const _responseText = response.data;
707
+ let result200 = null;
708
+ let resultData200 = _responseText;
709
+ result200 = JSON.parse(resultData200);
710
+ return Promise.resolve(result200);
711
+ }
712
+ else if (status === 404) {
713
+ const _responseText = response.data;
714
+ let result404 = null;
715
+ let resultData404 = _responseText;
716
+ result404 = JSON.parse(resultData404);
717
+ return throwException("Not Found", status, _responseText, _headers, result404);
718
+ }
719
+ else if (status === 401) {
720
+ const _responseText = response.data;
721
+ return throwException("Unauthorized", status, _responseText, _headers);
722
+ }
723
+ else if (status === 403) {
724
+ const _responseText = response.data;
725
+ return throwException("Forbidden", status, _responseText, _headers);
726
+ }
727
+ else if (status !== 200 && status !== 204) {
728
+ const _responseText = response.data;
729
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
730
+ }
731
+ return Promise.resolve(null);
732
+ }
639
733
  }
640
734
  exports.ProductReferencesApiClient = ProductReferencesApiClient;
641
735
  class ProductSpecificationsApiClient extends ApiClientBase {
@@ -2605,6 +2699,13 @@ var DatePeriod;
2605
2699
  DatePeriod["Last7Days"] = "Last7Days";
2606
2700
  DatePeriod["Last30Days"] = "Last30Days";
2607
2701
  })(DatePeriod = exports.DatePeriod || (exports.DatePeriod = {}));
2702
+ /** Available product resource types */
2703
+ var ProjectProductResourceType;
2704
+ (function (ProjectProductResourceType) {
2705
+ ProjectProductResourceType[ProjectProductResourceType["_0"] = 0] = "_0";
2706
+ ProjectProductResourceType[ProjectProductResourceType["_1"] = 1] = "_1";
2707
+ ProjectProductResourceType[ProjectProductResourceType["_2"] = 2] = "_2";
2708
+ })(ProjectProductResourceType = exports.ProjectProductResourceType || (exports.ProjectProductResourceType = {}));
2608
2709
  /** Storefront types. */
2609
2710
  var StorefrontType;
2610
2711
  (function (StorefrontType) {