export type GetApiApiRecordsetsIdMapArgs = {id: number, width?: number | undefined, height?: number | undefined, bbox?: string | undefined}; export type GetApiApiRecordsetsIdMapOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Returns WMS for a given recordset * * GET /api/recordsets/{id}/map */ export const getApiApiRecordsetsIdMap = async (args: GetApiApiRecordsetsIdMapArgs, options: GetApiApiRecordsetsIdMapOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.width != null) query.append("width", String(args.width)) if (args.height != null) query.append("height", String(args.height)) if (args.bbox != null) query.append("bbox", String(args.bbox)) const url = `${baseUrl.replace(/\/+$/, '')}/api/recordsets/${encodeURIComponent(String(args.id))}/map${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 };