Documentation ¶
Index ¶
- Constants
- func NewActionCardBuilder(title string, text string, buttonOrientation Orientation, ...) *actionCardBuilder
- func NewFeedCardBuilder() *feedCardBuilder
- type ActionCardElement
- type AtElement
- type AvatarState
- type ButtonElement
- type DingMessage
- type DingRobot
- type FeedCardElement
- type FeedLinkElement
- type LinkElement
- type MarkdownElement
- type MessageBuilder
- func (builder *MessageBuilder) ActionCard(element ActionCardElement) *MessageBuilder
- func (builder *MessageBuilder) At(mobiles []string, isAtAll bool) *MessageBuilder
- func (builder *MessageBuilder) Build() DingMessage
- func (builder *MessageBuilder) FeedCard(element FeedCardElement) *MessageBuilder
- func (builder *MessageBuilder) Link(title string, text string, messageURL string, pictureURL string) *MessageBuilder
- func (builder *MessageBuilder) Markdown(title string, text string) *MessageBuilder
- func (builder *MessageBuilder) Text(text string) *MessageBuilder
- type MessageType
- type Orientation
- type TextElement
Constants ¶
View Source
const ( TypeText MessageType = "text" TypeLink MessageType = "link" TypeMarkdown MessageType = "markdown" TypeActionCard MessageType = "actionCard" TypeFeedCard MessageType = "feedCard" OrientationVertical Orientation = "0" OrientationHorizon Orientation = "1" ShowAvatar AvatarState = "0" HideAvatar AvatarState = "1" )
View Source
const BaseSendURL = "https://oapi.dingtalk.com/robot/send?access_token={ACCESS_TOKEN}"
View Source
const JSONType = "application/json"
Variables ¶
This section is empty.
Functions ¶
func NewActionCardBuilder ¶
func NewActionCardBuilder(title string, text string, buttonOrientation Orientation, avatarState AvatarState) *actionCardBuilder
func NewFeedCardBuilder ¶
func NewFeedCardBuilder() *feedCardBuilder
Types ¶
type ActionCardElement ¶
type ActionCardElement struct { Title string `json:"title"` Text string `json:"text"` SingleTitle string `json:"singleTitle"` SingleURL string `json:"singleURL"` ButtonOrientation Orientation `json:"btnOrientation"` Avatar AvatarState `json:"hideAvatar"` Buttons []ButtonElement `json:"btns"` }
ActionCardElement ActionCard元素
type AvatarState ¶
type AvatarState string
type ButtonElement ¶
ButtonElement 按钮元素
type DingMessage ¶
type DingMessage struct { Type MessageType `json:"msgtype"` Text TextElement `json:"text"` Link LinkElement `json:"link"` Markdown MarkdownElement `json:"markdown"` ActionCard ActionCardElement `json:"actionCard"` FeedCard FeedCardElement `json:"feedCard"` At AtElement `json:"at"` }
DingMessage 钉钉机器人消息
type DingRobot ¶
func (DingRobot) SendMessage ¶
func (dr DingRobot) SendMessage(msg DingMessage) error
type FeedCardElement ¶
type FeedCardElement struct {
Links []FeedLinkElement `json:"links"`
}
FeedCardElement 图文元素
type FeedLinkElement ¶
type FeedLinkElement struct { Title string `json:"title"` // 消息标题 Text string `json:"text"` // 消息内容。如果太长只会部分展示 MessageURL string `json:"messageURL"` // 点击消息跳转的URL PictureURL string `json:"picURL"` // 图片URL }
LinkElement 链接元素
type LinkElement ¶
type LinkElement struct { Title string `json:"title"` // 消息标题 Text string `json:"text"` // 消息内容。如果太长只会部分展示 MessageURL string `json:"messageUrl"` // 点击消息跳转的URL PictureURL string `json:"picUrl"` // 图片URL }
LinkElement 链接元素
type MarkdownElement ¶
type MarkdownElement struct { Title string `json:"title"` // 首屏会话透出的展示内容 Text string `json:"text"` // markdown格式的消息 }
MarkdownElement Markdown元素
type MessageBuilder ¶
type MessageBuilder struct {
// contains filtered or unexported fields
}
func NewMessageBuilder ¶
func NewMessageBuilder(msgType MessageType) *MessageBuilder
func (*MessageBuilder) ActionCard ¶
func (builder *MessageBuilder) ActionCard(element ActionCardElement) *MessageBuilder
func (*MessageBuilder) At ¶
func (builder *MessageBuilder) At(mobiles []string, isAtAll bool) *MessageBuilder
func (*MessageBuilder) Build ¶
func (builder *MessageBuilder) Build() DingMessage
func (*MessageBuilder) FeedCard ¶
func (builder *MessageBuilder) FeedCard(element FeedCardElement) *MessageBuilder
func (*MessageBuilder) Link ¶
func (builder *MessageBuilder) Link(title string, text string, messageURL string, pictureURL string) *MessageBuilder
func (*MessageBuilder) Markdown ¶
func (builder *MessageBuilder) Markdown(title string, text string) *MessageBuilder
func (*MessageBuilder) Text ¶
func (builder *MessageBuilder) Text(text string) *MessageBuilder
type MessageType ¶
type MessageType string
type Orientation ¶
type Orientation string
Click to show internal directories.
Click to hide internal directories.