export type GetApiWaiverFormGetFormsWithPaginationArgs = {Authorization: string, SiteId: number, clientId: number, pageNumber: number, pageSize: number, sortBy: 'name' | 'state' | 'submissionDate'}; export type GetApiWaiverFormGetFormsWithPaginationOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Fetch list of all forms for a given consumer * By default, results are sorted by form state (pending first, completed last), * reverse chronological order (most recent first). Response is paginated. * * GET /WaiverForm/GetFormsWithPagination */ export const getApiWaiverFormGetFormsWithPagination = async (args: GetApiWaiverFormGetFormsWithPaginationArgs, options?: GetApiWaiverFormGetFormsWithPaginationOptions) => { 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.clientId != null) query.append("clientId", String(args.clientId)) if (args.pageNumber != null) query.append("pageNumber", String(args.pageNumber)) if (args.pageSize != null) query.append("pageSize", String(args.pageSize)) if (args.sortBy != null) query.append("sortBy", String(args.sortBy)) const url = `${baseUrl.replace(/\/+$/, '')}/WaiverForm/GetFormsWithPagination${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 };