import { apiGet, apiPost, apiUrl } from './client' import type { ExportContentResponse, ExportCreateResponse, ExportKind, ExportListResponse, ExportRead, VectorSelectionBBox, } from '../../types' export const exportsApi = { exportGeojson: ( payload: | { dataset_id?: string analysis_run_id?: string export_kind?: ExportKind name?: string bbox?: VectorSelectionBBox limit?: number } | string, ): Promise => { const body = typeof payload === 'string' ? { dataset_id: payload, export_kind: 'dataset' } : payload return apiPost(`/api/v1/exports/geojson`, body) }, exportProjectMetadata: (projectId: string, name?: string): Promise => apiPost(`/api/v1/exports/metadata`, { project_id: projectId, name }), exportProjectReport: (projectId: string, name?: string): Promise => apiPost(`/api/v1/exports/report`, { project_id: projectId, name }), listProjectExports: (projectId: string): Promise => apiGet(`/api/v1/exports/projects/${projectId}/exports`), getExport: (exportId: string): Promise => apiGet(`/api/v1/exports/${exportId}`), getContent: (exportId: string): Promise => apiGet(`/api/v1/exports/${exportId}/content`), downloadUrl: (exportId: string): string => apiUrl(`/api/v1/exports/${exportId}/download`), }