export type DeleteApiV1AppointmentsSessionsSessionIdArgs = {session_id: number}; export type DeleteApiV1AppointmentsSessionsSessionIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel a booking registration * * DELETE /v1/Appointments/Sessions/{session_id} */ export const deleteApiV1AppointmentsSessionsSessionId = async (args: DeleteApiV1AppointmentsSessionsSessionIdArgs, options?: DeleteApiV1AppointmentsSessionsSessionIdOptions) => { const {baseUrl = "https://api.zenoti.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/Appointments/Sessions/${encodeURIComponent(String(args.session_id))}${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 (await res.json()) as unknown };