Note: Active development on pixela-client-go has stopped. The only future changes will be bug fixes.
Please see pixela4go.
Pixela API client for Go.
https://godoc.org/github.com/ebc-2in2crc/pixela-client-go
$ go get -u github.com/ebc-2in2crc/pixela-client-go
package main
import (
"log"
"github.com/ebc-2in2crc/pixela-client-go"
)
func main() {
client := pixela.NewClient("YOUR_NAME", "YOUR_TOKEN")
// create new user
result, err := client.CreateUser(true, true, "")
if err != nil {
log.Fatal(err)
}
if result.IsSuccess == false {
log.Fatal(result.Message)
}
// create new graph
result, err = client.Graph("graph-id").Create(
"graph-name",
"commit",
pixela.TypeInt,
pixela.ColorShibafu,
"Asia/Tokyo",
pixela.SelfSufficientNone,
false,
false,
)
if err != nil {
log.Fatal(err)
}
if result.IsSuccess == false {
log.Fatal(result.Message)
}
// register value
result, err = client.Pixel("graph-id").Create("20180915", "5", "")
if err != nil {
log.Fatal(err)
}
if result.IsSuccess == false {
log.Fatal(result.Message)
}
// increment value
result, err = client.Pixel("graph-id").Increment()
if err != nil {
log.Fatal(err)
}
if result.IsSuccess == false {
log.Fatal(result.Message)
}
// create new webhook
webhook, err := client.Webhook().Create("graph-id", pixela.SelfSufficientIncrement)
if err != nil {
log.Fatal(err)
}
if webhook.IsSuccess == false {
log.Fatal(webhook.Message)
}
// invoke webhook
result, err = client.Webhook().Invoke(webhook.WebhookHash)
if err != nil {
log.Fatal(err)
}
if result.IsSuccess == false {
log.Fatal(result.Message)
}
}
- Fork this repository
- Create your issue branch (
git checkout -b issue/:id
) - Change codes
- Run test suite with the
make test
command and confirm that it passes - Run
make fmt
- Commit your changes (
git commit -am 'Add some feature'
) - Create new Pull Request