88 }
99
1010 GeocodeAddressOptions struct {
11- Longitude float64
1211 Latitude float64
12+ Longitude float64
1313 OSMTag string
1414 Language string
15+ Foramt string
1516 Limit int
1617 }
1718
19+ GeocodeIPOptions struct {
20+ Foramt string
21+ }
22+
1823 GeocodeReverseOptions struct {
19- Limit int
24+ Foramt string
25+ Limit int
2026 }
2127
2228 GeocodeGeometry struct {
@@ -36,16 +42,21 @@ type (
3642 }
3743)
3844
39- func (g * Geocode ) Address (location string , options GeocodeAddressOptions ) (* GeocodeResponse , * APIError ) {
45+ func (g * Geocode ) Address (location string ) (* GeocodeResponse , * APIError ) {
46+ return g .AddressWithOptions (location , GeocodeAddressOptions {})
47+ }
48+
49+ func (g * Geocode ) AddressWithOptions (location string , options GeocodeAddressOptions ) (* GeocodeResponse , * APIError ) {
4050 res := new (GeocodeResponse )
4151 err := new (APIError )
4252 r , e := g .resty .R ().
4353 SetQueryParams (map [string ]string {
4454 "location" : location ,
45- "longitude" : strconv .FormatFloat (options .Longitude , 'f' , - 1 , 64 ),
4655 "latitude" : strconv .FormatFloat (options .Latitude , 'f' , - 1 , 64 ),
56+ "longitude" : strconv .FormatFloat (options .Longitude , 'f' , - 1 , 64 ),
4757 "osm_tag" : options .OSMTag ,
4858 "language" : options .Language ,
59+ "foramt" : options .Foramt ,
4960 "limit" : strconv .Itoa (options .Limit ),
5061 }).
5162 SetResult (res ).
@@ -63,11 +74,16 @@ func (g *Geocode) Address(location string, options GeocodeAddressOptions) (*Geoc
6374}
6475
6576func (g * Geocode ) IP (ip string ) (* GeocodeResponse , * APIError ) {
77+ return g .IPWithOptions (ip , GeocodeIPOptions {})
78+ }
79+
80+ func (g * Geocode ) IPWithOptions (ip string , options GeocodeIPOptions ) (* GeocodeResponse , * APIError ) {
6681 res := new (GeocodeResponse )
6782 err := new (APIError )
6883 r , e := g .resty .R ().
6984 SetQueryParams (map [string ]string {
70- "ip" : ip ,
85+ "ip" : ip ,
86+ "foramt" : options .Foramt ,
7187 }).
7288 SetResult (res ).
7389 SetError (err ).
@@ -83,13 +99,18 @@ func (g *Geocode) IP(ip string) (*GeocodeResponse, *APIError) {
8399 return res , nil
84100}
85101
86- func (g * Geocode ) Reverse (longitude , latitude float64 , options GeocodeReverseOptions ) (* GeocodeResponse , * APIError ) {
102+ func (g * Geocode ) Reverse (latitude , longitude float64 ) (* GeocodeResponse , * APIError ) {
103+ return g .ReverseWithOptions (latitude , longitude , GeocodeReverseOptions {})
104+ }
105+
106+ func (g * Geocode ) ReverseWithOptions (latitude , longitude float64 , options GeocodeReverseOptions ) (* GeocodeResponse , * APIError ) {
87107 res := new (GeocodeResponse )
88108 err := new (APIError )
89109 r , e := g .resty .R ().
90110 SetQueryParams (map [string ]string {
91- "longitude" : strconv .FormatFloat (longitude , 'f' , - 1 , 64 ),
92111 "latitude" : strconv .FormatFloat (latitude , 'f' , - 1 , 64 ),
112+ "longitude" : strconv .FormatFloat (longitude , 'f' , - 1 , 64 ),
113+ "foramt" : options .Foramt ,
93114 "limit" : strconv .Itoa (options .Limit ),
94115 }).
95116 SetResult (res ).
0 commit comments