Documentation ¶
Overview ¶
Package newreleases is the NewReleases API v1 client for Go.
Index ¶
- Variables
- func Bool(v bool) (p *bool)
- func String(v string) (p *string)
- type AuthKey
- type AuthService
- type BadRequestError
- type Client
- type ClientOptions
- type DiscordChannel
- type DiscordChannelsService
- type EmailNotification
- type Exclusion
- type HangoutsChatWebhooksService
- type MatrixRoom
- type MatrixRoomsService
- type MattermostWebhooksService
- type MicrosoftTeamsWebhooksService
- type Project
- type ProjectListOptions
- type ProjectListOrder
- type ProjectOptions
- type ProjectsService
- func (s *ProjectsService) Add(ctx context.Context, provider, name string, o *ProjectOptions) (project *Project, err error)
- func (s *ProjectsService) DeleteByID(ctx context.Context, id string) (err error)
- func (s *ProjectsService) DeleteByName(ctx context.Context, provider, name string) (err error)
- func (s *ProjectsService) GetByID(ctx context.Context, id string) (project *Project, err error)
- func (s *ProjectsService) GetByName(ctx context.Context, provider, name string) (project *Project, err error)
- func (s *ProjectsService) List(ctx context.Context, o ProjectListOptions) (projects []Project, lastPage int, err error)
- func (s *ProjectsService) Search(ctx context.Context, query, provider string) (projects []Project, err error)
- func (s *ProjectsService) UpdateByID(ctx context.Context, id string, o *ProjectOptions) (project *Project, err error)
- func (s *ProjectsService) UpdateByName(ctx context.Context, provider, name string, o *ProjectOptions) (project *Project, err error)
- type ProvidersService
- type Rate
- type Release
- type ReleaseNote
- type ReleasesService
- func (s *ReleasesService) GetByProjectID(ctx context.Context, projectID, version string) (release *Release, err error)
- func (s *ReleasesService) GetByProjectName(ctx context.Context, provider, projectName, version string) (release *Release, err error)
- func (s *ReleasesService) GetLatestByProjectID(ctx context.Context, projectID string) (release *Release, err error)
- func (s *ReleasesService) GetLatestByProjectName(ctx context.Context, provider, projectName string) (release *Release, err error)
- func (s *ReleasesService) GetNoteByProjectID(ctx context.Context, projectID string, version string) (release *ReleaseNote, err error)
- func (s *ReleasesService) GetNoteByProjectName(ctx context.Context, provider, projectName string, version string) (release *ReleaseNote, err error)
- func (s *ReleasesService) ListByProjectID(ctx context.Context, projectID string, page int) (releases []Release, lastPage int, err error)
- func (s *ReleasesService) ListByProjectName(ctx context.Context, provider, projectName string, page int) (releases []Release, lastPage int, err error)
- type RocketchatWebhooksService
- type SlackChannel
- type SlackChannelsService
- type Tag
- type TagsService
- func (s *TagsService) Add(ctx context.Context, name string) (tag *Tag, err error)
- func (s *TagsService) Delete(ctx context.Context, id string) error
- func (s *TagsService) Get(ctx context.Context, id string) (tag *Tag, err error)
- func (s *TagsService) List(ctx context.Context) (tags []Tag, err error)
- func (s *TagsService) Update(ctx context.Context, id, name string) (tag *Tag, err error)
- type TelegramChat
- type TelegramChatsService
- type Webhook
- type WebhooksService
Constants ¶
This section is empty.
Variables ¶
var ( ErrForbidden = errors.New("forbidden") ErrNotFound = errors.New("not found") ErrMethodNotAllowed = errors.New("method not allowed") ErrTooManyRequests = errors.New("too many requests") ErrInternalServerError = errors.New("internal server error") ErrMaintenance = errors.New("maintenance") )
Errors that are returned by the API.
Functions ¶
Types ¶
type AuthKey ¶
type AuthKey struct { Name string `json:"name"` Secret string `json:"secret"` AuthorizedNetworks []net.IPNet `json:"authorized_networks"` }
AuthKey represents API authentication secret key, with its descriptive name and authorized networks.
func GetAuthKeys ¶
func GetAuthKeys(ctx context.Context, email, password string, o *ClientOptions) (keys []AuthKey, err error)
GetAuthKeys returns a list of all auth keys for an account by authenticating with account's email address and a password. This function can be used to get the authentication key without providing it explicitly to the client, but first asking for already known (to the user) credentials.
type AuthService ¶
type AuthService service
AuthService provides information about API authentication.
type BadRequestError ¶
type BadRequestError struct {
// contains filtered or unexported fields
}
BadRequestError holds list of errors from http response that represent invalid data submitted by the user.
func NewBadRequestError ¶
func NewBadRequestError(errors ...string) (err *BadRequestError)
NewBadRequestError constructs a new BadRequestError with provided errors.
func (*BadRequestError) Error ¶
func (e *BadRequestError) Error() (s string)
func (*BadRequestError) Errors ¶
func (e *BadRequestError) Errors() (errs []string)
Errors returns a list of error messages.
type Client ¶
type Client struct { // Services that API provides. Auth *AuthService Providers *ProvidersService Projects *ProjectsService Releases *ReleasesService SlackChannels *SlackChannelsService TelegramChats *TelegramChatsService DiscordChannels *DiscordChannelsService HangoutsChatWebhooks *HangoutsChatWebhooksService MicrosoftTeamsWebhooks *MicrosoftTeamsWebhooksService MattermostWebhooks *MattermostWebhooksService RocketchatWebhooks *RocketchatWebhooksService MatrixRooms *MatrixRoomsService Webhooks *WebhooksService Tags *TagsService // contains filtered or unexported fields }
Client manages communication with the NewReleases API.
func NewClient ¶
func NewClient(key string, o *ClientOptions) (c *Client)
NewClient constructs a new Client that uses API key authentication.
type ClientOptions ¶
ClientOptions holds optional parameters for the Client.
type DiscordChannel ¶ added in v1.3.0
DiscordChannel holds information about a Discord Channel that is connected to the account.
type DiscordChannelsService ¶ added in v1.3.0
type DiscordChannelsService service
DiscordChannelsService provides information about Discord notifications.
func (*DiscordChannelsService) List ¶ added in v1.3.0
func (s *DiscordChannelsService) List(ctx context.Context) (channels []DiscordChannel, err error)
List returns all connected Discord Channels.
type EmailNotification ¶
type EmailNotification string
EmailNotification enumerates available options for email notifications.
var ( EmailNotificationNone EmailNotification = "none" EmailNotificationInstant EmailNotification = "instant" EmailNotificationHourly EmailNotification = "hourly" EmailNotificationDaily EmailNotification = "daily" EmailNotificationWeekly EmailNotification = "weekly" EmailNotificationDefault EmailNotification = "default" )
Available email notification options.
type Exclusion ¶
Exclusion holds information about a regular expression used to filter release versions.
type HangoutsChatWebhooksService ¶
type HangoutsChatWebhooksService service
HangoutsChatWebhooksService provides information about Google Hangouts Chat Webhooks notifications.
type MatrixRoom ¶ added in v1.9.0
type MatrixRoom struct { ID string `json:"id"` Name string `json:"name"` HomeserverURL string `json:"homeserver_url"` InternalRoomID string `json:"internal_room_id"` }
MatrixRoom holds information about a Slack Channel that is connected to the account.
type MatrixRoomsService ¶ added in v1.9.0
type MatrixRoomsService service
MatrixRoomsService provides information about Matrix notifications.
func (*MatrixRoomsService) List ¶ added in v1.9.0
func (s *MatrixRoomsService) List(ctx context.Context) (rooms []MatrixRoom, err error)
List returns all Matrix rooms.
type MattermostWebhooksService ¶ added in v1.6.0
type MattermostWebhooksService service
MattermostWebhooksService provides information about Mattermost Webhooks notifications.
type MicrosoftTeamsWebhooksService ¶
type MicrosoftTeamsWebhooksService service
MicrosoftTeamsWebhooksService provides information about Microsoft Teams Webhooks notifications.
type Project ¶
type Project struct { ID string `json:"id"` Name string `json:"name"` Provider string `json:"provider"` URL string `json:"url"` EmailNotification EmailNotification `json:"email_notification,omitempty"` SlackIDs []string `json:"slack_channels,omitempty"` TelegramChatIDs []string `json:"telegram_chats,omitempty"` DiscordIDs []string `json:"discord_channels,omitempty"` HangoutsChatWebhookIDs []string `json:"hangouts_chat_webhooks,omitempty"` MSTeamsWebhookIDs []string `json:"microsoft_teams_webhooks,omitempty"` MattermostWebhookIDs []string `json:"mattermost_webhooks,omitempty"` RocketchatWebhookIDs []string `json:"rocketchat_webhooks,omitempty"` MatrixRoomIDs []string `json:"matrix_rooms,omitempty"` WebhookIDs []string `json:"webhooks,omitempty"` Exclusions []Exclusion `json:"exclude_version_regexp,omitempty"` ExcludePrereleases bool `json:"exclude_prereleases,omitempty"` ExcludeUpdated bool `json:"exclude_updated,omitempty"` Note string `json:"note,omitempty"` TagIDs []string `json:"tags,omitempty"` }
Project holds information about a tracked project and its configured options.
type ProjectListOptions ¶
type ProjectListOptions struct { Page int Order ProjectListOrder Reverse bool Provider string TagID string }
ProjectListOptions holds information about a project list page.
type ProjectListOrder ¶
type ProjectListOrder string
ProjectListOrder enumerates available project list orders.
var ( ProjectListOrderUpdated ProjectListOrder = "updated" ProjectListOrderAdded ProjectListOrder = "added" ProjectListOrderName ProjectListOrder = "name" )
Available project list orders.
type ProjectOptions ¶
type ProjectOptions struct { EmailNotification *EmailNotification `json:"email_notification"` SlackIDs []string `json:"slack_channels"` TelegramChatIDs []string `json:"telegram_chats"` DiscordIDs []string `json:"discord_channels"` HangoutsChatWebhookIDs []string `json:"hangouts_chat_webhooks"` MSTeamsWebhookIDs []string `json:"microsoft_teams_webhooks"` MattermostWebhookIDs []string `json:"mattermost_webhooks"` MatrixRoomIDs []string `json:"matrix_rooms"` RocketchatWebhookIDs []string `json:"rocketchat_webhooks"` WebhookIDs []string `json:"webhooks"` Exclusions []Exclusion `json:"exclude_version_regexp"` ExcludePrereleases *bool `json:"exclude_prereleases"` ExcludeUpdated *bool `json:"exclude_updated"` Note *string `json:"note"` TagIDs []string `json:"tags"` }
ProjectOptions holds information for setting options for a specific project. If any of the fields have nil value, the option is not set by Add method or changed by UpdateByID or UpdateByName methods. When using update methods, removing all elements must be done by setting an initialized slice, not a nil slice. For boolean pointer methods, there is a convenient functions Bool and String that return boolean pointer by passing a regular value.
type ProjectsService ¶
type ProjectsService service
ProjectsService provides information and methods to manage tracked projects.
func (*ProjectsService) Add ¶
func (s *ProjectsService) Add(ctx context.Context, provider, name string, o *ProjectOptions) (project *Project, err error)
Add adds a new project to be tracked.
func (*ProjectsService) DeleteByID ¶
func (s *ProjectsService) DeleteByID(ctx context.Context, id string) (err error)
DeleteByID removes a project referenced by its ID.
func (*ProjectsService) DeleteByName ¶
func (s *ProjectsService) DeleteByName(ctx context.Context, provider, name string) (err error)
DeleteByName removes a project referenced by its provider and name.
func (*ProjectsService) GetByName ¶
func (s *ProjectsService) GetByName(ctx context.Context, provider, name string) (project *Project, err error)
GetByName returns a specific project referenced by its provider and name.
func (*ProjectsService) List ¶
func (s *ProjectsService) List(ctx context.Context, o ProjectListOptions) (projects []Project, lastPage int, err error)
List returns a paginated list of tracked projects and the number of the last available page.
func (*ProjectsService) Search ¶
func (s *ProjectsService) Search(ctx context.Context, query, provider string) (projects []Project, err error)
Search performs a search with provided query on names of all tracked projects. Provider argument is optional and all projects are searched if it is a blank string.
func (*ProjectsService) UpdateByID ¶
func (s *ProjectsService) UpdateByID(ctx context.Context, id string, o *ProjectOptions) (project *Project, err error)
UpdateByID changes project options referenced by its ID.
func (*ProjectsService) UpdateByName ¶
func (s *ProjectsService) UpdateByName(ctx context.Context, provider, name string, o *ProjectOptions) (project *Project, err error)
UpdateByName changes project options referenced by its provider and name.
type ProvidersService ¶
type ProvidersService service
ProvidersService provides information about supported project providers and providers for projects that are added for tracking.
type Rate ¶
type Rate struct { Limit int // The maximum number of requests that the user is permitted to make per hour. Remaining int // The number of requests remaining in the current rate limit window. Reset time.Time // Seconds until current rate limit window will reset to the maximal value. Retry time.Time // Seconds until new requests are permitted when limit is reached. }
Rate contains the request rate limit information.
type Release ¶
type Release struct { Version string `json:"version"` Date time.Time `json:"date"` CVE []string `json:"cve,omitempty"` IsPrerelease bool `json:"is_prerelease,omitempty"` IsUpdated bool `json:"is_updated,omitempty"` IsExcluded bool `json:"is_excluded,omitempty"` HasNote bool `json:"has_note,omitempty"` }
Release holds information about a specific released version.
type ReleaseNote ¶
type ReleaseNote struct { Title string `json:"title,omitempty"` Message string `json:"message,omitempty"` URL string `json:"url,omitempty"` }
ReleaseNote holds information about an additional note for a specific version.
type ReleasesService ¶
type ReleasesService service
ReleasesService provides information about releases for every project that is tracked.
func (*ReleasesService) GetByProjectID ¶
func (s *ReleasesService) GetByProjectID(ctx context.Context, projectID, version string) (release *Release, err error)
GetByProjectID returns a specific version release for a project referenced by its ID.
func (*ReleasesService) GetByProjectName ¶
func (s *ReleasesService) GetByProjectName(ctx context.Context, provider, projectName, version string) (release *Release, err error)
GetByProjectName returns a specific version release for a project referenced by its provider and name.
func (*ReleasesService) GetLatestByProjectID ¶ added in v1.10.0
func (s *ReleasesService) GetLatestByProjectID(ctx context.Context, projectID string) (release *Release, err error)
GetLatestByProjectID returns the latest non-excluded version release for a project referenced by its ID.
func (*ReleasesService) GetLatestByProjectName ¶ added in v1.10.0
func (s *ReleasesService) GetLatestByProjectName(ctx context.Context, provider, projectName string) (release *Release, err error)
GetLatestByProjectName returns the latest non-excluded version release for a project referenced by its provider and name.
func (*ReleasesService) GetNoteByProjectID ¶
func (s *ReleasesService) GetNoteByProjectID(ctx context.Context, projectID string, version string) (release *ReleaseNote, err error)
GetNoteByProjectID returns a specific release note for a project referenced by its ID.
func (*ReleasesService) GetNoteByProjectName ¶
func (s *ReleasesService) GetNoteByProjectName(ctx context.Context, provider, projectName string, version string) (release *ReleaseNote, err error)
GetNoteByProjectName returns a specific release note for a project referenced by its provider and name.
func (*ReleasesService) ListByProjectID ¶
func (s *ReleasesService) ListByProjectID(ctx context.Context, projectID string, page int) (releases []Release, lastPage int, err error)
ListByProjectID returns a paginated list of project releases and the number of the last page. The project is referenced by its ID.
func (*ReleasesService) ListByProjectName ¶
func (s *ReleasesService) ListByProjectName(ctx context.Context, provider, projectName string, page int) (releases []Release, lastPage int, err error)
ListByProjectName returns a paginated list of project releases and the number of the last page. The project is referenced by its provider and name.
type RocketchatWebhooksService ¶ added in v1.7.0
type RocketchatWebhooksService service
RocketchatWebhooksService provides information about Rocket.Chat Webhooks notifications.
type SlackChannel ¶
type SlackChannel struct { ID string `json:"id"` Channel string `json:"channel"` TeamName string `json:"team_name"` }
SlackChannel holds information about a Slack Channel that is connected to the account.
type SlackChannelsService ¶
type SlackChannelsService service
SlackChannelsService provides information about Slack notifications.
func (*SlackChannelsService) List ¶
func (s *SlackChannelsService) List(ctx context.Context) (channels []SlackChannel, err error)
List returns all connected Slack Channels.
type TagsService ¶ added in v1.8.0
type TagsService service
TagsService provides information about project Tags.
func (*TagsService) Delete ¶ added in v1.8.0
func (s *TagsService) Delete(ctx context.Context, id string) error
Delete removes the tag by its ID.
type TelegramChat ¶ added in v1.1.0
type TelegramChat struct { ID string `json:"id"` Type string `json:"type"` Name string `json:"name"` }
TelegramChat holds information about a Telegram Chat which receives notifications.
type TelegramChatsService ¶ added in v1.1.0
type TelegramChatsService service
TelegramChatsService provides information about Telegram notifications.
func (*TelegramChatsService) List ¶ added in v1.1.0
func (s *TelegramChatsService) List(ctx context.Context) (channels []TelegramChat, err error)
List returns all connected Telegram Chats.
type WebhooksService ¶
type WebhooksService service
WebhooksService provides information about Webhooks notifications.