Documentation
¶
Index ¶
Constants ¶
View Source
const ( MsgTypeText = "text" MsgTypeLink = "link" MsgTypeMd = "markdown" MsgTypeActionCard = "actionCard" MsgTypeFeedCard = "feedCard" )
exported message types see https://open-doc.dingtalk.com/docs/doc.htm
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionCardMsg ¶
type ActionCardMsg struct {
Text string `json:"text"`
Title string `json:"title"`
HideAvatar string `json:"hideAvatar"` // "0" or "1"
BtnOrientation string `json:"btnOrientation"` // "0" or "1"
// single card
SingleTitle string `json:"singleTitle"`
SingleURL string `json:"singleURL"`
// independent cards
Btns []struct {
Title string `json:"title"`
ActionURL string `json:"actionURL"`
} `json:"btns"`
}
ActionCardMsg represents a action card.
type BotOption ¶
type BotOption func(*dingBot)
BotOption follows the functional option pattern.
func WithClient ¶
WithClient makes the bot use a custom http client.
type DingMessage ¶
type DingMessage struct {
Msgtype string `json:"msgtype"`
Text TextMsg `json:"text,omitempty"`
Link LinkMsg `json:"link,omitempty"`
Markdown MdMsg `json:"markdown,omitempty"`
ActionCard ActionCardMsg `json:"actionCard,omitempty"`
FeedCard FeedCardMsg `json:"feedCard,omitempty"`
At AtOption `json:"at,omitempty"`
}
DingMessage is the JSON-encoded message to send.
type DingResponse ¶
DingResponse is the response for sending msg.
type FeedCardMsg ¶
type FeedCardMsg struct {
Links []FeedLink `json:"links"`
}
FeedCardMsg represents a feed card.
type FeedLink ¶
type FeedLink struct {
Title string `json:"title"`
PicURL string `json:"picUrl"`
MessageURL string `json:"messageUrl"`
}
FeedLink represents a feed.
type LinkMsg ¶
type LinkMsg struct {
Text string `json:"text"`
Title string `json:"title"`
PicURL string `json:"picUrl,omitempty"`
MessageURL string `json:"messageUrl"`
}
LinkMsg represents a link.
type SenderBot ¶
type SenderBot interface {
Send(interface{}) error
}
SenderBot sends various message types to the Dingtalk webhook.
func NewDingBot ¶
NewDingBot returns a functional SenderBot with the provided token.
Click to show internal directories.
Click to hide internal directories.
