-
Notifications
You must be signed in to change notification settings - Fork 13
/
place.go
44 lines (38 loc) · 1.33 KB
/
place.go
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
package gotwtr
type PlaceField string
/*
Place field will only return
if you've also included the expansions=geo.place_id query parameter in your request.
*/
const (
PlaceFieldFullName PlaceField = "full_name"
PlaceFieldID PlaceField = "id"
PlaceFieldContainedWithin PlaceField = "contained_within"
PlaceFieldCountry PlaceField = "country"
PlaceFieldCountryCode PlaceField = "country_code"
PlaceFieldGeo PlaceField = "geo"
PlaceFieldName PlaceField = "name"
PlaceFieldPlaceType PlaceField = "place_type"
)
type Place struct {
FullName string `json:"full_name"`
ID string `json:"id"`
ContainedWithin []string `json:"contained_within,omitempty"`
Country string `json:"country,omitempty"`
CountryCode string `json:"country_code,omitempty"`
Geo *PlaceGeo `json:"geo,omitempty"`
Name string `json:"name,omitempty"`
PlaceType string `json:"place_type,omitempty"`
}
type PlaceGeo struct {
Type string `json:"type"`
BBox []float64 `json:"bbox"`
Properties map[string]interface{} `json:"properties"`
}
func placeFieldsToString(pfs []PlaceField) []string {
slice := make([]string, len(pfs))
for i, pf := range pfs {
slice[i] = string(pf)
}
return slice
}