Skip to content

Commit 15d130a

Browse files
committed
Bumped v0.20.0
Signed-off-by: Vishal Rana <[email protected]>
1 parent 6ddcd5b commit 15d130a

File tree

4 files changed

+26
-20
lines changed

4 files changed

+26
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
)
2323

2424
func main() {
25-
client := labstack.NewClient("<API_KEY>")
25+
client := labstack.NewClient("<ACCOUNT_ID>", "<API_KEY>")
2626
res, err := client.BarcodeGenerate(&labstack.BarcodeGenerateRequest{
2727
Format: "qr_code",
2828
Content: "https://labstack.com",

client.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import (
99

1010
type (
1111
Client struct {
12-
apiKey string
13-
resty *resty.Client
14-
logger *log.Logger
12+
accountID string
13+
apiKey string
14+
resty *resty.Client
15+
logger *log.Logger
1516
}
1617

1718
Download struct {
@@ -31,11 +32,12 @@ const (
3132
)
3233

3334
// NewClient creates a new client for the LabStack API.
34-
func NewClient(apiKey string) *Client {
35+
func NewClient(accountID, apiKey string) *Client {
3536
return &Client{
36-
apiKey: apiKey,
37-
resty: resty.New().SetHostURL(apiURL).SetAuthToken(apiKey),
38-
logger: log.New("labstack"),
37+
accountID: accountID,
38+
apiKey: apiKey,
39+
resty: resty.New().SetHostURL(apiURL).SetAuthToken(apiKey),
40+
logger: log.New("labstack"),
3941
}
4042
}
4143

geocode.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ type (
2121
Limit int `json:"limit"`
2222
}
2323

24-
GeocodeResponse struct {
25-
Type string `json:"type"`
26-
Features []*GeocodeFeature `json:"features"`
24+
GeocodeGeometry struct {
25+
Type string `json:"type"`
26+
Coordinates []float64 `json:"coordinates"`
2727
}
2828

2929
GeocodeFeature struct {
@@ -32,9 +32,9 @@ type (
3232
Properties Properties `json:"properties"`
3333
}
3434

35-
GeocodeGeometry struct {
36-
Type string `json:"type"`
37-
Coordinates []float64 `json:"coordinates"`
35+
GeocodeResponse struct {
36+
Type string `json:"type"`
37+
Features []*GeocodeFeature `json:"features"`
3838
}
3939
)
4040

properties.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,20 @@ func (p Properties) Bool(key string) bool {
1111
return false
1212
}
1313

14-
func (p Properties) String(key string) string {
14+
func (p Properties) Float64(key string) float64 {
1515
if val, ok := p[key]; ok {
16-
return val.(string)
16+
return val.(float64)
1717
}
18-
return ""
18+
return 0
1919
}
2020

21-
func (p Properties) Float64(key string) float64 {
21+
func (p Properties) Int(key string) int {
22+
return int(p.Float64(key))
23+
}
24+
25+
func (p Properties) String(key string) string {
2226
if val, ok := p[key]; ok {
23-
return val.(float64)
27+
return val.(string)
2428
}
25-
return 0
29+
return ""
2630
}

0 commit comments

Comments
 (0)