newreleases: newreleases.io/newreleases Index | Files

package newreleases

import "newreleases.io/newreleases"

Package newreleases is the NewReleases API v1 client for Go.

Index

Package Files

auth.go discord_channels.go doc.go errors.go newreleases.go projects.go providers.go rate.go releases.go slack_channels.go telegram_chats.go webhooks.go webhooks_hangouts_chat.go webhooks_microsoft_teams.go

Variables

var (
    ErrUnauthorized        = errors.New("unauthorized")
    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.

func Bool Uses

func Bool(v bool) (p *bool)

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

type AuthKey Uses

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 Uses

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 Uses

type AuthService service

AuthService provides information about API authentication.

func (*AuthService) List Uses

func (s *AuthService) List(ctx context.Context) (keys []AuthKey, err error)

List returns all authentication keys.

type BadRequestError Uses

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 Uses

func NewBadRequestError(errors ...string) (err *BadRequestError)

NewBadRequestError constructs a new BadRequestError with provided errors.

func (*BadRequestError) Error Uses

func (e *BadRequestError) Error() (s string)

func (*BadRequestError) Errors Uses

func (e *BadRequestError) Errors() (errs []string)

Errors returns a list of error messages.

type Client Uses

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
    Webhooks               *WebhooksService
    // contains filtered or unexported fields
}

Client manages communication with the NewReleases API.

func NewClient Uses

func NewClient(key string, o *ClientOptions) (c *Client)

NewClient constructs a new Client that uses API key authentication.

func (*Client) Rate Uses

func (c *Client) Rate() (r Rate)

Rate returns the current request rate limit information.

type ClientOptions Uses

type ClientOptions struct {
    HTTPClient *http.Client
    BaseURL    *url.URL
}

ClientOptions holds optional parameters for the Client.

type DiscordChannel Uses

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

DiscordChannel holds information about a Discord Channel that is connected to the account.

type DiscordChannelsService Uses

type DiscordChannelsService service

DiscordChannelsService provides information about Discord notifications.

func (*DiscordChannelsService) List Uses

func (s *DiscordChannelsService) List(ctx context.Context) (channels []DiscordChannel, err error)

List returns all connected Discord Channels.

type EmailNotification Uses

type EmailNotification string

EmailNotification enumerates available options for email notifications.

var (
    EmailNotificationNone    EmailNotification = "none"
    EmailNotificationHourly  EmailNotification = "hourly"
    EmailNotificationDaily   EmailNotification = "daily"
    EmailNotificationWeekly  EmailNotification = "weekly"
    EmailNotificationDefault EmailNotification = "default"
)

Available email notification options.

type Exclusion Uses

type Exclusion struct {
    Value   string `json:"value"`
    Inverse bool   `json:"inverse"`
}

Exclusion holds information about a regular expression used to filter release versions.

type HangoutsChatWebhooksService Uses

type HangoutsChatWebhooksService service

HangoutsChatWebhooksService provides information about Google Hangouts Chat Webhooks notifications.

func (*HangoutsChatWebhooksService) List Uses

func (s *HangoutsChatWebhooksService) List(ctx context.Context) (webhooks []Webhook, err error)

List returns all Google Hangouts Chat webhooks.

type MicrosoftTeamsWebhooksService Uses

type MicrosoftTeamsWebhooksService service

MicrosoftTeamsWebhooksService provides information about Microsoft Teams Webhooks notifications.

func (*MicrosoftTeamsWebhooksService) List Uses

func (s *MicrosoftTeamsWebhooksService) List(ctx context.Context) (webhooks []Webhook, err error)

List returns all Microsoft Teams webhooks.

type Project Uses

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"`
    WebhookIDs             []string          `json:"webhooks,omitempty"`
    Exclusions             []Exclusion       `json:"exclude_version_regexp,omitempty"`
    ExcludePrereleases     bool              `json:"exclude_prereleases,omitempty"`
    ExcludeUpdated         bool              `json:"exclude_updated,omitempty"`
}

Project holds information about a tracked project and its configured options.

type ProjectListOptions Uses

type ProjectListOptions struct {
    Page     int
    Order    ProjectListOrder
    Reverse  bool
    Provider string
}

ProjectListOptions holds information about a project list page.

type ProjectListOrder Uses

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 Uses

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"`
    WebhookIDs             []string           `json:"webhooks"`
    Exclusions             []Exclusion        `json:"exclude_version_regexp"`
    ExcludePrereleases     *bool              `json:"exclude_prereleases"`
    ExcludeUpdated         *bool              `json:"exclude_updated"`
}

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 function Bool that returns boolean pointer by passing a regular bool value.

type ProjectsService Uses

type ProjectsService service

ProjectsService provides information and methods to manage tracked projects.

func (*ProjectsService) Add Uses

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 Uses

func (s *ProjectsService) DeleteByID(ctx context.Context, id string) (err error)

DeleteByID removes a project referenced by its ID.

func (*ProjectsService) DeleteByName Uses

func (s *ProjectsService) DeleteByName(ctx context.Context, provider, name string) (err error)

DeleteByName removes a project referenced by its provider and name.

func (*ProjectsService) GetByID Uses

func (s *ProjectsService) GetByID(ctx context.Context, id string) (project *Project, err error)

GetByID returns a specific project referenced by its ID.

func (*ProjectsService) GetByName Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

type ProvidersService service

ProvidersService provides information about supported project providers and providers for projects that are added for tracking.

func (*ProvidersService) List Uses

func (s *ProvidersService) List(ctx context.Context) (providers []string, err error)

List returns all supported project providers.

func (*ProvidersService) ListAdded Uses

func (s *ProvidersService) ListAdded(ctx context.Context) (providers []string, err error)

ListAdded returns poviders for projects that are added for tracking.

type Rate Uses

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.

func (Rate) String Uses

func (r Rate) String() (s string)

type Release Uses

type Release struct {
    Version      string    `json:"version"`
    Date         time.Time `json:"date"`
    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 Uses

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 Uses

type ReleasesService service

ReleasesService provides information about releases for every project that is tracked.

func (*ReleasesService) GetByProjectID Uses

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 Uses

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) GetNoteByProjectID Uses

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 Uses

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 Uses

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 Uses

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 SlackChannel Uses

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 Uses

type SlackChannelsService service

SlackChannelsService provides information about Slack notifications.

func (*SlackChannelsService) List Uses

func (s *SlackChannelsService) List(ctx context.Context) (channels []SlackChannel, err error)

List returns all connected Slack Channels.

type TelegramChat Uses

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 Uses

type TelegramChatsService service

TelegramChatsService provides information about Telegram notifications.

func (*TelegramChatsService) List Uses

func (s *TelegramChatsService) List(ctx context.Context) (channels []TelegramChat, err error)

List returns all connected Telegram Chats.

type Webhook Uses

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

Webhook holds the information about webhook ID and its descriptive name.

type WebhooksService Uses

type WebhooksService service

WebhooksService provides information about Webhooks notifications.

func (*WebhooksService) List Uses

func (s *WebhooksService) List(ctx context.Context) (webhooks []Webhook, err error)

List returns all webhooks.

Package newreleases imports 14 packages (graph) and is imported by 1 packages. Updated 2020-01-04. Refresh now. Tools for package owners.