export type GetApiMapResampledTemplateArgs = {parcellation_id: string, space_id: string, name?: string | undefined}; export type GetApiMapResampledTemplateOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get Resampled Map * * GET /map/resampled_template */ export const getApiMapResampledTemplate = async (args: GetApiMapResampledTemplateArgs, options: GetApiMapResampledTemplateOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.parcellation_id != null) query.append("parcellation_id", String(args.parcellation_id)) if (args.space_id != null) query.append("space_id", String(args.space_id)) if (args.name != null) query.append("name", String(args.name)) const url = `${baseUrl.replace(/\/+$/, '')}/map/resampled_template${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 };