export type GetApiApiStatusCollectionsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * List all collections available in the OGC Environmental Data Retrieval API including location cache data * * GET /api/Status/collections */ export const getApiApiStatusCollections = async (options: GetApiApiStatusCollectionsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/api/Status/collections${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 };