UNPKG

xi_sdk_resellers

Version:

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

499 lines (467 loc) 26.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _PriceAndAvailabilityResponseInnerAvailability = _interopRequireDefault(require("./PriceAndAvailabilityResponseInnerAvailability")); var _PriceAndAvailabilityResponseInnerDiscountsInner = _interopRequireDefault(require("./PriceAndAvailabilityResponseInnerDiscountsInner")); var _PriceAndAvailabilityResponseInnerPricing = _interopRequireDefault(require("./PriceAndAvailabilityResponseInnerPricing")); var _PriceAndAvailabilityResponseInnerReserveInventoryDetailsInner = _interopRequireDefault(require("./PriceAndAvailabilityResponseInnerReserveInventoryDetailsInner")); var _PriceAndAvailabilityResponseInnerServiceFeesInner = _interopRequireDefault(require("./PriceAndAvailabilityResponseInnerServiceFeesInner")); var _PriceAndAvailabilityResponseInnerSubscriptionPriceInner = _interopRequireDefault(require("./PriceAndAvailabilityResponseInnerSubscriptionPriceInner")); 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 _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 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. * */ /** * The PriceAndAvailabilityResponseInner model module. * @module model/PriceAndAvailabilityResponseInner * @version 1.0.0 */ var PriceAndAvailabilityResponseInner = /*#__PURE__*/function () { /** * Constructs a new <code>PriceAndAvailabilityResponseInner</code>. * @alias module:model/PriceAndAvailabilityResponseInner */ function PriceAndAvailabilityResponseInner() { _classCallCheck(this, PriceAndAvailabilityResponseInner); PriceAndAvailabilityResponseInner.initialize(this); } /** * Initializes the fields of this object. * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). * Only for internal use. */ return _createClass(PriceAndAvailabilityResponseInner, null, [{ key: "initialize", value: function initialize(obj) {} /** * Constructs a <code>PriceAndAvailabilityResponseInner</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/PriceAndAvailabilityResponseInner} obj Optional instance to populate. * @return {module:model/PriceAndAvailabilityResponseInner} The populated <code>PriceAndAvailabilityResponseInner</code> instance. */ }, { key: "constructFromObject", value: function constructFromObject(data, obj) { if (data) { obj = obj || new PriceAndAvailabilityResponseInner(); if (data.hasOwnProperty('index')) { obj['index'] = _ApiClient["default"].convertToType(data['index'], 'Number'); } if (data.hasOwnProperty('productStatusCode')) { obj['productStatusCode'] = _ApiClient["default"].convertToType(data['productStatusCode'], 'String'); } if (data.hasOwnProperty('productStatusMessage')) { obj['productStatusMessage'] = _ApiClient["default"].convertToType(data['productStatusMessage'], 'String'); } if (data.hasOwnProperty('ingramPartNumber')) { obj['ingramPartNumber'] = _ApiClient["default"].convertToType(data['ingramPartNumber'], 'String'); } if (data.hasOwnProperty('vendorPartNumber')) { obj['vendorPartNumber'] = _ApiClient["default"].convertToType(data['vendorPartNumber'], 'String'); } if (data.hasOwnProperty('extendedVendorPartNumber')) { obj['extendedVendorPartNumber'] = _ApiClient["default"].convertToType(data['extendedVendorPartNumber'], 'String'); } if (data.hasOwnProperty('customerPartNumber')) { obj['customerPartNumber'] = _ApiClient["default"].convertToType(data['customerPartNumber'], 'String'); } if (data.hasOwnProperty('upc')) { obj['upc'] = _ApiClient["default"].convertToType(data['upc'], 'String'); } if (data.hasOwnProperty('partNumberType')) { obj['partNumberType'] = _ApiClient["default"].convertToType(data['partNumberType'], 'String'); } if (data.hasOwnProperty('vendorNumber')) { obj['vendorNumber'] = _ApiClient["default"].convertToType(data['vendorNumber'], 'String'); } if (data.hasOwnProperty('vendorName')) { obj['vendorName'] = _ApiClient["default"].convertToType(data['vendorName'], 'String'); } if (data.hasOwnProperty('description')) { obj['description'] = _ApiClient["default"].convertToType(data['description'], 'String'); } if (data.hasOwnProperty('productClass')) { obj['productClass'] = _ApiClient["default"].convertToType(data['productClass'], 'String'); } if (data.hasOwnProperty('uom')) { obj['uom'] = _ApiClient["default"].convertToType(data['uom'], 'String'); } if (data.hasOwnProperty('productStatus')) { obj['productStatus'] = _ApiClient["default"].convertToType(data['productStatus'], 'String'); } if (data.hasOwnProperty('acceptBackOrder')) { obj['acceptBackOrder'] = _ApiClient["default"].convertToType(data['acceptBackOrder'], 'Boolean'); } if (data.hasOwnProperty('productAuthorized')) { obj['productAuthorized'] = _ApiClient["default"].convertToType(data['productAuthorized'], 'Boolean'); } if (data.hasOwnProperty('returnableProduct')) { obj['returnableProduct'] = _ApiClient["default"].convertToType(data['returnableProduct'], 'Boolean'); } if (data.hasOwnProperty('endUserInfoRequired')) { obj['endUserInfoRequired'] = _ApiClient["default"].convertToType(data['endUserInfoRequired'], 'Boolean'); } if (data.hasOwnProperty('govtSpecialPriceAvailable')) { obj['govtSpecialPriceAvailable'] = _ApiClient["default"].convertToType(data['govtSpecialPriceAvailable'], 'Boolean'); } if (data.hasOwnProperty('govtProgramType')) { obj['govtProgramType'] = _ApiClient["default"].convertToType(data['govtProgramType'], 'String'); } if (data.hasOwnProperty('govtEndUserType')) { obj['govtEndUserType'] = _ApiClient["default"].convertToType(data['govtEndUserType'], 'String'); } if (data.hasOwnProperty('availability')) { obj['availability'] = _PriceAndAvailabilityResponseInnerAvailability["default"].constructFromObject(data['availability']); } if (data.hasOwnProperty('reserveInventoryDetails')) { obj['reserveInventoryDetails'] = _ApiClient["default"].convertToType(data['reserveInventoryDetails'], [_PriceAndAvailabilityResponseInnerReserveInventoryDetailsInner["default"]]); } if (data.hasOwnProperty('pricing')) { obj['pricing'] = _PriceAndAvailabilityResponseInnerPricing["default"].constructFromObject(data['pricing']); } if (data.hasOwnProperty('discounts')) { obj['discounts'] = _ApiClient["default"].convertToType(data['discounts'], [_PriceAndAvailabilityResponseInnerDiscountsInner["default"]]); } if (data.hasOwnProperty('bundlePartIndicator')) { obj['bundlePartIndicator'] = _ApiClient["default"].convertToType(data['bundlePartIndicator'], 'Boolean'); } if (data.hasOwnProperty('serviceFees')) { obj['serviceFees'] = _ApiClient["default"].convertToType(data['serviceFees'], [_PriceAndAvailabilityResponseInnerServiceFeesInner["default"]]); } if (data.hasOwnProperty('subscriptionPrice')) { obj['subscriptionPrice'] = _ApiClient["default"].convertToType(data['subscriptionPrice'], [_PriceAndAvailabilityResponseInnerSubscriptionPriceInner["default"]]); } } return obj; } /** * Validates the JSON data with respect to <code>PriceAndAvailabilityResponseInner</code>. * @param {Object} data The plain JavaScript object bearing properties of interest. * @return {boolean} to indicate whether the JSON data is valid with respect to <code>PriceAndAvailabilityResponseInner</code>. */ }, { key: "validateJSON", value: function validateJSON(data) { // ensure the json data is a string if (data['productStatusCode'] && !(typeof data['productStatusCode'] === 'string' || data['productStatusCode'] instanceof String)) { throw new Error("Expected the field `productStatusCode` to be a primitive type in the JSON string but got " + data['productStatusCode']); } // ensure the json data is a string if (data['productStatusMessage'] && !(typeof data['productStatusMessage'] === 'string' || data['productStatusMessage'] instanceof String)) { throw new Error("Expected the field `productStatusMessage` to be a primitive type in the JSON string but got " + data['productStatusMessage']); } // ensure the json data is a string if (data['ingramPartNumber'] && !(typeof data['ingramPartNumber'] === 'string' || data['ingramPartNumber'] instanceof String)) { throw new Error("Expected the field `ingramPartNumber` to be a primitive type in the JSON string but got " + data['ingramPartNumber']); } // ensure the json data is a string if (data['vendorPartNumber'] && !(typeof data['vendorPartNumber'] === 'string' || data['vendorPartNumber'] instanceof String)) { throw new Error("Expected the field `vendorPartNumber` to be a primitive type in the JSON string but got " + data['vendorPartNumber']); } // ensure the json data is a string if (data['extendedVendorPartNumber'] && !(typeof data['extendedVendorPartNumber'] === 'string' || data['extendedVendorPartNumber'] instanceof String)) { throw new Error("Expected the field `extendedVendorPartNumber` to be a primitive type in the JSON string but got " + data['extendedVendorPartNumber']); } // ensure the json data is a string if (data['customerPartNumber'] && !(typeof data['customerPartNumber'] === 'string' || data['customerPartNumber'] instanceof String)) { throw new Error("Expected the field `customerPartNumber` to be a primitive type in the JSON string but got " + data['customerPartNumber']); } // ensure the json data is a string if (data['upc'] && !(typeof data['upc'] === 'string' || data['upc'] instanceof String)) { throw new Error("Expected the field `upc` to be a primitive type in the JSON string but got " + data['upc']); } // ensure the json data is a string if (data['partNumberType'] && !(typeof data['partNumberType'] === 'string' || data['partNumberType'] instanceof String)) { throw new Error("Expected the field `partNumberType` to be a primitive type in the JSON string but got " + data['partNumberType']); } // ensure the json data is a string if (data['vendorNumber'] && !(typeof data['vendorNumber'] === 'string' || data['vendorNumber'] instanceof String)) { throw new Error("Expected the field `vendorNumber` to be a primitive type in the JSON string but got " + data['vendorNumber']); } // ensure the json data is a string if (data['vendorName'] && !(typeof data['vendorName'] === 'string' || data['vendorName'] instanceof String)) { throw new Error("Expected the field `vendorName` to be a primitive type in the JSON string but got " + data['vendorName']); } // ensure the json data is a string if (data['description'] && !(typeof data['description'] === 'string' || data['description'] instanceof String)) { throw new Error("Expected the field `description` to be a primitive type in the JSON string but got " + data['description']); } // ensure the json data is a string if (data['productClass'] && !(typeof data['productClass'] === 'string' || data['productClass'] instanceof String)) { throw new Error("Expected the field `productClass` to be a primitive type in the JSON string but got " + data['productClass']); } // ensure the json data is a string if (data['uom'] && !(typeof data['uom'] === 'string' || data['uom'] instanceof String)) { throw new Error("Expected the field `uom` to be a primitive type in the JSON string but got " + data['uom']); } // ensure the json data is a string if (data['productStatus'] && !(typeof data['productStatus'] === 'string' || data['productStatus'] instanceof String)) { throw new Error("Expected the field `productStatus` to be a primitive type in the JSON string but got " + data['productStatus']); } // ensure the json data is a string if (data['govtProgramType'] && !(typeof data['govtProgramType'] === 'string' || data['govtProgramType'] instanceof String)) { throw new Error("Expected the field `govtProgramType` to be a primitive type in the JSON string but got " + data['govtProgramType']); } // ensure the json data is a string if (data['govtEndUserType'] && !(typeof data['govtEndUserType'] === 'string' || data['govtEndUserType'] instanceof String)) { throw new Error("Expected the field `govtEndUserType` to be a primitive type in the JSON string but got " + data['govtEndUserType']); } // validate the optional field `availability` if (data['availability']) { // data not null _PriceAndAvailabilityResponseInnerAvailability["default"].validateJSON(data['availability']); } if (data['reserveInventoryDetails']) { // data not null // ensure the json data is an array if (!Array.isArray(data['reserveInventoryDetails'])) { throw new Error("Expected the field `reserveInventoryDetails` to be an array in the JSON data but got " + data['reserveInventoryDetails']); } // validate the optional field `reserveInventoryDetails` (array) var _iterator = _createForOfIteratorHelper(data['reserveInventoryDetails']), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var item = _step.value; _PriceAndAvailabilityResponseInnerReserveInventoryDetailsInner["default"].validateJSON(item); } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } ; } // validate the optional field `pricing` if (data['pricing']) { // data not null _PriceAndAvailabilityResponseInnerPricing["default"].validateJSON(data['pricing']); } if (data['discounts']) { // data not null // ensure the json data is an array if (!Array.isArray(data['discounts'])) { throw new Error("Expected the field `discounts` to be an array in the JSON data but got " + data['discounts']); } // validate the optional field `discounts` (array) var _iterator2 = _createForOfIteratorHelper(data['discounts']), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var _item = _step2.value; _PriceAndAvailabilityResponseInnerDiscountsInner["default"].validateJSON(_item); } } catch (err) { _iterator2.e(err); } finally { _iterator2.f(); } ; } if (data['serviceFees']) { // data not null // ensure the json data is an array if (!Array.isArray(data['serviceFees'])) { throw new Error("Expected the field `serviceFees` to be an array in the JSON data but got " + data['serviceFees']); } // validate the optional field `serviceFees` (array) var _iterator3 = _createForOfIteratorHelper(data['serviceFees']), _step3; try { for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { var _item2 = _step3.value; _PriceAndAvailabilityResponseInnerServiceFeesInner["default"].validateJSON(_item2); } } catch (err) { _iterator3.e(err); } finally { _iterator3.f(); } ; } if (data['subscriptionPrice']) { // data not null // ensure the json data is an array if (!Array.isArray(data['subscriptionPrice'])) { throw new Error("Expected the field `subscriptionPrice` to be an array in the JSON data but got " + data['subscriptionPrice']); } // validate the optional field `subscriptionPrice` (array) var _iterator4 = _createForOfIteratorHelper(data['subscriptionPrice']), _step4; try { for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { var _item3 = _step4.value; _PriceAndAvailabilityResponseInnerSubscriptionPriceInner["default"].validateJSON(_item3); } } catch (err) { _iterator4.e(err); } finally { _iterator4.f(); } ; } return true; } }]); }(); /** * @member {Number} index */ PriceAndAvailabilityResponseInner.prototype['index'] = undefined; /** * Codes signifying whether the sku is active or not. * @member {String} productStatusCode */ PriceAndAvailabilityResponseInner.prototype['productStatusCode'] = undefined; /** * Message returned saying whether sku is active. * @member {String} productStatusMessage */ PriceAndAvailabilityResponseInner.prototype['productStatusMessage'] = undefined; /** * Ingram Micro unique part number for the product. * @member {String} ingramPartNumber */ PriceAndAvailabilityResponseInner.prototype['ingramPartNumber'] = undefined; /** * Vendor’s part number for the product. * @member {String} vendorPartNumber */ PriceAndAvailabilityResponseInner.prototype['vendorPartNumber'] = undefined; /** * Extended Vendor Part Number. *Currently, this feature is not available in these countries (Mexico, Turkey, New Zealand, Colombia, Chile, Brazil, Peru, Western Sahara). * @member {String} extendedVendorPartNumber */ PriceAndAvailabilityResponseInner.prototype['extendedVendorPartNumber'] = undefined; /** * Reseller / end-user’s part number for the product. * @member {String} customerPartNumber */ PriceAndAvailabilityResponseInner.prototype['customerPartNumber'] = undefined; /** * The UPC code for the product. Consists of 12 numeric digits that are uniquely assigned to each trade item. * @member {String} upc */ PriceAndAvailabilityResponseInner.prototype['upc'] = undefined; /** * Number type of the part. * @member {String} partNumberType */ PriceAndAvailabilityResponseInner.prototype['partNumberType'] = undefined; /** * Vendor number that identifies the product. * @member {String} vendorNumber */ PriceAndAvailabilityResponseInner.prototype['vendorNumber'] = undefined; /** * Vendor name for the order. * @member {String} vendorName */ PriceAndAvailabilityResponseInner.prototype['vendorName'] = undefined; /** * The description given for the product. * @member {String} description */ PriceAndAvailabilityResponseInner.prototype['description'] = undefined; /** * Indicates whether the product is directly shipped from the vendor’s warehouse or if the product ships from Ingram Micro’s warehouse. Class Codes are Ingram classifications on how skus are stocked A = Product that is stocked usually in all IM warehouses and replenished on a regular basis. B = Product that is stocked in limited IM warehouses and replenished on a regular basis C = Product that is stocked in fewer IM warehouses and replenished on a regular basis. D = Product that Ingram Micro has elected to discontinue. E = Product that will be phased out later, according to the vendor. You may not want to replenish this product, but instead sell down what is in stock. F = Product that we carry for a specific customer or supplier under a contractual agreement. N = New Sku. Classification before first receipt O = Discontinued product to be liquidated S= Order for Specialized Demand (Order to backorder) X= direct ship from Vendor V = product that vendor has elected to discontinue. * @member {String} productClass */ PriceAndAvailabilityResponseInner.prototype['productClass'] = undefined; /** * The description given for the product. * @member {String} uom */ PriceAndAvailabilityResponseInner.prototype['uom'] = undefined; /** * Status that gives whether the product is Active. * @member {String} productStatus */ PriceAndAvailabilityResponseInner.prototype['productStatus'] = undefined; /** * Boolean that indicates if the product accepts backorder. * @member {Boolean} acceptBackOrder */ PriceAndAvailabilityResponseInner.prototype['acceptBackOrder'] = undefined; /** * Boolean that indicates whether a product is authorized. * @member {Boolean} productAuthorized */ PriceAndAvailabilityResponseInner.prototype['productAuthorized'] = undefined; /** * Boolean that indicates if the product can be returned. * @member {Boolean} returnableProduct */ PriceAndAvailabilityResponseInner.prototype['returnableProduct'] = undefined; /** * Boolean that indicates if end user information is required. * @member {Boolean} endUserInfoRequired */ PriceAndAvailabilityResponseInner.prototype['endUserInfoRequired'] = undefined; /** * Boolean that indicates if special pricing is available for the product. * @member {Boolean} govtSpecialPriceAvailable */ PriceAndAvailabilityResponseInner.prototype['govtSpecialPriceAvailable'] = undefined; /** * Program type, “PA” for government orders, “ED” for education order. * @member {String} govtProgramType */ PriceAndAvailabilityResponseInner.prototype['govtProgramType'] = undefined; /** * Type of end user of the program. F = Federal, S = State, E = Local, K = K-12 school, and H = Higher Education. * @member {String} govtEndUserType */ PriceAndAvailabilityResponseInner.prototype['govtEndUserType'] = undefined; /** * @member {module:model/PriceAndAvailabilityResponseInnerAvailability} availability */ PriceAndAvailabilityResponseInner.prototype['availability'] = undefined; /** * @member {Array.<module:model/PriceAndAvailabilityResponseInnerReserveInventoryDetailsInner>} reserveInventoryDetails */ PriceAndAvailabilityResponseInner.prototype['reserveInventoryDetails'] = undefined; /** * @member {module:model/PriceAndAvailabilityResponseInnerPricing} pricing */ PriceAndAvailabilityResponseInner.prototype['pricing'] = undefined; /** * @member {Array.<module:model/PriceAndAvailabilityResponseInnerDiscountsInner>} discounts */ PriceAndAvailabilityResponseInner.prototype['discounts'] = undefined; /** * True of false value to indicate whether it’s bundle part. *Currently, this feature is not available in these countries (Mexico, Turkey, New Zealand, Colombia, Chile, Brazil, Peru, Western Sahara). * @member {Boolean} bundlePartIndicator */ PriceAndAvailabilityResponseInner.prototype['bundlePartIndicator'] = undefined; /** * *Currently, this feature is not available in these countries (Mexico, Turkey, New Zealand, Colombia, Chile, Brazil, Peru, Western Sahara). * @member {Array.<module:model/PriceAndAvailabilityResponseInnerServiceFeesInner>} serviceFees */ PriceAndAvailabilityResponseInner.prototype['serviceFees'] = undefined; /** * @member {Array.<module:model/PriceAndAvailabilityResponseInnerSubscriptionPriceInner>} subscriptionPrice */ PriceAndAvailabilityResponseInner.prototype['subscriptionPrice'] = undefined; var _default = exports["default"] = PriceAndAvailabilityResponseInner;