export type IsochroneExportType = 'GeoJSON' | 'ESRI Shapefile' | 'XLSX'; export type CreateApiApiV1IndicatorsIsochroneExportArgs = {return_type?: IsochroneExportType | undefined, body: Record}; export type CreateApiApiV1IndicatorsIsochroneExportOptions = {baseUrl: string, OAuth2PasswordBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export Isochrones * * POST /api/v1/indicators/isochrone/export */ export const createApiApiV1IndicatorsIsochroneExport = async (args: CreateApiApiV1IndicatorsIsochroneExportArgs, options: CreateApiApiV1IndicatorsIsochroneExportOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2PasswordBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.return_type != null) query.append("return_type", String(args.return_type)) if (OAuth2PasswordBearer !== undefined) headers.set('authorization', `Bearer ${OAuth2PasswordBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/indicators/isochrone/export${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };