UNPKG

geocoder-dadata

Version:

Dadata geocoder API client that supports caching and is written purely on typescript

139 lines (138 loc) 4.41 kB
export interface IGeocoderOptions { api_token?: string; api_secret?: string; api_url?: string; pace_limit?: number; cached?: boolean; } export interface IGeoPoint { lat: number | void; lng: number | void; } export interface IGeoResponseForwardCoding { "source": string; "result": string; "postal_code": string | null; "country": "Россия"; "country_iso_code": "RU"; "federal_district": "Центральный"; "region_fias_id": "0c5b2444-70a0-4932-980c-b4dc0d3f02b5"; "region_kladr_id": "7700000000000"; "region_iso_code": string | null; "region_with_type": string | null; "region_type": string | null; "region_type_full": string | null; "region": string | null; "area_fias_id": string | null; "area_kladr_id": string | null; "area_with_type": string | null; "area_type": string | null; "area_type_full": string | null; "area": string | null; "city_fias_id": string | null; "city_kladr_id": string | null; "city_with_type": string | null; "city_type": string | null; "city_type_full": string | null; "city": string | null; "city_area": string | null; "city_district_fias_id": string | null; "city_district_kladr_id": string | null; "city_district_with_type": string | null; "city_district_type": string | null; "city_district_type_full": string | null; "city_district": string | null; "settlement_fias_id": string | null; "settlement_kladr_id": string | null; "settlement_with_type": string | null; "settlement_type": string | null; "settlement_type_full": string | null; "settlement": string | null; "street_fias_id": string | null; "street_kladr_id": string | null; "street_with_type": string | null; "street_type": string | null; "street_type_full": string | null; "street": string | null; "house_fias_id": string | null; "house_kladr_id": string | null; "house_type": string | null; "house_type_full": string | null; "house": string | null; "block_type": string | null; "block_type_full": string | null; "block": string | null; "entrance": string | null; "floor": string | null; "flat_fias_id": string | null; "flat_type": string | null; "flat_type_full": string | null; "flat": number | null; "flat_area": string | number | null; "square_meter_price": string | number | null; "flat_price": string | number | null; "postal_box": string | null; "fias_id": string | null; "fias_code": string | null; "fias_level": string | number | null; "fias_actuality_state": string | number | null; "kladr_id": string | number | null; "capital_marker": string | number | null; "okato": string | number | null; "oktmo": string | number | null; "tax_office": string | number | null; "tax_office_legal": string | number | null; "timezone": string | null; "geo_lat": number | null; "geo_lon": number | null; "beltway_hit": string | null; "beltway_distance": string | null; "qc_geo": number; "qc_complete": number; "qc_house": number; "qc": number; "unparsed_parts": any; "metro": [ { "name": string; "line": string; "distance": number; }, { "name": string; "line": string; "distance": number; }, { "name": string; "line": string; "distance": number; } ]; } export interface IGeoResult { ok: boolean; geo: IGeoPoint; } export declare class Geocoder { private API_TOKEN; private API_SECRET; private API_URL; private pace; private cached; constructor({ api_token, api_secret, api_url, pace_limit, cached }?: IGeocoderOptions); geocode(query: string | string[]): Promise<GeoResult>; } export default Geocoder; declare class GeoResult implements IGeoResult { status: undefined | { code: number; message: string; }; results: undefined | IGeoResponseForwardCoding[]; constructor(data: any); get total_results(): number; get ok(): boolean; get geo(): IGeoPoint; get address(): string; }