UNPKG

@whitebox-co/walmart-marketplace-api

Version:

A fully typed TypeScript, Javascript, and Node.js API library for the Walmart Marketplace API

385 lines 15.2 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Convert = exports.SpecVersion = exports.SellingChannel = exports.ProcessMode = exports.Locale = exports.Mart = exports.ProductIDType = exports.ProductCategory = void 0; var ProductCategory; (function (ProductCategory) { ProductCategory["AnimalAccessories"] = "Animal Accessories"; ProductCategory["AnimalFood"] = "Animal Food"; ProductCategory["AnimalHealthGrooming"] = "Animal Health & Grooming"; ProductCategory["AnimalOther"] = "Animal Other"; ProductCategory["ArtCraft"] = "Art & Craft"; ProductCategory["BabyClothing"] = "Baby Clothing"; ProductCategory["BabyDiaperingCareOther"] = "Baby Diapering, Care, & Other"; ProductCategory["BabyFood"] = "Baby Food"; ProductCategory["BabyFurniture"] = "Baby Furniture"; ProductCategory["BabyToys"] = "Baby Toys"; ProductCategory["BabyTransport"] = "Baby Transport"; ProductCategory["BeautyPersonalCareHygiene"] = "Beauty, Personal Care, & Hygiene"; ProductCategory["Bedding"] = "Bedding"; ProductCategory["BooksMagazines"] = "Books & Magazines"; ProductCategory["BuildingSupply"] = "Building Supply"; ProductCategory["CamerasLenses"] = "Cameras & Lenses"; ProductCategory["CarriersAccessories"] = "Carriers & Accessories"; ProductCategory["CasesBags"] = "Cases & Bags"; ProductCategory["CeremonialClothingAccessories"] = "Ceremonial Clothing & Accessories"; ProductCategory["Clothing"] = "Clothing"; ProductCategory["ComputerComponents"] = "Computer Components"; ProductCategory["Computers"] = "Computers"; ProductCategory["Costumes"] = "Costumes"; ProductCategory["Cycling"] = "Cycling"; ProductCategory["DecorationsFavors"] = "Decorations & Favors"; ProductCategory["Electrical"] = "Electrical"; ProductCategory["ElectronicsAccessories"] = "Electronics Accessories"; ProductCategory["ElectronicsCables"] = "Electronics Cables"; ProductCategory["ElectronicsOther"] = "Electronics Other"; ProductCategory["FoodBeverage"] = "Food & Beverage"; ProductCategory["Footwear"] = "Footwear"; ProductCategory["FuelsLubricants"] = "Fuels & Lubricants"; ProductCategory["Funeral"] = "Funeral"; ProductCategory["Furniture"] = "Furniture"; ProductCategory["GardenPatio"] = "Garden & Patio"; ProductCategory["GiftSupplyAwards"] = "Gift Supply & Awards"; ProductCategory["GrillsOutdoorCooking"] = "Grills & Outdoor Cooking"; ProductCategory["Hardware"] = "Hardware"; ProductCategory["HealthBeautyElectronics"] = "Health & Beauty Electronics"; ProductCategory["HomeDecorKitchenOther"] = "Home Decor, Kitchen, & Other"; ProductCategory["HouseholdCleaningProductsSupplies"] = "Household Cleaning Products & Supplies"; ProductCategory["InstrumentAccessories"] = "Instrument Accessories"; ProductCategory["Jewelry"] = "Jewelry"; ProductCategory["LandVehicles"] = "Land Vehicles"; ProductCategory["LargeAppliances"] = "Large Appliances"; ProductCategory["MedicalAidsEquipment"] = "Medical Aids & Equipment"; ProductCategory["MedicineSupplements"] = "Medicine & Supplements"; ProductCategory["Movies"] = "Movies"; ProductCategory["Music"] = "Music"; ProductCategory["MusicCasesBags"] = "Music Cases & Bags"; ProductCategory["MusicalInstruments"] = "Musical Instruments"; ProductCategory["Office"] = "Office"; ProductCategory["Optical"] = "Optical"; ProductCategory["Optics"] = "Optics"; ProductCategory["Other"] = "Other"; ProductCategory["PhotoAccessories"] = "Photo Accessories"; ProductCategory["PlumbingHVAC"] = "Plumbing & HVAC"; ProductCategory["PrintersScannersImaging"] = "Printers, Scanners, & Imaging"; ProductCategory["SafetyEmergency"] = "Safety & Emergency"; ProductCategory["Software"] = "Software"; ProductCategory["SoundRecording"] = "Sound & Recording"; ProductCategory["SportsRecreationOther"] = "Sports & Recreation Other"; ProductCategory["Storage"] = "Storage"; ProductCategory["TVShows"] = "TV Shows"; ProductCategory["TVsVideoDisplays"] = "TVs & Video Displays"; ProductCategory["Tires"] = "Tires"; ProductCategory["Tools"] = "Tools"; ProductCategory["ToolsHardwareOther"] = "Tools & Hardware Other"; ProductCategory["Toys"] = "Toys"; ProductCategory["VehicleOther"] = "Vehicle Other"; ProductCategory["VehiclePartsAccessories"] = "Vehicle Parts & Accessories"; ProductCategory["VideoGames"] = "Video Games"; ProductCategory["VideoProjectors"] = "Video Projectors"; ProductCategory["Watches"] = "Watches"; ProductCategory["Watercraft"] = "Watercraft"; ProductCategory["WheelsWheelComponents"] = "Wheels & Wheel Components"; })(ProductCategory = exports.ProductCategory || (exports.ProductCategory = {})); var ProductIDType; (function (ProductIDType) { ProductIDType["Ean"] = "EAN"; ProductIDType["Gtin"] = "GTIN"; ProductIDType["Isbn"] = "ISBN"; ProductIDType["Upc"] = "UPC"; })(ProductIDType = exports.ProductIDType || (exports.ProductIDType = {})); var Mart; (function (Mart) { Mart["AsdaGm"] = "ASDA_GM"; Mart["WalmartCA"] = "WALMART_CA"; Mart["WalmartUs"] = "WALMART_US"; })(Mart = exports.Mart || (exports.Mart = {})); var Locale; (function (Locale) { Locale["En"] = "en"; })(Locale = exports.Locale || (exports.Locale = {})); var ProcessMode; (function (ProcessMode) { ProcessMode["Merge"] = "MERGE"; ProcessMode["Replace"] = "REPLACE"; })(ProcessMode = exports.ProcessMode || (exports.ProcessMode = {})); var SellingChannel; (function (SellingChannel) { SellingChannel["Mpsetupbymatch"] = "mpsetupbymatch"; })(SellingChannel = exports.SellingChannel || (exports.SellingChannel = {})); var SpecVersion; (function (SpecVersion) { SpecVersion["The10"] = "1.0"; })(SpecVersion = exports.SpecVersion || (exports.SpecVersion = {})); // Converts JSON strings to/from your types // and asserts the results of JSON.parse at runtime class Convert { static toMpItemMatch4(json) { return cast(JSON.parse(json), r('MpItemMatch4')); } static mpItemMatch4ToJson(value) { return JSON.stringify(uncast(value, r('MpItemMatch4')), null, 2); } } exports.Convert = Convert; function invalidValue(typ, val, key = '') { if (key) { throw Error(`Invalid value for key "${key}". Expected type ${JSON.stringify(typ)} but got ${JSON.stringify(val)}`); } throw Error(`Invalid value ${JSON.stringify(val)} for type ${JSON.stringify(typ)}`); } function jsonToJSProps(typ) { if (typ.jsonToJS === undefined) { const map = {}; typ.props.forEach((p) => (map[p.json] = { key: p.js, typ: p.typ })); typ.jsonToJS = map; } return typ.jsonToJS; } function jsToJSONProps(typ) { if (typ.jsToJSON === undefined) { const map = {}; typ.props.forEach((p) => (map[p.js] = { key: p.json, typ: p.typ })); typ.jsToJSON = map; } return typ.jsToJSON; } function transform(val, typ, getProps, key = '') { function transformPrimitive(typ, val) { if (typeof typ === typeof val) return val; return invalidValue(typ, val, key); } function transformUnion(typs, val) { // val must validate against one typ in typs const l = typs.length; for (let i = 0; i < l; i++) { const typ = typs[i]; try { return transform(val, typ, getProps); } catch (_) { } } return invalidValue(typs, val); } function transformEnum(cases, val) { if (cases.indexOf(val) !== -1) return val; return invalidValue(cases, val); } function transformArray(typ, val) { // val must be an array with no invalid elements if (!Array.isArray(val)) return invalidValue('array', val); return val.map((el) => transform(el, typ, getProps)); } function transformDate(val) { if (val === null) { return null; } const d = new Date(val); if (isNaN(d.valueOf())) { return invalidValue('Date', val); } return d; } function transformObject(props, additional, val) { if (val === null || typeof val !== 'object' || Array.isArray(val)) { return invalidValue('object', val); } const result = {}; Object.getOwnPropertyNames(props).forEach((key) => { const prop = props[key]; const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined; result[prop.key] = transform(v, prop.typ, getProps, prop.key); }); Object.getOwnPropertyNames(val).forEach((key) => { if (!Object.prototype.hasOwnProperty.call(props, key)) { result[key] = transform(val[key], additional, getProps, key); } }); return result; } if (typ === 'any') return val; if (typ === null) { if (val === null) return val; return invalidValue(typ, val); } if (typ === false) return invalidValue(typ, val); while (typeof typ === 'object' && typ.ref !== undefined) { typ = typeMap[typ.ref]; } if (Array.isArray(typ)) return transformEnum(typ, val); if (typeof typ === 'object') { return typ.hasOwnProperty('unionMembers') ? transformUnion(typ.unionMembers, val) : typ.hasOwnProperty('arrayItems') ? transformArray(typ.arrayItems, val) : typ.hasOwnProperty('props') ? transformObject(getProps(typ), typ.additional, val) : invalidValue(typ, val); } // Numbers can be parsed by Date but shouldn't be. if (typ === Date && typeof val !== 'number') return transformDate(val); return transformPrimitive(typ, val); } function cast(val, typ) { return transform(val, typ, jsonToJSProps); } function uncast(val, typ) { return transform(val, typ, jsToJSONProps); } function a(typ) { return { arrayItems: typ }; } function u(...typs) { return { unionMembers: typs }; } function o(props, additional) { return { props, additional }; } function m(additional) { return { props: [], additional }; } function r(name) { return { ref: name }; } const typeMap = { MpItemMatch4: o([ { json: 'MPItem', js: 'MPItem', typ: a(r('MPItem')) }, { json: 'MPItemFeedHeader', js: 'MPItemFeedHeader', typ: r('MPItemFeedHeader') }, ], false), MPItem: o([{ json: 'Item', js: 'Item', typ: r('Item') }], false), Item: o([ { json: 'additionalOfferAttributes', js: 'additionalOfferAttributes', typ: u(undefined, a(r('AdditionalOfferAttribute'))), }, { json: 'additionalProductAttributes', js: 'additionalProductAttributes', typ: u(undefined, a(r('AdditionalProductAttribute'))), }, { json: 'asin', js: 'asin', typ: u(undefined, '') }, { json: 'price', js: 'price', typ: 3.14 }, { json: 'productCategory', js: 'productCategory', typ: u(undefined, r('ProductCategory')) }, { json: 'productIdentifiers', js: 'productIdentifiers', typ: r('ProductIdentifiers') }, { json: 'ShippingWeight', js: 'ShippingWeight', typ: 3.14 }, { json: 'sku', js: 'sku', typ: '' }, ], false), AdditionalOfferAttribute: o([ { json: 'additionalOfferAttributeName', js: 'additionalOfferAttributeName', typ: '' }, { json: 'additionalOfferAttributeValue', js: 'additionalOfferAttributeValue', typ: '' }, ], false), AdditionalProductAttribute: o([ { json: 'productAttributeName', js: 'productAttributeName', typ: '' }, { json: 'productAttributeValue', js: 'productAttributeValue', typ: '' }, ], false), ProductIdentifiers: o([ { json: 'productId', js: 'productId', typ: '' }, { json: 'productIdType', js: 'productIdType', typ: r('ProductIDType') }, ], false), MPItemFeedHeader: o([ { json: 'feedDate', js: 'feedDate', typ: u(undefined, Date) }, { json: 'locale', js: 'locale', typ: r('Locale') }, { json: 'Mart', js: 'Mart', typ: u(undefined, r('Mart')) }, { json: 'processMode', js: 'processMode', typ: u(undefined, r('ProcessMode')) }, { json: 'requestBatchId', js: 'requestBatchId', typ: u(undefined, '') }, { json: 'requestId', js: 'requestId', typ: u(undefined, '') }, { json: 'sellingChannel', js: 'sellingChannel', typ: r('SellingChannel') }, { json: 'subset', js: 'subset', typ: u(undefined, '') }, { json: 'version', js: 'version', typ: r('SpecVersion') }, ], false), ProductCategory: [ 'Animal Accessories', 'Animal Food', 'Animal Health & Grooming', 'Animal Other', 'Art & Craft', 'Baby Clothing', 'Baby Diapering, Care, & Other', 'Baby Food', 'Baby Furniture', 'Baby Toys', 'Baby Transport', 'Beauty, Personal Care, & Hygiene', 'Bedding', 'Books & Magazines', 'Building Supply', 'Cameras & Lenses', 'Carriers & Accessories', 'Cases & Bags', 'Ceremonial Clothing & Accessories', 'Clothing', 'Computer Components', 'Computers', 'Costumes', 'Cycling', 'Decorations & Favors', 'Electrical', 'Electronics Accessories', 'Electronics Cables', 'Electronics Other', 'Food & Beverage', 'Footwear', 'Fuels & Lubricants', 'Funeral', 'Furniture', 'Garden & Patio', 'Gift Supply & Awards', 'Grills & Outdoor Cooking', 'Hardware', 'Health & Beauty Electronics', 'Home Decor, Kitchen, & Other', 'Household Cleaning Products & Supplies', 'Instrument Accessories', 'Jewelry', 'Land Vehicles', 'Large Appliances', 'Medical Aids & Equipment', 'Medicine & Supplements', 'Movies', 'Music', 'Music Cases & Bags', 'Musical Instruments', 'Office', 'Optical', 'Optics', 'Other', 'Photo Accessories', 'Plumbing & HVAC', 'Printers, Scanners, & Imaging', 'Safety & Emergency', 'Software', 'Sound & Recording', 'Sports & Recreation Other', 'Storage', 'TV Shows', 'TVs & Video Displays', 'Tires', 'Tools', 'Tools & Hardware Other', 'Toys', 'Vehicle Other', 'Vehicle Parts & Accessories', 'Video Games', 'Video Projectors', 'Watches', 'Watercraft', 'Wheels & Wheel Components', ], ProductIDType: ['EAN', 'GTIN', 'ISBN', 'UPC'], Mart: ['ASDA_GM', 'WALMART_CA', 'WALMART_US'], Locale: ['en'], ProcessMode: ['MERGE', 'REPLACE'], SellingChannel: ['mpsetupbymatch'], SpecVersion: ['1.0'], }; //# sourceMappingURL=mpItemMatch.js.map