sentry

package module
Version: v0.0.0-...-8d5e8bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 7 Imported by: 0

README

sentry-web-api

Golang sentry web api library https://docs.sentry.io/api/

Configuration

See https://docs.sentry.io/api/auth/ for finding your authentication token.

Set your token to an environment variable named SENTRY_AUTH_TOKEN

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GitHash is the sha hash of the current commit used to build this code.
	GitHash string
	// Version is the semantic version according to the release.
	Version string
)

Functions

This section is empty.

Types

type Avatar

type Avatar struct {
	// Type is the type of avatar set for the entity.
	Type string `json:"avatarType"`
	// ID is a uuid or empty string.
	ID string `json:"avatarUuid"`
}

Avatar is used to display an avatar for an entity.

type Client

type Client struct {
	// AuthToken is the bearer token for use in the API.
	AuthToken string

	// Domain is the base domain for the api, including https://
	Domain string

	// Timeout in seconds before an api call times out.
	Timeout time.Duration
}

Client is used to make calls to the sentry web api.

func NewClient

func NewClient(domain string, seconds int, authToken string) *Client

NewClient creates a client with the given domain to make api calls.

func (*Client) APIGet

func (c *Client) APIGet(path string) ([]byte, error)

APIGet calls the API passing in the bearer token.

func (*Client) EventList

func (c *Client) EventList(orgSlug string, projectSlug string, full bool, cursor string) ([]Event, error)

EventList returns a list for the given organization and project.

func (*Client) OrganizationList

func (c *Client) OrganizationList(owner bool, cursor string) ([]Organization, error)

OrganizationList returns the list of Organizations available to the authenticated session.

func (*Client) ProjectList

func (c *Client) ProjectList(cursor string) ([]Project, error)

ProjectList returns the list of Projects.

type Event

type Event struct {
	EventID     string    `json:"eventID"`
	Tags        []Tag     `json:"tags"`
	DateCreated time.Time `json:"dateCreated"`
	User        string    `json:"user"`
	Message     string    `json:"message"`
	Title       string    `json:"title"`
	ID          string    `json:"id"`
	Platform    string    `json:"platform"`
	EventType   string    `json:"event.type"`
	GroupID     string    `json:"groupID"`
}

Event is a sentry event related to a project.

type Organization

type Organization struct {
	// Name is the name of the org.
	Name string `json:"name"`
	// Slug is the org's unique name.
	Slug string `json:"slug"`
	// ID is the id of the org.
	ID string `json:"id"`

	// Avatar is used to display a picture for an Organziation
	Avatar Avatar `json:"avatar"`

	// DateCreated is the date the org was created.
	DateCreated time.Time `json:"dateCreated"`

	// IsEarlyAdopter flag if the org is under an early adopter account.
	IsEarlyAdopter bool `json:"isEarlyAdopter"`
}

Organization represents an org in sentry.

func (Organization) String

func (o Organization) String() string

String is formatted version of the Organization struct.

type Project

type Project struct {
	Avatar       Avatar       `json:"avatar"`
	Color        string       `json:"color"`
	DateCreated  time.Time    `json:"dateCreated"`
	Features     []string     `json:"features"`
	FirstEvent   string       `json:"firstEvent"`
	HasAccess    bool         `json:"hasAccess"`
	ID           string       `json:"id"`
	IsBookmarked bool         `json:"isBookmarked"`
	IsInternal   bool         `json:"isInternal"`
	IsMember     bool         `json:"isMember"`
	IsPublic     bool         `json:"isPublic"`
	Name         string       `json:"name"`
	Organization Organization `json:"organization"`
	Platform     string       `json:"platform"`
	Slug         string       `json:"slug"`
	Status       string       `json:"status"`
}

Project is a sentry project.

type Status

type Status struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Status is used for the status of an entity.

type Tag

type Tag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL