notification

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExtraValueTypeNotification = "notification"
	ExtraValueModelGlobal      = "global"
)
View Source
const (
	TypeMail   = "mail"
	TypeMobile = "mobile"
)
View Source
const (
	PluginName = "notification"
)
View Source
const (
	SettingsColName = "notification_settings"
)

Variables

This section is empty.

Functions

func GetFooter

func GetFooter() string

func SendMail

func SendMail(s *Setting, to, cc, title, content string) error

func SendMobileNotification

func SendMobileNotification(webhook string, title string, content string) error

Types

type MailTheme

type MailTheme interface {
	hermes.Theme
	GetStyle() string
}

type MailThemeFlat

type MailThemeFlat struct{}

MailThemeFlat is a theme

func (*MailThemeFlat) GetStyle

func (dt *MailThemeFlat) GetStyle() string

func (*MailThemeFlat) HTMLTemplate

func (dt *MailThemeFlat) HTMLTemplate() string

HTMLTemplate returns a Golang template that will generate an HTML email.

func (*MailThemeFlat) Name

func (dt *MailThemeFlat) Name() string

Name returns the name of the flat theme

func (*MailThemeFlat) PlainTextTemplate

func (dt *MailThemeFlat) PlainTextTemplate() string

PlainTextTemplate returns a Golang template that will generate an plain text email.

type ResBody

type ResBody struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

type SendPayload

type SendPayload struct {
	TaskId primitive.ObjectID `json:"task_id"`
	Data   string             `json:"data"`
}

type Service

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

func GetService

func GetService() *Service

func NewService

func NewService() *Service

func (*Service) DeleteSetting

func (svc *Service) DeleteSetting(id primitive.ObjectID) (err error)

func (*Service) DisableSetting

func (svc *Service) DisableSetting(id primitive.ObjectID) (err error)

func (*Service) EnableSetting

func (svc *Service) EnableSetting(id primitive.ObjectID) (err error)

func (*Service) GetSetting

func (svc *Service) GetSetting(id primitive.ObjectID) (res *Setting, err error)

func (*Service) GetSettingList

func (svc *Service) GetSettingList(query bson.M, pagination *entity.Pagination, sort bson.D) (res []Setting, total int, err error)

func (*Service) GetTriggerList

func (svc *Service) GetTriggerList() (res []string, total int, err error)

func (*Service) Init

func (svc *Service) Init() (err error)

func (*Service) PosSetting

func (svc *Service) PosSetting(s *Setting) (err error)

func (*Service) PutSetting

func (svc *Service) PutSetting(id primitive.ObjectID, s Setting) (err error)

func (*Service) Start

func (svc *Service) Start() (err error)

func (*Service) Stop

func (svc *Service) Stop() (err error)

type Setting

type Setting struct {
	Id          primitive.ObjectID `json:"_id" bson:"_id"`
	Type        string             `json:"type" bson:"type"`
	Name        string             `json:"name" bson:"name"`
	Description string             `json:"description" bson:"description"`
	Enabled     bool               `json:"enabled" bson:"enabled"`
	Global      bool               `json:"global" bson:"global"`
	Title       string             `json:"title,omitempty" bson:"title,omitempty"`
	Template    string             `json:"template,omitempty" bson:"template,omitempty"`
	Triggers    []string           `json:"triggers" bson:"triggers"`
	Targets     []SettingTarget    `json:"targets" bson:"targets"` // TODO: implement
	Mail        SettingMail        `json:"mail,omitempty" bson:"mail,omitempty"`
	Mobile      SettingMobile      `json:"mobile,omitempty" bson:"mobile,omitempty"`
}

type SettingMail

type SettingMail struct {
	Server         string `json:"server" bson:"server"`
	Port           string `json:"port,omitempty" bson:"port,omitempty"`
	User           string `json:"user,omitempty" bson:"user,omitempty"`
	Password       string `json:"password,omitempty" bson:"password,omitempty"`
	SenderEmail    string `json:"sender_email,omitempty" bson:"sender_email,omitempty"`
	SenderIdentity string `json:"sender_identity,omitempty" bson:"sender_identity,omitempty"`
	To             string `json:"to,omitempty" bson:"to,omitempty"`
	Cc             string `json:"cc,omitempty" bson:"cc,omitempty"`
}

type SettingMobile

type SettingMobile struct {
	Webhook string `json:"webhook" bson:"webhook"`
}

type SettingTarget

type SettingTarget struct {
	Id    primitive.ObjectID `json:"_id" bson:"_id"`
	Model string             `json:"model" bson:"model"`
}

type SettingTrigger

type SettingTrigger struct {
	Name  string `json:"name" bson:"name"`
	Event string `json:"event" bson:"event"`
}

Jump to

Keyboard shortcuts

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