export type DeleteApiApi20PatientsIdInsuranceCardsArgs = {archive?: string | undefined, id: number, rank: string, side: string}; export type DeleteApiApi20PatientsIdInsuranceCardsOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Patients Insurance Card * * DELETE /api/2.0/patients/{id}/insurance_cards/ */ export const deleteApiApi20PatientsIdInsuranceCards = async (args: DeleteApiApi20PatientsIdInsuranceCardsArgs, options?: DeleteApiApi20PatientsIdInsuranceCardsOptions) => { const {baseUrl = "https://sandbox.elationemr.com/api/2.0", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.archive != null) query.append("archive", String(args.archive)) if (args.rank != null) query.append("rank", String(args.rank)) if (args.side != null) query.append("side", String(args.side)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/2.0/patients/${encodeURIComponent(String(args.id))}/insurance_cards/${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 };