export type PatchApiV1AppointmentsIdArgs = {id: number, body: {start?: string | undefined, provider?: number | undefined, service?: number | undefined, lead?: Record | undefined, status?: ('new' | 'pending' | 'request' | 'processed' | 'received' | 'reject' | 'absent' | 'cancelled' | 'deleted') | undefined, remarks?: string | undefined, cancelled_reason?: string | undefined, ignore_rules?: Array | undefined}}; export type PatchApiV1AppointmentsIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update / reschedule / cancel * * PATCH /v1/appointments/{id} */ export const patchApiV1AppointmentsId = async (args: PatchApiV1AppointmentsIdArgs, options?: PatchApiV1AppointmentsIdOptions) => { 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/appointments/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };