export type GetApiWaiverFormFormsCountByAppointmentArgs = {Authorization: string, SiteId: number, appointmentId: number}; export type GetApiWaiverFormFormsCountByAppointmentOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Fetch count of pending/completed forms for a given appointment by client. * * GET /WaiverForm/FormsCountByAppointment */ export const getApiWaiverFormFormsCountByAppointment = async (args: GetApiWaiverFormFormsCountByAppointmentArgs, options?: GetApiWaiverFormFormsCountByAppointmentOptions) => { 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/FormsCountByAppointment${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 };