export type GetApiMedicalNotesArgs = {consultation_id?: number | undefined, note_type?: string | undefined, page?: number | undefined, per_page?: number | undefined}; export type GetApiMedicalNotesOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /medical_notes * * GET /medical_notes */ export const getApiMedicalNotes = async (args: GetApiMedicalNotesArgs, options?: GetApiMedicalNotesOptions) => { const {baseUrl = "https://api.example.test", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.consultation_id != null) query.append("consultation_id", String(args.consultation_id)) if (args.note_type != null) query.append("note_type", String(args.note_type)) if (args.page != null) query.append("page", String(args.page)) if (args.per_page != null) query.append("per_page", String(args.per_page)) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/medical_notes${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 undefined };