dingtalk

package
v0.0.0-...-3bcd2b0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgTypeText     = "text"
	MsgTypeLink     = "link"
	MsgTypeMarkdown = "markdown"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AtMessage

type AtMessage struct {
	AtMobiles []string `json:"atMobiles,omitempty"`
	IsAtAll   bool     `json:"isAtAll,omitempty"`
}

type LinkMessage

type LinkMessage struct {
	Title      string `json:"title,omitempty"`
	Text       string `json:"text,omitempty"`
	PicUrl     string `json:"picUrl,omitempty"`
	MessageUrl string `json:"messageUrl,omitempty"`
}

type MarkdownMessage

type MarkdownMessage struct {
	Title string `json:"title,omitempty"`
	Text  string `json:"text,omitempty"`
}

type Message

type Message struct {
	MsgType  string           `json:"msgtype,omitempty"`
	Text     *TextMessage     `json:"text,omitempty"`
	Link     *LinkMessage     `json:"link,omitempty"`
	Markdown *MarkdownMessage `json:"markdown,omitempty"`
	At       *AtMessage       `json:"at,omitempty"`
}

func NewLinkMessage

func NewLinkMessage(title string, text string, picUrl string, messageUrl string) *Message

创建链接消息

func NewMarkdownMessage

func NewMarkdownMessage(title string, text string) *Message

创建markdown消息

func NewTextMessage

func NewTextMessage(content string) *Message

创建文本消息

func (*Message) AtAll

func (m *Message) AtAll() *Message

@所有人

func (*Message) AtMobiles

func (m *Message) AtMobiles(mobiles ...string) *Message

@指定用户

func (*Message) Marshaler

func (m *Message) Marshaler() []byte

消息序列号

type Robot

type Robot struct {
	Webhook string
	Secret  string
}

func NewRobot

func NewRobot() *Robot

创建钉钉机器人实例

func (*Robot) GetUrl

func (rb *Robot) GetUrl() (string, error)

获取请求地址

func (*Robot) SendMessage

func (rb *Robot) SendMessage(m *Message) error

发送消息

func (*Robot) SetSecret

func (rb *Robot) SetSecret(secret string) *Robot

设置签名密钥

func (*Robot) SetWebhook

func (rb *Robot) SetWebhook(webhook string) *Robot

设置webhook地址

type TextMessage

type TextMessage struct {
	Content string `json:"content,omitempty"`
}

Jump to

Keyboard shortcuts

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