tripadvisor_api_module_v1
Version:
TripAdvisor API Module
72 lines (71 loc) • 6.48 kB
TypeScript
import { TripadvisorCategory } from "../consts/tripadvisor-categories.js";
import { TripadvisorCurrency } from "../consts/tripadvisor-currencies.js";
import { TRIPADVISOR_LANGUAGE_CODES, TripadvisorLanguageCode } from "../consts/tripadvisor-language-codes.js";
import { TripadvisorRadiusUnit } from "../consts/tripadvisor-radius-unit.js";
import { TripadvisorAPIResponsePhotos, TripadvisorAPIResponseReviews, TripadvisorAPIResponseSearch, TripadvisorLocationDetail } from "./models.js";
export declare class TripadvisorAPI {
private TRIPADVISOR_API_KEY;
constructor(key: string);
/**
* Nearby Search
* API Document: https://tripadvisor-content-api.readme.io/reference/searchfornearbylocations
* API URL https://api.content.tripadvisor.com/api/v1/location/nearby_search
* @param latLong string (required) Latitude/Longitude pair to scope down the search around a specifc point - eg. "42.3455,-71.10767"
* @param category string (optional) Filters result set based on property type. Valid options are "hotels", "attractions", "restaurants", and "geos"
* @param phone string (optional) Phone number to filter the search results by (this can be in any format with spaces and dashes but without the "+" sign at the beginning)
* @param address string (optional) Address to filter the search results by
* @param radius string (optional) Length of the radius from the provided latitude/longitude pair to filter results.
* @param radiusUnit string (optional) Unit for length of the radius. Valid options are "km", "mi", "m" (km=kilometers, mi=miles, m=meters)
* @param language string (optional) The language in which to return results (e.g. "en" for English or "es" for Spanish) from the list of our Supported Languages.
* @returns
*/
searchNearby(latLong: string, category?: TripadvisorCategory, phone?: string, address?: string, radius?: number, radiusUnit?: TripadvisorRadiusUnit, language?: TripadvisorLanguageCode): Promise<TripadvisorAPIResponseSearch | unknown>;
/**
* Text(Query) Search
* API Document: https://tripadvisor-content-api.readme.io/reference/searchforlocations
* API URL https://api.content.tripadvisor.com/api/v1/location/search
* @param searchQuery string (required) Text to use for searching based on the name of the location
* @param category string (optional) Filters result set based on property type. Valid options are "hotels", "attractions", "restaurants", and "geos"
* @param phone string (optional) Phone number to filter the search results by (this can be in any format with spaces and dashes but without the "+" sign at the beginning)
* @param address string (optional) Address to filter the search results by
* @param latLong string (optional) Latitude/Longitude pair to scope down the search around a specifc point - eg. "42.3455,-71.10767"
* @param radius number (optional) > 0 Length of the radius from the provided latitude/longitude pair to filter results.
* @param radiusUnit string (optional) Unit for length of the radius. Valid options are "km", "mi", "m" (km=kilometers, mi=miles, m=meters)
* @param language string (optional) The language in which to return results (e.g. "en" for English or "es" for Spanish) from the list of our Supported Languages.
* @returns
*/
searchByText(searchQuery: string, category?: TripadvisorCategory, phone?: string, address?: string, latLong?: string, radius?: number, radiusUnit?: TripadvisorRadiusUnit, language?: TripadvisorLanguageCode): Promise<TripadvisorAPIResponseSearch | unknown>;
/**
* Get Location Details
* API Document: https://tripadvisor-content-api.readme.io/reference/getlocationdetails
* API URL https://api.content.tripadvisor.com/api/v1/location/{locationId}/details
* @param locationId string (required) A unique identifier for a location on Tripadvisor. The location ID can be obtained using the Location Search.
* @param language string (optional) The language in which to return results (e.g. "en" for English or "es" for Spanish) from the list of our Supported Languages.
* @param currency string (optional) The currency code to use for request and response (should follow ISO 4217).
* @returns
*/
getLocationDetails(locationId: string, language?: TripadvisorLanguageCode, currency?: TripadvisorCurrency): Promise<TripadvisorLocationDetail | unknown>;
/**
* Get Location Photos
* API Document: https://tripadvisor-content-api.readme.io/reference/getlocationphotos
* API URL https://api.content.tripadvisor.com/api/v1/location/{locationId}/photos
* @param locationId string (required) A unique identifier for a location on Tripadvisor. The location ID can be obtained using the Location Search.
* @param language string (optional) The language in which to return results (e.g. "en" for English or "es" for Spanish) from the list of our Supported Languages.
* @param limit number (optional) The number of results to return
* @param offset number (optional) The index of the first result
* @param source string (optional) A comma-separated list of allowed photo sources. Allowed values are 'Expert', 'Management', 'Traveler'. If not specified, allow photos from all sources.
* @returns
*/
getLocationPhotos(locationId: string, language?: (typeof TRIPADVISOR_LANGUAGE_CODES)[keyof typeof TRIPADVISOR_LANGUAGE_CODES], limit?: number, offset?: number, source?: string): Promise<TripadvisorAPIResponsePhotos | unknown>;
/**
* Get Location Reviews
* API Document: https://tripadvisor-content-api.readme.io/reference/getlocationreviews
* API URL https://api.content.tripadvisor.com/api/v1/location/{locationId}/reviews
* @param locationId string (required) A unique identifier for a location on Tripadvisor. The location ID can be obtained using the Location Search.
* @param language string (optional) The language in which to return results (e.g. "en" for English or "es" for Spanish) from the list of our Supported Languages.
* @param limit number (optional) The number of results to return
* @param offset number (optional) The index of the first result
* @returns
*/
getLocationReviews(locationId: string, language?: (typeof TRIPADVISOR_LANGUAGE_CODES)[keyof typeof TRIPADVISOR_LANGUAGE_CODES], limit?: number, offset?: number): Promise<TripadvisorAPIResponseReviews | unknown>;
}