import type { AxiosInstance } from 'axios' ; import { GeocodeCommand } from '../../../command' ; import type { GeocodeQuery } from '../../../model' ; import type { MapQuestGeocodeQueryInterface } from '../interface' ; import { MapQuestCommonCommandMixin } from './mixin' ; link export class MapQuestGeocodeCommand extends MapQuestCommonCommandMixin ( GeocodeCommand ) < MapQuestGeocodeQueryInterface > { constructor ( httpClient , private readonly apiKey ) { super ( httpClient , apiKey ) ; } static getUrl ( ) { return 'https://www.mapquestapi.com/geocoding/v1/address' ; } protected async buildQuery ( query ) { const providerQuery = { key : this . apiKey , location : query . address , maxResults : query . limit , thumbMaps : false , outFormat : 'json' , } ; if ( query . lat && query . lon ) { providerQuery . location = `${ query . lon },${ query . lat }` ; } return providerQuery ; } }