This is a library that implements a client in go for the sentry api. It supports all the endpoints and can do a good bit. For a full reference you can check the godoc link above.
import (
"fmt"
"github.com/atlassian/go-sentry-api"
)
// Auth token is always required, secondary is endpoint and third is timeout defaults 60 seconds
client := sentry.NewClient("yourauthtokengoeshere", nil, nil)
// Fetch your organization
org, err := client.GetOrganization("sentry")
if err != nil {
panice(err)
}
// Fetch a project you already made
project, err := client.GetProject(org, "my-project-slug")
if err != nil {
panice(err)
}
// Create a new Client DSN via the API
key, err := client.CreateClientKey(org, project, "example-dsn")
if err != nil {
panic(err)
}
fmt.Printf(key.DSN.Secret)
go get github.com/atlassian/go-sentry-api
To run tests you can setup a local sentry instance via docker. There is a
makefile command called make devenv
which will setup all of the containers.
Once complete you can then setup a environment var of SENTRY_AUTHTOKEN
and then run make test
which should go through and create and run all tests aginst localhost:8080
Pull requests, issues and comments welcome. For pull requests:
- Add tests for new features and bug fixes
- Follow the existing style
- Separate unrelated changes into multiple pull requests
See the existing issues for things to start contributing. For bigger changes, make sure you start a discussion first by creating an issue and explaining the intended change. Atlassian requires contributors to sign a Contributor License Agreement, known as a CLA. This serves as a record stating that the contributor is entitled to contribute the code/documentation/translation to the project and is willing to have it used in distributions and derivative works (or is willing to transfer ownership).
Prior to accepting your contributions we ask that you please follow the appropriate link below to digitally sign the CLA. The Corporate CLA is for those who are contributing as a member of an organization and the individual CLA is for those contributing as an individual.
Copyright (c) 2017 Atlassian and others. Apache 2.0 licensed, see LICENSE.txt file.