export type GetApiWaiverFormGetFormsByAppointmentIdArgs = {Authorization: string, SiteId: number, appointmentId: number}; export type GetApiWaiverFormGetFormsByAppointmentIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Fetch list of forms for a given appointment. * Results are sorted by form state (pending first, completed last), * reverse chronological order (most recent first). * * GET /WaiverForm/GetFormsByAppointmentId */ export const getApiWaiverFormGetFormsByAppointmentId = async (args: GetApiWaiverFormGetFormsByAppointmentIdArgs, options?: GetApiWaiverFormGetFormsByAppointmentIdOptions) => { const {baseUrl = "https://api.mindbodyonline.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args.SiteId != null) headers.set("SiteId", String(args.SiteId)) if (args.appointmentId != null) query.append("appointmentId", String(args.appointmentId)) const url = `${baseUrl.replace(/\/+$/, '')}/WaiverForm/GetFormsByAppointmentId${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 };