Documentation ¶
Overview ¶
Implements travelpayouts API for hotel searches. Some methods require valid marker and token. Some methods returns static data, so feel free to cache their response.
[Cities, Countries, Amenities, HotelList, RoomTypes, HotelTypes, Photos]
Index ¶
- Variables
- type API
- func (this *API) Amenities() ([]Amenity, error)
- func (this *API) Cities() (*[]Cities, error)
- func (this *API) Countries() (*[]Countries, error)
- func (this *API) FetchHotelList(locationId string) (*HotelList, error)
- func (this *API) FetchSearchResults(req *SearchResultsRequest) (*SearchResults, error)
- func (this *API) Lookup(req *LookupRequest) (*LookupResponse, error)
- func (this *API) PhotoLink(hotelId, photoId int, size string) string
- func (this *API) Price(req *PriceRequest) (*[]PriceResponse, error)
- func (this *API) RequestsLimit() int
- func (this *API) RequestsRemains() int
- func (this *API) RoomTypes() (*interface{}, error)
- func (this *API) Search(req *SearchRequest) (int, error)
- func (this *API) SetToken(token string)
- type Amenity
- type Cities
- type Countries
- type Hotel
- type HotelList
- type LookupRequest
- type LookupResponse
- type PriceRequest
- type PriceResponse
- type SearchRequest
- type SearchResults
- type SearchResultsRequest
- type VariationBlock
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) Amenities ¶
Fetch available facilities. Watch https://support.travelpayouts.com/hc/ru/articles/203956133-API-поиска-отелей#43
func (*API) Cities ¶
Fetch city list. Very long request. Watch https://support.travelpayouts.com/hc/ru/articles/203956133-API-поиска-отелей#42
func (*API) Countries ¶
Fetch contry list. Watch https://support.travelpayouts.com/hc/ru/articles/203956133-API-поиска-отелей#41
func (*API) FetchHotelList ¶
Fetch hotel list Watch https://support.travelpayouts.com/hc/ru/articles/203956133-API-поиска-отелей#44
func (*API) FetchSearchResults ¶
func (this *API) FetchSearchResults(req *SearchResultsRequest) (*SearchResults, error)
func (*API) Lookup ¶
func (this *API) Lookup(req *LookupRequest) (*LookupResponse, error)
Watch https://support.travelpayouts.com/hc/ru/articles/203956133-API-поиска-отелей#31
func (*API) Price ¶
func (this *API) Price(req *PriceRequest) (*[]PriceResponse, error)
Watch https://support.travelpayouts.com/hc/ru/articles/203956133-API-поиска-отелей#34
func (*API) RequestsLimit ¶
Returns numeric value of API rate limit. (X-Ratelimit-Limit )
func (*API) RequestsRemains ¶
Return number of remaining requests to HotelLook API. (X-Ratelimit-Remaining )
func (*API) RoomTypes ¶
Fetch room types. Watch https://support.travelpayouts.com/hc/ru/articles/203956133-API-поиска-отелей#45
type Cities ¶
type Cities struct { ID string `json:"id"` //locationID Code string `json:"code"` CountryID string `json:"countryId"` Latitude string `json:"latitude"` Longitude string `json:"longitude"` EN []VariationBlock `json:"EN"` RU []VariationBlock `json:"RU"` }
type Countries ¶
type Countries struct { ID string `json:"id"` Code string `json:"code"` EN []VariationBlock `json:"EN"` RU []VariationBlock `json:"RU"` }
type Hotel ¶
type Hotel struct { ID int `json:"id"` CityID int `json:"cityId"` Stars int `json:"stars"` PriceFrom int `json:"pricefrom"` Rating int `json:"rating"` Popularity int `json:"popularity"` PropertyType int `json:"propertyType"` CheckIn string `json:"checkIn"` CheckOut string `json:"checkOut"` Distance float64 `json:"distance"` YearOpened int `json:"yearOpened"` YearRenovated int `json:"yearRenovated"` PhotoCount int `json:"photoCount"` Photos []struct { URL string `json:"url"` Width int `json:"width"` Height int `json:"height"` } `json:"photos"` Facilities []int `json:"facilities"` ShortFacilities []string `json:"shortFacilities"` Location struct { Latitude float64 `json:"lat"` Logitude float64 `json:"lon"` } `json:"location"` Name struct { EN string `json:"en"` RU string `json:"ru,omitempty"` } `json:"name"` CountFloors int `json:"cntFloors"` CountRooms int `json:"cntRooms"` Address struct { EN string `json:"en"` RU string `json:"ru,omitempty"` } Link string `json:"link"` }
type LookupRequest ¶
type LookupRequest struct { Query string // Any ISO language code (fr, de, ru...). Default is en. Lang string // city/hotel/both // City - cities and islands // Hotel - only hotels // Both - all values. Default. LookFor string // 10 by default. Limit int // Automatically change of keyboard map (actual for russian users). Default 1. ConvertCase int }
type LookupResponse ¶
type LookupResponse struct { Status string `json:"status"` Results struct { Locations []struct { CityName string `json:"cityName"` FullName string `json:"fullName"` CountryCode string `json:"countryCode,omitempty"` CountryName string `json:"countryName,omitempty"` Iata []string `json:"iata"` ID string `json:"id"` HotelsCount string `json:"hotelsCount"` Location struct { Lat string `json:"lat"` Lon string `json:"lon"` } `json:"location"` Score float64 `json:"_score,omitempty"` } `json:"locations"` Hotels []struct { ID interface{} `json:"id"` FullName string `json:"fullName"` LocationName string `json:"locationName"` Label string `json:"label"` LocationID int `json:"locationId"` Location struct { Lat float64 `json:"lat"` Lon float64 `json:"lon"` } `json:"location"` Score float64 `json:"_score"` } `json:"hotels"` } `json:"results"` }
type PriceRequest ¶
type PriceRequest struct { Location string CheckIn string // 2016-12-10 CheckOut string // 2016-12-10 Currency string LocationID int HotelID int Hotel string Adults int // Number of adults. By default, it equals 2. Children int // Childrens, age 2-18. Infants int // Infants, ag 0-2. Limit int CustomerIP net.IP }
type PriceResponse ¶
type PriceResponse struct { Stars int `json:"stars"` HotelID int `json:"hotelId"` HotelName string `json:"hotelName"` PriceAvg float64 `json:"priceAvg"` PriceFrom float64 `json:"priceFrom"` LocationID int `json:"locationId"` Location struct { Country string `json:"country"` State string `json:"state"` Name string `json:"name"` Geo struct { Lon float64 `json:"lon"` Lat float64 `json:"lat"` } `json:"geo"` } `json:"location"` }
type SearchRequest ¶
type SearchResults ¶
type SearchResults struct { Status string `json:"status"` Results []struct { FullURL string `json:"fullUrl"` // ссылка на отель с вашим партнерским маркером MaxPricePerNight int `json:"maxPricePerNight"` // максимальная цена за ночь; MinPriceTotal int `json:"minPriceTotal"` MaxPrice int `json:"maxPrice"` PhotoCount int `json:"photoCount"` GuestScore int `json:"guestScore"` Address string `json:"address"` ID int `json:"id"` Price int `json:"price"` // средняя цена за номер; Name string `json:"name"` URL string `json:"url"` Popularity int `json:"popularity"` Location struct { Lat float64 `json:"lat"` Lon float64 `json:"lon"` } `json:"location"` Stars int `json:"stars"` Distance float64 `json:"distance"` // расстояние от отеля до центра города; Rooms []struct { AgencyID string `json:"agencyId"` AgencyName string `json:"agencyName"` BookingURL string `json:"bookingURL"` Type string `json:"type"` Tax float64 `json:"tax"` Total int `json:"total"` Price int `json:"price"` FullBookingURL string `json:"fullBookingURL"` Rating int `json:"rating"` Description string `json:"desc"` Options struct { Available int `json:"available"` // количество оставшихся комнат; Breakfast bool `json:"breakfast"` // включён ли завтрак; Refundable bool `json":"refundable"` // возможность возврата; Deposit bool `json:"deposit"` // оплата на сайте OTA (при бронировании); CardRequired bool `json:"cardRequired"` // обязательно наличие банковской карты; Smoking bool `json:"smoking"` // можно ли курить в номере; FreeWifi bool `json:"freeWifi"` // есть ли бесплатный wifi в номере; HotelWebsite bool `json:"hotelWebsite"` // предложение ведёт на официальный сайт отеля. } `json:"options"` } `json:"rooms"` } `json:"result"` }