-
Notifications
You must be signed in to change notification settings - Fork 246
/
geosearch.go
57 lines (54 loc) · 1.82 KB
/
geosearch.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
51
52
53
54
55
56
57
package anaconda
import "net/url"
type GeoSearchResult struct {
Result struct {
Places []struct {
ID string `json:"id"`
URL string `json:"url"`
PlaceType string `json:"place_type"`
Name string `json:"name"`
FullName string `json:"full_name"`
CountryCode string `json:"country_code"`
Country string `json:"country"`
ContainedWithin []struct {
ID string `json:"id"`
URL string `json:"url"`
PlaceType string `json:"place_type"`
Name string `json:"name"`
FullName string `json:"full_name"`
CountryCode string `json:"country_code"`
Country string `json:"country"`
Centroid []float64 `json:"centroid"`
BoundingBox struct {
Type string `json:"type"`
Coordinates [][][]float64 `json:"coordinates"`
} `json:"bounding_box"`
Attributes struct {
} `json:"attributes"`
} `json:"contained_within"`
Centroid []float64 `json:"centroid"`
BoundingBox struct {
Type string `json:"type"`
Coordinates [][][]float64 `json:"coordinates"`
} `json:"bounding_box"`
Attributes struct {
} `json:"attributes"`
} `json:"places"`
} `json:"result"`
Query struct {
URL string `json:"url"`
Type string `json:"type"`
Params struct {
Accuracy float64 `json:"accuracy"`
Granularity string `json:"granularity"`
Query string `json:"query"`
Autocomplete bool `json:"autocomplete"`
TrimPlace bool `json:"trim_place"`
} `json:"params"`
} `json:"query"`
}
func (a TwitterApi) GeoSearch(v url.Values) (c GeoSearchResult, err error) {
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/geo/search.json", v, &c, _GET, response_ch}
return c, (<-response_ch).err
}