export type GetApiRecipesIdEquipmentWidgetPngArgs = {id: number}; export type GetApiRecipesIdEquipmentWidgetPngOptions = {baseUrl?: string | undefined, apiKeyScheme?: string | undefined, fetch?: typeof fetch | undefined}; /** * Equipment by ID Image * * GET /recipes/{id}/equipmentWidget.png */ export const getApiRecipesIdEquipmentWidgetPng = async (args: GetApiRecipesIdEquipmentWidgetPngArgs, options?: GetApiRecipesIdEquipmentWidgetPngOptions) => { const {baseUrl = "https://api.spoonacular.com", fetch: fetchFn = fetch, apiKeyScheme} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/png") if (apiKeyScheme !== undefined) headers.set("x-api-key", apiKeyScheme) const url = `${baseUrl.replace(/\/+$/, '')}/recipes/${encodeURIComponent(String(args.id))}/equipmentWidget.png${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.blob() };