notification

package
v0.0.0-...-0485310 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeMail = "mail"
	TypeIM   = "im"
)
View Source
const (
	ChannelMailProviderGmail   = "gmail"
	ChannelMailProviderOutlook = "outlook"
	ChannelMailProviderYahoo   = "yahoo"
	ChannelMailProviderICloud  = "icloud"
	ChannelMailProviderAol     = "aol"
	ChannelMailProviderZoho    = "zoho"
	ChannelMailProviderQQ      = "qq"
	ChannelMailProvider163     = "163"
	ChannelMailProviderExmail  = "exmail"

	ChannelIMProviderSlack      = "slack"       // https://api.slack.com/messaging/webhooks
	ChannelIMProviderTelegram   = "telegram"    // https://core.telegram.org/bots/api
	ChannelIMProviderDiscord    = "discord"     // https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
	ChannelIMProviderMSTeams    = "ms_teams"    // https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=newteams%2Cjavascript
	ChannelIMProviderWechatWork = "wechat_work" // https://developer.work.weixin.qq.com/document/path/91770
	ChannelIMProviderDingtalk   = "dingtalk"    // https://open.dingtalk.com/document/orgapp/custom-robot-access
	ChannelIMProviderLark       = "lark"        // https://www.larksuite.com/hc/en-US/articles/099698615114-use-webhook-triggers
)
View Source
const (
	StatusSending = "sending"
	StatusSuccess = "success"
	StatusError   = "error"
)

Variables

This section is empty.

Functions

func GetTheme

func GetTheme() string

func SendIMNotification

func SendIMNotification(ch *models.NotificationChannelV2, title, content string) error

func SendMail

func SendMail(s *models.NotificationSettingV2, ch *models.NotificationChannelV2, to, cc, bcc []string, title, content string) error

Types

type GmailOAuth2Auth

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

GmailOAuth2Auth 自定义OAuth2认证

func (*GmailOAuth2Auth) Next

func (a *GmailOAuth2Auth) Next(_ []byte, _ bool) ([]byte, error)

func (*GmailOAuth2Auth) Start

func (a *GmailOAuth2Auth) Start(_ *smtp.ServerInfo) (string, []byte, error)

type ResBody

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

type ServiceV2

type ServiceV2 struct {
}

func GetNotificationServiceV2

func GetNotificationServiceV2() *ServiceV2

func (*ServiceV2) Send

func (svc *ServiceV2) Send(s *models.NotificationSettingV2, args ...any)

func (*ServiceV2) SendIM

func (svc *ServiceV2) SendIM(s *models.NotificationSettingV2, ch *models.NotificationChannelV2, title, content string)

func (*ServiceV2) SendMail

func (svc *ServiceV2) SendMail(s *models.NotificationSettingV2, ch *models.NotificationChannelV2, title, content string)

func (*ServiceV2) SendNodeNotification

func (svc *ServiceV2) SendNodeNotification(node *models.NodeV2)

type VariableData

type VariableData struct {
	Task     *models.TaskV2              `json:"task"`
	TaskStat *models.TaskStatV2          `json:"task_stat"`
	Spider   *models.SpiderV2            `json:"spider"`
	Node     *models.NodeV2              `json:"node"`
	Schedule *models.ScheduleV2          `json:"schedule"`
	Alert    *models.NotificationAlertV2 `json:"alert"`
	Metric   *models.MetricV2            `json:"metric"`
}

Jump to

Keyboard shortcuts

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