-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhotels.go
More file actions
81 lines (73 loc) · 3.23 KB
/
Copy pathhotels.go
File metadata and controls
81 lines (73 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package hotellook
import "fmt"
type HotelsResponse struct {
GenTimestamp float64 `json:"gen_timestamp" bson:"gen_timestamp"`
Hotels []Hotel `json:"hotels" bson:"hotels"`
Pois []Poi `json:"pois" bson:"pois"`
}
type Hotel struct {
Address map[string]string `json:"address" bson:"address"`
CheckIn string `json:"checkIn" bson:"checkIn"`
CheckOut string `json:"checkOut" bson:"checkOut"`
CityId int `json:"cityId" bson:"cityId"`
CntFloors int `json:"cntFloors" bson:"cntFloors"`
CntRooms int `json:"cntRooms" bson:"cntRooms"`
CntSuites int `json:"cntSuites" bson:"cntSuites"`
Distance float64 `json:"distance" bson:"distance"`
Facilities []int `json:"facilities" bson:"facilities"`
Id int `json:"id" bson:"id"`
Link string `json:"link" bson:"link"`
Location Coordinates `json:"location" bson:"location"`
Name map[string]string `json:"name" bson:"name"`
PhotoCount int `json:"photoCount" bson:"photoCount"`
Photos []Photo `json:"photos" bson:"photos"`
PhotosByRoomType map[string]int `json:"photosByRoomType" bson:"photosByRoomType"`
PoiDistance map[string]int `json:"poi_distance" bson:"poi_distance"`
Popularity int `json:"popularity" bson:"popularity"`
Pricefrom int `json:"pricefrom" bson:"pricefrom"`
PropertyType int `json:"propertyType" bson:"propertyType"`
Rating int `json:"rating" bson:"rating"`
ShortFacilities []string `json:"shortFacilities" bson:"shortFacilities"`
Stars int `json:"stars" bson:"stars"`
YearOpened int `json:"yearOpened" bson:"yearOpened"`
YearRenovated int `json:"yearRenovated" bson:"yearRenovated"`
}
type Poi struct {
Category string `json:"category" bson:"category"`
Confirmed bool `json:"confirmed" bson:"confirmed"`
Geom Geom `json:"geom" bson:"geom"`
Id int `json:"id" bson:"id"`
Location Coordinates `json:"location" bson:"location"`
Name string `json:"name" bson:"name"`
Rating float64 `json:"rating" bson:"rating"`
}
type Geom struct {
Coordinates []interface{} `json:"coordinates" bson:"coordinates"`
Type string `json:"type" bson:"type"`
}
type Photo struct {
Url string `json:"url" bson:"url"`
Width int `json:"width" bson:"width"`
Height int `json:"height" bson:"height"`
}
type Coordinates struct {
Lon float64 `json:"lon" bson:"lon"`
Lan float64 `json:"lat" bson:"lat"`
}
// Hotels returns a list of hotels by locationId.
//
// Documentation:
// https://support.travelpayouts.com/hc/en-us/articles/115000343268-Hotels-data-API#44
//
// Example URI:
// http://engine.hotellook.com/api/v2/static/hotels.json?locationId=895&token=YOUR_TOKEN
func (a *HotellookApi) Hotels(locationId int) (hotels HotelsResponse, err error) {
err = a.getJson(
"static/hotels.json",
map[string]string{
"locationId": fmt.Sprintf("%d", locationId),
},
&hotels,
)
return
}