UNPKG

xi_sdk_resellers

Version:

Ingram Micro - Xvantage Integration (XI) Node.Js Server-side SDK.

316 lines (307 loc) 19.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _ErrorResponse = _interopRequireDefault(require("../model/ErrorResponse")); var _PriceAndAvailabilityRequest = _interopRequireDefault(require("../model/PriceAndAvailabilityRequest")); var _PriceAndAvailabilityResponseInner = _interopRequireDefault(require("../model/PriceAndAvailabilityResponseInner")); var _ProductDetailResponse = _interopRequireDefault(require("../model/ProductDetailResponse")); var _ProductSearchResponse = _interopRequireDefault(require("../model/ProductSearchResponse")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /** * XI Sdk Resellers * For Resellers seeking to innovate with Ingram Micro's API solutions, automate your eCommerce experience with our array of API's and webhooks to craft a seamless journey for your customers. * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. * */ /** * ProductCatalog service. * @module api/ProductCatalogApi * @version 1.0.0 */ var ProductCatalogApi = exports["default"] = /*#__PURE__*/function () { /** * Constructs a new ProductCatalogApi. * @alias module:api/ProductCatalogApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ function ProductCatalogApi(apiClient) { _classCallCheck(this, ProductCatalogApi); this.apiClient = apiClient || _ApiClient["default"].instance; } /** * Callback function to receive the result of the getResellerV6Productdetail operation. * @callback module:api/ProductCatalogApi~getResellerV6ProductdetailCallback * @param {String} error Error message, if any. * @param {module:model/ProductDetailResponse} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Product Details * Search all the product-related details using a unique Ingram Part Number. Currently, this API is available in the USA, India, and Netherlands. * @param {String} ingramPartNumber Ingram Micro unique part number for the product * @param {String} iMCustomerNumber Your unique Ingram Micro customer number * @param {String} iMCountryCode Two-character ISO country code. * @param {String} iMCorrelationID Unique transaction number to identify each transaction accross all the systems * @param {Object} opts Optional parameters * @param {String} [iMSenderID] Sender Identification text * @param {module:api/ProductCatalogApi~getResellerV6ProductdetailCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ProductDetailResponse} */ return _createClass(ProductCatalogApi, [{ key: "getResellerV6Productdetail", value: function getResellerV6Productdetail(ingramPartNumber, iMCustomerNumber, iMCountryCode, iMCorrelationID, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'ingramPartNumber' is set if (ingramPartNumber === undefined || ingramPartNumber === null) { throw new Error("Missing the required parameter 'ingramPartNumber' when calling getResellerV6Productdetail"); } // verify the required parameter 'iMCustomerNumber' is set if (iMCustomerNumber === undefined || iMCustomerNumber === null) { throw new Error("Missing the required parameter 'iMCustomerNumber' when calling getResellerV6Productdetail"); } // verify the required parameter 'iMCountryCode' is set if (iMCountryCode === undefined || iMCountryCode === null) { throw new Error("Missing the required parameter 'iMCountryCode' when calling getResellerV6Productdetail"); } // verify the required parameter 'iMCorrelationID' is set if (iMCorrelationID === undefined || iMCorrelationID === null) { throw new Error("Missing the required parameter 'iMCorrelationID' when calling getResellerV6Productdetail"); } var pathParams = { 'ingramPartNumber': ingramPartNumber }; var queryParams = {}; var headerParams = { 'IM-CustomerNumber': iMCustomerNumber, 'IM-CountryCode': iMCountryCode, 'IM-SenderID': opts['iMSenderID'], 'IM-CorrelationID': iMCorrelationID }; var formParams = {}; var authNames = ['application']; var contentTypes = []; var accepts = ['application/json']; var returnType = _ProductDetailResponse["default"]; return this.apiClient.callApi('/resellers/v6/catalog/details/{ingramPartNumber}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getResellerV6Productdetailcmp operation. * @callback module:api/ProductCatalogApi~getResellerV6ProductdetailcmpCallback * @param {String} error Error message, if any. * @param {module:model/ProductDetailResponse} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Product Details * Search all the product-related details. * @param {String} iMCustomerNumber Your unique Ingram Micro customer number * @param {String} iMCountryCode Two-character ISO country code. * @param {String} iMCorrelationID Unique transaction number to identify each transaction across all the systems * @param {Object} opts Optional parameters * @param {String} [iMSenderID] Sender Identification text * @param {String} [planName] Name of the subscription plan * @param {String} [planId] Id of the subscription plan. <span style='color:red'>To search for details of subscription products, customer must pass either vendorPartNumber, planName or planId.</span> * @param {String} [vendorPartNumber] Vendor’s part number for the product. * @param {module:api/ProductCatalogApi~getResellerV6ProductdetailcmpCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ProductDetailResponse} */ }, { key: "getResellerV6Productdetailcmp", value: function getResellerV6Productdetailcmp(iMCustomerNumber, iMCountryCode, iMCorrelationID, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'iMCustomerNumber' is set if (iMCustomerNumber === undefined || iMCustomerNumber === null) { throw new Error("Missing the required parameter 'iMCustomerNumber' when calling getResellerV6Productdetailcmp"); } // verify the required parameter 'iMCountryCode' is set if (iMCountryCode === undefined || iMCountryCode === null) { throw new Error("Missing the required parameter 'iMCountryCode' when calling getResellerV6Productdetailcmp"); } // verify the required parameter 'iMCorrelationID' is set if (iMCorrelationID === undefined || iMCorrelationID === null) { throw new Error("Missing the required parameter 'iMCorrelationID' when calling getResellerV6Productdetailcmp"); } var pathParams = {}; var queryParams = { 'planName': opts['planName'], 'planId': opts['planId'], 'vendorPartNumber': opts['vendorPartNumber'] }; var headerParams = { 'IM-CustomerNumber': iMCustomerNumber, 'IM-CountryCode': iMCountryCode, 'IM-SenderID': opts['iMSenderID'], 'IM-CorrelationID': iMCorrelationID }; var formParams = {}; var authNames = ['application']; var contentTypes = []; var accepts = ['application/json']; var returnType = _ProductDetailResponse["default"]; return this.apiClient.callApi('/resellers/v6/catalog/details', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the getResellerV6Productsearch operation. * @callback module:api/ProductCatalogApi~getResellerV6ProductsearchCallback * @param {String} error Error message, if any. * @param {module:model/ProductSearchResponse} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Search Products * Search the Ingram Micro product catalog by providing any of the information in the keyword(Ingram part number / vendor part number/ product description / UPC * @param {String} iMCustomerNumber Your unique Ingram Micro customer number * @param {String} iMCorrelationID Unique transaction number to identify each transaction accross all the systems * @param {String} iMCountryCode Two-character ISO country code. * @param {Object} opts Optional parameters * @param {Number} [pageNumber] Current page number. Default is 1 * @param {Number} [pageSize] Number of records required in the call - max records 100 per page * @param {String} [iMSenderID] Sender Identification text * @param {module:model/String} [type] The SKU type of product. One of Physical, Digital, or Any. * @param {String} [hasDiscounts] Specifies if there are discounts available for the product. * @param {Array.<String>} [vendor] The name of the vendor/manufacturer of the product. * @param {Array.<String>} [vendorPartNumber] The vendors part number for the product. * @param {String} [acceptLanguage = 'en')] Header to the API calls, the content will help us identify the response language. * @param {String} [vendorNumber] Vendor number of the product * @param {Array.<String>} [keyword] Keyword search,can be ingram part number or vendor part number or product title or vendor nameKeyword search. Can be Ingram Micro part number, vender part number, product title, or vendor name. * @param {String} [category] The category of the product. Example: Displays. * @param {String} [skipAuthorisation] This parameter is True when you want Skip the authorization, so template will work like current B2b template. * @param {String} [groupName] Name of the Product Group * @param {String} [planID] ID of the plan * @param {Boolean} [showGroupInfo] In case of value true, below Group related information will displayed without the plan info. Group Name, Group Description, Number of plans, link in the group. A link will be provided if customer want to see all the plans in that group. * @param {module:api/ProductCatalogApi~getResellerV6ProductsearchCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ProductSearchResponse} */ }, { key: "getResellerV6Productsearch", value: function getResellerV6Productsearch(iMCustomerNumber, iMCorrelationID, iMCountryCode, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'iMCustomerNumber' is set if (iMCustomerNumber === undefined || iMCustomerNumber === null) { throw new Error("Missing the required parameter 'iMCustomerNumber' when calling getResellerV6Productsearch"); } // verify the required parameter 'iMCorrelationID' is set if (iMCorrelationID === undefined || iMCorrelationID === null) { throw new Error("Missing the required parameter 'iMCorrelationID' when calling getResellerV6Productsearch"); } // verify the required parameter 'iMCountryCode' is set if (iMCountryCode === undefined || iMCountryCode === null) { throw new Error("Missing the required parameter 'iMCountryCode' when calling getResellerV6Productsearch"); } var pathParams = {}; var queryParams = { 'pageNumber': opts['pageNumber'], 'pageSize': opts['pageSize'], 'type': opts['type'], 'hasDiscounts': opts['hasDiscounts'], 'vendor': this.apiClient.buildCollectionParam(opts['vendor'], 'multi'), 'vendorPartNumber': this.apiClient.buildCollectionParam(opts['vendorPartNumber'], 'multi'), 'vendorNumber': opts['vendorNumber'], 'keyword': this.apiClient.buildCollectionParam(opts['keyword'], 'multi'), 'category': opts['category'], 'skipAuthorisation': opts['skipAuthorisation'], 'groupName': opts['groupName'], 'planID': opts['planID'], 'showGroupInfo': opts['showGroupInfo'] }; var headerParams = { 'IM-CustomerNumber': iMCustomerNumber, 'IM-SenderID': opts['iMSenderID'], 'IM-CorrelationID': iMCorrelationID, 'IM-CountryCode': iMCountryCode, 'Accept-Language': opts['acceptLanguage'] }; var formParams = {}; var authNames = ['application']; var contentTypes = []; var accepts = ['application/json']; var returnType = _ProductSearchResponse["default"]; return this.apiClient.callApi('/resellers/v6/catalog', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } /** * Callback function to receive the result of the postPriceandavailability operation. * @callback module:api/ProductCatalogApi~postPriceandavailabilityCallback * @param {String} error Error message, if any. * @param {Array.<module:model/PriceAndAvailabilityResponseInner>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Price and Availability * The PriceAndAvailability API, will retrieve Pricing, Availability, discounts, Inventory Location, Reserve Inventory for the products upto 50 products. * @param {Boolean} includeAvailability Pass boolean value as input, if true the response will contain warehouse availability details, if false the response will not hold warehouse availability details * @param {Boolean} includePricing Pass boolean value as input, if true the response will contain Pricing details of the Product, if false the response will not hold Pricing details. * @param {String} iMCustomerNumber Your unique Ingram Micro customer number. * @param {String} iMCountryCode Two-character ISO country code. * @param {String} iMCorrelationID Unique transaction number to identify each transaction across all the systems. * @param {Object} opts Optional parameters * @param {Boolean} [includeProductAttributes] Pass boolean value as input, if true the response will contain detailed attributes related to the Product, if false or not sent the response will contain very few Product details. * @param {String} [iMSenderID] Unique value used to identify the sender of the transaction. Example: MyCompany * @param {module:model/PriceAndAvailabilityRequest} [priceAndAvailabilityRequest] * @param {module:api/ProductCatalogApi~postPriceandavailabilityCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/PriceAndAvailabilityResponseInner>} */ }, { key: "postPriceandavailability", value: function postPriceandavailability(includeAvailability, includePricing, iMCustomerNumber, iMCountryCode, iMCorrelationID, opts, callback) { opts = opts || {}; var postBody = opts['priceAndAvailabilityRequest']; // verify the required parameter 'includeAvailability' is set if (includeAvailability === undefined || includeAvailability === null) { throw new Error("Missing the required parameter 'includeAvailability' when calling postPriceandavailability"); } // verify the required parameter 'includePricing' is set if (includePricing === undefined || includePricing === null) { throw new Error("Missing the required parameter 'includePricing' when calling postPriceandavailability"); } // verify the required parameter 'iMCustomerNumber' is set if (iMCustomerNumber === undefined || iMCustomerNumber === null) { throw new Error("Missing the required parameter 'iMCustomerNumber' when calling postPriceandavailability"); } // verify the required parameter 'iMCountryCode' is set if (iMCountryCode === undefined || iMCountryCode === null) { throw new Error("Missing the required parameter 'iMCountryCode' when calling postPriceandavailability"); } // verify the required parameter 'iMCorrelationID' is set if (iMCorrelationID === undefined || iMCorrelationID === null) { throw new Error("Missing the required parameter 'iMCorrelationID' when calling postPriceandavailability"); } var pathParams = {}; var queryParams = { 'includeAvailability': includeAvailability, 'includePricing': includePricing, 'includeProductAttributes': opts['includeProductAttributes'] }; var headerParams = { 'IM-CustomerNumber': iMCustomerNumber, 'IM-CountryCode': iMCountryCode, 'IM-CorrelationID': iMCorrelationID, 'IM-SenderID': opts['iMSenderID'] }; var formParams = {}; var authNames = ['application']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = [_PriceAndAvailabilityResponseInner["default"]]; return this.apiClient.callApi('/resellers/v6/catalog/priceandavailability', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback); } }]); }();