export type GetApiGeomodelComparisonIdZoomXYPngArgs = {id: string, zoom: number, x: number, y: number, tile_size?: (256 | 512) | undefined}; export type GetApiGeomodelComparisonIdZoomXYPngOptions = {baseUrl?: string | undefined, userJwtOptional?: string | undefined, fetch?: typeof fetch | undefined}; /** * Taxon Geomodel Comparison Tiles * * GET /geomodel_comparison/{id}/{zoom}/{x}/{y}.png */ export const getApiGeomodelComparisonIdZoomXYPng = async (args: GetApiGeomodelComparisonIdZoomXYPngArgs, options?: GetApiGeomodelComparisonIdZoomXYPngOptions) => { const {baseUrl = "https://api.inaturalist.org/v2", fetch: fetchFn = fetch, userJwtOptional} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/png") if (args.tile_size != null) query.append("tile_size", String(args.tile_size)) if (userJwtOptional !== undefined) headers.set("Authorization", userJwtOptional) const url = `${baseUrl.replace(/\/+$/, '')}/geomodel_comparison/${encodeURIComponent(String(args.id))}/${encodeURIComponent(String(args.zoom))}/${encodeURIComponent(String(args.x))}/${encodeURIComponent(String(args.y))}.png${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() };