export type GetApiRecipesIdEquipmentWidgetArgs = {id: number, defaultCss?: boolean | undefined}; export type GetApiRecipesIdEquipmentWidgetOptions = {baseUrl?: string | undefined, apiKeyScheme?: string | undefined, fetch?: typeof fetch | undefined}; /** * Equipment by ID Widget * * GET /recipes/{id}/equipmentWidget */ export const getApiRecipesIdEquipmentWidget = async (args: GetApiRecipesIdEquipmentWidgetArgs, options?: GetApiRecipesIdEquipmentWidgetOptions) => { const {baseUrl = "https://api.spoonacular.com", fetch: fetchFn = fetch, apiKeyScheme} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/html") if (args.defaultCss != null) query.append("defaultCss", String(args.defaultCss)) if (apiKeyScheme !== undefined) headers.set("x-api-key", apiKeyScheme) const url = `${baseUrl.replace(/\/+$/, '')}/recipes/${encodeURIComponent(String(args.id))}/equipmentWidget${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 res.text() };