pushmod

package
v0.0.0-...-e50c5d4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ErrTypeErr          = misc.ErrStr("type err")
	ErrPushDeerPushFail = misc.ErrStr("pushdeer push fail")
)

前面的err是用来区分类型的,所以看上去有点扭曲

View Source
const ApiUrl = "https://oapi.dingtalk.com/robot/send"

Variables

This section is empty.

Functions

func GetDingSign

func GetDingSign(token string) (timestamp string, sign string)

GetDingSign 获得签名

func PushEmail

func PushEmail(host, user, token, fromEmailAddr string, fromName string, targetEmailAddr string, title string, content string, markDown bool) error

func PushPushDeer

func PushPushDeer(setting PushDeerSetting, title string, content string, markDown bool) error

func SendDingMessage

func SendDingMessage(accessToken, secret string, message DingMessage) error

Types

type At

type At struct {
	AtMobiles []string `json:"atMobiles"`
	AtUserIds []string `json:"atUserIds"`
	IsAtAll   bool     `json:"isAtAll"`
}

type DingActionCard

type DingActionCard struct {
	MsgType    string `json:"msgtype"`
	ActionCard struct {
		Title          string `json:"title"`
		Text           string `json:"text"`
		BtnOrientation string `json:"btnOrientation"`
		Btns           []struct {
			Title     string `json:"title"`
			ActionURL string `json:"actionURL"`
		} `json:"btns"`
		SingleTitle string `json:"singleTitle"`
		SingleURL   string `json:"singleURL"`
	} `json:"actionCard"`
}

func NewDingActionCard

func NewDingActionCard() *DingActionCard

func (*DingActionCard) ToJson

func (m *DingActionCard) ToJson() string

type DingFeedCard

type DingFeedCard struct {
	MsgType  string `json:"msgtype"`
	FeedCard struct {
		Links []struct {
			Title      string `json:"title"`
			MessageURL string `json:"messageURL"`
			PicURL     string `json:"picURL"`
		} `json:"links"`
	} `json:"feedCard"`
}
type DingLink struct {
	MsgType string `json:"msgtype"`
	Link    struct {
		Text       string `json:"text"`
		Title      string `json:"title"`
		PicUrl     string `json:"picUrl"`
		MessageUrl string `json:"messageUrl"`
	} `json:"link"`
}
func NewDingLink() *DingLink

func (*DingLink) ToJson

func (m *DingLink) ToJson() string

type DingMarkdown

type DingMarkdown struct {
	MsgType  string `json:"msgtype"`
	Markdown struct {
		Title string `json:"title"`
		Text  string `json:"text"`
	} `json:"markdown"`
	At At `json:"at"`
}

func NewDingMarkdown

func NewDingMarkdown() *DingMarkdown

func (*DingMarkdown) ToJson

func (m *DingMarkdown) ToJson() string

type DingMessage

type DingMessage interface {
	ToJson() string
}

type DingRobotMgr

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

func NewDingRobotMgr

func NewDingRobotMgr(setting DingSetting) (*DingRobotMgr, error)

func (*DingRobotMgr) Init

func (m *DingRobotMgr) Init(setting DingSetting) error

func (*DingRobotMgr) Push

func (m *DingRobotMgr) Push(title string, content string) error

func (*DingRobotMgr) PushMarkDown

func (m *DingRobotMgr) PushMarkDown(title string, content string) error

func (*DingRobotMgr) Send

func (m *DingRobotMgr) Send(message DingMessage) error

func (*DingRobotMgr) SetSetting

func (m *DingRobotMgr) SetSetting(setting interface{}) error

type DingRobotToken

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

type DingSetting

type DingSetting struct {
	Token             string
	Secret            string
	SendInterval      int32 // 每隔多少时间
	IntervalSendCount int32 // 有多少次发送机会
	Ctx               context.Context
}

type DingText

type DingText struct {
	At   At `json:"at"`
	Text struct {
		Content string `json:"content"`
	} `json:"text"`
	MsgType string `json:"msgtype"`
}

func NewDingText

func NewDingText() *DingText

func (*DingText) ToJson

func (m *DingText) ToJson() string

type EmailMgr

type EmailMgr struct {
	misc.InitTag
	EmailSetting EmailSetting
}

func NewEmailMgr

func NewEmailMgr(setting EmailSetting) (*EmailMgr, error)

func (*EmailMgr) Init

func (m *EmailMgr) Init(setting EmailSetting) error

func (*EmailMgr) Push

func (m *EmailMgr) Push(title string, content string) error

func (*EmailMgr) PushMarkDown

func (m *EmailMgr) PushMarkDown(title string, content string) error

func (*EmailMgr) SetSetting

func (m *EmailMgr) SetSetting(setting interface{}) error

type EmailSetting

type EmailSetting struct {
	User  string
	Token string
	// contains filtered or unexported fields
}

type PushDeerMgr

type PushDeerMgr struct {
	misc.InitTag
	// contains filtered or unexported fields
}

func NewPushDeerMgr

func NewPushDeerMgr(setting *PushDeerSetting) (*PushDeerMgr, error)

func (*PushDeerMgr) Init

func (m *PushDeerMgr) Init(setting *PushDeerSetting) error

func (*PushDeerMgr) Push

func (m *PushDeerMgr) Push(title string, content string) error

func (*PushDeerMgr) PushMarkDown

func (m *PushDeerMgr) PushMarkDown(title string, content string) error

func (*PushDeerMgr) SetSetting

func (m *PushDeerMgr) SetSetting(setting interface{}) error

type PushDeerSetting

type PushDeerSetting struct {
	Token string
}

Jump to

Keyboard shortcuts

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