UNPKG

migros-api-wrapper

Version:

Making the api of migros more accessible to the public.

31 lines 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRecipeProducts = void 0; const requests_1 = require("../../utils/requests"); const apiPaths_1 = require("../apiPaths"); const Language_1 = require("../enums/Language"); const url = apiPaths_1.migrosApiPaths.migusto.recipeProducts.v1 + "/forIngredients"; const defaultRecipeProductOptions = { id: "", language: Language_1.Language.DE, limit: 20, offset: 0, }; async function getRecipeSearchRequest(url, options) { const necessaryHeaders = { ["Accept"]: "*/*", }; const { id, language, ...rest } = options; url += `/${id}/${language}/FREQUENCY`; const response = await (0, requests_1.getRequest)(url, rest, necessaryHeaders); return { productIds: await response.json() }; } async function getRecipeProducts(recipeProductOptions) { recipeProductOptions = { ...defaultRecipeProductOptions, ...recipeProductOptions, }; return getRecipeSearchRequest(url, recipeProductOptions); } exports.getRecipeProducts = getRecipeProducts; //# sourceMappingURL=recipe-products.js.map