export type GetApiApiBillsArgs = {'auto.equals'?: boolean | undefined, 'auto.in'?: Array | undefined, 'auto.notEquals'?: boolean | undefined, 'auto.notIn'?: Array | undefined, 'auto.specified'?: boolean | undefined, page?: number | undefined, size?: number | undefined, sort?: Array | undefined}; export type GetApiApiBillsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * getAllBills * * GET /api/bills */ export const getApiApiBills = async (args: GetApiApiBillsArgs, options: GetApiApiBillsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args['auto.equals'] != null) query.append("auto.equals", String(args['auto.equals'])) for (const item of args['auto.in'] ?? []) query.append("auto.in", String(item)) if (args['auto.notEquals'] != null) query.append("auto.notEquals", String(args['auto.notEquals'])) for (const item of args['auto.notIn'] ?? []) query.append("auto.notIn", String(item)) if (args['auto.specified'] != null) query.append("auto.specified", String(args['auto.specified'])) if (args.page != null) query.append("page", String(args.page)) if (args.size != null) query.append("size", String(args.size)) for (const item of args.sort ?? []) query.append("sort", String(item)) const url = `${baseUrl.replace(/\/+$/, '')}/api/bills${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 res.blob() };