Skip to content

Commit c3a65d1

Browse files
committed
Bumped version
Signed-off-by: Vishal Rana <[email protected]>
1 parent b15cca0 commit c3a65d1

File tree

6 files changed

+40
-66
lines changed

6 files changed

+40
-66
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ import (
2424
func main() {
2525
client := labstack.NewClient("<API_KEY>")
2626
geocode := client.Geocode()
27-
res, err := geocode.Address(&labstack.GeocodeAddressRequest{
28-
Location: "eiffel tower",
29-
})
27+
res, err := geocode.Address("eiffel tower")
3028
if err != nil {
3129
fmt.Println(err)
3230
} else {

currency.go

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,25 @@ type (
1010
*Client
1111
}
1212

13-
CurrencyConvertRequest struct {
14-
From string
15-
To string
16-
Value float64
17-
}
18-
1913
CurrencyConvertResponse struct {
2014
Value float64 `json:"value"`
2115
UpdatedAt time.Time `json:"updated_at"`
2216
}
2317

24-
CurrencyRatesRequest struct {
25-
Base string
26-
}
27-
2818
CurrencyRatesResponse struct {
2919
Rates map[string]float64 `json:"rates"`
3020
UpdatedAt time.Time `json:"updated_at"`
3121
}
3222
)
3323

34-
func (c *Currency) Convert(req *CurrencyConvertRequest) (*CurrencyConvertResponse, *APIError) {
24+
func (c *Currency) Convert(from, to string, value float64) (*CurrencyConvertResponse, *APIError) {
3525
res := new(CurrencyConvertResponse)
3626
err := new(APIError)
3727
r, e := c.resty.R().
3828
SetQueryParams(map[string]string{
39-
"from": req.From,
40-
"to": req.To,
41-
"value": strconv.FormatFloat(req.Value, 'f', -1, 64),
29+
"from": from,
30+
"to": to,
31+
"value": strconv.FormatFloat(value, 'f', -1, 64),
4232
}).
4333
SetResult(res).
4434
SetError(err).
@@ -54,12 +44,12 @@ func (c *Currency) Convert(req *CurrencyConvertRequest) (*CurrencyConvertRespons
5444
return res, nil
5545
}
5646

57-
func (c *Currency) Rates(req *CurrencyRatesRequest) (*CurrencyRatesResponse, *APIError) {
47+
func (c *Currency) Rates(base string) (*CurrencyRatesResponse, *APIError) {
5848
res := new(CurrencyRatesResponse)
5949
err := new(APIError)
6050
r, e := c.resty.R().
6151
SetQueryParams(map[string]string{
62-
"base": req.Base,
52+
"base": base,
6353
}).
6454
SetResult(res).
6555
SetError(err).

geocode.go

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,16 @@ type (
77
*Client
88
}
99

10-
GeocodeAddressRequest struct {
11-
Location string
10+
GeocodeAddressOptions struct {
1211
Longitude float64
1312
Latitude float64
1413
OSMTag string
1514
Language string
1615
Limit int
1716
}
1817

19-
GeocodeIPRequest struct {
20-
IP string
21-
}
22-
23-
GeocodeReverseRequest struct {
24-
Longitude float64
25-
Latitude float64
26-
Language string
27-
Limit int
18+
GeocodeReverseOptions struct {
19+
Limit int
2820
}
2921

3022
GeocodeGeometry struct {
@@ -44,17 +36,17 @@ type (
4436
}
4537
)
4638

47-
func (g *Geocode) Address(req *GeocodeAddressRequest) (*GeocodeResponse, *APIError) {
39+
func (g *Geocode) Address(location string, options GeocodeAddressOptions) (*GeocodeResponse, *APIError) {
4840
res := new(GeocodeResponse)
4941
err := new(APIError)
5042
r, e := g.resty.R().
5143
SetQueryParams(map[string]string{
52-
"location": req.Location,
53-
"longitude": strconv.FormatFloat(req.Longitude, 'f', -1, 64),
54-
"latitude": strconv.FormatFloat(req.Latitude, 'f', -1, 64),
55-
"osm_tag": req.OSMTag,
56-
"language": req.Language,
57-
"limit": strconv.Itoa(req.Limit),
44+
"location": location,
45+
"longitude": strconv.FormatFloat(options.Longitude, 'f', -1, 64),
46+
"latitude": strconv.FormatFloat(options.Latitude, 'f', -1, 64),
47+
"osm_tag": options.OSMTag,
48+
"language": options.Language,
49+
"limit": strconv.Itoa(options.Limit),
5850
}).
5951
SetResult(res).
6052
SetError(err).
@@ -70,12 +62,12 @@ func (g *Geocode) Address(req *GeocodeAddressRequest) (*GeocodeResponse, *APIErr
7062
return res, nil
7163
}
7264

73-
func (g *Geocode) IP(req *GeocodeIPRequest) (*GeocodeResponse, *APIError) {
65+
func (g *Geocode) IP(ip string) (*GeocodeResponse, *APIError) {
7466
res := new(GeocodeResponse)
7567
err := new(APIError)
7668
r, e := g.resty.R().
7769
SetQueryParams(map[string]string{
78-
"ip": req.IP,
70+
"ip": ip,
7971
}).
8072
SetResult(res).
8173
SetError(err).
@@ -91,15 +83,14 @@ func (g *Geocode) IP(req *GeocodeIPRequest) (*GeocodeResponse, *APIError) {
9183
return res, nil
9284
}
9385

94-
func (g *Geocode) Reverse(req *GeocodeReverseRequest) (*GeocodeResponse, *APIError) {
86+
func (g *Geocode) Reverse(longitude, latitude float64, options GeocodeReverseOptions) (*GeocodeResponse, *APIError) {
9587
res := new(GeocodeResponse)
9688
err := new(APIError)
9789
r, e := g.resty.R().
9890
SetQueryParams(map[string]string{
99-
"longitude": strconv.FormatFloat(req.Longitude, 'f', -1, 64),
100-
"latitude": strconv.FormatFloat(req.Latitude, 'f', -1, 64),
101-
"language": req.Language,
102-
"limit": strconv.Itoa(req.Limit),
91+
"longitude": strconv.FormatFloat(longitude, 'f', -1, 64),
92+
"latitude": strconv.FormatFloat(latitude, 'f', -1, 64),
93+
"limit": strconv.Itoa(options.Limit),
10394
}).
10495
SetResult(res).
10596
SetError(err).

post.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ type (
55
*Client
66
}
77

8-
PostVerifyRequest struct {
9-
Email string
10-
}
11-
128
PostVerifyResponse struct {
139
ValidSyntax bool `json:"valid_syntax"`
1410
Deliverable bool `json:"deliverable"`
@@ -19,12 +15,12 @@ type (
1915
}
2016
)
2117

22-
func (p *Post) Verify(req *PostVerifyRequest) (*PostVerifyResponse, *APIError) {
18+
func (p *Post) Verify(email string) (*PostVerifyResponse, *APIError) {
2319
res := new(PostVerifyResponse)
2420
err := new(APIError)
2521
r, e := p.resty.R().
2622
SetQueryParams(map[string]string{
27-
"email": req.Email,
23+
"email": email,
2824
}).
2925
SetResult(res).
3026
SetError(err).

watermark.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type (
77
*Client
88
}
99

10-
WatermarkImageRequest struct {
10+
WatermarkImageOptions struct {
1111
File string
1212
Text string
1313
Font string
@@ -23,19 +23,19 @@ type (
2323
}
2424
)
2525

26-
func (w *Watermark) Image(req *WatermarkImageRequest) (*WatermarkImageResponse, *APIError) {
26+
func (w *Watermark) Image(file, text string, options WatermarkImageOptions) (*WatermarkImageResponse, *APIError) {
2727
res := new(WatermarkImageResponse)
2828
err := new(APIError)
2929
r, e := w.resty.R().
30-
SetFile("file", req.File).
30+
SetFile("file", file).
3131
SetFormData(map[string]string{
32-
"text": req.Text,
33-
"font": req.Font,
34-
"size": strconv.Itoa(req.Size),
35-
"color": req.Color,
36-
"opacity": strconv.Itoa(req.Opacity),
37-
"position": req.Position,
38-
"margin": strconv.Itoa(req.Margin),
32+
"text": text,
33+
"font": options.Font,
34+
"size": strconv.Itoa(options.Size),
35+
"color": options.Color,
36+
"opacity": strconv.Itoa(options.Opacity),
37+
"position": options.Position,
38+
"margin": strconv.Itoa(options.Margin),
3939
}).
4040
SetResult(res).
4141
SetError(err).

webpage.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ type (
55
*Client
66
}
77

8-
WebpagePDFRequest struct {
9-
URL string
8+
WebpagePDFOptions struct {
109
Layout string
1110
Format string
1211
}
@@ -16,14 +15,14 @@ type (
1615
}
1716
)
1817

19-
func (w *Webpage) PDF(req *WebpagePDFRequest) (*WebpagePDFResponse, *APIError) {
18+
func (w *Webpage) PDF(url string, options WebpagePDFOptions) (*WebpagePDFResponse, *APIError) {
2019
res := new(WebpagePDFResponse)
2120
err := new(APIError)
2221
r, e := w.resty.R().
2322
SetQueryParams(map[string]string{
24-
"url": req.URL,
25-
"layout": req.Layout,
26-
"foramt": req.Format,
23+
"url": url,
24+
"layout": options.Layout,
25+
"foramt": options.Format,
2726
}).
2827
SetResult(res).
2928
SetError(err).

0 commit comments

Comments
 (0)