export type GetApiEcologyApiV1PropertiesArgs = {skip: number, take: number}; export type GetApiEcologyApiV1PropertiesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get all observable properties * * GET /ecology/api/v1/properties */ export const getApiEcologyApiV1Properties = async (args: GetApiEcologyApiV1PropertiesArgs, options: GetApiEcologyApiV1PropertiesOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.skip != null) query.append("skip", String(args.skip)) if (args.take != null) query.append("take", String(args.take)) const url = `${baseUrl.replace(/\/+$/, '')}/ecology/api/v1/properties${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 };