Documentation
¶
Index ¶
- type ActionCardButton
- type ActionCardMessage
- type At
- type Client
- func (c *Client) GenSign(secret string, timestamp int64) (string, error)
- func (c *Client) SendMessage(message Message) (*Response, error)
- func (c *Client) SendMessageByUrl(url string, message Message) (*Response, error)
- func (c *Client) SendMessageStr(json string) (*Response, error)
- func (c *Client) SendMessageStrByUrl(url, json string) (*Response, error)
- type FeedCardMessage
- type Link
- type LinkMessage
- type MarkdownMessage
- type Message
- type MsgType
- type Response
- type SingleActionCardMessage
- type TextMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionCardButton ¶
type ActionCardButton struct { // Title 按钮标题 Title string // ActionUrl 点击按钮触发的URL ActionUrl string }
ActionCardButton ActionCardMessage btn
func NewActionCardButton ¶
func NewActionCardButton(title, actionUrl string) ActionCardButton
NewActionCardButton create ActionCardButton
func (ActionCardButton) ToMessageMap ¶
func (button ActionCardButton) ToMessageMap() map[string]interface{}
type ActionCardMessage ¶
type ActionCardMessage struct { // Title 首屏会话透出的展示内容 Title string // Text markdown格式的消息 Text string // Buttons 按钮 Buttons []ActionCardButton // BtnOrientation 按钮排布方式 // true: 按钮横向排列 // false: 按钮竖直排列 BtnOrientation bool }
ActionCardMessage 独立跳转ActionCard类型
func NewActionCardMessage ¶
func NewActionCardMessage(title, text string, btns ...ActionCardButton) *ActionCardMessage
NewActionCardMessage create ActionCardMessage
func (*ActionCardMessage) AddButtons ¶
func (actionCard *ActionCardMessage) AddButtons(btns ...ActionCardButton) *ActionCardMessage
AddButtons add ActionCardMessage Buttons
func (*ActionCardMessage) ToMessageMap ¶
func (actionCard *ActionCardMessage) ToMessageMap() map[string]interface{}
type At ¶
type At struct { // AtMobiles 被@人的手机号 AtMobiles []string // AtUserIds 被@人的用户userid AtUserIds []string // atAll 是否@所有人 AtAll bool }
At dingtalk at
func (*At) AddAtMobiles ¶
AddAtMobiles add AtMobiles
func (*At) AddAtUserIds ¶
AddAtUserIds add AtUserIds
func (*At) SetAtMobiles ¶
SetAtMobiles set AtMobiles
func (*At) SetAtUserIds ¶
SetAtUserIds set AtUserIds
func (*At) ToMessageMap ¶
type Client ¶
type Client struct { // Webhook dingtalk robot webhook Webhook string // Secret dingtalk robot secret Secret string // contains filtered or unexported fields }
Client dingtalk robot client
func (*Client) SendMessage ¶
SendMessage send message
func (*Client) SendMessageByUrl ¶
SendMessageByUrl send message custom url
func (*Client) SendMessageStr ¶
SendMessageStr send message json string
type FeedCardMessage ¶
type FeedCardMessage struct { // Links Link list Links []Link }
FeedCardMessage FeedCard message
func NewFeedCardMessage ¶
func NewFeedCardMessage(link ...Link) *FeedCardMessage
NewFeedCardMessage create FeedCardMessage
func (*FeedCardMessage) AddLinks ¶
func (feedCard *FeedCardMessage) AddLinks(link ...Link) *FeedCardMessage
AddLinks add FeedCardMessage Links
func (*FeedCardMessage) ToMessageMap ¶
func (feedCard *FeedCardMessage) ToMessageMap() map[string]interface{}
type Link ¶
type Link struct { // Title 单条信息文本 Title string // MessageUrl 点击单条信息到跳转链接 MessageUrl string // PicUrl 单条信息后面图片的URL PicUrl string }
Link FeedCardMessage links
func (Link) ToMessageMap ¶
type LinkMessage ¶
type LinkMessage struct { // Text 消息内容。如果太长只会部分展示 Text string // Title 消息标题 Title string // PicUrl 图片URL PicUrl string // MessageUrl 点击消息跳转的URL MessageUrl string }
LinkMessage link message
func NewLinkMessage ¶
func NewLinkMessage(text, title, messageUrl string) *LinkMessage
NewLinkMessage create LinkMessage
func (*LinkMessage) ToMessageMap ¶
func (link *LinkMessage) ToMessageMap() map[string]interface{}
type MarkdownMessage ¶
type MarkdownMessage struct { // Title 首屏会话透出的展示内容 Title string // Text markdown格式的消息 Text string // At @信息 At *At }
MarkdownMessage markdown message
func NewMarkdownMessage ¶
func NewMarkdownMessage(title, text string) *MarkdownMessage
NewMarkdownMessage create MarkdownMessage
func (*MarkdownMessage) ToMessageMap ¶
func (markdown *MarkdownMessage) ToMessageMap() map[string]interface{}
type Message ¶
type Message interface { // ToMessageMap 返回Message对象组装出来的Map对象,供后续JSON序列化 ToMessageMap() map[string]interface{} }
Message dingtalk message
type MsgType ¶
type MsgType string
MsgType message type
const ( // TextMsgType text message Type TextMsgType MsgType = "text" // LinkMsgType link message type LinkMsgType MsgType = "link" // MarkdownMsgType markdown message type MarkdownMsgType MsgType = "markdown" // ActionCardMsgType actionCard message type ActionCardMsgType MsgType = "actionCard" // FeedCardMsgType feedCard message Type FeedCardMsgType MsgType = "feedCard" )
type SingleActionCardMessage ¶
type SingleActionCardMessage struct { // Title 首屏会话透出的展示内容 Title string // Text markdown格式的消息 Text string // SingleTitle 单个按钮的标题 SingleTitle string // SingleUrl 点击消息跳转的URL SingleUrl string // BtnOrientation 按钮排布方式 // true: 按钮横向排列 // false: 按钮竖直排列 BtnOrientation bool }
SingleActionCardMessage 整体跳转ActionCard类型
func NewSingleActionCardMessage ¶
func NewSingleActionCardMessage(title, text, singleTitle, singleUrl string) *SingleActionCardMessage
NewSingleActionCardMessage create SingleActionCardMessage
func (*SingleActionCardMessage) ToMessageMap ¶
func (single *SingleActionCardMessage) ToMessageMap() map[string]interface{}
type TextMessage ¶
TextMessage dingtalk text message
func NewTextMessage ¶
func NewTextMessage(content string) *TextMessage
NewTextMessage create TextMessage
func (*TextMessage) ToMessageMap ¶
func (text *TextMessage) ToMessageMap() map[string]interface{}