core

package
v0.0.0-...-4ee0dd3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExtraValueTypeNotification = "notification"
	ExtraValueModelGlobal      = "global"
)
View Source
const (
	NotificationTypeMail   = "mail"
	NotificationTypeMobile = "mobile"
)
View Source
const (
	NotificationSettingsColName = "notification_settings"
)

Variables

This section is empty.

Functions

func GetFooter

func GetFooter() string

func SendMail

func SendMail(s *NotificationSetting, 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 NotificationSetting

type NotificationSetting 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     []NotificationSettingTarget `json:"targets" bson:"targets"` // TODO: implement
	Mail        NotificationSettingMail     `json:"mail,omitempty" bson:"mail,omitempty"`
	Mobile      NotificationSettingMobile   `json:"mobile,omitempty" bson:"mobile,omitempty"`
}

type NotificationSettingMail

type NotificationSettingMail 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 NotificationSettingMobile

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

type NotificationSettingTarget

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

type NotificationSettingTrigger

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

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 {
	*plugin.Internal
	// contains filtered or unexported fields
}

func NewService

func NewService() *Service

func (*Service) Init

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

func (*Service) Start

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

func (*Service) Stop

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

Jump to

Keyboard shortcuts

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