export type GetApiPatientsPatientIdPatientStarPlotSummaryGraphArgs = {patient_id: number, date_since: string, date_until: string, disaggregated: boolean, daily_avg_method: boolean, include_custom_items?: boolean | undefined, enforce_unique_base_food?: boolean | undefined}; export type GetApiPatientsPatientIdPatientStarPlotSummaryGraphOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get the patient's summary metrics as a star plot graph * * GET /patients/{patient_id}/patient_star_plot_summary/graph */ export const getApiPatientsPatientIdPatientStarPlotSummaryGraph = async (args: GetApiPatientsPatientIdPatientStarPlotSummaryGraphArgs, options: GetApiPatientsPatientIdPatientStarPlotSummaryGraphOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/png") if (args.date_since != null) query.append("date_since", String(args.date_since)) if (args.date_until != null) query.append("date_until", String(args.date_until)) if (args.disaggregated != null) query.append("disaggregated", String(args.disaggregated)) if (args.daily_avg_method != null) query.append("daily_avg_method", String(args.daily_avg_method)) if (args.include_custom_items != null) query.append("include_custom_items", String(args.include_custom_items)) if (args.enforce_unique_base_food != null) query.append("enforce_unique_base_food", String(args.enforce_unique_base_food)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/patients/${encodeURIComponent(String(args.patient_id))}/patient_star_plot_summary/graph${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() };