notify

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package notify provides notification functionality.

Index

Constants

This section is empty.

Variables

View Source
var NopService = &Service{}

NopService is do-nothing notifier, without destinations

Functions

This section is empty.

Types

type Destination

type Destination interface {
	fmt.Stringer
	Send(ctx context.Context, req request) error
}

Destination defines interface for a given destination service, like telegram, email and so on

type Service

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

Service delivers notifications to multiple destinations

func NewService

func NewService(dataService Store, size int, destinations ...Destination) *Service

NewService makes notification service routing comments to all destinations.

func (*Service) Close

func (s *Service) Close()

Close queue channel and wait for completion

func (*Service) Submit

func (s *Service) Submit(comment store.Comment)

Submit comment to internal channel if not busy, drop if can't send

type Store

type Store interface {
	Get(locator store.Locator, id string) (store.Comment, error)
}

Store defines the minimal interface accessing stored commens used by notifier

type Telegram

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

Telegram implements notify.Destination for telegram

func NewTelegram

func NewTelegram(token string, channelID string, timeout time.Duration, api string) (*Telegram, error)

NewTelegram makes telegram bot for notifications

func (*Telegram) Send

func (t *Telegram) Send(ctx context.Context, req request) error

Send to telegram channel

func (*Telegram) String

func (t *Telegram) String() string

Jump to

Keyboard shortcuts

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