Documentation ¶
Index ¶
- Constants
- func HmacSha256(data []byte, secret []byte) (output []byte)
- type DingDingApp
- func (r *DingDingApp) CreateGroupChat(name, ownerID string, userIDList []string, ...) (newChatID string, err error)
- func (r *DingDingApp) GetGroupChat(chatID string) (group DingDingAppGroup, err error)
- func (r *DingDingApp) GetMessageSendProgress(taskID int) (sendProgressResp DingDingAppMessageSendProgressResp, err error)
- func (r *DingDingApp) GetMessageSendResult(taskID int) (sendResultResp DingDingAppMessageSendResultResp, err error)
- func (r *DingDingApp) IsAccessTokenExpired() bool
- func (r *DingDingApp) RecallMessage(taskID int) (revokeResp DingDingAppMessageRecallResp, err error)
- func (r *DingDingApp) SendActionCardMessage(userIDList []string, departmentIDList []string, toAllUser bool, ...) (resp DingDingAppMessageSendResp, err error)
- func (r *DingDingApp) SendFileMessage(userIDList []string, departmentIDList []string, toAllUser bool, mediaID string) (resp DingDingAppMessageSendResp, err error)
- func (r *DingDingApp) SendGroupActionCardMessage(chatID string, actionCardMessage *DingDingAppActionCardMessage) (resp DingDingAppGroupMessageSendResp, err error)
- func (r *DingDingApp) SendGroupFileMessage(chatID, mediaID string) (resp DingDingAppGroupMessageSendResp, err error)
- func (r *DingDingApp) SendGroupImageMessage(chatID, mediaID string) (resp DingDingAppGroupMessageSendResp, err error)
- func (r *DingDingApp) SendGroupLinkMessage(chatID string, linkMessage *DingDingAppLinkMessage) (resp DingDingAppGroupMessageSendResp, err error)
- func (r *DingDingApp) SendGroupMarkdownMessage(chatID, title, content string) (resp DingDingAppGroupMessageSendResp, err error)
- func (r *DingDingApp) SendGroupTextMessage(chatID string, content string) (resp DingDingAppGroupMessageSendResp, err error)
- func (r *DingDingApp) SendGroupVoiceMessage(chatID, mediaID string, duration int) (resp DingDingAppGroupMessageSendResp, err error)
- func (r *DingDingApp) SendImageMessage(userIDList []string, departmentIDList []string, toAllUser bool, mediaID string) (resp DingDingAppMessageSendResp, err error)
- func (r *DingDingApp) SendLinkMessage(userIDList []string, departmentIDList []string, toAllUser bool, ...) (resp DingDingAppMessageSendResp, err error)
- func (r *DingDingApp) SendMarkdownMessage(userIDList []string, departmentIDList []string, toAllUser bool, ...) (resp DingDingAppMessageSendResp, err error)
- func (r *DingDingApp) SendTextMessage(userIDList []string, departmentIDList []string, toAllUser bool, content string) (resp DingDingAppMessageSendResp, err error)
- func (r *DingDingApp) SendVoiceMessage(userIDList []string, departmentIDList []string, toAllUser bool, mediaID string, ...) (resp DingDingAppMessageSendResp, err error)
- func (r *DingDingApp) UpdateGroupChat(chatID string, options *DingDingAppUpdateGroupOptions) (err error)
- type DingDingAppActionCardButton
- type DingDingAppActionCardMessage
- type DingDingAppCreateGroupOptions
- type DingDingAppCreateGroupResp
- type DingDingAppGetGroupResp
- type DingDingAppGroup
- type DingDingAppGroupMessageSendResp
- type DingDingAppLinkMessage
- type DingDingAppMessageRecallResp
- type DingDingAppMessageSendProgress
- type DingDingAppMessageSendProgressResp
- type DingDingAppMessageSendResp
- type DingDingAppMessageSendResult
- type DingDingAppMessageSendResultResp
- type DingDingAppTokenResp
- type DingDingAppUpdateGroupOptions
- type DingDingAppUpdateGroupResp
- type DingDingRobot
- func (r *DingDingRobot) SendActionCardMessage(securitySettings *DingDingSecuritySettings, ...) (err error)
- func (r *DingDingRobot) SendFeedCardMessage(securitySettings *DingDingSecuritySettings, ...) (err error)
- func (r *DingDingRobot) SendLinkMessage(securitySettings *DingDingSecuritySettings, ...) (err error)
- func (r *DingDingRobot) SendMarkdownMessage(securitySettings *DingDingSecuritySettings, ...) (err error)
- func (r *DingDingRobot) SendMarkdownMessageWithMention(securitySettings *DingDingSecuritySettings, ...) (err error)
- func (r *DingDingRobot) SendTextMessage(securitySettings *DingDingSecuritySettings, content string) (err error)
- func (r *DingDingRobot) SendTextMessageWithMention(securitySettings *DingDingSecuritySettings, content string, ...) (err error)
- type DingDingRobotActionCardButton
- type DingDingRobotActionCardMessage
- type DingDingRobotFeedCardMessage
- type DingDingRobotLinkMessage
- type DingDingRobotMarkdownMessage
- type DingDingRobotMentionAt
- type DingDingRobotMessageResp
- type DingDingSecuritySettings
Constants ¶
const ( DingDingOptionYes = 1 DingDingOptionNo = 0 )
const ( DingDingAppMessageTypeText = "text" DingDingAppMessageTypeImage = "image" DingDingAppMessageTypeVoice = "voice" DingDingAppMessageTypeFile = "file" DingDingAppMessageTypeLink = "link" DingDingAppMessageTypeOA = "oa" DingDingAppMessageTypeMarkdown = "markdown" DingDingAppMessageTypeActionCard = "action_card" )
const ( DingDingRobotMessageTypeText = "text" DingDingRobotMessageTypeLink = "link" DingDingRobotMessageTypeMarkdown = "markdown" DingDingRobotMessageTypeActionCard = "actionCard" DingDingRobotMessageTypeFeedCard = "feedCard" )
const ( DingDingActionCardMessageButtonOrientationVertical = "0" DingDingActionCardMessageButtonOrientationHorizontal = "1" )
const DingDingAppCreateGroupAPI = "https://oapi.dingtalk.com/chat/create"
DingDingAppCreateGroupAPI is the api to create dingding group
const DingDingAppGetGroupAPI = "https://oapi.dingtalk.com/chat/get"
DingDingAppGetGroupAPI is the api to get dingding group
const DingDingAppGetMessageSendProgressAPI = "https://oapi.dingtalk.com/topapi/message/corpconversation/getsendprogress"
DingDingAppGetMessageSendProgressAPI is the api to get the message send progress
const DingDingAppGetMessageSendResultAPI = "https://oapi.dingtalk.com/topapi/message/corpconversation/getsendresult"
DingDingAppGetMessageSendResultAPI is the api to get the message send result
const DingDingAppRecallMessageAPI = "https://oapi.dingtalk.com/topapi/message/corpconversation/recall"
DingDingAppRecallMessageAPI is the api to recall the message
const DingDingAppSendGroupMessageAPI = "https://oapi.dingtalk.com/chat/send"
DingDingAppSendGroupMessageAPI is the api to send message to group
const DingDingAppSendMessageAPI = "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2"
DingDingAppSendMessageAPI is the api to send message to end users
const DingDingAppStatusOK = 0
DingDingAppStatusOK is the ok status of api call
const DingDingAppTimeout = time.Second * 10
DingDingAppTimeout is the dingding app default timeout
const DingDingAppTokenAPI = "https://oapi.dingtalk.com/gettoken"
DingDingAppTokenAPI is the api to get app access token
const DingDingAppUpdateGroupAPI = "https://oapi.dingtalk.com/chat/update"
DingDingAppUpdateGroupAPI is the api to update dingding group
const DingDingCodeAccessTokenExpired = 42001
See doc https://ding-doc.dingtalk.com/doc#/faquestions/rftpfg
const DingDingRobotMessageAPI = "https://oapi.dingtalk.com/robot/send"
DingDingRobotMessageAPI is the api to send the robot messages
const DingDingRobotStatusOK = 0
DingDingRobotStatusOK is the ok status of api call
const DingDingRobotTimeout = time.Second * 10
DingDingRobotTimeout is the dingding robot default timeout
Variables ¶
This section is empty.
Functions ¶
func HmacSha256 ¶
HmacSha256 hash the data using algorithm hmac-sha1
Types ¶
type DingDingApp ¶
type DingDingApp struct {
// contains filtered or unexported fields
}
func NewDingDingApp ¶
func NewDingDingApp(appKey, appSecret, agentID string) *DingDingApp
NewDingDingApp create a new dingding app
func NewDingDingAppWithClient ¶
func NewDingDingAppWithClient(appKey, appSecret, agentID string, client *http.Client) *DingDingApp
NewDingDingAppWithClient create a new dingding app with http.Client
func NewDingDingAppWithTimeout ¶
func NewDingDingAppWithTimeout(appKey, appSecret, agentID string, timeout time.Duration) *DingDingApp
NewDingDingAppWithTimeout create a new dingding app with timeout
func (*DingDingApp) CreateGroupChat ¶
func (r *DingDingApp) CreateGroupChat(name, ownerID string, userIDList []string, options *DingDingAppCreateGroupOptions) (newChatID string, err error)
CreateGroupChat create a new group chat
func (*DingDingApp) GetGroupChat ¶
func (r *DingDingApp) GetGroupChat(chatID string) (group DingDingAppGroup, err error)
func (*DingDingApp) GetMessageSendProgress ¶
func (r *DingDingApp) GetMessageSendProgress(taskID int) (sendProgressResp DingDingAppMessageSendProgressResp, err error)
func (*DingDingApp) GetMessageSendResult ¶
func (r *DingDingApp) GetMessageSendResult(taskID int) (sendResultResp DingDingAppMessageSendResultResp, err error)
func (*DingDingApp) IsAccessTokenExpired ¶
func (r *DingDingApp) IsAccessTokenExpired() bool
func (*DingDingApp) RecallMessage ¶
func (r *DingDingApp) RecallMessage(taskID int) (revokeResp DingDingAppMessageRecallResp, err error)
func (*DingDingApp) SendActionCardMessage ¶
func (r *DingDingApp) SendActionCardMessage(userIDList []string, departmentIDList []string, toAllUser bool, actionCardMessage *DingDingAppActionCardMessage) ( resp DingDingAppMessageSendResp, err error)
func (*DingDingApp) SendFileMessage ¶
func (r *DingDingApp) SendFileMessage(userIDList []string, departmentIDList []string, toAllUser bool, mediaID string) ( resp DingDingAppMessageSendResp, err error)
func (*DingDingApp) SendGroupActionCardMessage ¶
func (r *DingDingApp) SendGroupActionCardMessage(chatID string, actionCardMessage *DingDingAppActionCardMessage) ( resp DingDingAppGroupMessageSendResp, err error)
func (*DingDingApp) SendGroupFileMessage ¶
func (r *DingDingApp) SendGroupFileMessage(chatID, mediaID string) ( resp DingDingAppGroupMessageSendResp, err error)
func (*DingDingApp) SendGroupImageMessage ¶
func (r *DingDingApp) SendGroupImageMessage(chatID, mediaID string) ( resp DingDingAppGroupMessageSendResp, err error)
func (*DingDingApp) SendGroupLinkMessage ¶
func (r *DingDingApp) SendGroupLinkMessage(chatID string, linkMessage *DingDingAppLinkMessage) ( resp DingDingAppGroupMessageSendResp, err error)
func (*DingDingApp) SendGroupMarkdownMessage ¶
func (r *DingDingApp) SendGroupMarkdownMessage(chatID, title, content string) ( resp DingDingAppGroupMessageSendResp, err error)
func (*DingDingApp) SendGroupTextMessage ¶
func (r *DingDingApp) SendGroupTextMessage(chatID string, content string) ( resp DingDingAppGroupMessageSendResp, err error)
func (*DingDingApp) SendGroupVoiceMessage ¶
func (r *DingDingApp) SendGroupVoiceMessage(chatID, mediaID string, duration int) ( resp DingDingAppGroupMessageSendResp, err error)
func (*DingDingApp) SendImageMessage ¶
func (r *DingDingApp) SendImageMessage(userIDList []string, departmentIDList []string, toAllUser bool, mediaID string) ( resp DingDingAppMessageSendResp, err error)
func (*DingDingApp) SendLinkMessage ¶
func (r *DingDingApp) SendLinkMessage(userIDList []string, departmentIDList []string, toAllUser bool, linkMessage *DingDingAppLinkMessage) ( resp DingDingAppMessageSendResp, err error)
func (*DingDingApp) SendMarkdownMessage ¶
func (r *DingDingApp) SendMarkdownMessage(userIDList []string, departmentIDList []string, toAllUser bool, title, content string) ( resp DingDingAppMessageSendResp, err error)
func (*DingDingApp) SendTextMessage ¶
func (r *DingDingApp) SendTextMessage(userIDList []string, departmentIDList []string, toAllUser bool, content string) ( resp DingDingAppMessageSendResp, err error)
func (*DingDingApp) SendVoiceMessage ¶
func (r *DingDingApp) SendVoiceMessage(userIDList []string, departmentIDList []string, toAllUser bool, mediaID string, duration int) ( resp DingDingAppMessageSendResp, err error)
func (*DingDingApp) UpdateGroupChat ¶
func (r *DingDingApp) UpdateGroupChat(chatID string, options *DingDingAppUpdateGroupOptions) (err error)
type DingDingAppActionCardMessage ¶
type DingDingAppActionCardMessage struct { Title string `json:"title"` Markdown string `json:"markdown"` SingleTitle string `json:"single_title,omitempty"` // single jump action card fields SingleURL string `json:"single_url,omitempty"` ButtonOrientation string `json:"btn_orientation"` // standalone jump action card fields Buttons []DingDingAppActionCardButton `json:"btn_json_list,omitempty"` }
type DingDingAppGetGroupResp ¶
type DingDingAppGetGroupResp struct { ErrCode int `json:"errcode"` ErrMessage string `json:"errmsg"` ChatInfo DingDingAppGroup `json:"chat_info"` }
type DingDingAppGroup ¶
type DingDingAppGroup struct { ChatID string `json:"chatid"` Name string `json:"name"` Owner string `json:"owner"` UserIDList []string `json:"useridlist"` Icon string `json:"icon"` ShowHistoryType int `json:"showHistoryType"` Searchable int `json:"searchable"` ValidationType int `json:"validationType"` MentionAllAuthority int `json:"mentionAllAuthority"` ChatBannedType int `json:"chatBannedType"` ManagementType int `json:"managementType"` }
type DingDingAppLinkMessage ¶
type DingDingAppMessageSendProgressResp ¶
type DingDingAppMessageSendProgressResp struct { ErrCode int `json:"errcode"` ErrMessage string `json:"errmsg"` Progress DingDingAppMessageSendProgress `json:"progress"` }
type DingDingAppMessageSendResult ¶
type DingDingAppMessageSendResult struct { InvalidUserIDList []string `json:"invalid_user_id_list"` ForbiddenUserIDList []string `json:"forbidden_user_id_list"` FailedUserIDList []string `json:"failed_user_id_list"` ReadUserIDList []string `json:"read_user_id_list"` UnReadUserIDList []string `json:"unread_user_id_list"` InvalidDeptIDList []string `json:"invalid_dept_id_list"` }
type DingDingAppMessageSendResultResp ¶
type DingDingAppMessageSendResultResp struct { ErrCode int `json:"errcode"` ErrMessage string `json:"errmsg"` SendResult DingDingAppMessageSendResult `json:"send_result"` }
type DingDingAppTokenResp ¶
type DingDingRobot ¶
type DingDingRobot struct {
// contains filtered or unexported fields
}
func NewDingDingRobot ¶
func NewDingDingRobot() *DingDingRobot
NewDingDingRobot create a new dingding robot
func NewDingDingRobotWithClient ¶
func NewDingDingRobotWithClient(client *http.Client) *DingDingRobot
NewDingDingRobotWithClient create a new dingding robot with http.Client
func NewDingDingRobotWithTimeout ¶
func NewDingDingRobotWithTimeout(timeout time.Duration) *DingDingRobot
NewDingDingRobotWithTimeout create a new dingding robot with timeout
func (*DingDingRobot) SendActionCardMessage ¶
func (r *DingDingRobot) SendActionCardMessage(securitySettings *DingDingSecuritySettings, actionCardMessage *DingDingRobotActionCardMessage) (err error)
func (*DingDingRobot) SendFeedCardMessage ¶
func (r *DingDingRobot) SendFeedCardMessage(securitySettings *DingDingSecuritySettings, feedCardMessages []DingDingRobotFeedCardMessage) (err error)
func (*DingDingRobot) SendLinkMessage ¶
func (r *DingDingRobot) SendLinkMessage(securitySettings *DingDingSecuritySettings, linkMessage *DingDingRobotLinkMessage) (err error)
func (*DingDingRobot) SendMarkdownMessage ¶
func (r *DingDingRobot) SendMarkdownMessage(securitySettings *DingDingSecuritySettings, markdownMessage *DingDingRobotMarkdownMessage) (err error)
func (*DingDingRobot) SendMarkdownMessageWithMention ¶
func (r *DingDingRobot) SendMarkdownMessageWithMention(securitySettings *DingDingSecuritySettings, markdownMessage *DingDingRobotMarkdownMessage, mentionedMobileList []string, atAll bool) (err error)
func (*DingDingRobot) SendTextMessage ¶
func (r *DingDingRobot) SendTextMessage(securitySettings *DingDingSecuritySettings, content string) (err error)
func (*DingDingRobot) SendTextMessageWithMention ¶
func (r *DingDingRobot) SendTextMessageWithMention(securitySettings *DingDingSecuritySettings, content string, mentionedMobileList []string, atAll bool) (err error)
type DingDingRobotActionCardMessage ¶
type DingDingRobotActionCardMessage struct { Title string `json:"title"` Text string `json:"text"` // single jump action card fields SingleTitle string `json:"singleTitle,omitempty"` SingleURL string `json:"singleURL,omitempty"` // standalone jump action card fields ButtonOrientation string `json:"btnOrientation"` Buttons []DingDingRobotActionCardButton `json:"btns,omitempty"` }