Documentation
¶
Overview ¶
Package wxworkfinancesdk 企业内容存档SDK
Index ¶
- Constants
- func BufferPool() *bytes.Buffer
- func BufferPoolRelease(v *bytes.Buffer)
- func MediaDataPoolRelease(m *MediaData)
- func RSADecrypt(privateKey []byte, ciphertext []byte) ([]byte, error)
- func RSADecryptBase64(privateKey []byte, cryptoText string) ([]byte, error)
- func RSAEncrypt(publicKey []byte, origData []byte) ([]byte, error)
- func RSAEncryptBase64(publicKey []byte, origData []byte) (string, error)
- func RSASignWithSHA1(privateKey []byte, data []byte) ([]byte, error)
- func RSASignWithSHA1Base64(privateKey []byte, data []byte) (string, error)
- func RSAVerifySignWithSha1(publicKey []byte, origData []byte, signData string) error
- func ReaderPool(bs []byte) *bytes.Reader
- func ReaderPoolRelease(r *bytes.Reader)
- func Sha1Sum(data []byte) []byte
- type ActionType
- type AggreeMessage
- type BaseMessage
- type CalendarMessage
- type CardMessage
- type ChatData
- type ChatDataResponse
- type ChatRecord
- type ChatRecordMessage
- type ChatRecordType
- type Client
- func (c *Client) DecryptData(encryptKey string, encryptMsg string) (Message, error)
- func (c *Client) DownloadMedia(w io.Writer, sdkFileId string, proxy string, passwd string, timeout int) error
- func (c *Client) DownloadMediaZeroAlloc(w io.Writer, sdkFileId string, proxy string, passwd string, timeout int) error
- func (c *Client) Free()
- func (c *Client) GetChatData(seq uint64, limit uint64, proxy string, passwd string, timeout int) ([]ChatData, error)
- func (c Client) GetContentFromSlice(slice *C.struct_Slice_t, buf *bytes.Buffer)
- func (c *Client) GetMediaData(indexBuf string, sdkFileId string, proxy string, passwd string, timeout int, ...) error
- type CollectDetails
- type CollectDetailsType
- type CollectMessage
- type DemoFileData
- type DocMessage
- type EmotionMessage
- type EmotionType
- type Error
- type FileMessage
- type ImageMessage
- type LinkMessage
- type LocationMessage
- type MarkdownMessage
- type MediaData
- type MeetingMessage
- type MeetingStatus
- type MeetingType
- type MeetingVoiceCall
- type MeetingVoiceCallMessage
- type Message
- type MessageType
- type MixedMessage
- type MixedMsg
- type News
- type NewsMessage
- type RedpacketMessage
- type RedpacketType
- type RevokeMessage
- type ShareScreenData
- type SphfeedMessage
- type SphfeedType
- type SwitchMessage
- type TextMessage
- type TodoMessage
- type VideoMessage
- type VoiceMessage
- type VoipDocShare
- type VoipDocShareMessage
- type VoteMessage
- type VoteType
- type WeappMessage
Constants ¶
const ( // SDKErrMsg 错误消息 // SDKInitErrMsg sdk 初始化失败 SDKInitErrMsg = "sdk init failed" // GetChatDataErrMsg 调用 GetChatData API 失败 GetChatDataErrMsg = "call GetChatData failed" // DecryptErrMsg 调用 DecryptMessage API 失败 DecryptErrMsg = "call DecryptMessage API failed" // GetMediaDataErrMsg 调用 GetMediaData API 失败 GetMediaDataErrMsg = "call GetMediaData API failed" )
Variables ¶
This section is empty.
Functions ¶
func BufferPool ¶ added in v1.1.0
func BufferPoolRelease ¶ added in v1.1.0
func MediaDataPoolRelease ¶ added in v1.1.0
func MediaDataPoolRelease(m *MediaData)
func RSADecrypt ¶
RSADecrypt RSA解密
func RSADecryptBase64 ¶
RSADecryptBase64 base64decode后RSA解密
func RSAEncrypt ¶
RSAEncrypt RSA加密
func RSAEncryptBase64 ¶
RSAEncryptBase64 RSA加密后base64encode
func RSASignWithSHA1 ¶
RSASignWithSHA1 RSA-SHA1签名
func RSASignWithSHA1Base64 ¶
RSASignWithSHA1Base64 RSA-SHA1签名后做base64encode
func RSAVerifySignWithSha1 ¶
RSAVerifySignWithSha1 RSA-SHA1签名验证
func ReaderPool ¶ added in v1.1.0
func ReaderPoolRelease ¶ added in v1.1.0
Types ¶
type ActionType ¶
type ActionType = string
ActionType // 消息动作
const ( // SEND_ACTION 发送消息 SEND_ACTION ActionType = "send" // RECALL_ACTION 撤回消息 RECALL_ACTION ActionType = "recall" // SWITCH_ACTION 切换企业日志 SWITCH_ACTION ActionType = "switch" )
type AggreeMessage ¶
type AggreeMessage struct { BaseMessage UserId string `json:"userid,omitempty"` // 同意/不同意协议者的userid,外部企业默认为external_userid。 AgreeTime int64 `json:"agree_time,omitempty"` // 同意/不同意协议的时间,utc时间,ms单位。 }
AggreeMessage 同意会话消息
type BaseMessage ¶
type BaseMessage struct { MsgId string `json:"msgid,omitempty"` // 消息id,消息的唯一标识,企业可以使用此字段进行消息去重。 Action ActionType `json:"action,omitempty"` // 消息动作,目前有send(发送消息)/recall(撤回消息)/switch(切换企业日志)三种类型。 From string `json:"from,omitempty"` // 消息发送方id。同一企业内容为userid,非相同企业为external_userid。消息如果是机器人发出,也为external_userid。 ToList []string `json:"tolist,omitempty"` // 消息接收方列表,可能是多个,同一个企业内容为userid,非相同企业为external_userid。 RoomId string `json:"roomid,omitempty"` // 群聊消息的群id。如果是单聊则为空。 MsgTime int64 `json:"msgtime,omitempty"` // 消息发送时间戳,utc时间,ms单位。 MsgType MessageType `json:"msgtype,omitempty"` // 文本消息为:text。 }
BaseMessage 会话消息公共字段
func (BaseMessage) ActionType ¶
func (m BaseMessage) ActionType() ActionType
ActionType Message interface
func (BaseMessage) MessageType ¶
func (m BaseMessage) MessageType() MessageType
MessageType implement Message interface
type CalendarMessage ¶
type CalendarMessage struct { BaseMessage Title string `json:"title,omitempty"` // 日程主题 CreatorName string `json:"creatorname,omitempty"` // 日程组织者 AttendeeName []string `json:"attendeename,omitempty"` // 日程参与人。数组,内容为String类型 StartTime int64 `json:"starttime,omitempty"` // 日程开始时间。Utc时间,单位秒 EndTime int64 `json:"endtime,omitempty"` // 日程结束时间。Utc时间,单位秒 Place string `json:"place,omitempty"` // 日程地点 Remarks string `json:"remarks,omitempty"` // 日程备注 }
CalendarMessage 日程消息
type CardMessage ¶
type CardMessage struct { BaseMessage CorpName string `json:"corpname,omitempty"` // 名片所有者所在的公司名称。 UserId string `json:"userid,omitempty"` // 名片所有者的id,同一公司是userid,不同公司是external_userid }
CardMessage 名片消息
type ChatData ¶
type ChatData struct { Seq uint64 `json:"seq,omitempty"` // 消息的seq值,标识消息的序号。再次拉取需要带上上次回包中最大的seq。Uint64类型,范围0-pow(2,64)-1 MsgId string `json:"msgid,omitempty"` // 消息id,消息的唯一标识,企业可以使用此字段进行消息去重。 PublickeyVer uint32 `json:"publickey_ver,omitempty"` // 加密此条消息使用的公钥版本号。 EncryptRandomKey string `json:"encrypt_random_key,omitempty"` // 使用publickey_ver指定版本的公钥进行非对称加密后base64加密的内容,需要业务方先base64 decode处理后,再使用指定版本的私钥进行解密,得出内容。 EncryptChatMsg string `json:"encrypt_chat_msg,omitempty"` // 消息密文。需要业务方使用将encrypt_random_key解密得到的内容,与encrypt_chat_msg,传入sdk接口DecryptData,得到消息明文。 }
ChatData 加密消息数据
type ChatDataResponse ¶
ChatDataResponse 拉去消息返回值
type ChatRecord ¶
type ChatRecord struct { Type ChatRecordType `json:"type,omitempty"` // 每条聊天记录的具体消息类型:ChatRecordText/ ChatRecordFile/ ChatRecordImage/ ChatRecordVideo/ ChatRecordLink/ ChatRecordLocation/ ChatRecordMixed …. Content string `json:"content,omitempty"` // 消息内容。Json串,内容为对应类型的json MsgTime int64 `json:"msgtime,omitempty"` // 消息时间,utc时间,ms单位。 FromChatroom bool `json:"from_chatroom,omitempty"` // 是否来自群会话。 }
ChatRecord 消息记录内的消息内
type ChatRecordMessage ¶
type ChatRecordMessage struct { BaseMessage Title string `json:"title,omitempty"` // 聊天记录标题 Item []ChatRecord `json:"item,omitempty"` // 消息记录内的消息内容,批量数据 }
ChatRecordMessage 聊天记录消息
type ChatRecordType ¶
type ChatRecordType = string
ChatRecordType 每条聊天记录的具体消息类型
const ( // TEXT_REC_MSG 文本消息 TEXT_REC_MSG ChatRecordType = "ChatRecordText" // IMG_REC_MSG 图片消息 IMG_REC_MSG ChatRecordType = "ChatRecordImage" // VOICE_REC_MSG 语音消息 VOICE_REC_MSG ChatRecordType = "ChatRecordVoice" // VIDEO_REC_MSG 视频消息 VIDEO_REC_MSG ChatRecordType = "ChatRecordVideo" // CARD_REC_MSG 名片消息 CARD_REC_MSG ChatRecordType = "ChatRecordCard" // LOC_REC_MSG 位置消息 LOC_REC_MSG ChatRecordType = "ChatRecordLocation" // EMOTION_REC_MSG 表情消息 EMOTION_REC_MSG ChatRecordType = "ChatRecordEmotion" // FILE_REC_MSG 文件消息 FILE_REC_MSG ChatRecordType = "ChatRecordFile" // LINK_REC_MSG 链接消息 LINK_REC_MSG ChatRecordType = "ChatRecordLink" // WEAPP_REC_MSG 小程序消息 WEAPP_REC_MSG ChatRecordType = "ChatRecordWeapp" // MIXED_REC_MSG 混合消息 MIXED_REC_MSG ChatRecordType = "ChatRecordMixed" )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client Client对象
func NewClient ¶
NewClient 初始化函数 @param [in] corpid 调用企业的企业id,例如:wwd08c8exxxx5ab44d,可以在企业微信管理端--我的企业--企业信息查看 @param [in] secret 聊天内容存档的Secret,可以在企业微信管理端--管理工具--聊天内容存档查看
func (*Client) DecryptData ¶
DecryptData 解析密文.企业微信自有解密内容 @param [in] encrypt_key, getchatdata返回的encrypt_random_key,使用企业自持对应版本秘钥RSA解密后的内容 @param [in] encrypt_msg, getchatdata返回的encrypt_chat_msg @return msg, 解密的消息明文
func (*Client) DownloadMedia ¶
func (c *Client) DownloadMedia(w io.Writer, sdkFileId string, proxy string, passwd string, timeout int) error
DownloadMedia 下载MediaData
func (*Client) DownloadMediaZeroAlloc ¶ added in v1.1.0
func (c *Client) DownloadMediaZeroAlloc(w io.Writer, sdkFileId string, proxy string, passwd string, timeout int) error
DownloadMediaZeroAlloc 下载MediaData zero mem alloc version
func (*Client) GetChatData ¶
func (c *Client) GetChatData(seq uint64, limit uint64, proxy string, passwd string, timeout int) ([]ChatData, error)
GetChatData 拉取聊天记录函数
@param [in] seq 从指定的seq开始拉取消息,注意的是返回的消息从seq+1开始返回,seq为之前接口返回的最大seq值。首次使用请使用seq:0 @param [in] limit 一次拉取的消息条数,最大值1000条,超过1000条会返回错误 @param [in] proxy 使用代理的请求,需要传入代理的链接。如:socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081 @param [in] passwd 代理账号密码,需要传入代理的账号密码。如 user_name:passwd_123 @param [in] timeout 超时时间,单位秒 @return chatDatas 返回本次拉取消息的数据,slice结构体.内容包括errcode/errmsg,以及每条消息内容。示例如下:
{"errcode":0,"errmsg":"ok","chatdata":[{"seq":196,"msgid":"CAQQ2fbb4QUY0On2rYSAgAMgip/yzgs=","publickey_ver":3,"encrypt_random_key":"ftJ+uz3n/z1DsxlkwxNgE+mL38H42/KCvN8T60gbbtPD+Rta1hKTuQPzUzO6Hzne97MgKs7FfdDxDck/v8cDT6gUVjA2tZ/M7euSD0L66opJ/IUeBtpAtvgVSD5qhlaQjvfKJc/zPMGNK2xCLFYqwmQBZXbNT7uA69Fflm512nZKW/piK2RKdYJhRyvQnA1ISxK097sp9WlEgDg250fM5tgwMjujdzr7ehK6gtVBUFldNSJS7ndtIf6aSBfaLktZgwHZ57ONewWq8GJe7WwQf1hwcDbCh7YMG8nsweEwhDfUz+u8rz9an+0lgrYMZFRHnmzjgmLwrR7B/32Qxqd79A==","encrypt_chat_msg":"898WSfGMnIeytTsea7Rc0WsOocs0bIAerF6de0v2cFwqo9uOxrW9wYe5rCjCHHH5bDrNvLxBE/xOoFfcwOTYX0HQxTJaH0ES9OHDZ61p8gcbfGdJKnq2UU4tAEgGb8H+Q9n8syRXIjaI3KuVCqGIi4QGHFmxWenPFfjF/vRuPd0EpzUNwmqfUxLBWLpGhv+dLnqiEOBW41Zdc0OO0St6E+JeIeHlRZAR+E13Isv9eS09xNbF0qQXWIyNUi+ucLr5VuZnPGXBrSfvwX8f0QebTwpy1tT2zvQiMM2MBugKH6NuMzzuvEsXeD+6+3VRqL"}]}
func (Client) GetContentFromSlice ¶
func (c Client) GetContentFromSlice(slice *C.struct_Slice_t, buf *bytes.Buffer)
GetContentFromSlice 转换C.struct_Slice_t为go bytes
func (*Client) GetMediaData ¶
func (c *Client) GetMediaData(indexBuf string, sdkFileId string, proxy string, passwd string, timeout int, data *MediaData) error
GetMediaData 拉取媒体消息函数 Return值=0表示该API调用成功
@param [in] sdkFileid 从GetChatData返回的聊天消息中,媒体消息包括的sdkfileid @param [in] proxy 使用代理的请求,需要传入代理的链接。如:socks5://10.0.0.1:8081 或者 http://10.0.0.1:8081 @param [in] passwd 代理账号密码,需要传入代理的账号密码。如 user_name:passwd_123 @param [in] indexbuf 媒体消息分片拉取,需要填入每次拉取的索引信息。首次不需要填写,默认拉取512k,后续每次调用只需要将上次调用返回的outindexbuf填入即可。 @param [in] timeout 超时时间,单位秒 @return media_data 返回本次拉取的媒体数据.MediaData结构体.内容包括data(数据内容)/outindexbuf(下次索引)/is_finish(拉取完成标记)
type CollectDetails ¶
type CollectDetails struct { Id uint64 `json:"id,omitempty"` // 表项id Ques string `json:"ques,omitempty"` // 表项名称 Type CollectDetailsType `json:"type,omitempty"` // 表项类型,有Text(文本),Number(数字),Date(日期),Time(时间) }
CollectDetails 填表消息表内容
type CollectDetailsType ¶
type CollectDetailsType = string
CollectDetailsType 表项类型
const ( // TEXT 文本 TEXT CollectDetailsType = "Text" // NUMBER 数字 NUMBER CollectDetailsType = "Number" // DATE 日期 DATE CollectDetailsType = "Date" // TIME 时间 TIME CollectDetailsType = "Time" )
type CollectMessage ¶
type CollectMessage struct { BaseMessage RoomName string `json:"room_name,omitempty"` // 填表消息所在的群名称。 Creator string `json:"creator,omitempty"` // 创建者在群中的名字 CreateTime string `json:"create_time,omitempty"` // 创建的时间 Details []CollectDetails `json:"details,omitempty"` // 表内容 }
CollectMessage 填表消息
type DemoFileData ¶
type DemoFileData struct { FileName string `json:"filename,omitempty"` // 文档共享名称 DemoOperator string `json:"demooperator,omitempty"` // 文档共享操作用户的id StartTime int64 `json:"starttime,omitempty"` // 文档共享开始时间 EndTime int64 `json:"endtime,omitempty"` // 文档共享结束时间 }
DemoFileData 文档分享对
type DocMessage ¶
type DocMessage struct { BaseMessage Title string `json:"title,omitempty"` // 在线文档名称 LinkUrl string `json:"link_url,omitempty"` // 在线文档链接 DocCreator string `json:"doc_creator,omitempty"` // 在线文档创建者。本企业成员创建为userid;外部企业成员创建为external_userid }
DocMessage 在线文档消息
type EmotionMessage ¶
type EmotionMessage struct { BaseMessage Type EmotionType `json:"type,omitempty"` // 表情类型,png或者gif.1表示gif 2表示png。 Width uint32 `json:"width,omitempty"` // 表情图片宽度。 Height uint32 `json:"height,omitempty"` // 表情图片高度。 ImageSize uint32 `json:"imagesize,omitempty"` // 资源的文件大小。 SdkFileId string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。 Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。 }
EmotionMessage 表情消息
type EmotionType ¶
type EmotionType = uint32
EmotionType 表情类型
const ( // GIF gif表情 GIF EmotionType = 1 // PNG png表情 PNG EmotionType = 2 )
type Error ¶
type Error struct { ErrCode int `json:"errcode,omitempty"` // 错误代码 ErrMsg string `json:"errmsg,omitempty"` // 错误说明 Hint string `json:"hint,omitempty"` }
Error SDK Error结构体
type FileMessage ¶
type FileMessage struct { BaseMessage FileName string `json:"filename,omitempty"` // 文件名称。 FileExt string `json:"fileext,omitempty"` // 文件类型后缀。 SdkFileId string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。 FileSize uint32 `json:"filesize,omitempty"` // 文件大小。 Md5Sum string `json:"md5sum,omitempty"` // 资源的md5值,供进行校验。 }
FileMessage 文件消息
type ImageMessage ¶
type ImageMessage struct { BaseMessage SdkFileId string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。 Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。 FileSize uint32 `json:"filesize,omitempty"` // 图片资源的文件大小。 }
ImageMessage 图片消息
type LinkMessage ¶
type LinkMessage struct { BaseMessage Title string `json:"title,omitempty"` // 消息标题。 Desc string `json:"description,omitempty"` // 消息描述。 LinkUrl string `json:"link_url,omitempty"` // 链接url地址 ImageUrl string `json:"image_url,omitempty"` // 链接图片url。 }
LinkMessage 链接消息
type LocationMessage ¶
type LocationMessage struct { BaseMessage Lng float64 `json:"longitude,omitempty"` // 经度,单位double Lat float64 `json:"latitude,omitempty"` // 纬度,单位double Address string `json:"address,omitempty"` // 地址信息 Title string `json:"title,omitempty"` // 位置信息的title。 Zoom uint32 `json:"zoom,omitempty"` // 缩放比例。 }
LocationMessage 位置消息
type MarkdownMessage ¶
type MarkdownMessage struct { BaseMessage Content string `json:"content,omitempty"` // markdown消息内容,目前为机器人发出的消息 }
MarkdownMessage MarkDown格式消息
type MediaData ¶
type MediaData struct { OutIndexBuf string `json:"outindexbuf,omitempty"` // 消息分片索引信息 IsFinish bool `json:"is_finish,omitempty"` // Data []byte `json:"data,omitempty"` // 媒体数据内通 }
MediaData 媒体消息结构体
func MediaDataPool ¶ added in v1.1.0
func MediaDataPool() *MediaData
type MeetingMessage ¶
type MeetingMessage struct { BaseMessage Topic string `json:"topic,omitempty"` // 会议主题 StartTime int64 `json:"starttime,omitempty"` // 会议开始时间。Utc时间 EndTime int64 `json:"endtime,omitempty"` // 会议结束时间。Utc时间 Address string `json:"address,omitempty"` // 会议地址 Remarks string `json:"remarks,omitempty"` // 会议备注 MeetingType MeetingType `json:"meetingtype,omitempty"` // 会议消息类型。101发起会议邀请消息、102处理会议邀请消息 MeetingId uint64 `json:"meetingid,omitempty"` // 会议id。方便将发起、处理消息进行对照 Status MeetingStatus `json:"status,omitempty"` // 会议邀请处理状态。1 参加会议、2 拒绝会议、3 待定、4 未被邀请、5 会议已取消、6 会议已过期、7 不在房间内。 }
MeetingMessage 会议邀请消息
type MeetingStatus ¶
type MeetingStatus = uint32
MeetingStatus 会议邀请处理状态
const ( // JOIN_MEETING 参加会议 JOIN_MEETING MeetingStatus = 1 // REJECT_MEETING 绝会议 REJECT_MEETING MeetingStatus = 2 // PENDING_MEETING 待定 PENDING_MEETING MeetingStatus = 3 // NOINVITE_MEETING 未被邀请 NOINVITE_MEETING MeetingStatus = 4 // CANCELED_MEETING 会议已取消 CANCELED_MEETING MeetingStatus = 5 // EXPIRED_MEETING 会议已过期 EXPIRED_MEETING MeetingStatus = 6 // ABSENT_MEETING 不在房间内 ABSENT_MEETING MeetingStatus = 7 )
type MeetingType ¶
type MeetingType = uint32
MeetingType 会议消息类型
const ( // LAUNCH_MEETING 发起会议邀请消息 LAUNCH_MEETING MeetingType = 101 // HANDLE_MEETING 处理会议邀请消息 HANDLE_MEETING MeetingType = 102 )
type MeetingVoiceCall ¶
type MeetingVoiceCall struct { EndTime int64 `json:"endtime,omitempty"` // 音频结束时间 SdkFileId string `json:"sdkfileid,omitempty"` // 音频媒体下载的id DemoFileData []DemoFileData `json:"demofiledata,omitempty"` // 文档分享对象,Object类型 }
MeetingVoiceCall 音频消息内
type MeetingVoiceCallMessage ¶
type MeetingVoiceCallMessage struct { BaseMessage VoiceId string `json:"voiceid,omitempty"` // 音频id MeetingVoiceCall *MeetingVoiceCall `json:"meeting_voice_call,omitempty"` // 音频消息内容。包括结束时间、fileid,可能包括多个demofiledata、sharescreendata消息,demofiledata表示文档共享信息,sharescreendata表示屏幕共享信息。Object类型 }
MeetingVoiceCallMessage 音频存档消息
type Message ¶
type Message interface { ID() string // 消息ID MessageType() MessageType // 消息类型 ActionType() ActionType // 消息动作类型 }
Message 会话消息
type MessageType ¶
type MessageType = string
MessageType 消息类型
const ( // UNKNOWN_MSG 未定义 UNKNOWN_MSG MessageType = "" // TEXT_MSG 文本消息 TEXT_MSG MessageType = "text" // IMG_MSG 图片消息 IMG_MSG MessageType = "image" // REVOKE_MSG 撤回消息 REVOKE_MSG MessageType = "revoke" // AGREE_MSG 同意消息 AGREE_MSG MessageType = "agree" // DISAGREE_MSG 不同意消息 DISAGREE_MSG MessageType = "disagree" // VOICE_MSG 语音消息 VOICE_MSG MessageType = "voice" // VIDEO_MSG 视频消息 VIDEO_MSG MessageType = "video" // CARD_MSG 名片消息 CARD_MSG MessageType = "card" // LOC_MSG 位置消息 LOC_MSG MessageType = "location" // EMOTION_MSG 表情消息 EMOTION_MSG MessageType = "emotion" // FILE_MSG 文件消息 FILE_MSG MessageType = "file" // LINK_MSG 链接消息 LINK_MSG MessageType = "link" // WEAPP_MSG 小程序消息 WEAPP_MSG MessageType = "weapp" // CHATRECORD_MSG 话记录消息 CHATRECORD_MSG MessageType = "chatrecord" // TODO_MSG 待办消息 TODO_MSG MessageType = "todo" // VOTE_MSG 投票消息 VOTE_MSG MessageType = "vote" // COLLECT_MSG 填表消息 COLLECT_MSG MessageType = "collect" // REDPACKET_MSG 红包消息 REDPACKET_MSG MessageType = "redpacket" // MEETING_MSG 会议邀请消息 MEETING_MSG MessageType = "meeting" // DOC_MSG 在线文档消息 DOC_MSG MessageType = "docmsg" // MARKDOWN_MSG MarkDown格式消息 MARKDOWN_MSG MessageType = "markdown" // NEWS_MSG 图文消息 NEWS_MSG MessageType = "news" // CALENDAR_MSG 日程消息 CALENDAR_MSG MessageType = "calendar" // MIXED_MSG 混合消息 MIXED_MSG MessageType = "mixed" // MEETING_VOICE_CALL_MSG 音频存档消息 MEETING_VOICE_CALL_MSG MessageType = "meeting_voice_call" // VOIP_DOC_SHARE_MSG 音频共享文档 VOIP_DOC_SHARE_MSG MessageType = "voip_doc_share" // EXTERNAL_REDPACKET_MSG 红包消息 EXTERNAL_REDPACKET_MSG MessageType = "external_redpacket" // SPHFEED_MSG 视频号消息 SPHFEED_MSG MessageType = "sphfeed" )
type MixedMessage ¶
type MixedMessage struct { BaseMessage Mixed struct { Item []MixedMsg `json:"item,omitempty"` } `json:"mixed,omitempty"` // 消息内容。可包含图片、文字、表情等多种消息。Object类型 }
MixedMessage 混合消息
type MixedMsg ¶
type MixedMsg struct { Type MessageType `json:"type,omitempty"` Content string `json:"content,omitempty"` }
MixedMsg 混合消息内容
type News ¶
type News struct { Title string `json:"title,omitempty"` // 图文消息标题 Desc string `json:"description,omitempty"` // 图文消息描述 Url string `json:"url,omitempty"` // 图文消息点击跳转地址 PicUrl string `json:"picurl,omitempty"` // 图文消息配图的url }
News 图文消息图文内容
type NewsMessage ¶
type NewsMessage struct { BaseMessage Info struct { Item []News `json:"item,omitempty"` // 图文消息数组 } `json:"info,omitempty"` // 图文消息的内容 }
NewsMessage 图文消息
type RedpacketMessage ¶
type RedpacketMessage struct { BaseMessage Type RedpacketType `json:"type,omitempty"` // 红包消息类型。1 普通红包、2 拼手气群红包、3 激励群红包。 Wish string `json:"wish,omitempty"` // 红包祝福语 TotalCnt uint32 `json:"totalcnt,omitempty"` // 红包总个数 TotalAmount uint32 `json:"totalamount,omitempty"` // 红包总金额。单位为分。 }
RedpacketMessage 红包消息
type RedpacketType ¶
type RedpacketType = uint32
RedpacketType 红包类型
const ( // NORMAL_REDPACKET 普通红包 NORMAL_REDPACKET RedpacketType = 1 // SPELL_REDPACKET 拼手气群红包 SPELL_REDPACKET RedpacketType = 2 // INCENTIVE_REDPACKET 励群红包 INCENTIVE_REDPACKET RedpacketType = 3 )
type RevokeMessage ¶
type RevokeMessage struct { BaseMessage PreMsgId string `json:"pre_msgid,omitempty"` // 标识撤回的原消息的msgid }
RevokeMessage 撤回消息
type SphfeedMessage ¶
type SphfeedMessage struct { BaseMessage FeedType SphfeedType `json:"feed_type,omitempty"` // 视频号消息类型 SphName string `json:"sph_name,omitempty"` // 视频号账号名称 FeedDesc string `json:"feed_desc,omitempty"` // 视频号消息描述 }
SphfeedMessage 视频号消息
type SphfeedType ¶
type SphfeedType = uint32
SphfeedType 视频号消息类型
const ( // SPHFEED_IMAGE 图片 SPHFEED_IMAGE SphfeedType = 2 // SPHFEED_VIDEO 视频 SPHFEED_VIDEO SphfeedType = 4 // SPHFEED_LIVE 直播 SPHFEED_LIVE SphfeedType = 9 )
type SwitchMessage ¶
type SwitchMessage struct { MsgId string `json:"msgid,omitempty"` // 消息id,消息的唯一标识,企业可以使用此字段进行消息去重 Action string `json:"action,omitempty"` // 消息动作,切换企业为switch Time int64 `json:"time,omitempty"` // 消息发送时间戳,utc时间,ms单位。 User string `json:"user,omitempty"` // 具体为切换企业的成员的userid。 }
SwitchMessage 切换企业日志
func (SwitchMessage) ActionType ¶
func (m SwitchMessage) ActionType() ActionType
ActionType implement ActionType interface
func (SwitchMessage) MessageType ¶
func (m SwitchMessage) MessageType() MessageType
MessageType implement Message interface
type TextMessage ¶
type TextMessage struct { BaseMessage Content string `json:"content,omitempty"` // 消息内容。 }
TextMessage 文字消息
type TodoMessage ¶
type TodoMessage struct { BaseMessage Title string `json:"title,omitempty"` // 待办的来源文本 Content string `json:"content,omitempty"` // 待办的具体内容 }
TodoMessage 待办事项消息
type VideoMessage ¶
type VideoMessage struct { BaseMessage SdkFileId string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。 FileSize uint32 `json:"filesize,omitempty"` // 图片资源的文件大小。 PlayLength uint32 `json:"play_length,omitempty"` // 播放长度。 Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。 }
VideoMessage 视频消息
type VoiceMessage ¶
type VoiceMessage struct { BaseMessage SdkFileId string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。 VoiceSize uint32 `json:"voice_size,omitempty"` // 语音消息大小。 PlayLength uint32 `json:"play_length,omitempty"` // 播放长度。 Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。 }
VoiceMessage 语音消息
type VoteMessage ¶
type VoteMessage struct { BaseMessage VoteTitle string `json:"votetitle,omitempty"` // 投票主题。 VoteItem []string `json:"voteitem,omitempty"` // 投票选项,可能多个内容。 VoteType VoteType `json:"votetype,omitempty"` // 投票类型.101发起投票、102参与投票。 VoteId string `json:"voteid,omitempty"` // 投票id,方便将参与投票消息与发起投票消息进行前后对照。 }
VoteMessage 投票消息
type WeappMessage ¶
type WeappMessage struct { BaseMessage Title string `json:"title,omitempty"` // 消息标题。 Desc string `json:"description,omitempty"` // 消息描述。 Username string `json:"username,omitempty"` // 用户名称。 DisplayName string `json:"displayname,omitempty"` // 小程序名称 }
WeappMessage 小程序消息