notify

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FeishuColorOrange = "orange"
	FeishuColorGreen  = "green"
	FeishuColorRed    = "red"
)

Variables

This section is empty.

Functions

func Error

func Error(title, message string)

func ErrorThrottle

func ErrorThrottle(key string, expiration time.Duration, title, message string)

func Info

func Info(title, message string)

func InfoThrottle

func InfoThrottle(key string, expiration time.Duration, title, message string)

func Notify

func Notify(level Level, title, message string)

func PostToFeiShuv2

func PostToFeiShuv2(ctx context.Context, color, title, text, wh string) error

func SetDefaultNotifier

func SetDefaultNotifier(notifier Notifier)

func Throttle

func Throttle(level Level, key string, expiration time.Duration, title, message string)

func Warn

func Warn(title, message string)

func WarnThrottle

func WarnThrottle(key string, expiration time.Duration, title, message string)

Types

type Cards

type Cards struct {
	Config   Conf      `json:"config"`
	Elements []Element `json:"elements"`
	Header   Headers   `json:"header"`
}

type Conf

type Conf struct {
	WideScreenMode bool `json:"wide_screen_mode"`
	EnableForward  bool `json:"enable_forward"`
}

type Element

type Element struct {
	Tag      string    `json:"tag"`
	Text     Te        `json:"text"`
	Content  string    `json:"content"`
	Elements []Element `json:"elements"`
}

type FSMessagev2

type FSMessagev2 struct {
	MsgType string `json:"msg_type"`
	Email   string `json:"email"`
	Card    Cards  `json:"card"`
}

type FeiShuv2Resp

type FeiShuv2Resp struct {
	StatusCode    int    `json:"StatusCode"`
	StatusMessage string `json:"StatusMessage"`
	Code          int    `json:"code"`
	Data          any    `json:"data"`
	Msg           string `json:"msg"`
}

type FeishuNotifier

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

func (*FeishuNotifier) Notify

func (f *FeishuNotifier) Notify(level Level, title, message string)

func (*FeishuNotifier) NotifyThrottle

func (f *FeishuNotifier) NotifyThrottle(level Level, key string, expiration time.Duration, title, message string)

type Headers

type Headers struct {
	Title    Titles `json:"title"`
	Template string `json:"template"`
}

type Level

type Level string
const (
	LevelInfo  Level = "info"
	LevelWarn  Level = "warn"
	LevelError Level = "error"
)

type Notifier

type Notifier interface {
	Notify(level Level, title, message string)
	NotifyThrottle(level Level, key string, expiration time.Duration, title, message string)
}

func NewFeishuNotify

func NewFeishuNotify(wh string) Notifier

type StdNotifier

type StdNotifier struct{}

func (*StdNotifier) Notify

func (n *StdNotifier) Notify(level Level, title, message string)

func (*StdNotifier) NotifyThrottle

func (n *StdNotifier) NotifyThrottle(level Level, key string, expiration time.Duration, title, message string)

type Te

type Te struct {
	Content string `json:"content"`
	Tag     string `json:"tag"`
}

type TenantAccessMeg

type TenantAccessMeg struct {
	AppID     string `json:"app_id"`
	AppSecret string `json:"app_secret"`
}

type TenantAccessResp

type TenantAccessResp struct {
	Code              int    `json:"code"`
	Msg               string `json:"msg"`
	TenantAccessToken string `json:"tenant_access_token"`
}

type Titles

type Titles struct {
	Content string `json:"content"`
	Tag     string `json:"tag"`
}

Jump to

Keyboard shortcuts

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