notify

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package notify defines interfaces each supported notification destination should implement.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Destination

type Destination interface {
	fmt.Stringer
	Send(ctx context.Context, tagName, text string) error
}

Destination defines interface for a given destination service, like telegram, email or stdout.

type Destinations added in v0.2.0

type Destinations []Destination

Destinations is an aggregation of notifiers.

func (Destinations) Send added in v0.2.0

func (d Destinations) Send(ctx context.Context, tagName, text string) error

Send sends the message to all destinations.

func (Destinations) String added in v0.2.0

func (d Destinations) String() string

String returns the names of all destinations.

type Github

type Github struct {
	GithubParams
	// contains filtered or unexported fields
}

Github makes a new release on Github on the given version.

func NewGithub

func NewGithub(params GithubParams) (*Github, error)

NewGithub makes new instance of Github.

func (*Github) Send

func (g *Github) Send(ctx context.Context, tagName, text string) error

Send makes new release on github repository.

func (*Github) String

func (g *Github) String() string

String returns the string representation of the destination.

type GithubParams

type GithubParams struct {
	Owner               string
	Name                string
	BasicAuthUsername   string
	BasicAuthPassword   string
	HTTPClient          http.Client
	ReleaseNameTmplText string
}

GithubParams describes parameters to initialize github releaser.

type Mattermost added in v0.2.0

type Mattermost struct {
	MattermostParams
	// contains filtered or unexported fields
}

Mattermost is a notifier for Mattermost.

func NewMattermost added in v0.2.0

func NewMattermost(params MattermostParams) (*Mattermost, error)

NewMattermost makes a new Mattermost notifier.

func (*Mattermost) Send added in v0.2.0

func (m *Mattermost) Send(ctx context.Context, _, text string) error

Send sends a message to Mattermost.

func (*Mattermost) String added in v0.2.0

func (m *Mattermost) String() string

String returns the name of the notifier.

type MattermostParams added in v0.2.0

type MattermostParams struct {
	Client    http.Client
	BaseURL   string
	ChannelID string

	LoginID  string
	Password string
	LDAP     bool
}

MattermostParams are Mattermost notifier params.

type Telegram

type Telegram struct {
	TelegramParams
}

Telegram implements Destination to send changelogs to specified telegram chats.

func NewTelegram

func NewTelegram(params TelegramParams) *Telegram

NewTelegram makes telegram bot for notifications

func (*Telegram) Send

func (t *Telegram) Send(ctx context.Context, _, text string) error

Send changelog via Telegram.

func (*Telegram) String

func (t *Telegram) String() string

String returns the string representation to identify this notifier.

type TelegramParams

type TelegramParams struct {
	Log *log.Logger

	ChatID                string
	Client                http.Client
	Token                 string
	DisableWebPagePreview bool
}

TelegramParams defines parameters needed to initialize Telegram notifier.

type WriterNotifier

type WriterNotifier struct {
	Writer io.Writer
	Name   string // used for debugging purposes
}

WriterNotifier prints the changelog to the specified writer. Writer might be os.Stdout, in order to use in pipelines and CI/CD.

func (*WriterNotifier) Send

func (w *WriterNotifier) Send(_ context.Context, _, text string) error

Send writes changelog to writer.

func (*WriterNotifier) String

func (w *WriterNotifier) String() string

String returns the string representation to identify this notifier.

Jump to

Keyboard shortcuts

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