export type GetApiApiRecordsetsIdDataArgs = {id: number, page?: number | undefined, resultsPerPage?: number | undefined, filters?: string | undefined, fields?: string | undefined, asAt?: string | undefined, orderBy?: string | undefined}; export type GetApiApiRecordsetsIdDataOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Returns a single page of records from a recordset. * * GET /api/recordsets/{id}/data */ export const getApiApiRecordsetsIdData = async (args: GetApiApiRecordsetsIdDataArgs, options: GetApiApiRecordsetsIdDataOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.page != null) query.append("page", String(args.page)) if (args.resultsPerPage != null) query.append("resultsPerPage", String(args.resultsPerPage)) if (args.filters != null) query.append("filters", String(args.filters)) if (args.fields != null) query.append("fields", String(args.fields)) if (args.asAt != null) query.append("asAt", String(args.asAt)) if (args.orderBy != null) query.append("orderBy", String(args.orderBy)) const url = `${baseUrl.replace(/\/+$/, '')}/api/recordsets/${encodeURIComponent(String(args.id))}/data${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 };