UNPKG

@yandex/ymaps3-types

Version:

Types for ymaps3 maps library

76 lines (75 loc) 2.74 kB
import type { LngLat, LngLatBounds } from "../../common/types/index"; import { Config } from '../config'; type DeprecatedGeoSuggestType = 'all' | 'toponyms' | 'addresses' | 'organizations'; type GeoSuggestType = 'biz' | 'geo' | 'street' | 'metro' | 'district' | 'locality' | 'area' | 'province' | 'country' | 'house'; export type SuggestOptions = { text: string; center?: LngLat; span?: LngLat; bounds?: LngLatBounds; limit?: number; localOnly?: number; highlight?: boolean; types?: GeoSuggestType[]; /** @deprecated */ countries?: string; /** @deprecated use types instead */ type?: DeprecatedGeoSuggestType; }; type DeprecatedObjectType = 'unknown' | 'toponym' | 'business' | 'transit'; /** Positions of chars to highlight between */ type Highlight = [ number, number ]; type TextWithHighlight = { text: string; hl: Highlight[]; }; type Distance = { text: string; value: number; }; export type SuggestResponseItem = { /** Human-readable object title with matching highlighting */ title: TextWithHighlight; /** Human-readable object subtitle with matching highlighting */ subtitle?: TextWithHighlight; /** Distance to the object in meters */ distance?: Distance; /** Additional object information that can be used in a Geocoder HTTP API request. */ uri?: string; /** Object tags. Possible values: business, street, metro, district, locality, area, province, country, hydro, railway, station, route, vegetation, airport, other, house */ tags?: string[]; /** Object's address. */ address?: { /** Object's address. */ formattedAddress?: string; /** Address components. */ component?: { /** Address component name. */ name: string; /** Address component type. Two components with the same `kind` values but different `name` may be returned. */ kind: string[]; }[]; }; /** @deprecated Use uri instead */ value: string; /** @deprecated Use tags instead */ type?: DeprecatedObjectType; }; export type SuggestResponse = SuggestResponseItem[]; /** * Static function to work with Suggest API. * * Before using this function it is required to set apikey for Suggest API * using `ymaps3.getDefaultConfig().setApikeys({suggest: "YOUR_SUGGEST_API_KEY"})`. * You can get the key in the [Developer's Dashboard](https://developer.tech.yandex.ru/services). * * * @param {SuggestOptions} options Request options * @param {Config} config Current config * @returns {Promise<SuggestResponse>} */ export declare function suggest(options: SuggestOptions, config?: Config | undefined): Promise<SuggestResponse>; export {};