export type GetApiApiBiddersArgs = {offset?: number | undefined, size?: string | undefined, cursor?: string | undefined, sale_id: string, with_positions?: boolean | undefined, sort?: ('created_at' | '-created_at' | '-last_bid_placed_at') | undefined}; export type GetApiApiBiddersOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Retrieve bidders. * * GET /api/bidders */ export const getApiApiBidders = async (args: GetApiApiBiddersArgs, options: GetApiApiBiddersOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() 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.sale_id != null) query.append("sale_id", String(args.sale_id)) if (args.with_positions != null) query.append("with_positions", String(args.with_positions)) if (args.sort != null) query.append("sort", String(args.sort)) const url = `${baseUrl.replace(/\/+$/, '')}/api/bidders${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 };