export type UpdateApiConsumerV1AppointmentsIdConfirmArgs = {id: number, undo?: boolean | undefined}; export type UpdateApiConsumerV1AppointmentsIdConfirmOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Confirm Appointment * * PUT /consumer/v1/appointments/{id}/confirm */ export const updateApiConsumerV1AppointmentsIdConfirm = async (args: UpdateApiConsumerV1AppointmentsIdConfirmArgs, options?: UpdateApiConsumerV1AppointmentsIdConfirmOptions) => { const {baseUrl = "https://sandbox-api.onsched.com", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.undo != null) query.append("undo", String(args.undo)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/consumer/v1/appointments/${encodeURIComponent(String(args.id))}/confirm${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };