tripadvisor_api_module_v1
Version:
TripAdvisor API Module
186 lines (185 loc) • 3.96 kB
TypeScript
export type TripadvisorAPIResponseError = {
error: {
message: string;
type: string;
code: number;
};
};
export type TripadvisorAPIResponsePhotos = {
data: TripadvisorPhoto[];
};
export type TripadvisorAPIResponseReviews = {
data: TripadvisorReview[];
};
export type TripadvisorAPIResponseSearch = {
data: TripadvisorLocation[];
};
export type ImageMeta = {
height: number;
width: number;
url: string;
};
export type AddressObj = {
street1?: string;
street2?: string;
city?: string;
state?: string;
country: string;
postalcode?: string;
address_string: string;
};
export type UserBasic = {
username: string;
};
export type Avatar = {
thumbnail: string;
small: string;
medium: string;
large: string;
original?: string;
};
export type UserWithLocation = UserBasic & {
user_location?: {
id: string;
name?: string;
};
avatar?: Avatar;
};
export type LocationAncestor = {
abbrv?: string;
level: string;
name: string;
location_id: string;
};
export type CategoryInfo = {
name: string;
localized_name: string;
};
export type TripadvisorLocation = {
location_id: string;
name: string;
distance?: string;
bearing?: string;
address_obj: AddressObj;
};
export type RankingData = {
geo_location_id: string;
ranking_string: string;
geo_location_name: string;
ranking_out_of: string;
ranking: number;
};
export type ReviewRatingCount = {
"1": number;
"2": number;
"3": number;
"4": number;
"5": number;
};
export type Group = {
name: string;
localized_name: string;
categories: CategoryInfo[];
};
export type NeighborhoodInfo = {
location_id: string;
name: string;
};
export type TripType = {
name: string;
localized_name: string;
value: number;
};
export type Award = {
award_type: string;
year: number;
images: {
tiny: string;
small: string;
large: string;
};
categories: CategoryInfo[];
display_name: string;
};
export type Period = {
open: {
day: number;
time: string;
};
close: {
day: number;
time: string;
};
};
export type Hours = {
periods: Period[];
week_day_text: string[];
};
export type TripadvisorLocationDetail = {
location_id: string;
name: string;
description?: string;
web_url?: string;
address_obj: AddressObj;
ancestors?: LocationAncestor[];
latitude?: string;
longitude?: string;
timezone?: string;
phone?: string;
website?: string;
write_review?: string;
ranking_data?: RankingData;
rating?: number;
rating_image_url?: string;
num_reviews?: number;
review_rating_count?: ReviewRatingCount;
photo_count?: number;
see_all_photos?: string;
hours?: Hours;
category?: CategoryInfo;
subcategory?: CategoryInfo[];
groups?: Group[];
neighborhood_info?: NeighborhoodInfo[];
trip_types?: TripType[];
awards?: Award[];
};
export type TripadvisorPhoto = {
id: number;
is_blessed: boolean;
caption: string;
published_date: string;
album: string;
images: {
thumbnail: ImageMeta;
small: ImageMeta;
medium: ImageMeta;
large: ImageMeta;
original: ImageMeta;
};
source: {
name: string;
localized_name: string;
};
user: UserBasic;
};
export type TripadvisorReview = {
id: number;
lang: string;
location_id: number;
published_date: string;
rating: number;
helpful_votes: number;
rating_image_url: string;
url: string;
text: string;
title: string;
trip_type: string;
travel_date: string;
user: UserWithLocation;
subratings?: Record<string, {
name: string;
rating_image_url: string;
value: number;
localized_name: string;
}>;
};