notify

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 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 Email

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

func NewEmail

func NewEmail() (email *Email)

func (*Email) Save

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

func (*Email) SetRender

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

type IMessage

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

type Notify

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

func NewNotify

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

func (*Notify) GetCfg

func (n *Notify) GetCfg() *NotifyConfig

func (*Notify) Repeat

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

func (*Notify) Restart

func (n *Notify) Restart()

func (Notify) Send

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

func (*Notify) Shutdown

func (n *Notify) Shutdown()

func (*Notify) Start

func (n *Notify) Start()

func (*Notify) Stat

func (n *Notify) Stat() *NotifyStat

func (*Notify) UpdateCfg

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

type NotifyBind

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

Javascript Binding

IC.Notifr()

.newSMS()
.newEmail()
.newSlack(channel, text)
.newTelegram(text)
.send(msg)

func (*NotifyBind) NewEmail

func (b *NotifyBind) NewEmail() *Email

func (*NotifyBind) NewSMS

func (b *NotifyBind) NewSMS() *SMS

func (*NotifyBind) NewSlack

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

func (*NotifyBind) NewTelegram added in v0.0.18

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

func (*NotifyBind) Send

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

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
}

func NewNotifyConfig added in v0.0.18

func NewNotifyConfig(adaptor *adaptors.Adaptors) *NotifyConfig

func (*NotifyConfig) Get added in v0.0.18

func (n *NotifyConfig) Get()

func (*NotifyConfig) Update added in v0.0.18

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

type NotifyStat

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

type SMS

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

func NewSMS

func NewSMS() (sms *SMS)

func (*SMS) AddPhone

func (s *SMS) AddPhone(phone string)

func (*SMS) Save

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

func (*SMS) SetRender

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

type SlackMessage

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

func NewSlackMessage

func NewSlackMessage(channel, text string) *SlackMessage

func (*SlackMessage) Save

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

func (*SlackMessage) SetRender

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

type Telegram

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

func NewTelegram

func NewTelegram(text string) *Telegram

func (*Telegram) Save added in v0.0.18

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

func (*Telegram) SetRender added in v0.0.18

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

type TemplateBind

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

Javascript Binding

IC.Template()

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

func (*TemplateBind) Render

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

type Worker

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

func NewWorker

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

func (*Worker) Start

func (n *Worker) Start()

func (*Worker) Stop

func (n *Worker) Stop()

Jump to

Keyboard shortcuts

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