UNPKG

universal-geocoder

Version:

Universal geocoding abstraction server-side and client-side with multiple built-in providers

77 lines 3.54 kB
import { ExternalLoaderBody, ExternalLoaderHeaders, ExternalLoaderInterface, ExternalLoaderParams } from "../../ExternalLoader"; import { BingGeocoded, ErrorCallback, GeocodedResultsCallback, ProviderInterface, ProviderOptionsInterface } from "./.."; import { GeocodeQuery, GeocodeQueryObject, ReverseQuery, ReverseQueryObject } from "../../query"; import { FlatBoundingBox, FlatCoordinates } from "../../types"; export declare type BingPrecision = "High" | "Medium" | "Low"; export interface BingResult { __type: string; bbox: FlatBoundingBox; name: string; point: { type: string; coordinates: FlatCoordinates; }; address: { addressLine: string; neighborhood?: string; adminDistrict: string; adminDistrict2: string; countryRegion: string; countryRegionIso2?: string; landmark?: string; formattedAddress: string; locality: string; postalCode: string; }; confidence: BingPrecision; entityType: string; geocodePoints: { type: string; coordinates: FlatCoordinates; calculationMethod: "Interpolation" | "InterpolationOffset" | "Parcel" | "Rooftop"; usageTypes: ("Display" | "Route")[]; }[]; queryParseValues?: { property: " AddressLine" | "Locality" | "AdminDistrict" | "AdminDistrict2" | "PostalCode" | "CountryRegion" | "Landmark"; value: string; }; matchCodes: ("Good" | "Ambiguous" | "UpHierarchy")[]; } export interface BingResponse { statusCode: number; statusDescription: string | null; authenticationResultCode: "ValidCredentials" | "InvalidCredentials" | "CredentialsExpired" | "NotAuthorized" | "NoCredentials" | "None"; traceId: string; copyright: string; brandLogoUri: string; resourceSets: { estimatedTotal: number; resources: BingResult[]; }[]; errorDetails?: string[]; } export interface BingProviderOptionsInterface extends ProviderOptionsInterface { readonly apiKey: string; } export declare const defaultBingProviderOptions: { apiKey: string; useSsl?: boolean | undefined; useJsonp?: boolean | undefined; }; declare type BingGeocodedResultsCallback = GeocodedResultsCallback<BingGeocoded>; export default class BingProvider implements ProviderInterface<BingGeocoded> { private externalLoader; private options; constructor(_externalLoader: ExternalLoaderInterface, options?: BingProviderOptionsInterface); geocode(query: string | GeocodeQuery | GeocodeQueryObject): Promise<BingGeocoded[]>; geocode(query: string | GeocodeQuery | GeocodeQueryObject, callback: BingGeocodedResultsCallback, errorCallback?: ErrorCallback): void; geodecode(query: ReverseQuery | ReverseQueryObject): Promise<BingGeocoded[]>; geodecode(query: ReverseQuery | ReverseQueryObject, callback: BingGeocodedResultsCallback, errorCallback?: ErrorCallback): void; geodecode(latitude: number | string, longitude: number | string): Promise<BingGeocoded[]>; geodecode(latitude: number | string, longitude: number | string, callback: BingGeocodedResultsCallback, errorCallback?: ErrorCallback): void; private withCommonParams; executeRequest(params: ExternalLoaderParams, callback: BingGeocodedResultsCallback, headers?: ExternalLoaderHeaders, body?: ExternalLoaderBody, errorCallback?: ErrorCallback): void; static mapToGeocoded(result: BingResult, attribution?: string): BingGeocoded; } export {}; //# sourceMappingURL=BingProvider.d.ts.map