import { ITransferManager , TransferManager } from "@here/harp-transfer-manager" ; import { AreaCopyrightInfo , CopyrightCoverageProvider , CopyrightCoverageResponse } from "./CopyrightCoverageProvider" ; interface RequestHeaders { [ field ] : string ; } /**
 * Copyright provider which retrieves copyright coverage information from provided URL.
 */ export class UrlCopyrightProvider extends CopyrightCoverageProvider { private m_cachedCopyrightResponse : Promise < AreaCopyrightInfo [ ] > | undefined ; param m_fetchURL param m_baseScheme param m_requestHeaders constructor ( private readonly m_fetchURL , private readonly m_baseScheme , private m_requestHeaders ? , private readonly m_transferManager = TransferManager . instance ( ) ) { super ( ) ; } param headers setRequestHeaders ( headers ) { this . m_requestHeaders = headers ; } inheritdoc @override
      getCopyrightCoverageData ( abortSignal ? ) { if ( this . m_cachedCopyrightResponse !== undefined ) { return this . m_cachedCopyrightResponse ; } this . m_cachedCopyrightResponse = this . m_transferManager . downloadJson < CopyrightCoverageResponse > ( this . m_fetchURL , { headers : this . m_requestHeaders , signal : abortSignal } ) . then ( json => json [ this . m_baseScheme ] ) . catch ( error => { this . logger . error ( error ) ; return [ ] ; } ) ; return this . m_cachedCopyrightResponse ; } }