export type DeleteApiFoodWhiteboardItemIdArgs = {food_name?: string | undefined, rxfood_id?: string | undefined, id: number}; export type DeleteApiFoodWhiteboardItemIdOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a whiteboard note for a food from the food editor * * DELETE /food/whiteboard-item/{id} */ export const deleteApiFoodWhiteboardItemId = async (args: DeleteApiFoodWhiteboardItemIdArgs, options: DeleteApiFoodWhiteboardItemIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.food_name != null) query.append("food_name", String(args.food_name)) if (args.rxfood_id != null) query.append("rxfood_id", String(args.rxfood_id)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/food/whiteboard-item/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };