export type CreateApiV1PatientsIdMergeArgs = {id: number, body: {merge_from: number, name?: string | undefined, phone?: string | undefined, ic?: string | undefined, email?: string | undefined, dob?: string | undefined, gender?: ('male' | 'female') | undefined}}; export type CreateApiV1PatientsIdMergeOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Merge duplicate patients * * POST /v1/patients/{id}/merge */ export const createApiV1PatientsIdMerge = async (args: CreateApiV1PatientsIdMergeArgs, options?: CreateApiV1PatientsIdMergeOptions) => { const {baseUrl = "https://developer.yezza.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-Api-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/patients/${encodeURIComponent(String(args.id))}/merge${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 };