export type GetApiApiAppointmentsAdminSessionsArgs = {UserId: string, startDate?: string | undefined, endDate?: string | undefined, CenterId?: string | undefined, ClassType?: number | undefined, page?: number | undefined, size?: number | undefined, sorters?: Record | undefined, filters?: boolean | undefined}; export type GetApiApiAppointmentsAdminSessionsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve the class session registrations of a guest * * GET /api/Appointments/Admin/Sessions */ export const getApiApiAppointmentsAdminSessions = async (args: GetApiApiAppointmentsAdminSessionsArgs, options?: GetApiApiAppointmentsAdminSessionsOptions) => { const {baseUrl = "https://api.zenoti.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.UserId != null) query.append("UserId", String(args.UserId)) if (args.startDate != null) query.append("startDate", String(args.startDate)) if (args.endDate != null) query.append("endDate", String(args.endDate)) if (args.CenterId != null) query.append("CenterId", String(args.CenterId)) if (args.ClassType != null) query.append("ClassType", String(args.ClassType)) if (args.page != null) query.append("page", String(args.page)) if (args.size != null) query.append("size", String(args.size)) if (args.sorters != null) query.append("sorters", JSON.stringify(args.sorters)) if (args.filters != null) query.append("filters", String(args.filters)) const url = `${baseUrl.replace(/\/+$/, '')}/api/Appointments/Admin/Sessions${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 (await res.json()) as unknown };