@yandex/ymaps3-types
Version:
Types for ymaps3 maps library
64 lines (63 loc) • 2.32 kB
TypeScript
import type { LngLat, LngLatBounds } from "../../common/types";
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[];
/** @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 {};