This library implements a very very simple client to talk to the GitHub (and someday possibly other) APIs. The goals of this client are:
- Lightweight: Low dependency count.
- Easy to use in tests, easy to mock.
- Pluggable credential (token) providers.
Non-goals include:
- Response parsing
- Anything else beyond handling https connections.
To use the client, simply export a token in GITHUB_TOKEN
and run something
like:
package main
import "github.com/carabiner-dev/github"
func main() {
// Creat the client
client, err := github.NewClient()
// Call an API endpoint:
resp, err := client.Call(ctx, http.MethodGet, "users/carabiner-dev", nil)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
}
// Output the response to stdout:
io.Copy(os.Stdout, resp.Body)
resp.Close()
}
To pull the package simply use go get:
github.com/carabiner-dev/github
This package is released under the Apache 2.0 license by Carabiner Systems, Inc. Patches issues and contributions are welcome!