export type GetApiProductBundleOptionsIdArgs = {id: string, 'X-STOREFRONT-KEY': string, 'X-Locale'?: string | undefined, 'X-Channel'?: string | undefined, 'X-Currency'?: string | undefined}; export type GetApiProductBundleOptionsIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get a bundle option (one decision group inside a bundle product) * * GET /product_bundle_options/{id} */ export const getApiProductBundleOptionsId = async (args: GetApiProductBundleOptionsIdArgs, options?: GetApiProductBundleOptionsIdOptions) => { const {baseUrl = "http://localhost:8000/api/shop", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args['X-STOREFRONT-KEY'] != null) headers.set("X-STOREFRONT-KEY", String(args['X-STOREFRONT-KEY'])) if (args['X-Locale'] != null) headers.set("X-Locale", String(args['X-Locale'])) if (args['X-Channel'] != null) headers.set("X-Channel", String(args['X-Channel'])) if (args['X-Currency'] != null) headers.set("X-Currency", String(args['X-Currency'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/product_bundle_options/${encodeURIComponent(String(args.id))}${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 (await res.json()) as unknown };