import AbstractProvider, { EndpointArgument, LatLng, ParseArgument, ProviderOptions, ProviderParams, ReverseArgument, SearchArgument, SearchResult } from './provider'; interface GeoCoordinates { lat?: number; lon?: number; boundingBox?: { minLat: number; maxLat: number; minLon: number; maxLon: number; }; } /** an autocomplete suggestion, or a retrieved one with geoCoordinates */ export interface Suggestion { id: string; displayName: string; type?: string; countryCode?: string; category?: string; geoCoordinates?: GeoCoordinates; } export interface ReverseResult { address: { displayName: string; geoCoordinates?: GeoCoordinates; addressDetails?: { [key: string]: unknown; }; goodMatch?: boolean; }; distanceM?: number; layer?: string; } export type RawResult = Suggestion | ReverseResult; export type RequestResult = { suggestions?: Suggestion[]; } | { results?: ReverseResult[]; } | Suggestion; export type OpenGeocodingProviderOptions = { apiKey: string; host?: string; } & ProviderOptions; export default class OpenGeocodingProvider extends AbstractProvider { apiKey: string; host: string; constructor(options?: OpenGeocodingProviderOptions); endpoint({ query, type }: EndpointArgument): string; reverseParams({ lat, lng }: LatLng): ProviderParams; /** * suggestions are free but have no coordinates. A picked one comes back * as data and is looked up by its id, which costs a request */ search({ query, data, signal, }: SearchArgument & { data?: SearchResult; }): Promise[]>; reverse({ lat, lng, signal, }: ReverseArgument): Promise[]>; request(url: string, signal?: AbortSignal): Promise; parse({ data }: ParseArgument): SearchResult[]; } export {};