export type GetApiV1AppointmentsIdArgs = {id: number, pid?: boolean | undefined}; export type GetApiV1AppointmentsIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve an appointment * * GET /v1/appointments/{id} */ export const getApiV1AppointmentsId = async (args: GetApiV1AppointmentsIdArgs, options?: GetApiV1AppointmentsIdOptions) => { const {baseUrl = "https://developer.yezza.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.pid != null) query.append("pid", String(args.pid)) 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: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };