irem
Version:
Search for any city in any language in Earth.
41 lines (40 loc) • 2.07 kB
TypeScript
import { CountryCode, PlaceMatchWithCountry, PlaceWithCountry, SupportedLanguage } from "./types.js";
/**
* Returns a list of places based on search term in given language. if `latitude` and `longitude` is provided, the list is sorted by distance, otherwise sorted by text match.
* `countryCode` is a two letters string represents a country such as `TR` or `US`. If it's provided, results from the country will have precedence.
* `maxResultCount` is the size of returned array length. It should be in [0,100] range
* If `language` is undefined, results will be returned in English.
* @export
* @async
* @param {string} searchTerm
* @param {?SupportedLanguage} [language]
* @param {?number} [latitude]
* @param {?number} [longitude]
* @param {number} [maxResultCount=10]
* @param {(CountryCode | "")} [countryCode=""]
* @returns {Promise<PlaceMatchWithCountry[]>}
*/
export declare function getPlaceSuggestionsByText(searchTerm: string, language?: SupportedLanguage, latitude?: number, longitude?: number, maxResultCount?: number, countryCode?: CountryCode | ""): Promise<PlaceMatchWithCountry[]>;
/**
* * Returns a list of places based on provided `latitude` and `longitude` values in given language. The list is sorted by distance.
* `maxResultCount` is the size of returned array length. It should be in [0,100] range
* @export
* @async
* @param {number} latitude
* @param {number} longitude
* @param {?SupportedLanguage} [language]
* @param {number} [maxResultCount=10]
* @returns {Promise<PlaceWithCountry[]>}
*/
export declare function getNearbyPlaces(latitude: number, longitude: number, language?: SupportedLanguage, maxResultCount?: number): Promise<PlaceWithCountry[]>;
/**
* Returns a `PlaceWithCountry` object from provided id. Id must exist in `db.tsv` file
*
* @async
* @param {number} placeId
* @param {?SupportedLanguage} [language]
* @returns {unknown}
*/
export declare function getPlaceById(placeId: number, language?: SupportedLanguage): Promise<(import("./types.js").Place & {
country: string;
}) | undefined>;