sentry

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

# Go Sentry API

[![godoc]( https://pkg.go.dev/badge/mod/ithub.com/GrantStreetGroup/go-sentry-api "Go Doc Reference")](https://pkg.go.dev/github.com/GrantStreetGroup/go-sentry-api)

This is a library that implements a client in go for the [sentry api](http://www.sentry.io/api/). It supports all the endpoints and can do a good bit. For a full reference you can check the godoc link above.

## Usage
### Initialization and Create New DSN Key
```go
import (
	"fmt"

	"github.com/GrantStreetGroup/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 {
	panic(err)
}

// Fetch a project you already made
project, err := client.GetProject(org, "my-project-slug")
if err != nil {
	panic(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)

```
## Installation
```
go get github.com/GrantStreetGroup/go-sentry-api
```
## Documentation
[![godoc]( https://pkg.go.dev/badge/mod/ithub.com/GrantStreetGroup/go-sentry-api "Go Doc Reference")](https://pkg.go.dev/github.com/GrantStreetGroup/go-sentry-api)

## Tests
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

## Contributors
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


## License
Copyright (c) 2017 Atlassian and others. Apache 2.0 licensed, see LICENSE.txt file.

Documentation

Overview

Package sentry provides a client to access https://sentry.io/api and sentry instances apis.

Index

Constants

View Source
const (
	// DefaultHost is the default host that is used
	DefaultHost = "https://sentry.io"
	// DefaultEndpoint is the entry point for the api
	DefaultEndpoint = "/api/0/"
	// DefaultTimeout is the default timeout and is set to 60 seconds
	DefaultTimeout = time.Duration(60) * time.Second
)
View Source
const (
	MembersEndpointName = "members"
	OrgEndpointName     = "organizations"
	UsersEndpointName   = "users"
)

Variables

View Source
var (
	AlertRuleMatchAll  = alertRuleMatchPolicy("all")
	AlertRuleMatchAny  = alertRuleMatchPolicy("any")
	AlertRuleMatchNone = alertRuleMatchPolicy("none")
)

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Detail     string `json:"detail,omitempty"`
	StatusCode int    `json:"-"`
}

APIError is used when the api returns back a non 200 response

func (APIError) Error

func (s APIError) Error() string

Error is the interface needed to transfor to a error type

type Activity

type Activity struct {
	Data        *map[string]interface{} `json:"data,omitempty"`
	DateCreated *time.Time              `json:"dateCreated,omitempty"`
	ID          *string                 `json:"id,omitempty"`
	Type        *string                 `json:"type,omitempty"`
	User        *InternalUser           `json:"user,omitempty"`
}

Activity is what current activity has happend on a issue

type AlertFilters

type AlertFilters struct {
	ID               string      `json:"id,omitempty"`
	Name             string      `json:"name,omitempty"`
	Attribute        string      `json:"attribute,omitempty"`
	Match            string      `json:"match,omitempty"`
	Value            interface{} `json:"value,omitempty"`
	Level            string      `json:"level,omitempty"`
	ComparisonType   string      `json:"comparison_type,omitempty"`
	Time             string      `json:"time,omitempty"`
	TargetType       string      `json:"targetType,omitempty"`
	TargetIdentifier string      `json:"targetIdentifier,omitempty"`
	Key              string      `json:"key,omitempty"`
}

AlertFilter represents alert filter Refer to https://github.com/getsentry/sentry/tree/master/src/sentry/rules/filters or GUI to get detailed information.

type AlertRule

type AlertRule struct {
	ID          string               `json:"id,omitempty"`
	Name        string               `json:"name,omitempty"`
	DateCreated *time.Time           `json:"dateCreated,omitempty"`
	Environment *string              `json:"environment,omitempty"`
	ActionMatch alertRuleMatchPolicy `json:"actionMatch,omitempty"`
	FilterMatch alertRuleMatchPolicy `json:"filterMatch,omitempty"`
	Frequency   uint                 `json:"frequency,omitempty"` // run actions at most once every Frequency minutes
	Conditions  []AlertRuleCondition `json:"conditions,omitempty"`
	Filters     []AlertFilters       `json:"filters,omitempty"`
	Actions     []AlertRuleAction    `json:"actions,omitempty"`
	Owner       string               `json:"owner,omitempty"`
	Status      string               `json:"status,omitempty"`
}

type AlertRuleAction

type AlertRuleAction struct {
	ID               string `json:"id,omitempty"`
	TargetType       string `json:"targetType,omitempty"`
	FallThroughType  string `json:"fallthroughType,omitempty"`
	TargetIdentifier uint   `json:"targetIdentifier,omitempty"`
	Name             string `json:"name,omitempty"`
	Service          string `json:"service,omitempty"`
	Workspace        string `json:"workspace,omitempty"`
	Channel          string `json:"channel,omitempty"`
	ChannelID        string `json:"channel_id,omitempty"`
	Tags             string `json:"tags,omitempty"`
	Account          string `json:"account,omitempty"`
}

AlertRuleAction represents alert rule action. Refer to https://github.com/getsentry/sentry/tree/master/src/sentry/rules/actions or GUI to get detailed information.

type AlertRuleCondition

type AlertRuleCondition struct {
	ID        string      `json:"id,omitempty"`
	Name      string      `json:"name,omitempty"`
	Interval  string      `json:"interval,omitempty"` // 1m, 1w, 30d etc
	Value     interface{} `json:"value,omitempty"`
	Attribute string      `json:"attribute,omitempty"`
	Key       string      `json:"key,omitempty"`
}

AlertRuleCondition represents alert rule condition. Refer to https://github.com/getsentry/sentry/tree/master/src/sentry/rules/conditions or GUI to get detailed information.

type Asset

type Asset struct {
	URL string `json:"url,omitempty"`
}

Asset is used from a testPlugin. Things like js/html

type Avatar

type Avatar struct {
	AvatarType *string `json:"avatarType,omitempty"`
	AvatarUUID *string `json:"avatarUuid,omitempty"`
}

Avatar is used for a users avatar

type Client

type Client struct {
	AuthToken  string
	Endpoint   string
	HTTPClient *http.Client
}

Client is used to talk to a sentry endpoint. Needs a auth token. If no endpoint this defaults to https://sentry.io/api/0/

func NewClient

func NewClient(authtoken string, endpoint *string, timeout *int) (*Client, error)

NewClient takes a auth token a optional endpoint and optional timeout and will return back a client and error

func (*Client) AddAlertRule

func (c *Client) AddAlertRule(o Organization, p Project, r AlertRule) (AlertRule, error)

func (*Client) AddExistingMemberToTeam

func (c *Client) AddExistingMemberToTeam(o Organization, t Team, m Member) error

AddExistingMemberToTeam takes a member and adds them to a team

func (*Client) BulkDeleteIssues

func (c *Client) BulkDeleteIssues(o Organization, p Project, issues []string) error

BulkDeleteIssues takes a list of IDs and will delete them

func (*Client) BulkMutateIssues

func (c *Client) BulkMutateIssues(o Organization, p Project, req IssueBulkRequest, issues *[]string, status *Status) (IssueBulkResponse, error)

BulkMutateIssues takes a list of ids and optional status to filter through

func (*Client) CreateClientKey

func (c *Client) CreateClientKey(o Organization, p Project, name string) (Key, error)

CreateClientKey creates a new client key for a project and org

func (*Client) CreateMember

func (c *Client) CreateMember(o Organization, email string) (Member, error)

CreateMember takes an email and creates a new member

func (*Client) CreateOrganization

func (c *Client) CreateOrganization(orgname string) (Organization, error)

CreateOrganization creates a organization with a name

func (*Client) CreateProject

func (c *Client) CreateProject(o Organization, t Team, name string, slug *string) (Project, error)

CreateProject will create a new project in your org and team

func (*Client) CreateRelease

func (c *Client) CreateRelease(o Organization, p Project, r NewRelease) (Release, error)

CreateRelease will create a new release for a project in a org

func (*Client) CreateTeam

func (c *Client) CreateTeam(o Organization, name string, slug *string) (Team, error)

CreateTeam creates a team with a organization object and requires a name and a optional slug

func (*Client) DeleteAlertRule

func (c *Client) DeleteAlertRule(o Organization, p Project, r AlertRule) error

func (*Client) DeleteClientKey

func (c *Client) DeleteClientKey(o Organization, p Project, k Key) error

DeleteClientKey deletes a client key for a project and org

func (*Client) DeleteIssue

func (c *Client) DeleteIssue(i Issue) error

DeleteIssue will delete an issue

func (*Client) DeleteMember

func (c *Client) DeleteMember(o Organization, m Member) error

DeleteMember takes a member and deletes from the org

func (*Client) DeleteOrganization

func (c *Client) DeleteOrganization(org Organization) error

DeleteOrganization will delete the Org. There is not way to revert this if you do.

func (*Client) DeleteProject

func (c *Client) DeleteProject(o Organization, p Project) error

DeleteProject will take your org, team, and proj and delete it from sentry.

func (*Client) DeleteRelease

func (c *Client) DeleteRelease(o Organization, p Project, r Release) error

DeleteRelease will delete the release from your project

func (*Client) DeleteReleaseFile

func (c *Client) DeleteReleaseFile(o Organization, p Project, r Release, f File) error

DeleteReleaseFile will remove the file from a sentry release

func (*Client) DeleteTeam

func (c *Client) DeleteTeam(o Organization, t Team) error

DeleteTeam deletes a team from a organization

func (*Client) DisablePlugin

func (c *Client) DisablePlugin(o Organization, p Project, pluginID string) error

func (*Client) EnablePlugin

func (c *Client) EnablePlugin(o Organization, p Project, pluginID string) error

func (*Client) GetAlertRules

func (c *Client) GetAlertRules(o Organization, p Project) ([]AlertRule, *Link, error)

func (*Client) GetClientKeys

func (c *Client) GetClientKeys(o Organization, p Project) ([]Key, error)

GetClientKeys fetches all client keys of the given project

func (*Client) GetIssue

func (c *Client) GetIssue(id string) (Issue, error)

GetIssue will fetch a issue by its ID as a string

func (*Client) GetIssueEvents

func (c *Client) GetIssueEvents(i Issue) ([]Event, *Link, error)

GetIssueEvents will fetch all events for a issue

func (*Client) GetIssueHashes

func (c *Client) GetIssueHashes(i Issue) ([]Hash, *Link, error)

GetIssueHashes will fetch all hashes for a issue

func (*Client) GetIssueTag

func (c *Client) GetIssueTag(i Issue, tagname string) (IssueTag, error)

GetIssueTag will fetch a tag used in a issue. Eg; environment, release, server

func (*Client) GetIssueTagValues

func (c *Client) GetIssueTagValues(i Issue, tag IssueTag) ([]IssueTagValue, *Link, error)

GetIssueTagValues will fetch all values for a issues tag

func (*Client) GetIssueTags

func (c *Client) GetIssueTags(i Issue) ([]IssueTag, *Link, error)

GetIssueTags will fetch all tags for a issue

func (*Client) GetIssues

func (c *Client) GetIssues(o Organization, p Project, StatsPeriod *string, ShortIDLookup *bool, query *string) ([]Issue, *Link, error)

GetIssues will fetch all issues for organization and project

func (*Client) GetLatestEvent

func (c *Client) GetLatestEvent(i Issue) (Event, error)

GetLatestEvent will fetch the latest event for a issue

func (*Client) GetMemberByEmail

func (c *Client) GetMemberByEmail(o Organization, memberEmail string) (Member, error)

GetMemberByEmail takes a user email and returns back the user

func (*Client) GetOldestEvent

func (c *Client) GetOldestEvent(i Issue) (Event, error)

GetOldestEvent will fetch the latest event for a issue

func (*Client) GetOrgProjects

func (c *Client) GetOrgProjects(o Organization) ([]Project, *Link, error)

GetOrgProjects fetchs all projects belonging to a organization

func (*Client) GetOrganization

func (c *Client) GetOrganization(orgslug string) (Organization, error)

GetOrganization takes a org slug and returns back the org

func (*Client) GetOrganizationMember

func (c *Client) GetOrganizationMember(orgslug string, memberID string) (Member, error)

GetOrganizationMember returns the member associated with orgslug and memberID

func (*Client) GetOrganizationStats

func (c *Client) GetOrganizationStats(org Organization, stat StatQuery, since, until int64, resolution *string) ([]Stat, error)

GetOrganizationStats fetches stats from the org. Needs a Organization, a StatQuery, a timestamp in seconds since epoch and a optional resolution

func (*Client) GetOrganizationTeams

func (c *Client) GetOrganizationTeams(o Organization) ([]Team, error)

GetOrganizationTeams will fetch all teams for this org

func (*Client) GetOrganizations

func (c *Client) GetOrganizations() ([]Organization, *Link, error)

GetOrganizations will return back every organization in the sentry instance

func (*Client) GetPage

func (c *Client) GetPage(p Page, out interface{}) (*Link, error)

GetPage will fetch a page via the Link object and decode it from out. Should be used like `client.GetPage(link.Previous, make([]Organization, 0))`

func (*Client) GetPlugin

func (c *Client) GetPlugin(o Organization, p Project, pluginID string) (plugin Plugin, err error)

func (*Client) GetProject

func (c *Client) GetProject(o Organization, projslug string) (Project, error)

GetProject takes a project slug and returns back the project

func (*Client) GetProjectEvent

func (c *Client) GetProjectEvent(o Organization, p Project, eventID string) (Event, error)

GetProjectEvent will fetch a event on a project

func (*Client) GetProjectStats

func (c *Client) GetProjectStats(o Organization, p Project, stat StatQuery, since, until int64, resolution *string) ([]Stat, error)

GetProjectStats will fetch all stats for a specific project. Similar to GetOrganizationStats

func (*Client) GetProjectUserFeedback

func (c *Client) GetProjectUserFeedback(o Organization, p Project) ([]UserFeedback, *Link, error)

GetProjectUserFeedback is used to fetch all feedback given for a certain project

func (*Client) GetProjects

func (c *Client) GetProjects() ([]Project, *Link, error)

GetProjects fetchs all projects in a sentry instance

func (*Client) GetRelease

func (c *Client) GetRelease(o Organization, p Project, version string) (Release, error)

GetRelease will fetch a release from your org and project this does need a version string

func (*Client) GetReleaseFile

func (c *Client) GetReleaseFile(o Organization, p Project, r Release, id string) (File, error)

GetReleaseFile will get the release file

func (*Client) GetReleaseFiles

func (c *Client) GetReleaseFiles(o Organization, p Project, r Release) ([]File, error)

GetReleaseFiles will fetch all files in a release

func (*Client) GetReleases

func (c *Client) GetReleases(o Organization, p Project) ([]Release, *Link, error)

GetReleases will fetch all releases from your org and project

func (*Client) GetTeam

func (c *Client) GetTeam(o Organization, teamSlug string) (Team, error)

GetTeam takes a team slug and returns back the team

func (*Client) GetTeamProjects

func (c *Client) GetTeamProjects(o Organization, t Team) ([]Project, error)

GetTeamProjects fetchs all projects for a Team

func (*Client) GetTeamStats

func (c *Client) GetTeamStats(o Organization, t Team, stat StatQuery, since, until int64, resolution *string) ([]Stat, error)

GetTeamStats will fetch all stats for a specific team. Similar to GetOrganizationStats

func (*Client) GetTeams

func (c *Client) GetTeams(o Organization) ([]Team, *Link, error)

GetTeams will take a organization and retrieve a list of teams

func (*Client) ListOrganizationUsers

func (c *Client) ListOrganizationUsers(orgslug string) ([]User, error)

ListOrganizationUsers returns users in the organization identified by orgslug

func (*Client) MakeAdmin

func (c *Client) MakeAdmin(o Organization, a Member) error

MakeAdmin takes a member and makes them admin

func (*Client) SetClientKeyRateLimit

func (c *Client) SetClientKeyRateLimit(o Organization, p Project, k Key, count, window int) (Key, error)

SetClientKeyRateLimit updates the rate limit only of a key. window is in seconds.

func (*Client) SetPluginConfig

func (c *Client) SetPluginConfig(o Organization, p Project, pluginID string, config map[string]interface{}) (plugin Plugin, err error)

func (*Client) SubmitUserFeedback

func (c *Client) SubmitUserFeedback(o Organization, p Project, u *UserFeedback) error

SubmitUserFeedback is used when you want to submit feedback to a organizations project

func (*Client) UpdateAlertRule

func (c *Client) UpdateAlertRule(o Organization, p Project, r AlertRule) (AlertRule, error)

func (*Client) UpdateClientKey

func (c *Client) UpdateClientKey(o Organization, p Project, k Key, name string) (Key, error)

UpdateClientKey updates the name only of a key

func (*Client) UpdateIssue

func (c *Client) UpdateIssue(i Issue) error

UpdateIssue will update status, assign to, hasseen, isbookmarked and issubscribed

func (*Client) UpdateOrganization

func (c *Client) UpdateOrganization(org Organization) error

UpdateOrganization takes a organization and updates it on the server side

func (*Client) UpdateProject

func (c *Client) UpdateProject(o Organization, p Project) error

UpdateProject takes a organization and project then updates it on the server side

func (*Client) UpdateRelease

func (c *Client) UpdateRelease(o Organization, p Project, r Release) error

UpdateRelease will update ref, url, started, released for a release. Version should not change.

func (*Client) UpdateReleaseFile

func (c *Client) UpdateReleaseFile(o Organization, p Project, r Release, f File) error

UpdateReleaseFile will update just the name of the release file

func (*Client) UpdateTeam

func (c *Client) UpdateTeam(o Organization, t Team) error

UpdateTeam will update a team on the server side

func (*Client) UploadReleaseFile

func (c *Client) UploadReleaseFile(o Organization, p Project, r Release,
	name string, buffer io.Reader, header string) (File, error)

UploadReleaseFile will upload a file to release

type DSN

type DSN struct {
	Secret string `json:"secret,omitempty"`
	CSP    string `json:"csp,omitempty"`
	Public string `json:"public,omitempty"`
}

DSN is the actual connection strings used to send errors

type Entry

type Entry struct {
	Type string          `json:"type,omitempty"`
	Data json.RawMessage `json:"data,omitempty"`
}

Entry is the entry for the message/stacktrace/etc...

func (*Entry) GetInterface

func (e *Entry) GetInterface() (string, interface{}, error)

GetInterface will convert the entry into a go interface

type Event

type Event struct {
	EventID         string                  `json:"eventID,omitempty"`
	UserReport      *string                 `json:"userReport,omitempty"`
	NextEventID     *string                 `json:"nextEventID,omitempty"`
	PreviousEventID *string                 `json:"previousEventID,omitempty"`
	Message         *string                 `json:"message,omitempty"`
	ID              *string                 `json:"id,omitempty"`
	Size            *int                    `json:"size,omitempty"`
	Platform        *string                 `json:"platform,omitempty"`
	Type            *string                 `json:"type,omitempty"`
	Metadata        *map[string]string      `json:"metadata,omitempty"`
	Tags            *[]Tag                  `json:"tags,omitempty"`
	DateCreated     *time.Time              `json:"dateCreated,omitempty"`
	DateReceived    *time.Time              `json:"dateReceived,omitempty"`
	User            *User                   `json:"user,omitempty"`
	Entries         []Entry                 `json:"entries,omitempty"`
	Packages        *map[string]string      `json:"packages,omitempty"`
	SDK             *map[string]interface{} `json:"sdk,omitempty"`
	Contexts        *map[string]interface{} `json:"contexts,omitempty"`
	Context         *map[string]interface{} `json:"context,omitempty"`
	Release         *Release                `json:"release,omitempty"`
	GroupID         *string                 `json:"groupID,omitempty"`
}

Event is the event that was created on the app and sentry reported on

type File

type File struct {
	SHA1        string            `json:"sha1,omitempty"`
	Name        string            `json:"name,omitempty"`
	DateCreated time.Time         `json:"dateCreated,omitempty"`
	Headers     map[string]string `json:"headers,omitempty"`
	ID          string            `json:"id,omitempty"`
	Size        int               `json:"size,omitempty"`
}

File is used to create a new file for a release

type Hash

type Hash struct {
	ID string `json:"id,omitempty"`
}

Hash is returned via the issue_id/hashes

type InternalUser

type InternalUser struct {
	AvatarURL  *string    `json:"avatarUrl,omitempty"`
	DateJoined *time.Time `json:"dateJoined,omitempty"`
	Email      *string    `json:"email,omitempty"`
	Has2FA     *bool      `json:"has2fa,omitempty"`
	ID         *string    `json:"iD,omitempty"`
	IsActive   *bool      `json:"isActive,omitempty"`
	IsManaged  *bool      `json:"isManaged,omitempty"`
	LastLogin  *time.Time `json:"lastLogin,omitempty"`
	Name       *string    `json:"name,omitempty"`
	Username   *string    `json:"username,omitempty"`
}

InternalUser is a user on sentry and not a external customer

type Issue

type Issue struct {
	Annotations         *[]string               `json:"annotations,omitempty"`
	AssignedTo          *InternalUser           `json:"assignedTo,omitempty"`
	Activity            *[]Activity             `json:"activity,omitempty"`
	Count               *string                 `json:"count,omitempty"`
	Culprit             *string                 `json:"culprit,omitempty"`
	FirstSeen           *time.Time              `json:"firstSeen,omitempty"`
	HasSeen             *bool                   `json:"hasSeen,omitempty"`
	ID                  *string                 `json:"id,omitempty"`
	IsBookmarked        *bool                   `json:"isBookmarked,omitempty"`
	IsPublic            *bool                   `json:"isPublic,omitempty"`
	IsSubscribed        *bool                   `json:"isSubscribed,omitempty"`
	LastSeen            *time.Time              `json:"lastSeen,omitempty"`
	Level               *string                 `json:"level,omitempty"`
	Logger              *string                 `json:"logger,omitempty"`
	Metadata            *map[string]interface{} `json:"metadata,omitempty"`
	NumComments         *int                    `json:"numComments,omitempty"`
	Permalink           *string                 `json:"permalink,omitempty"`
	Project             *Project                `json:"project,omitempty"`
	ShareID             *string                 `json:"shareId,omitempty"`
	ShortID             *string                 `json:"shortId,omitempty"`
	Stats               *IssueStats             `json:"stats,omitempty"`
	Status              *Status                 `json:"status,omitempty"`
	StatusDetails       *map[string]interface{} `json:"statusDetails,omitempty"`
	SubscriptionDetails *map[string]string      `json:"subscriptionDetails,omitempty"`
	Tags                *[]IssueTag             `json:"tags,omitempty"`
	Title               *string                 `json:"title,omitempty"`
	Type                *string                 `json:"type,omitempty"`
	UserCount           *int                    `json:"userCount,omitempty"`
	UserReportCount     *int                    `json:"userReportCount,omitempty"`
}

Issue returns a issue found in sentry

type IssueBulkRequest

type IssueBulkRequest struct {
	Status         *Status `json:"status,omitempty"`
	IgnoreDuration *int    `json:"ignoreDuration,omitempty"`
	IsPublic       *bool   `json:"isPublic,omitempty"`
	Merge          *bool   `json:"merge,omitempty"`
	HasSeen        *bool   `json:"hasSeen,omitempty"`
	IsBookmarked   *bool   `json:"isBookmarked,omitempty"`
}

IssueBulkRequest is what should be used when bulk mutate issue

type IssueBulkResponse

type IssueBulkResponse struct {
	Status        *Status            `json:"status,omitempty"`
	IsPublic      *bool              `json:"isPublic,omitempty"`
	StatusDetails *map[string]string `json:"statusDetails,omitempty"`
}

IssueBulkResponse is what is returned when your mutation is done

type IssueStats

type IssueStats struct {
	TwentyFourHour *[]Stat `json:"24h,omitempty"`
	FourteenDays   *[]Stat `json:"14d,omitempty"`
	ThirtyDays     *[]Stat `json:"30d,omitempty"`
}

IssueStats is the stats of a issue

type IssueTag

type IssueTag struct {
	UniqueValues int             `json:"uniqueValues,omitempty"`
	ID           string          `json:"id,omitempty"`
	Key          string          `json:"key,omitempty"`
	Name         string          `json:"name,omitempty"`
	TopValues    []IssueTagValue `json:"topValues,omitempty"`
}

IssueTag is a tag used in a sentry issue

type IssueTagValue

type IssueTagValue struct {
	Count     *int64     `json:"count,omitempty"`
	FirstSeen *time.Time `json:"firstSeen,omitempty"`
	ID        *string    `json:"iD,omitempty"`
	Key       *string    `json:"key,omitempty"`
	LastSeen  *time.Time `json:"lastSeen,omitempty"`
	Name      *string    `json:"name,omitempty"`
	Value     *string    `json:"value,omitempty"`
}

IssueTagValue represents a tags value

type Key

type Key struct {
	Label       string        `json:"label,omitempty"`
	DSN         DSN           `json:"dsn,omitempty"`
	Secret      string        `json:"secret,omitempty"`
	ID          string        `json:"id,omitempty"`
	DateCreated time.Time     `json:"dateCreated,omitempty"`
	Public      string        `json:"public,omitempty"`
	RateLimit   *KeyRateLimit `json:"rateLimit,omitempty"`
}

Key is a DSN that sentry has made

type KeyRateLimit

type KeyRateLimit struct {
	Count  int `json:"count"`
	Window int `json:"window"`
}

KeyRateLimit is the rate limit for a DSN

type Link struct {
	Previous Page
	Next     Page
}

Link represents a link object as per: https://docs.sentry.io/api/pagination/

func NewLink(linkheader string) *Link

NewLink creates a new link object via the link header string

type Member

type Member struct {
	Email       string     `json:"email,omitempty"`
	Expired     *bool      `json:"expired,omitempty"`
	Name        *string    `json:"name,omitempty"`
	IsPending   *bool      `json:"isPending,omitempty"`
	DateCreated *time.Time `json:"dateCreated,omitempty"`
	Role        string     `json:"role,omitempty"`
	ID          *string    `json:"id,omitempty"`
	RoleName    *string    `json:"roleName,omitempty"`
	Teams       []string   `json:"teams,omitempty"`
}

Member is a sentry member

type NewRelease

type NewRelease struct {
	// Optional commit ref.
	Ref *string `json:"ref,omitempty"`

	// Optional URL to point to the online source code
	URL *string `json:"url,omitempty"`

	// Required for creating the release
	Version string `json:"version"`

	// Optional to set when it started
	DateStarted *time.Time `json:"dateStarted,omitempty"`

	// Optional to set when it was released to the public
	DateReleased *time.Time `json:"dateReleased,omitempty"`
}

NewRelease is used to create a new release

type Organization

type Organization struct {
	PendingAccessRequest *int       `json:"pendingAccessRequests,omitempty"`
	Slug                 *string    `json:"slug,omitempty"`
	Name                 string     `json:"name"`
	Quota                *Quota     `json:"quota,omitempty"`
	DateCreated          *time.Time `json:"dateCreated,omitempty"`
	Teams                *[]Team    `json:"teams,omitempty"`
	ID                   *string    `json:"id,omitempty"`
	IsEarlyAdopter       *bool      `json:"isEarlyAdopter,omitempty"`
	Features             *[]string  `json:"features,omitempty"`
}

Organization is your sentry organization.

type Page

type Page struct {
	URL     string
	Results bool
}

Page is a link and if it has results or not

type Plugin

type Plugin struct {
	Assets     []Asset                `json:"assets,omitempty"`
	IsTestable bool                   `json:"isTestable,omitempty"`
	Enabled    bool                   `json:"enabled,omitempty"`
	Name       string                 `json:"name,omitempty"`
	CanDisable bool                   `json:"canDisable,omitempty"`
	Type       string                 `json:"type,omitempty"`
	ID         string                 `json:"id,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
	Config     []PluginConfigItem     `json:"config,omitempty"`
}

Plugin is a type of project testPlugin

type PluginConfigItem

type PluginConfigItem struct {
	ReadOnly     bool          `json:"readonly,omitempty"`
	Choices      []interface{} `json:"choices,omitempty"`
	Placeholder  string        `json:"placeholder,omitempty"`
	Name         string        `json:"name,omitempty"`
	Help         string        `json:"help,omitempty"`
	DefaultValue interface{}   `json:"defaultValue,omitempty"`
	Required     bool          `json:"required,omitempty"`
	Type         string        `json:"type,omitempty"`
	Value        interface{}   `json:"value,omitempty"`
	Label        string        `json:"label,omitempty"`
}

PluginConfigItem describes testPlugin option

type Project

type Project struct {
	Status             string                  `json:"status,omitempty"`
	Slug               *string                 `json:"slug,omitempty"`
	DefaultEnvironment *string                 `json:"defaultEnvironment,omitempty"`
	Color              *string                 `json:"color,omitempty"`
	IsPublic           bool                    `json:"isPublic,omitempty"`
	DateCreated        *time.Time              `json:"dateCreated,omitempty"`
	CallSign           string                  `json:"callSign,omitempty"`
	FirstEvent         *time.Time              `json:"firstEvent,omitempty"`
	IsBookmarked       bool                    `json:"isBookmarked,omitempty"`
	CallSignReviewed   bool                    `json:"callSignReviewed,omitempty"`
	ID                 string                  `json:"id,omitempty"`
	Name               string                  `json:"name"`
	Platforms          *[]string               `json:"platforms,omitempty"`
	Options            *map[string]interface{} `json:"options,omitempty"`
	Plugins            *[]Plugin               `json:"plugins,omitempty"`
	Team               *Team                   `json:"team,omitempty"`
	Organization       *Organization           `json:"organization,omitempty"`
	DigestMinDelay     *int                    `json:"digestMinDelay,omitempty"`
	DigestMaxDelay     *int                    `json:"digestMaxDelay,omitempty"`
	VerifySSL          *bool                   `json:"verifySSL,omitempty"`
}

Project is your project in sentry

type QueryArgs

type QueryArgs interface {
	ToQueryString() string
}

QueryArgs is a simple internal interface

type Quota

type Quota struct {
	ProjectLimit int `json:"projectLimit"`
	MaxRate      int `json:"maxRate"`
}

Quota is your quote for a project limit and max rate

type Release

type Release struct {
	DateCreated  *time.Time `json:"dateCreated,omitempty"`
	DateReleased *time.Time `json:"dateReleased,omitempty"`
	DateStarted  *time.Time `json:"dateStarted,omitempty"`
	FirstEvent   *time.Time `json:"firstEvent,omitempty"`
	LastEvent    *time.Time `json:"lastEvent,omitempty"`
	NewGroups    *int       `json:"newGroups,omitempty"`
	Owner        *string    `json:"owner,omitempty"`
	Ref          *string    `json:"ref,omitempty"`
	ShortVersion string     `json:"shortVersion"`
	URL          *string    `json:"url,omitempty"`
	Version      string     `json:"version"`
}

Release is your release for a orgs teams project

type Stat

type Stat [2]float64

Stat is used for tetting a time in seconds and the metric in a float

type StatQuery

type StatQuery string

StatQuery is sample type for sending to /stats/ endpoints

const (
	// StatReceived is set to received for sending to /stats/ endpoints
	StatReceived StatQuery = "received"
	// StatRejected is set to rejected for sending to /stats/ endpoints
	StatRejected StatQuery = "rejected"
	// StatBlacklisted is set to blacklisted for sending to /stats/ endpoints
	StatBlacklisted StatQuery = "blacklisted"
)

type Status

type Status string

Status is used to make consts for statuses

const (
	// Resolved helps mark a issue or others as resolved
	Resolved Status = "resolved"
	// Unresolved helps mark a issue or others as unresolved
	Unresolved Status = "unresolved"
	// Ignored helps mark a issue or others as ignored
	Ignored Status = "ignored"
)

type Tag

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

Tag is used for a event

type Team

type Team struct {
	Slug        *string    `json:"slug,omitempty"`
	Name        string     `json:"name"`
	HasAccess   *bool      `json:"hasAccess,omitempty"`
	IsPending   *bool      `json:"isPending,omitempty"`
	DateCreated *time.Time `json:"dateCreated,omitempty"`
	IsMember    *bool      `json:"isMember,omitempty"`
	ID          *string    `json:"id,omitempty"`
	Projects    *[]Project `json:"projects,omitempty"`
}

Team is a sentry team

type User

type User struct {
	Username *string  `json:"username,omitempty"`
	Email    *string  `json:"email,omitempty"`
	ID       *string  `json:"id,omitempty"`
	Name     *string  `json:"name,omitempty"`
	Role     *string  `json:"role,omitempty"`
	RoleName *string  `json:"roleName,omitempty"`
	Projects []string `json:"projects,omitempty"`
}

User is the user that was affected

type UserFeedback

type UserFeedback struct {
	EventID     *string    `json:"event_id,omitempty"`
	Name        *string    `json:"name,omitempty"`
	Comments    *string    `json:"comments,omitempty"`
	Email       *string    `json:"email,omitempty"`
	DateCreated *time.Time `json:"dateCreated,omitempty"`
	Issue       *Issue     `json:"issue,omitempty"`
	ID          *string    `json:"id,omitempty"`
}

UserFeedback is the feedback on a given project and issue

func NewUserFeedback

func NewUserFeedback(name, comments, email, eventID string) UserFeedback

NewUserFeedback will generate a new UserFeedback and type correctly

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL