export type GetApiApiOstansArgs = {page?: number | undefined, size?: number | undefined, sort?: Array | undefined}; export type GetApiApiOstansOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * getAllOstans * * GET /api/ostans */ export const getApiApiOstans = async (args: GetApiApiOstansArgs, options: GetApiApiOstansOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") 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/ostans${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() };