File tree Expand file tree Collapse file tree 4 files changed +26
-20
lines changed Expand file tree Collapse file tree 4 files changed +26
-20
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import (
22
22
)
23
23
24
24
func main () {
25
- client := labstack.NewClient (" <API_KEY>" )
25
+ client := labstack.NewClient (" <ACCOUNT_ID> " , " < API_KEY>" )
26
26
res , err := client.BarcodeGenerate (&labstack.BarcodeGenerateRequest {
27
27
Format: " qr_code" ,
28
28
Content: " https://labstack.com" ,
Original file line number Diff line number Diff line change @@ -9,9 +9,10 @@ import (
9
9
10
10
type (
11
11
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
15
16
}
16
17
17
18
Download struct {
@@ -31,11 +32,12 @@ const (
31
32
)
32
33
33
34
// NewClient creates a new client for the LabStack API.
34
- func NewClient (apiKey string ) * Client {
35
+ func NewClient (accountID , apiKey string ) * Client {
35
36
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" ),
39
41
}
40
42
}
41
43
Original file line number Diff line number Diff line change 21
21
Limit int `json:"limit"`
22
22
}
23
23
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 "`
27
27
}
28
28
29
29
GeocodeFeature struct {
32
32
Properties Properties `json:"properties"`
33
33
}
34
34
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 "`
38
38
}
39
39
)
40
40
Original file line number Diff line number Diff line change @@ -11,16 +11,20 @@ func (p Properties) Bool(key string) bool {
11
11
return false
12
12
}
13
13
14
- func (p Properties ) String (key string ) string {
14
+ func (p Properties ) Float64 (key string ) float64 {
15
15
if val , ok := p [key ]; ok {
16
- return val .(string )
16
+ return val .(float64 )
17
17
}
18
- return ""
18
+ return 0
19
19
}
20
20
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 {
22
26
if val , ok := p [key ]; ok {
23
- return val .(float64 )
27
+ return val .(string )
24
28
}
25
- return 0
29
+ return ""
26
30
}
You can’t perform that action at this time.
0 commit comments