import { UserSession } from "@esri/arcgis-rest-auth" ; import { hubRequestDatasetExport } from "./hub/hub-request-dataset-export" ; import { portalRequestDatasetExport } from "./portal/portal-request-dataset-export" ; import { DownloadFormat } from "./download-format" ; import { DownloadTarget } from "./download-target" ; export interface IDatasetExportRequestParams { target ? : DownloadTarget ; host ? : string ; datasetId : string ; format : DownloadFormat ; spatialRefId ? : string ; geometry ? : string ; where ? : string ; authentication ? : UserSession ; title ? : string ; } export interface IDatasetExportResult { downloadId : string ; jobId ? : string ; exportCreated ? : number ; size ? : number ; } param params export function requestDatasetExport ( params ) { const { host , datasetId , format , spatialRefId , geometry , where , title , target , authentication } = params ; if ( ! target || target === "hub" ) { return hubRequestDatasetExport ( { host , datasetId , format , spatialRefId , geometry , where } ) ; } return portalRequestDatasetExport ( { datasetId , format , title , authentication , spatialRefId , where } ) ; }