Go library for accessing the Sentry Web API.
go-sentry is compatible with modern Go releases in module mode, with Go installed:
go get github.com/jianyuan/go-sentry/v2/sentry
import "github.com/jianyuan/go-sentry/v2/sentry"
Create a new Sentry client. Then, use the various services on the client to access different parts of the Sentry Web API. For example:
client := sentry.NewClient(nil)
// List all organizations
orgs, _, err := client.Organizations.List(ctx, nil)
The library does not directly handle authentication. When creating a new client, pass an
http.Client
that can handle authentication for you. We recommend the oauth2
library. For example:
package main
import (
"github.com/jianyuan/go-sentry/v2/sentry"
"golang.org/x/oauth2"
)
func main() {
ctx := context.Background()
tokenSrc := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: "YOUR-API-KEY"},
)
httpClient := oauth2.NewClient(ctx, tokenSrc)
client := sentry.NewClient(httpClient)
// List all organizations
orgs, _, err := client.Organizations.List(ctx, nil)
}
The code structure was inspired by google/go-github.
This library is distributed under the MIT License.