Documentation
¶
Index ¶
- Constants
- type WxWorkApp
- func (r *WxWorkApp) CreateGroupChat(name, ownerID string, userIDList []string, ...) (newChatID string, err error)
- func (r *WxWorkApp) GetGroupChat(chatID string) (group WxWorkAppGroup, err error)
- func (r *WxWorkApp) IsAccessTokenExpired() bool
- func (r *WxWorkApp) SendFileMessage(userIDList []string, partyIDList []string, tagIDList []string, mediaID string, ...) (resp WxWorkAppMessageResp, err error)
- func (r *WxWorkApp) SendGroupFileMessage(chatID, mediaID string, options *WxWorkAppMessageSendOptions) (err error)
- func (r *WxWorkApp) SendGroupImageMessage(chatID, mediaID string, options *WxWorkAppMessageSendOptions) (err error)
- func (r *WxWorkApp) SendGroupMarkdownMessage(chatID, content string, options *WxWorkAppMessageSendOptions) (err error)
- func (r *WxWorkApp) SendGroupMpNewsMessage(chatID string, articles []WxWorkAppMpNewsMessageArticle, ...) (err error)
- func (r *WxWorkApp) SendGroupNewsMessage(chatID string, articles []WxWorkAppNewsMessageArticle, ...) (err error)
- func (r *WxWorkApp) SendGroupTextCardMessage(chatID, title, description, url, btnText string, ...) (err error)
- func (r *WxWorkApp) SendGroupTextMessage(chatID, content string, options *WxWorkAppMessageSendOptions) (err error)
- func (r *WxWorkApp) SendGroupVideoMessage(chatID, mediaID, mediaTitle, mediaDescription string, ...) (err error)
- func (r *WxWorkApp) SendGroupVoiceMessage(chatID, mediaID string, options *WxWorkAppMessageSendOptions) (err error)
- func (r *WxWorkApp) SendImageMessage(userIDList []string, partyIDList []string, tagIDList []string, mediaID string, ...) (resp WxWorkAppMessageResp, err error)
- func (r *WxWorkApp) SendMarkdownMessage(userIDList []string, partyIDList []string, tagIDList []string, content string, ...) (resp WxWorkAppMessageResp, err error)
- func (r *WxWorkApp) SendMiniProgramNoticeMessage(userIDList []string, partyIDList []string, tagIDList []string, ...) (resp WxWorkAppMessageResp, err error)
- func (r *WxWorkApp) SendMpNewsMessage(userIDList []string, partyIDList []string, tagIDList []string, ...) (resp WxWorkAppMessageResp, err error)
- func (r *WxWorkApp) SendNewsMessage(userIDList []string, partyIDList []string, tagIDList []string, ...) (resp WxWorkAppMessageResp, err error)
- func (r *WxWorkApp) SendTaskCardMessage(userIDList []string, partyIDList []string, tagIDList []string, ...) (resp WxWorkAppMessageResp, err error)
- func (r *WxWorkApp) SendTextCardMessage(userIDList []string, partyIDList []string, tagIDList []string, ...) (resp WxWorkAppMessageResp, err error)
- func (r *WxWorkApp) SendTextMessage(userIDList []string, partyIDList []string, tagIDList []string, content string, ...) (resp WxWorkAppMessageResp, err error)
- func (r *WxWorkApp) SendVideoMessage(userIDList []string, partyIDList []string, tagIDList []string, ...) (resp WxWorkAppMessageResp, err error)
- func (r *WxWorkApp) SendVoiceMessage(userIDList []string, partyIDList []string, tagIDList []string, mediaID string, ...) (resp WxWorkAppMessageResp, err error)
- func (r *WxWorkApp) UpdateGroupChat(chatID string, options *WxWorkAppUpdateGroupOptions) (err error)
- func (r *WxWorkApp) UploadImage(fileBody []byte, fileName string) (imageURL string, err error)
- func (r *WxWorkApp) UploadMedia(fileBody []byte, fileName, fileType string) (mediaID string, createdAt int64, err error)
- type WxWorkAppCreateGroupOptions
- type WxWorkAppCreateGroupResp
- type WxWorkAppGetGroupResp
- type WxWorkAppGroup
- type WxWorkAppGroupMessageResp
- type WxWorkAppMessageResp
- type WxWorkAppMessageSendOptions
- type WxWorkAppMiniProgramNoticeMessageItem
- type WxWorkAppMpNewsMessageArticle
- type WxWorkAppNewsMessageArticle
- type WxWorkAppTaskCardMessageButton
- type WxWorkAppTokenResp
- type WxWorkAppUpdateGroupOptions
- type WxWorkAppUpdateGroupResp
- type WxWorkAppUploadImageResp
- type WxWorkAppUploadMediaResp
- type WxWorkRobot
- func (r *WxWorkRobot) SendFileMessage(key, mediaID string) (err error)
- func (r *WxWorkRobot) SendImageMessage(key string, imageData []byte) (err error)
- func (r *WxWorkRobot) SendMarkdownMessage(key, content string) (err error)
- func (r *WxWorkRobot) SendMarkdownMessageWithMention(key, content string, mentionedList []string, mentionedMobileList []string) (err error)
- func (r *WxWorkRobot) SendNewsMessage(key string, articles []WxWorkRobotNewsMessageArticle) (err error)
- func (r *WxWorkRobot) SendTextMessage(key, text string) (err error)
- func (r *WxWorkRobot) SendTextMessageWithMention(key, content string, mentionedList []string, mentionedMobileList []string) (err error)
- func (r *WxWorkRobot) UploadFile(key string, fileBody []byte, fileName string) (mediaID string, createdAt int64, err error)
- type WxWorkRobotFileMessage
- type WxWorkRobotFileMessageBody
- type WxWorkRobotImagMessage
- type WxWorkRobotImagMessageBody
- type WxWorkRobotMarkdownMessage
- type WxWorkRobotMarkdownMessageBody
- type WxWorkRobotMessageResp
- type WxWorkRobotNewsMessage
- type WxWorkRobotNewsMessageArticle
- type WxWorkRobotNewsMessageBody
- type WxWorkRobotTextMessage
- type WxWorkRobotTextMessageBody
- type WxWorkRobotUploadFileResp
Constants ¶
const ( WxWorkAppMessageTypeText = "text" WxWorkAppMessageTypeImage = "image" WxWorkAppMessageTypeVoice = "voice" WxWorkAppMessageTypeVideo = "video" WxWorkAppMessageTypeFile = "file" WxWorkAppMessageTypeTextCard = "textcard" WxWorkAppMessageTypeNews = "news" WxWorkAppMessageTypeMpNews = "mpnews" WxWorkAppMessageTypeMarkdown = "markdown" // The following two message type are only supported by simple message WxWorkAppMessageTypeMiniProgramNotice = "miniprogram_notice" WxWorkAppMessageTypeTaskCard = "taskcard" )
const ( WxWorkAppMediaTypeImage = "image" WxWorkAppMediaTypeVoice = "voice" WxWorkAppMediaTypeVideo = "video" WxWorkAppMediaTypeFile = "file" )
const ( WxWorkRobotMessageTypeText = "text" WxWorkRobotMessageTypeMarkdown = "markdown" WxWorkRobotMessageTypeImage = "image" WxWorkRobotMessageTypeNews = "news" WxWorkRobotMessageTypeFile = "file" )
const WxWorkAppCreateGroupAPI = "https://qyapi.weixin.qq.com/cgi-bin/appchat/create"
WxWorkAppCreateGroupAPI is the api to create the wxwork group
const WxWorkAppGetGroupAPI = "https://qyapi.weixin.qq.com/cgi-bin/appchat/get"
WxWorkAppGetGroupAPI is the api to get the wxwork group
const WxWorkAppGroupMessageAPI = "https://qyapi.weixin.qq.com/cgi-bin/appchat/send"
WxWorkAppGroupMessageAPI is the api to send messages to wxwork group
const WxWorkAppMessageAPI = "https://qyapi.weixin.qq.com/cgi-bin/message/send"
WxWorkAppMessageAPI is the api to send messages to wxwork user/party/tag
const WxWorkAppStatusOK = 0
WxWorkAppStatusOK is the ok status of api call
const WxWorkAppTimeout = time.Second * 10
WxWorkAppTimeout is the wxwork app default timeout
const WxWorkAppTokenAPI = "https://qyapi.weixin.qq.com/cgi-bin/gettoken"
WxWorkAppGroupMessageAPI is the api to get the app access token
const WxWorkAppUpdateGroupAPI = "https://qyapi.weixin.qq.com/cgi-bin/appchat/update"
WxWorkAppUpdateGroupAPI is the api to update the wxwork group
const WxWorkAppUploadImageAPI = "https://qyapi.weixin.qq.com/cgi-bin/media/uploadimg"
WxWorkAppUploadImageAPI is the api to upload the wxwork app image
const WxWorkAppUploadMediaAPI = "https://qyapi.weixin.qq.com/cgi-bin/media/upload"
WxWorkAppUploadMediaAPI is the api to upload the wxwork app media
const WxWorkCodeAccessTokenExpired = 42001
See doc https://work.weixin.qq.com/api/doc/90000/90139/90313
const WxWorkRobotMessageAPI = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send"
WxWorkRobotMessageAPI is the api to send the robot messages
const WxWorkRobotStatusOK = 0
const WxWorkRobotTimeout = time.Second * 10
WxWorkRobotTimeout is the wxwork robot default timeout
const WxWorkRobotUploadFileAPI = "https://qyapi.weixin.qq.com/cgi-bin/webhook/upload_media"
WxWorkRobotUploadFileAPI is the api to upload file
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WxWorkApp ¶
type WxWorkApp struct {
// contains filtered or unexported fields
}
func NewWxWorkApp ¶
NewWxWorkApp create a new wxwork app
func NewWxWorkAppWithClient ¶
NewWxWorkAppWithClient create a new wxwork app with http.Client
func NewWxWorkAppWithTimeout ¶
NewWxWorkAppWithTimeout create a new wxwork app with timeout
func (*WxWorkApp) CreateGroupChat ¶
func (r *WxWorkApp) CreateGroupChat(name, ownerID string, userIDList []string, options *WxWorkAppCreateGroupOptions) (newChatID string, err error)
CreateGroupChat create a new group chat
func (*WxWorkApp) GetGroupChat ¶
func (r *WxWorkApp) GetGroupChat(chatID string) (group WxWorkAppGroup, err error)
func (*WxWorkApp) IsAccessTokenExpired ¶
func (*WxWorkApp) SendFileMessage ¶
func (r *WxWorkApp) SendFileMessage(userIDList []string, partyIDList []string, tagIDList []string, mediaID string, options *WxWorkAppMessageSendOptions) (resp WxWorkAppMessageResp, err error)
func (*WxWorkApp) SendGroupFileMessage ¶
func (r *WxWorkApp) SendGroupFileMessage(chatID, mediaID string, options *WxWorkAppMessageSendOptions) (err error)
func (*WxWorkApp) SendGroupImageMessage ¶
func (r *WxWorkApp) SendGroupImageMessage(chatID, mediaID string, options *WxWorkAppMessageSendOptions) (err error)
func (*WxWorkApp) SendGroupMarkdownMessage ¶
func (r *WxWorkApp) SendGroupMarkdownMessage(chatID, content string, options *WxWorkAppMessageSendOptions) (err error)
func (*WxWorkApp) SendGroupMpNewsMessage ¶
func (r *WxWorkApp) SendGroupMpNewsMessage(chatID string, articles []WxWorkAppMpNewsMessageArticle, options *WxWorkAppMessageSendOptions) (err error)
func (*WxWorkApp) SendGroupNewsMessage ¶
func (r *WxWorkApp) SendGroupNewsMessage(chatID string, articles []WxWorkAppNewsMessageArticle, options *WxWorkAppMessageSendOptions) (err error)
func (*WxWorkApp) SendGroupTextCardMessage ¶
func (r *WxWorkApp) SendGroupTextCardMessage(chatID, title, description, url, btnText string, options *WxWorkAppMessageSendOptions) (err error)
func (*WxWorkApp) SendGroupTextMessage ¶
func (r *WxWorkApp) SendGroupTextMessage(chatID, content string, options *WxWorkAppMessageSendOptions) (err error)
func (*WxWorkApp) SendGroupVideoMessage ¶
func (r *WxWorkApp) SendGroupVideoMessage(chatID, mediaID, mediaTitle, mediaDescription string, options *WxWorkAppMessageSendOptions) (err error)
func (*WxWorkApp) SendGroupVoiceMessage ¶
func (r *WxWorkApp) SendGroupVoiceMessage(chatID, mediaID string, options *WxWorkAppMessageSendOptions) (err error)
func (*WxWorkApp) SendImageMessage ¶
func (r *WxWorkApp) SendImageMessage(userIDList []string, partyIDList []string, tagIDList []string, mediaID string, options *WxWorkAppMessageSendOptions) (resp WxWorkAppMessageResp, err error)
func (*WxWorkApp) SendMarkdownMessage ¶
func (r *WxWorkApp) SendMarkdownMessage(userIDList []string, partyIDList []string, tagIDList []string, content string, options *WxWorkAppMessageSendOptions) (resp WxWorkAppMessageResp, err error)
func (*WxWorkApp) SendMiniProgramNoticeMessage ¶
func (r *WxWorkApp) SendMiniProgramNoticeMessage(userIDList []string, partyIDList []string, tagIDList []string, appID, page, title, description string, emphisFirstItem bool, contentItems []WxWorkAppMiniProgramNoticeMessageItem, options *WxWorkAppMessageSendOptions) (resp WxWorkAppMessageResp, err error)
func (*WxWorkApp) SendMpNewsMessage ¶
func (r *WxWorkApp) SendMpNewsMessage(userIDList []string, partyIDList []string, tagIDList []string, articles []WxWorkAppMpNewsMessageArticle, options *WxWorkAppMessageSendOptions) (resp WxWorkAppMessageResp, err error)
func (*WxWorkApp) SendNewsMessage ¶
func (r *WxWorkApp) SendNewsMessage(userIDList []string, partyIDList []string, tagIDList []string, articles []WxWorkAppNewsMessageArticle, options *WxWorkAppMessageSendOptions) (resp WxWorkAppMessageResp, err error)
func (*WxWorkApp) SendTaskCardMessage ¶
func (r *WxWorkApp) SendTaskCardMessage(userIDList []string, partyIDList []string, tagIDList []string, taskID, title, description, url string, buttons []WxWorkAppTaskCardMessageButton, options *WxWorkAppMessageSendOptions) (resp WxWorkAppMessageResp, err error)
func (*WxWorkApp) SendTextCardMessage ¶
func (r *WxWorkApp) SendTextCardMessage(userIDList []string, partyIDList []string, tagIDList []string, title, description, url, btnText string, options *WxWorkAppMessageSendOptions) (resp WxWorkAppMessageResp, err error)
func (*WxWorkApp) SendTextMessage ¶
func (r *WxWorkApp) SendTextMessage(userIDList []string, partyIDList []string, tagIDList []string, content string, options *WxWorkAppMessageSendOptions) (resp WxWorkAppMessageResp, err error)
func (*WxWorkApp) SendVideoMessage ¶
func (r *WxWorkApp) SendVideoMessage(userIDList []string, partyIDList []string, tagIDList []string, mediaID, mediaTitle, mediaDescription string, options *WxWorkAppMessageSendOptions) (resp WxWorkAppMessageResp, err error)
func (*WxWorkApp) SendVoiceMessage ¶
func (r *WxWorkApp) SendVoiceMessage(userIDList []string, partyIDList []string, tagIDList []string, mediaID string, options *WxWorkAppMessageSendOptions) (resp WxWorkAppMessageResp, err error)
func (*WxWorkApp) UpdateGroupChat ¶
func (r *WxWorkApp) UpdateGroupChat(chatID string, options *WxWorkAppUpdateGroupOptions) (err error)
func (*WxWorkApp) UploadImage ¶
type WxWorkAppCreateGroupOptions ¶
type WxWorkAppCreateGroupOptions struct {
ChatID string
}
type WxWorkAppGetGroupResp ¶
type WxWorkAppGetGroupResp struct { ErrCode int `json:"errcode"` ErrMessage string `json:"errmsg"` ChatInfo WxWorkAppGroup `json:"chat_info"` }
type WxWorkAppGroup ¶
type WxWorkAppMessageResp ¶
type WxWorkAppTokenResp ¶
type WxWorkRobot ¶
type WxWorkRobot struct {
// contains filtered or unexported fields
}
WxWorkRobot is a robot to send wxwork messages
func NewWxWorkRobotWithClient ¶
func NewWxWorkRobotWithClient(client *http.Client) *WxWorkRobot
NewWxWorkRobotWithClient create a new wxwork robot with http.Client
func NewWxWorkRobotWithTimeout ¶
func NewWxWorkRobotWithTimeout(timeout time.Duration) *WxWorkRobot
NewWxWorkRobotWithTimeout create a new wxwork robot with timeout
func (*WxWorkRobot) SendFileMessage ¶
func (r *WxWorkRobot) SendFileMessage(key, mediaID string) (err error)
SendFileMessage send the file message
func (*WxWorkRobot) SendImageMessage ¶
func (r *WxWorkRobot) SendImageMessage(key string, imageData []byte) (err error)
SendImageMessage send the markdown message
func (*WxWorkRobot) SendMarkdownMessage ¶
func (r *WxWorkRobot) SendMarkdownMessage(key, content string) (err error)
SendMarkdownMessage send the markdown message
func (*WxWorkRobot) SendMarkdownMessageWithMention ¶
func (r *WxWorkRobot) SendMarkdownMessageWithMention(key, content string, mentionedList []string, mentionedMobileList []string) (err error)
SendMarkdownMessageWithMention send the markdown message with specified mentioned users
func (*WxWorkRobot) SendNewsMessage ¶
func (r *WxWorkRobot) SendNewsMessage(key string, articles []WxWorkRobotNewsMessageArticle) (err error)
SendNewsMessage send the news message
func (*WxWorkRobot) SendTextMessage ¶
func (r *WxWorkRobot) SendTextMessage(key, text string) (err error)
SendTextMessage send the text message
func (*WxWorkRobot) SendTextMessageWithMention ¶
func (r *WxWorkRobot) SendTextMessageWithMention(key, content string, mentionedList []string, mentionedMobileList []string) (err error)
SendTextMessage send the text message with specified mentioned users
func (*WxWorkRobot) UploadFile ¶
func (r *WxWorkRobot) UploadFile(key string, fileBody []byte, fileName string) (mediaID string, createdAt int64, err error)
UploadFile upload the media file
type WxWorkRobotFileMessage ¶
type WxWorkRobotFileMessage struct { MessageType string `json:"msgtype"` MessageBody WxWorkRobotFileMessageBody `json:"file"` }
type WxWorkRobotFileMessageBody ¶
type WxWorkRobotFileMessageBody struct {
MediaID string `json:"media_id"`
}
type WxWorkRobotImagMessage ¶
type WxWorkRobotImagMessage struct { MessageType string `json:"msgtype"` MessageBody WxWorkRobotImagMessageBody `json:"image"` }
type WxWorkRobotMarkdownMessage ¶
type WxWorkRobotMarkdownMessage struct { MessageType string `json:"msgtype"` MessageBody WxWorkRobotMarkdownMessageBody `json:"markdown"` }
type WxWorkRobotMarkdownMessageBody ¶
type WxWorkRobotMarkdownMessageBody WxWorkRobotTextMessageBody
type WxWorkRobotMessageResp ¶
type WxWorkRobotNewsMessage ¶
type WxWorkRobotNewsMessage struct { MessageType string `json:"msgtype"` MessageBody WxWorkRobotNewsMessageBody `json:"news"` }
type WxWorkRobotNewsMessageBody ¶
type WxWorkRobotNewsMessageBody struct {
Articles []WxWorkRobotNewsMessageArticle `json:"articles"`
}
type WxWorkRobotTextMessage ¶
type WxWorkRobotTextMessage struct { MessageType string `json:"msgtype"` MessageBody WxWorkRobotTextMessageBody `json:"text"` }