notify

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

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, changelog store.Changelog) error
}

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

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, changelog store.Changelog) 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
	ReleaseNotesBuilder *service.ReleaseNotesBuilder
	ReleaseNameTmplText string
}

GithubParams describes parameters to initialize github releaser.

type Params

type Params struct {
	Log          *log.Logger
	Destinations []Destination
}

Params describes parameters to initialize notifier service.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service delivers changelog to multiple destinations.

func NewService

func NewService(params Params) *Service

NewService makes new instance of Service.

func (*Service) Send

func (s *Service) Send(ctx context.Context, changelog store.Changelog) error

Send sends the changelog to all destinations.

func (*Service) String

func (s *Service) String() string

String used for debugging purposes.

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, changelog store.Changelog) 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 {
	ReleaseNotesBuilder *service.ReleaseNotesBuilder
	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 {
	ReleaseNotesBuilder *service.ReleaseNotesBuilder
	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, changelog store.Changelog) 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