import * as EventEmitter from "eventemitter3" ; import { UserSession } from "@esri/arcgis-rest-auth" ; import { hubPollDownloadMetadata } from "./hub/hub-poll-download-metadata" ; import { portalPollExportJobStatus } from "./portal/portal-poll-export-job-status" ; import { DownloadFormat } from "./download-format" ; import { DownloadTarget } from "./download-target" ; import { IPoller } from "./poller" ; export interface IPollDownloadMetadataRequestParams { downloadId : string ; eventEmitter : EventEmitter ; pollingInterval : number ; target ? : DownloadTarget ; host ? : string ; datasetId : string ; format : DownloadFormat ; spatialRefId ? : string ; geometry ? : string ; where ? : string ; authentication ? : UserSession ; jobId ? : string ; exportCreated ? : number ; existingFileDate ? : string ; } param params export function pollDownloadMetadata ( params ) { const { target , downloadId , datasetId , jobId , format , authentication , exportCreated , eventEmitter , pollingInterval , spatialRefId , geometry , where , host , existingFileDate } = params ; if ( ! target || target === "hub" ) { return hubPollDownloadMetadata ( { host , downloadId , datasetId , format , eventEmitter , pollingInterval , spatialRefId , geometry , where , existingFileDate } ) ; } return portalPollExportJobStatus ( { downloadId , datasetId , jobId , authentication , exportCreated , format , spatialRefId , eventEmitter , pollingInterval , geometry , where } ) ; }