UNPKG

migros-api-wrapper

Version:

Making the api of migros more accessible to the public.

31 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getProductSupply = void 0; const requests_1 = require("../../utils/requests"); const apiPaths_1 = require("../apiPaths"); const url = apiPaths_1.migrosApiPaths["store-availability"].public.v2 + "/products"; const defaultProductSupplyOptions = { pids: "", costCenterIds: "0", }; async function getProductSupplyRequest(url, options, headers) { if (Array.isArray(options.costCenterIds)) { options.costCenterIds = options.costCenterIds.join(","); } url += `/${options.pids}?costCenterIds=${options.costCenterIds}`; const necessaryHeaders = { accept: "application/json, text/plain, */*", ...headers, }; const response = await (0, requests_1.getRequestBypass)(url, {}, necessaryHeaders); return response.data; } async function getProductSupply(productSupplyOptions, headers) { productSupplyOptions = { ...defaultProductSupplyOptions, ...productSupplyOptions, }; return getProductSupplyRequest(url, productSupplyOptions, headers); } exports.getProductSupply = getProductSupply; //# sourceMappingURL=product-supply.js.map