Skip to content

Commit f6cc611

Browse files
committed
Bumped v0.6.0
Signed-off-by: Vishal Rana <[email protected]>
1 parent ac3795b commit f6cc611

File tree

2 files changed

+51
-13
lines changed

2 files changed

+51
-13
lines changed

README.md

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,44 @@
1-
# LabStack Go Client
1+
<a href="https://labstack.com"><img height="80" src="https://cdn.labstack.com/images/labstack-logo.svg"></a>
22

3+
## Go Client
34

4-
[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/labstack/labstack-go)
5-
[![Go Report Card](https://goreportcard.com/badge/github.com/labstack/labstack-go?style=flat-square)](https://goreportcard.com/report/github.com/labstack/labstack-go)
6-
[![Build Status](http://img.shields.io/travis/labstack/labstack-go.svg?style=flat-square)](https://travis-ci.org/labstack/labstack-go)
7-
[![Codecov](https://img.shields.io/codecov/c/github/labstack/labstack-go.svg?style=flat-square)](https://codecov.io/gh/labstack/labstack-go)
8-
[![Forum](https://img.shields.io/badge/community-forum-00afd1.svg?style=flat-square)](https://forum.labstack.com)
9-
[![Twitter](https://img.shields.io/badge/[email protected]?style=flat-square)](https://twitter.com/labstack)
10-
[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/labstack/labstack-go/master/LICENSE)
5+
## Installation
6+
7+
`go get github.com/labstack/labstack-go`
8+
9+
## Quick Start
10+
11+
[Sign up](https://labstack.com/signup) to get an API key
12+
13+
Create a file `app.go` with the following content:
14+
15+
```go
16+
package main
17+
18+
import (
19+
"fmt"
20+
21+
"github.com/labstack/labstack-go"
22+
)
23+
24+
func main() {
25+
client := labstack.NewClient("<ACCOUNT_ID>", "<API_KEY>")
26+
store := client.Store()
27+
doc, err := store.Insert("users", labstack.Document{
28+
"name": "Jack",
29+
"location": "Disney",
30+
})
31+
if err != nil {
32+
panic(err)
33+
}
34+
fmt.Printf("%+v", doc)
35+
}
36+
```
37+
38+
From terminal run your app:
39+
40+
```sh
41+
go run app.go
42+
```
43+
44+
## [Docs](https://labstack.com/docs) | [Forum](https://forum.labstack.com)

client.go

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

1010
type (
1111
Client struct {
12-
sling *sling.Sling
13-
logger *glog.Logger
12+
accountID string
13+
apiKey string
14+
sling *sling.Sling
15+
logger *glog.Logger
1416
}
1517

1618
Fields map[string]interface{}
@@ -30,10 +32,12 @@ const (
3032
)
3133

3234
// NewClient creates a new client for the LabStack API.
33-
func NewClient(apiKey string) *Client {
35+
func NewClient(accountID, apiKey string) *Client {
3436
return &Client{
35-
sling: sling.New().Base(apiURL).Add("Authorization", "Bearer "+apiKey),
36-
logger: glog.New("labstack"),
37+
accountID: accountID,
38+
apiKey: apiKey,
39+
sling: sling.New().Base(apiURL).Add("Authorization", "Bearer "+apiKey),
40+
logger: glog.New("labstack"),
3741
}
3842
}
3943

0 commit comments

Comments
 (0)