export type GetApiApiShowsArgs = {status?: ('upcoming' | 'running' | 'closed' | 'current') | undefined, partner_id?: string | undefined, fair_id?: string | undefined, offset?: number | undefined, size?: string | undefined, cursor?: string | undefined, sample?: string | undefined}; export type GetApiApiShowsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Retrieve a collection of shows. * * GET /api/shows */ export const getApiApiShows = async (args: GetApiApiShowsArgs, options: GetApiApiShowsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.status != null) query.append("status", String(args.status)) if (args.partner_id != null) query.append("partner_id", String(args.partner_id)) if (args.fair_id != null) query.append("fair_id", String(args.fair_id)) if (args.offset != null) query.append("offset", String(args.offset)) if (args.size != null) query.append("size", String(args.size)) if (args.cursor != null) query.append("cursor", String(args.cursor)) if (args.sample != null) query.append("sample", String(args.sample)) const url = `${baseUrl.replace(/\/+$/, '')}/api/shows${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 };