export type GetApiV1PatientsIdHistoriesArgs = {begin?: string | undefined, until?: string | undefined, past_months?: number | undefined, providers?: string | undefined, services?: string | undefined, medications?: string | undefined, diagnoses?: string | undefined, id: number, search?: string | undefined, ordering?: string | undefined, limit?: number | undefined, offset?: number | undefined}; export type GetApiV1PatientsIdHistoriesOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * List visit history * * GET /v1/patients/{id}/histories */ export const getApiV1PatientsIdHistories = async (args: GetApiV1PatientsIdHistoriesArgs, options?: GetApiV1PatientsIdHistoriesOptions) => { const {baseUrl = "https://developer.yezza.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.begin != null) query.append("begin", String(args.begin)) if (args.until != null) query.append("until", String(args.until)) if (args.past_months != null) query.append("past_months", String(args.past_months)) if (args.providers != null) query.append("providers", String(args.providers)) if (args.services != null) query.append("services", String(args.services)) if (args.medications != null) query.append("medications", String(args.medications)) if (args.diagnoses != null) query.append("diagnoses", String(args.diagnoses)) if (args.search != null) query.append("search", String(args.search)) if (args.ordering != null) query.append("ordering", String(args.ordering)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.offset != null) query.append("offset", String(args.offset)) if (ApiKeyAuth !== undefined) headers.set("X-Api-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/patients/${encodeURIComponent(String(args.id))}/histories${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 };