migros-api-wrapper
Version:
Making the api of migros more accessible to the public.
32 lines • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.categoryList = void 0;
const Region_1 = require("../enums/Region");
const Language_1 = require("../enums/Language");
const requests_1 = require("../../utils/requests");
const apiPaths_1 = require("../apiPaths");
const url = apiPaths_1.migrosApiPaths["onesearch-oc-seapi"].public.v2 + "/storemap";
const defaultCategoryListOptions = {
language: Language_1.LanguageUpper.EN,
regionId: Region_1.Region.NATIONAL,
storeMapScope: "DEFAULT",
};
async function getCategoryListRequest(url, options, headers) {
const necessaryHeaders = {
accept: "application/json, text/plain, *!/!*",
// eslint-disable-next-line @typescript-eslint/naming-convention
"content-type": "application/json",
...headers,
};
const response = await (0, requests_1.getRequestBypass)(url, options, necessaryHeaders);
return response.data;
}
async function categoryList(headers, categoryListOptions) {
categoryListOptions = {
...defaultCategoryListOptions,
...categoryListOptions,
};
return getCategoryListRequest(url, categoryListOptions, headers);
}
exports.categoryList = categoryList;
//# sourceMappingURL=category.js.map