notify

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	From    string `json:"from"`
	To      string `json:"to"`
	Subject string `json:"subject"`
	Body    string `json:"template"`
}

Email ...

func NewEmail

func NewEmail() (email *Email)

NewEmail ...

func (*Email) Save

func (e *Email) Save() (addresses []string, message *m.Message)

Save ...

func (*Email) SetRender

func (e *Email) SetRender(render *m.TemplateRender)

SetRender ...

type IMessage

type IMessage interface {
	Save() (addresses []string, message *models.Message)
}

IMessage ...

type Notify

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

Notify ...

func NewNotify

func NewNotify(
	adaptor *adaptors.Adaptors,
	appCfg *config.AppConfig,
	graceful *graceful_service.GracefulService,
	scriptService *scripts.ScriptService) *Notify

NewNotify ...

func (*Notify) GetCfg

func (n *Notify) GetCfg() *NotifyConfig

GetCfg ...

func (*Notify) Repeat

func (n *Notify) Repeat(msg *m.MessageDelivery)

Repeat ...

func (*Notify) Restart

func (n *Notify) Restart()

Restart ...

func (Notify) Send

func (n Notify) Send(msg interface{})

Send ...

func (*Notify) Shutdown

func (n *Notify) Shutdown()

Shutdown ...

func (*Notify) Start

func (n *Notify) Start()

Start ...

func (*Notify) Stat

func (n *Notify) Stat() *NotifyStat

Stat ...

func (*Notify) UpdateCfg

func (n *Notify) UpdateCfg(cfg *NotifyConfig) error

UpdateCfg ...

type NotifyBind

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

Javascript Binding

Notifr()

.NewSMS()
.NewEmail()
.NewSlack(channel, text)
.NewTelegram(text)
.Send(msg)

func (*NotifyBind) NewEmail

func (b *NotifyBind) NewEmail() *Email

NewEmail ...

func (*NotifyBind) NewSMS

func (b *NotifyBind) NewSMS() *SMS

NewSMS ...

func (*NotifyBind) NewSlack

func (b *NotifyBind) NewSlack(channel, text string) *SlackMessage

NewSlack ...

func (*NotifyBind) NewTelegram added in v0.0.18

func (b *NotifyBind) NewTelegram(text string) *Telegram

NewTelegram ...

func (*NotifyBind) Send

func (b *NotifyBind) Send(msg interface{})

Send ...

type NotifyConfig

type NotifyConfig struct {
	MbAccessKey    string `json:"mb_access_key"`
	MbName         string `json:"mb_name"`
	TWFrom         string `json:"tw_from"`
	TWSid          string `json:"tw_sid"`
	TWAuthToken    string `json:"tw_auth_token"`
	TelegramToken  string `json:"telegram_token"`
	TelegramChatId *int64 `json:"telegram_chat_id"`
	EmailAuth      string `json:"email_auth"`
	EmailPass      string `json:"email_pass"`
	EmailSmtp      string `json:"email_smtp"`
	EmailPort      int    `json:"email_port"`
	EmailSender    string `json:"email_sender"`
	SlackToken     string `json:"slack_token"`
	SlackUserName  string `json:"slack_user_name"`
	// contains filtered or unexported fields
}

NotifyConfig ...

func NewNotifyConfig added in v0.0.18

func NewNotifyConfig(adaptor *adaptors.Adaptors) *NotifyConfig

NewNotifyConfig ...

func (*NotifyConfig) Get added in v0.0.18

func (n *NotifyConfig) Get()

Get ...

func (*NotifyConfig) Update added in v0.0.18

func (n *NotifyConfig) Update() (err error)

Update ...

type NotifyStat

type NotifyStat struct {
	MbBalance float32 `json:"mb_balance,omitempty"`
	TwBalance float32 `json:"tw_balance,omitempty"`
	Workers   int     `json:"workers"`
}

NotifyStat ...

type SMS

type SMS struct {
	Text string `json:"text"`
	// contains filtered or unexported fields
}

SMS ...

func NewSMS

func NewSMS() (sms *SMS)

NewSMS ...

func (*SMS) AddPhone

func (s *SMS) AddPhone(phone string)

AddPhone ...

func (*SMS) Save

func (s *SMS) Save() (addresses []string, message *m.Message)

Save ...

func (*SMS) SetRender

func (s *SMS) SetRender(render *m.TemplateRender)

SetRender ...

type SlackMessage

type SlackMessage struct {
	Channel string `json:"channel"`
	Text    string `json:"text"`
}

SlackMessage ...

func NewSlackMessage

func NewSlackMessage(channel, text string) *SlackMessage

NewSlackMessage ...

func (*SlackMessage) Save

func (s *SlackMessage) Save() (addresses []string, message *m.Message)

Save ...

func (*SlackMessage) SetRender

func (s *SlackMessage) SetRender(render *m.TemplateRender)

SetRender ...

type Telegram

type Telegram struct {
	Text string `json:"text"`
}

Telegram ...

func NewTelegram

func NewTelegram(text string) *Telegram

NewTelegram ...

func (*Telegram) Save added in v0.0.18

func (s *Telegram) Save() (addresses []string, message *m.Message)

Save ...

func (*Telegram) SetRender added in v0.0.18

func (s *Telegram) SetRender(render *m.TemplateRender)

SetRender ...

type TemplateBind

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

Javascript Binding

Template()

.Render('name', {'key':'val'})

func (*TemplateBind) Render

func (t *TemplateBind) Render(templateName string, params map[string]interface{}) *m.TemplateRender

Render ...

type Worker

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

Worker ...

func NewWorker

func NewWorker(cfg *NotifyConfig,
	adaptor *adaptors.Adaptors) *Worker

NewWorker ...

func (*Worker) Start

func (n *Worker) Start()

Start ...

func (*Worker) Stop

func (n *Worker) Stop()

Stop ...

Jump to

Keyboard shortcuts

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