interface IQueryParams { [ key ] : string ; } private export function urlBuilder ( params ) { const { host , route , query } = params ; const baseUrl = host . endsWith ( "/" ) ? host : `${ host }/` ; const url = new URL ( route , baseUrl ) ; url . search = buildQueryString ( query ) ; return url . toString ( ) ; } function buildQueryString ( params = { } ) { const queryParams = Object . keys ( params ) . filter ( key => { return params [ key ] !== undefined ; } ) . reduce ( ( acc , key ) => { acc [ key ] = params [ key ] ; return acc ; } , { } ) ; return new URLSearchParams ( queryParams ) . toString ( ) ; } private export interface IDownloadIdParams { datasetId : string ; format : string ; spatialRefId ? : string ; geometry ? : string ; where ? : string ; } private export function composeDownloadId ( params ) { const { datasetId , format , spatialRefId , geometry , where } = params ; return `${ datasetId }:${ format }:${ spatialRefId }:${ geometry }:${ where }` ; }