1package anaconda
2
3import "net/url"
4
5type GeoSearchResult struct {
6	Result struct {
7		Places []struct {
8			ID              string `json:"id"`
9			URL             string `json:"url"`
10			PlaceType       string `json:"place_type"`
11			Name            string `json:"name"`
12			FullName        string `json:"full_name"`
13			CountryCode     string `json:"country_code"`
14			Country         string `json:"country"`
15			ContainedWithin []struct {
16				ID          string    `json:"id"`
17				URL         string    `json:"url"`
18				PlaceType   string    `json:"place_type"`
19				Name        string    `json:"name"`
20				FullName    string    `json:"full_name"`
21				CountryCode string    `json:"country_code"`
22				Country     string    `json:"country"`
23				Centroid    []float64 `json:"centroid"`
24				BoundingBox struct {
25					Type        string        `json:"type"`
26					Coordinates [][][]float64 `json:"coordinates"`
27				} `json:"bounding_box"`
28				Attributes struct {
29				} `json:"attributes"`
30			} `json:"contained_within"`
31			Centroid    []float64 `json:"centroid"`
32			BoundingBox struct {
33				Type        string        `json:"type"`
34				Coordinates [][][]float64 `json:"coordinates"`
35			} `json:"bounding_box"`
36			Attributes struct {
37			} `json:"attributes"`
38		} `json:"places"`
39	} `json:"result"`
40	Query struct {
41		URL    string `json:"url"`
42		Type   string `json:"type"`
43		Params struct {
44			Accuracy     float64 `json:"accuracy"`
45			Granularity  string  `json:"granularity"`
46			Query        string  `json:"query"`
47			Autocomplete bool    `json:"autocomplete"`
48			TrimPlace    bool    `json:"trim_place"`
49		} `json:"params"`
50	} `json:"query"`
51}
52
53func (a TwitterApi) GeoSearch(v url.Values) (c GeoSearchResult, err error) {
54	response_ch := make(chan response)
55	a.queryQueue <- query{a.baseUrl + "/geo/search.json", v, &c, _GET, response_ch}
56	return c, (<-response_ch).err
57}
58