export type CreateApiMedicalHistoriesArgs = {body: {medical_history?: ({person_id?: string | undefined, work_history?: ({past_employment?: ({active?: boolean | undefined, text?: string | undefined}) | undefined, accident_caused_disabilities?: ({active?: boolean | undefined, text: unknown}) | undefined, sickness_caused_disabilities?: ({active?: boolean | undefined, text?: string | undefined}) | undefined, contact_with_dust_particles?: {text: unknown} | undefined, exposure_to_loud_noises?: {text: unknown} | undefined, exposure_to_chemicals?: {text: unknown} | undefined, fractures_or_injuries?: {text: unknown} | undefined, accidents_or_illnesses?: {text: unknown} | undefined, fit_to_work?: {text: unknown} | undefined, others?: {text: unknown} | undefined}) | undefined, allergies?: string | undefined, pathological_records?: ({prior_hospitalization?: ({active?: boolean | undefined, text?: string | undefined}) | undefined, prior_surgeries?: ({active?: boolean | undefined, text: unknown}) | undefined, diabetes?: {text: unknown} | undefined, thyroid_diseases?: {text: unknown} | undefined, hypertension?: {text: unknown} | undefined, heart_diseases?: {text: unknown} | undefined, injuries?: {text: unknown} | undefined, cancer?: {text: unknown} | undefined, tuberculosis?: {text: unknown} | undefined, transfusions?: {text: unknown} | undefined, respiratory?: {text: unknown} | undefined, gastrointestinal?: {text: unknown} | undefined, stds?: {text: unknown} | undefined, other?: {text: unknown} | undefined}) | undefined, nonpathological_records?: ({physical_activity?: ({active?: boolean | undefined, text?: string | undefined}) | undefined, smoking?: ({active?: boolean | undefined, text: unknown}) | undefined, alcoholism?: {text: unknown} | undefined, drugs_abuse?: {text: unknown} | undefined, recent_immunization?: {text: unknown} | undefined, other?: {text: unknown} | undefined}) | undefined, heredofamilial_records?: ({diabetes?: ({active?: boolean | undefined, text?: string | undefined}) | undefined, heart_diseases?: ({active?: boolean | undefined, text: unknown}) | undefined, hypertension?: {text: unknown} | undefined, thyroid_diseases?: {text: unknown} | undefined, other?: {text: unknown} | undefined}) | undefined}) | undefined}}; export type CreateApiMedicalHistoriesOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /medical_histories * * POST /medical_histories */ export const createApiMedicalHistories = async (args: CreateApiMedicalHistoriesArgs, options?: CreateApiMedicalHistoriesOptions) => { const {baseUrl = "https://api.example.test", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/medical_histories${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };