forked from g8rswimmer/go-twitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
place_obj.go
50 lines (45 loc) · 1.97 KB
/
place_obj.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
45
46
47
48
49
50
package twitter
// PlaceField can expand the tweet primary object
type PlaceField string
const (
// PlaceFieldContainedWithin returns the identifiers of known places that contain the referenced place.
PlaceFieldContainedWithin PlaceField = "contained_within"
// PlaceFieldCountry is the full-length name of the country this place belongs to.
PlaceFieldCountry PlaceField = "country"
// PlaceFieldCountryCode is the ISO Alpha-2 country code this place belongs to.
PlaceFieldCountryCode PlaceField = "country_code"
// PlaceFieldFullName is a longer-form detailed place name.
PlaceFieldFullName PlaceField = "full_name"
// PlaceFieldGeo contains place details in GeoJSON format.
PlaceFieldGeo PlaceField = "geo"
// PlaceFieldID is the unique identifier of the expanded place, if this is a point of interest tagged in the Tweet.
PlaceFieldID PlaceField = "id"
// PlaceFieldName is the short name of this place
PlaceFieldName PlaceField = "name"
// PlaceFieldPlaceType is specified the particular type of information represented by this place information, such as a city name, or a point of interest.
PlaceFieldPlaceType PlaceField = "place_type"
)
func placeFieldStringArray(arr []PlaceField) []string {
strs := make([]string, len(arr))
for i, field := range arr {
strs[i] = string(field)
}
return strs
}
// PlaceObj tagged in a Tweet is not a primary object on any endpoint
type PlaceObj struct {
FullName string `json:"full_name"`
ID string `json:"id"`
ContainedWithin []string `json:"contained_within"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
Geo PlaceGeoObj `json:"geo"`
Name string `json:"name"`
PlaceType string `json:"place_type"`
}
// PlaceGeoObj contains place details
type PlaceGeoObj struct {
Type string `json:"type"`
BBox []float64 `json:"bbox"`
Properties map[string]interface{} `json:"properties"`
}