export type GetApiProductProductDataArgs = {'user-agent': string, siteCode: string, eans: string, all?: boolean | undefined, name?: boolean | undefined, categories?: boolean | undefined, url?: boolean | undefined, imageURL?: boolean | undefined, available?: boolean | undefined, availableQuantity?: boolean | undefined, brand?: boolean | undefined, isChild?: boolean | undefined, isFashion?: boolean | undefined, fashion?: boolean | undefined, sku?: boolean | undefined, merchantID?: boolean | undefined, oldPrice?: boolean | undefined, tags?: boolean | undefined, rating?: boolean | undefined, description?: boolean | undefined, params?: boolean | undefined, groupId?: boolean | undefined, accessories?: boolean | undefined, seasonality?: boolean | undefined, priceMargin?: boolean | undefined, isNew?: boolean | undefined, auto?: boolean | undefined, model?: boolean | undefined, leftovers?: boolean | undefined, typePrefix?: boolean | undefined, price?: boolean | undefined, priceHistory?: boolean | undefined, timeLastView?: boolean | undefined, timeLastAddToCart?: boolean | undefined, timeLastBuy?: boolean | undefined, prettyPrint?: boolean | undefined}; export type GetApiProductProductDataOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get product data * * GET /product/productData */ export const getApiProductProductData = async (args: GetApiProductProductDataArgs, options?: GetApiProductProductDataOptions) => { const {baseUrl = "https://api.kameleoon.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['user-agent'] != null) headers.set("user-agent", String(args['user-agent'])) if (args.siteCode != null) query.append("siteCode", String(args.siteCode)) if (args.eans != null) query.append("eans", String(args.eans)) if (args.all != null) query.append("all", String(args.all)) if (args.name != null) query.append("name", String(args.name)) if (args.categories != null) query.append("categories", String(args.categories)) if (args.url != null) query.append("url", String(args.url)) if (args.imageURL != null) query.append("imageURL", String(args.imageURL)) if (args.available != null) query.append("available", String(args.available)) if (args.availableQuantity != null) query.append("availableQuantity", String(args.availableQuantity)) if (args.brand != null) query.append("brand", String(args.brand)) if (args.isChild != null) query.append("isChild", String(args.isChild)) if (args.isFashion != null) query.append("isFashion", String(args.isFashion)) if (args.fashion != null) query.append("fashion", String(args.fashion)) if (args.sku != null) query.append("sku", String(args.sku)) if (args.merchantID != null) query.append("merchantID", String(args.merchantID)) if (args.oldPrice != null) query.append("oldPrice", String(args.oldPrice)) if (args.tags != null) query.append("tags", String(args.tags)) if (args.rating != null) query.append("rating", String(args.rating)) if (args.description != null) query.append("description", String(args.description)) if (args.params != null) query.append("params", String(args.params)) if (args.groupId != null) query.append("groupId", String(args.groupId)) if (args.accessories != null) query.append("accessories", String(args.accessories)) if (args.seasonality != null) query.append("seasonality", String(args.seasonality)) if (args.priceMargin != null) query.append("priceMargin", String(args.priceMargin)) if (args.isNew != null) query.append("isNew", String(args.isNew)) if (args.auto != null) query.append("auto", String(args.auto)) if (args.model != null) query.append("model", String(args.model)) if (args.leftovers != null) query.append("leftovers", String(args.leftovers)) if (args.typePrefix != null) query.append("typePrefix", String(args.typePrefix)) if (args.price != null) query.append("price", String(args.price)) if (args.priceHistory != null) query.append("priceHistory", String(args.priceHistory)) if (args.timeLastView != null) query.append("timeLastView", String(args.timeLastView)) if (args.timeLastAddToCart != null) query.append("timeLastAddToCart", String(args.timeLastAddToCart)) if (args.timeLastBuy != null) query.append("timeLastBuy", String(args.timeLastBuy)) if (args.prettyPrint != null) query.append("prettyPrint", String(args.prettyPrint)) const url = `${baseUrl.replace(/\/+$/, '')}/product/productData${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };