UNPKG

vinmonopolet-ts

Version:

Extracts information on products, categories and stores from Vinmonopolet

14 lines (13 loc) 591 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const constants_1 = require("../../constants"); const GET_1 = require("../../util/GET"); const mapper_1 = require("../../models/product/mapper"); async function getProduct(code) { const product = await (0, GET_1.GET)(constants_1.VINMONOPOLET_PRODUCT_URL + code, new URLSearchParams({ fields: "FULL" })); if (product !== null) { return (0, mapper_1.fromDTOToPopulatedProduct)(product); } throw new Error("Unable to get product with id " + code); } exports.default = getProduct;