Documentation
¶
Index ¶
- Variables
- func DecryptData(privateKey *rsa.PrivateKey, encryptRandomKey string, encryptMsg string) (msg []byte, err error)
- func MD5Sum(data []byte) string
- func ParsePrivateKey(privateKey string) (*rsa.PrivateKey, error)
- func RSADecryptBase64(privateKey *rsa.PrivateKey, cryptoText string) ([]byte, error)
- type AgreeMessage
- type BaseMessage
- func (m BaseMessage) GetAction() string
- func (m *BaseMessage) GetBaseMessage() *BaseMessage
- func (m BaseMessage) GetCorpID() string
- func (m BaseMessage) GetID() string
- func (m BaseMessage) GetRaw() json.RawMessage
- func (m BaseMessage) GetSequence() uint64
- func (m BaseMessage) GetTime() time.Time
- func (m BaseMessage) GetType() string
- func (m *BaseMessage) SetCorpID(corpID string)
- func (m *BaseMessage) SetRaw(r json.RawMessage)
- func (m *BaseMessage) SetSequence(seq uint64)
- func (m BaseMessage) String() string
- type CalendarMessage
- type CardMessage
- type ChatData
- type ChatRawData
- type ChatRecord
- type ChatRecordMessage
- type Client
- type ClientOptionBuilder
- func (b *ClientOptionBuilder) Apply() (Client, error)
- func (b *ClientOptionBuilder) Build() (ClientOptions, error)
- func (b *ClientOptionBuilder) MustApply() Client
- func (b *ClientOptionBuilder) MustBuild() ClientOptions
- func (b *ClientOptionBuilder) ParseEnv() *ClientOptionBuilder
- func (b *ClientOptionBuilder) PrivateKey(v string) *ClientOptionBuilder
- func (b *ClientOptionBuilder) PrivateKeyFn(fn func(ver int) (string, error)) *ClientOptionBuilder
- func (b *ClientOptionBuilder) PrivateKeys(m map[int]string) *ClientOptionBuilder
- func (b *ClientOptionBuilder) Proxy(value string) *ClientOptionBuilder
- func (b *ClientOptionBuilder) ProxyCredential(value string) *ClientOptionBuilder
- type ClientOptions
- type CollectDetail
- type CollectMessage
- type DemoFileData
- type DocMessage
- type EmotionMessage
- type Error
- type ExternalRedPacketMessage
- type FileMessage
- type GetChatDataOptions
- type GetMediaDataOptions
- type HasBaseMessage
- type HasMedias
- type ImageMessage
- type LinkMessage
- type LocationMessage
- type MarkdownMessage
- type Media
- type MediaData
- type MediaVerifyOptions
- type MeetingMessage
- type MeetingVoiceCall
- type MeetingVoiceCallMessage
- type Message
- type MixedMessage
- type MixedMessageItem
- type News
- type NewsMessage
- type RedPacketMessage
- type RevokeMessage
- type SaveMediaOptions
- type ShareScreenData
- type SphFeedMessage
- type SwitchMessage
- func (m SwitchMessage) GetAction() string
- func (m SwitchMessage) GetCorpID() string
- func (m SwitchMessage) GetID() string
- func (m SwitchMessage) GetRaw() json.RawMessage
- func (m SwitchMessage) GetSequence() uint64
- func (m SwitchMessage) GetTime() time.Time
- func (m SwitchMessage) GetType() string
- func (m *SwitchMessage) SetCorpID(corpID string)
- func (m *SwitchMessage) SetRaw(r json.RawMessage)
- func (m *SwitchMessage) SetSequence(seq uint64)
- func (m SwitchMessage) String() string
- type TextMessage
- type TodoMessage
- type VideoMessage
- type VoiceMessage
- type VoipDocShare
- type VoipDocShareMessage
- type VoteMessage
- type WeAppMessage
Constants ¶
This section is empty.
Variables ¶
var MessageOfType = func(action, typ string) Message { switch action { case "switch": return &SwitchMessage{} } switch typ { case "text": return &TextMessage{} case "image": return &ImageMessage{} case "revoke": return &RevokeMessage{} case "agree": fallthrough case "disagree": return &AgreeMessage{} case "voice": return &VoiceMessage{} case "video": return &VideoMessage{} case "card": return &CardMessage{} case "location": return &LocationMessage{} case "emotion": return &EmotionMessage{} case "link": return &LinkMessage{} case "chatrecord": return &ChatRecordMessage{} case "todo": return &TodoMessage{} case "vote": return &VoteMessage{} case "collect": return &CollectMessage{} case "redpacket": return &RedPacketMessage{} case "meeting": return &MeetingMessage{} case "docmsg": return &DocMessage{} case "markdown": return &MarkdownMessage{} case "news": return &NewsMessage{} case "calendar": return &CalendarMessage{} case "mixed": return &MixedMessage{} case "external_redpacket": return &ExternalRedPacketMessage{} case "sphfeed": return &SphFeedMessage{} case "voip_doc_share": return &VoipDocShareMessage{} case "file": return &FileMessage{} case "meeting_voice_call": case "voiptext": case "qydiskfile": case "weapp": } return &BaseMessage{} }
Functions ¶
func DecryptData ¶
func ParsePrivateKey ¶
func ParsePrivateKey(privateKey string) (*rsa.PrivateKey, error)
func RSADecryptBase64 ¶
func RSADecryptBase64(privateKey *rsa.PrivateKey, cryptoText string) ([]byte, error)
Types ¶
type AgreeMessage ¶
type AgreeMessage struct {
BaseMessage
Agree struct {
UserID string `json:"userid,omitempty"` // 同意/不同意协议者的userid,外部企业默认为external_userid。
AgreeTime int64 `json:"agree_time,omitempty"` // 同意/不同意协议的时间,utc时间,ms单位。
} `json:"agree,omitempty"`
}
AgreeMessage 同意会话聊天内容 类型为:agree(同意)、disagree(不同意)
type BaseMessage ¶
type BaseMessage struct {
ID string `json:"msgid,omitempty"` // 消息id,消息的唯一标识,企业可以使用此字段进行消息去重。
Action string `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。如果是单聊则为空。
Timestamp int64 `json:"msgtime,omitempty"` // 消息发送时间戳,utc时间,ms单位。
Type string `json:"msgtype,omitempty"` // 消息类型,具体数据见消息注释内容
Raw json.RawMessage `json:"-"` // 原始消息对象
Sequence uint64 `json:"-"` // 消息序号
CorpID string `json:"-"`
}
BaseMessage 会话存档基础消息
func UnmarshalToBase ¶
func UnmarshalToBase(data []byte) (msg *BaseMessage, err error)
UnmarshalToBase can avoid json error
func (BaseMessage) GetAction ¶
func (m BaseMessage) GetAction() string
func (*BaseMessage) GetBaseMessage ¶
func (m *BaseMessage) GetBaseMessage() *BaseMessage
func (BaseMessage) GetCorpID ¶
func (m BaseMessage) GetCorpID() string
func (BaseMessage) GetID ¶
func (m BaseMessage) GetID() string
func (BaseMessage) GetRaw ¶
func (m BaseMessage) GetRaw() json.RawMessage
func (BaseMessage) GetSequence ¶
func (m BaseMessage) GetSequence() uint64
func (BaseMessage) GetTime ¶
func (m BaseMessage) GetTime() time.Time
func (BaseMessage) GetType ¶
func (m BaseMessage) GetType() string
func (*BaseMessage) SetCorpID ¶
func (m *BaseMessage) SetCorpID(corpID string)
func (*BaseMessage) SetRaw ¶
func (m *BaseMessage) SetRaw(r json.RawMessage)
func (*BaseMessage) SetSequence ¶
func (m *BaseMessage) SetSequence(seq uint64)
func (BaseMessage) String ¶
func (m BaseMessage) String() string
type CalendarMessage ¶
type CalendarMessage struct {
BaseMessage
Calendar struct {
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"` // 日程备注
} `json:"calendar,omitempty"`
}
CalendarMessage 日程消息 类型为:calendar
type CardMessage ¶
type CardMessage struct {
BaseMessage
Card struct {
CorpName string `json:"corpname,omitempty"` // 名片所有者所在的公司名称。
UserID string `json:"userid,omitempty"` // 名片所有者的id,同一公司是userid,不同公司是external_userid
} `json:"card,omitempty"`
}
CardMessage 名片 类型为:card
type ChatData ¶
type ChatData struct {
Sequence uint64 `json:"seq,omitempty"` // 消息的seq值,标识消息的序号。再次拉取需要带上上次回包中最大的seq。Uint64类型,范围0-pow(2,64)-1
MessageID string `json:"msgid,omitempty"` // 消息id,消息的唯一标识,企业可以使用此字段进行消息去重。
PublicKeyVersion int `json:"publickey_ver,omitempty"` // 加密此条消息使用的公钥版本号。
EncryptRandomKey string `json:"encrypt_random_key,omitempty"` // 使用publickey_ver指定版本的公钥进行非对称加密后base64加密的内容,需要业务方先base64 decode处理后,再使用指定版本的私钥进行解密,得出内容。
EncryptChatMessage string `json:"encrypt_chat_msg,omitempty"` // 消息密文。需要业务方使用将encrypt_random_key解密得到的内容,与encrypt_chat_msg,传入sdk接口DecryptData,得到消息明文。
Message Message `json:"-"` // 消息明文
}
type ChatRawData ¶
func (ChatRawData) IsError ¶
func (c ChatRawData) IsError() bool
type ChatRecord ¶
type ChatRecord struct {
Type string `json:"type,omitempty"` // 每条聊天记录的具体消息类型:ChatRecordText/ ChatRecordFile/ ChatRecordImage/ ChatRecordVideo/ ChatRecordLink/ ChatRecordLocation/ ChatRecordMixed ….
Content string `json:"content,omitempty"` // 消息内容。Json串,内容为对应类型的json
Timestamp int64 `json:"msgtime,omitempty"` // 消息时间,utc时间,ms单位。
FromChatroom bool `json:"from_chatroom,omitempty"` // 是否来自群会话。
}
ChatRecord 会话记录消息item
type ChatRecordMessage ¶
type ChatRecordMessage struct {
BaseMessage
ChatRecord struct {
Title string `json:"title,omitempty"` // 聊天记录标题
Item []ChatRecord `json:"item,omitempty"` // 消息记录内的消息内容,批量数据
} `json:"chatrecord,omitempty"`
}
ChatRecordMessage 会话记录消息 类型为:chatrecord
func (ChatRecordMessage) GetMedias ¶
func (m ChatRecordMessage) GetMedias() []Media
type Client ¶
type Client interface {
GetCorpID() string
Options() *ClientOptionBuilder
CopyMediaData(o GetMediaDataOptions, w io.Writer) (sum int, err error)
ReadMediaData(o GetMediaDataOptions) (data []byte, err error)
GetMediaData(o GetMediaDataOptions) (*MediaData, error)
GetChatData(o GetChatDataOptions) ([]*ChatData, error)
Close()
}
func NewClientFromEnv ¶
type ClientOptionBuilder ¶
type ClientOptionBuilder struct {
Options ClientOptions
Errors []error
Client *client
}
func (*ClientOptionBuilder) Apply ¶
func (b *ClientOptionBuilder) Apply() (Client, error)
func (*ClientOptionBuilder) Build ¶
func (b *ClientOptionBuilder) Build() (ClientOptions, error)
func (*ClientOptionBuilder) MustApply ¶
func (b *ClientOptionBuilder) MustApply() Client
func (*ClientOptionBuilder) MustBuild ¶
func (b *ClientOptionBuilder) MustBuild() ClientOptions
func (*ClientOptionBuilder) ParseEnv ¶
func (b *ClientOptionBuilder) ParseEnv() *ClientOptionBuilder
func (*ClientOptionBuilder) PrivateKey ¶
func (b *ClientOptionBuilder) PrivateKey(v string) *ClientOptionBuilder
func (*ClientOptionBuilder) PrivateKeyFn ¶
func (b *ClientOptionBuilder) PrivateKeyFn(fn func(ver int) (string, error)) *ClientOptionBuilder
func (*ClientOptionBuilder) PrivateKeys ¶
func (b *ClientOptionBuilder) PrivateKeys(m map[int]string) *ClientOptionBuilder
func (*ClientOptionBuilder) Proxy ¶
func (b *ClientOptionBuilder) Proxy(value string) *ClientOptionBuilder
func (*ClientOptionBuilder) ProxyCredential ¶
func (b *ClientOptionBuilder) ProxyCredential(value string) *ClientOptionBuilder
type ClientOptions ¶
type ClientOptions struct {
Proxy string
TempDir string
ProxyCredential string
Timeout int
PrivateKey *rsa.PrivateKey
PrivateKeyFn func(ver int) (*rsa.PrivateKey, error)
}
type CollectDetail ¶
type CollectDetail struct {
ID uint64 `json:"id,omitempty"` // 表项id
Ques string `json:"ques,omitempty"` // 表项名称
Type string `json:"type,omitempty"` // 表项类型,有Text(文本),Number(数字),Date(日期),Time(时间)
}
CollectDetail 填表内容详情
type CollectMessage ¶
type CollectMessage struct {
BaseMessage
Collect struct {
RoomName string `json:"room_name,omitempty"` // 填表消息所在的群名称。
Creator string `json:"creator,omitempty"` // 创建者在群中的名字。
CreateTime string `json:"create_time,omitempty"` // 创建的时间。
Title string `json:"title,omitempty"` // 表名。
Details []CollectDetail `json:"details,omitempty"` // 表内容。
} `json:"collect,omitempty"`
}
CollectMessage 填表消息 类型为:collect
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
Doc struct {
Title string `json:"title,omitempty"` // 在线文档名称
LinkURL string `json:"link_url,omitempty"` // 在线文档链接
DocCreator string `json:"doc_creator,omitempty"` // 在线文档创建者。本企业成员创建为userid;外部企业成员创建为external_userid
} `json:"doc,omitempty"`
}
DocMessage 在线文档消息 类型为:docmsg
type EmotionMessage ¶
type EmotionMessage struct {
BaseMessage
Emotion struct {
Type int `json:"type,omitempty"` // 表情类型,png或者gif.1表示gif 2表示png。
Width int `json:"width,omitempty"` // 表情图片宽度。
Height int `json:"height,omitempty"` // 表情图片高度。
ImageSize int `json:"imagesize,omitempty"` // 资源的文件大小。
SdkFileID string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。
Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。
} `json:"emotion,omitempty"`
}
EmotionMessage 表情 类型为:emotion
func (EmotionMessage) GetEmotionFormat ¶
func (m EmotionMessage) GetEmotionFormat() string
func (EmotionMessage) GetMedias ¶
func (m EmotionMessage) GetMedias() []Media
func (EmotionMessage) String ¶
func (m EmotionMessage) String() string
type Error ¶
type Error struct {
Code int `json:"errcode,omitempty"`
Message string `json:"errmsg,omitempty"`
Detail string `json:"-"`
}
func ErrorOfCode ¶
func (Error) IsRetryable ¶
type ExternalRedPacketMessage ¶
type ExternalRedPacketMessage struct {
BaseMessage
RedPacket struct {
Type int32 `json:"type,omitempty"` // 红包消息类型。1 普通红包、2 拼手气群红包。Uint32类型
Wish string `json:"wish,omitempty"` // 红包祝福语。String类型
TotalCnt int32 `json:"totalcnt,omitempty"` // 红包总个数。Uint32类型
TotalAmount int32 `json:"totalamount,omitempty"` // 红包消息类型。1 普通红包、2 拼手气群红包。Uint32类型
} `json:"redpacket,omitempty"`
}
ExternalRedPacketMessage 互通红包消息 类型为:external_redpacket,出现在本企业与外部企业群聊发送的红包、或者本企业与微信单聊、群聊发送的红包消息场景下。
type FileMessage ¶
type FileMessage struct {
BaseMessage
File struct {
FileName string `json:"filename,omitempty"` // 文件名称。
FileExt string `json:"fileext,omitempty"` // 文件类型后缀。
SdkFileID string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。
FileSize int `json:"filesize,omitempty"` // 文件大小。
Md5Sum string `json:"md5sum,omitempty"` // 资源的md5值,供进行校验。
} `json:"file,omitempty"`
}
FileMessage 文件 类型为:file
func (FileMessage) GetMedias ¶
func (m FileMessage) GetMedias() []Media
type GetChatDataOptions ¶
type GetMediaDataOptions ¶
type HasBaseMessage ¶
type HasBaseMessage interface {
GetBaseMessage() *BaseMessage
}
type ImageMessage ¶
type ImageMessage struct {
BaseMessage
Image struct {
SdkFileID string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。
Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。
FileSize int `json:"filesize,omitempty"` // 图片资源的文件大小。
} `json:"image,omitempty"`
}
ImageMessage 图片 类型为:image
func (ImageMessage) GetMedias ¶
func (m ImageMessage) GetMedias() []Media
type LinkMessage ¶
type LinkMessage struct {
BaseMessage
Link struct {
Title string `json:"title,omitempty"` // 消息标题。
Description string `json:"description,omitempty"` // 消息描述。
LinkURL string `json:"link_url,omitempty"` // 链接url地址
ImageURL string `json:"image_url,omitempty"` // 链接图片url。
} `json:"link,omitempty"`
}
LinkMessage 链接 类型为:link
type LocationMessage ¶
type LocationMessage struct {
BaseMessage
Location struct {
Longitude float64 `json:"longitude,omitempty"` // 经度,单位double
Latitude float64 `json:"latitude,omitempty"` // 纬度,单位double
Address string `json:"address,omitempty"` // 地址信息
Title string `json:"title,omitempty"` // 位置信息的title。
Zoom uint32 `json:"zoom,omitempty"` // 缩放比例。
} `json:"location,omitempty"`
}
LocationMessage 位置 类型为:location
type MarkdownMessage ¶
type MarkdownMessage struct {
BaseMessage
Info struct {
Content string `json:"content,omitempty"` // markdown消息内容,目前为机器人发出的消息
} `json:"info,omitempty"`
}
MarkdownMessage MarkDown消息 类型为:markdown
type Media ¶
type Media struct {
ID string // fileid
Name string // filename
Ext string // png, gif
Width int
Height int
Size int // file size
Length int // audio, video
MD5Sum string // 消息中的 MD5
OriginalMD5Sum string // 写入文件的 MD5 - 可能不一样,暂不知道为什么
Message Message `json:"-"` // track back
MessageID string
Index int
Data []byte
}
func (*Media) VerifyData ¶
func (m *Media) VerifyData(data []byte, o *MediaVerifyOptions) error
type MediaVerifyOptions ¶
type MediaVerifyOptions struct {
SkipChecksum bool
}
type MeetingMessage ¶
type MeetingMessage struct {
BaseMessage
Meeting struct {
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 uint32 `json:"meetingtype,omitempty"` // 会议消息类型。101发起会议邀请消息、102处理会议邀请消息
MeetingID uint64 `json:"meetingid,omitempty"` // 会议id。方便将发起、处理消息进行对照
Status uint32 `json:"status,omitempty"` // 会议邀请处理状态。1 参加会议、2 拒绝会议、3 待定、4 未被邀请、5 会议已取消、6 会议已过期、7 不在房间内。
} `json:"meeting,omitempty"`
}
MeetingMessage 会议邀请消息 类型为:meeting
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 音频存档消息 类型为:meeting_voice_call
func (MeetingVoiceCallMessage) GetMedias ¶
func (m MeetingVoiceCallMessage) GetMedias() []Media
type Message ¶
type MixedMessage ¶
type MixedMessage struct {
BaseMessage
Mixed struct {
Item []MixedMessageItem `json:"item,omitempty"`
} `json:"mixed,omitempty"` // 消息内容。可包含图片、文字、表情等多种消息。Object类型
}
MixedMessage 混合消息 类型为:mixed
type MixedMessageItem ¶
type MixedMessageItem struct {
Type string `json:"type,omitempty"`
Content string `json:"content,omitempty"`
}
MixedMessageItem 混合消息详情
type News ¶
type News struct {
Title string `json:"title,omitempty"` // 图文消息标题
Description 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 图文消息 类型为:news
type RedPacketMessage ¶
type RedPacketMessage struct {
BaseMessage
RedPacket struct {
Type uint32 `json:"type,omitempty"` // 红包消息类型。1 普通红包、2 拼手气群红包、3 激励群红包。
Wish string `json:"wish,omitempty"` // 红包祝福语
TotalCnt uint32 `json:"totalcnt,omitempty"` // 红包总个数
TotalAmount uint32 `json:"totalamount,omitempty"` // 红包总金额。单位为分。
} `json:"redpacket,omitempty"`
}
RedPacketMessage 红包消息 类型为:redpacket
type RevokeMessage ¶
type RevokeMessage struct {
BaseMessage
Revoke struct {
MessageID string `json:"pre_msgid,omitempty"` // 标识撤回的原消息的msgid
} `json:"revoke,omitempty"`
}
RevokeMessage 撤回消息 类型为:revoke
type SaveMediaOptions ¶
type SphFeedMessage ¶
type SphFeedMessage struct {
BaseMessage
SphFeed struct {
FeedType int `json:"feed_type,omitempty"` // 视频号消息类型
SphName string `json:"sph_name,omitempty"` // 视频号账号名称
FeedDesc string `json:"feed_desc,omitempty"` // 视频号账号名称
}
}
SphFeedMessage 视频号消息 类型为:sphfeed
type SwitchMessage ¶
type SwitchMessage struct {
ID string `json:"msgid,omitempty"` // 消息id,消息的唯一标识,企业可以使用此字段进行消息去重
Action string `json:"action,omitempty"` // 消息动作,切换企业为switch
Timestamp int64 `json:"time,omitempty"` // 消息发送时间戳,utc时间,ms单位。
User string `json:"user,omitempty"` // 具体为切换企业的成员的userid。
Raw json.RawMessage `json:"-"`
Sequence uint64 `json:"-"` // 消息序号
CorpID string `json:"-"`
}
SwitchMessage 切换企业日志 注:切换企业日志不是真正的消息,与上述消息结构不完全相同
func (SwitchMessage) GetAction ¶
func (m SwitchMessage) GetAction() string
func (SwitchMessage) GetCorpID ¶
func (m SwitchMessage) GetCorpID() string
func (SwitchMessage) GetID ¶
func (m SwitchMessage) GetID() string
func (SwitchMessage) GetRaw ¶
func (m SwitchMessage) GetRaw() json.RawMessage
func (SwitchMessage) GetSequence ¶
func (m SwitchMessage) GetSequence() uint64
func (SwitchMessage) GetTime ¶
func (m SwitchMessage) GetTime() time.Time
func (SwitchMessage) GetType ¶
func (m SwitchMessage) GetType() string
func (*SwitchMessage) SetCorpID ¶
func (m *SwitchMessage) SetCorpID(corpID string)
func (*SwitchMessage) SetRaw ¶
func (m *SwitchMessage) SetRaw(r json.RawMessage)
func (*SwitchMessage) SetSequence ¶
func (m *SwitchMessage) SetSequence(seq uint64)
func (SwitchMessage) String ¶
func (m SwitchMessage) String() string
type TextMessage ¶
type TextMessage struct {
BaseMessage
Text struct {
Content string `json:"content,omitempty"` // 消息内容。
} `json:"text,omitempty"`
}
TextMessage 文本 类型为:text
func (TextMessage) String ¶
func (m TextMessage) String() string
type TodoMessage ¶
type TodoMessage struct {
BaseMessage
Todo struct {
Title string `json:"title,omitempty"` // 代办的来源文本
Content string `json:"content,omitempty"` // 代办的具体内容
} `json:"todo,omitempty"`
}
TodoMessage 待办消息 类型为:todo
type VideoMessage ¶
type VideoMessage struct {
BaseMessage
Video struct {
SdkFileID string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。
FileSize int `json:"filesize,omitempty"` // 图片资源的文件大小。
PlayLength int `json:"play_length,omitempty"` // 播放长度。
Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。
} `json:"video,omitempty"`
}
VideoMessage 视频 类型为:video
func (VideoMessage) GetMedias ¶
func (m VideoMessage) GetMedias() []Media
type VoiceMessage ¶
type VoiceMessage struct {
BaseMessage
Voice struct {
SdkFileID string `json:"sdkfileid,omitempty"` // 媒体资源的id信息。
VoiceSize int `json:"voice_size,omitempty"` // 语音消息大小。
PlayLength int `json:"play_length,omitempty"` // 播放长度。
Md5Sum string `json:"md5sum,omitempty"` // 图片资源的md5值,供进行校验。
} `json:"voice,omitempty"`
}
VoiceMessage 语音 类型为:voice
func (VoiceMessage) GetMedias ¶
func (m VoiceMessage) GetMedias() []Media
type VoipDocShareMessage ¶
type VoipDocShareMessage struct {
}
VoipDocShareMessage 音频共享文档消息 类型为:voip_doc_share
func (VoipDocShareMessage) GetMedias ¶
func (m VoipDocShareMessage) GetMedias() []Media
type VoteMessage ¶
type VoteMessage struct {
BaseMessage
VoteTitle string `json:"votetitle,omitempty"` // 投票主题。
VoteItem []string `json:"voteitem,omitempty"` // 投票选项,可能多个内容。
VoteType uint32 `json:"votetype,omitempty"` // 投票类型.101发起投票、102参与投票。
VoteID string `json:"voteid,omitempty"` // 投票id,方便将参与投票消息与发起投票消息进行前后对照。
}
VoteMessage 投票消息 类型为:vote
type WeAppMessage ¶
type WeAppMessage struct {
BaseMessage
WeApp struct {
Title string `json:"title,omitempty"` // 消息标题。
Description string `json:"description,omitempty"` // 消息描述。
Username string `json:"username,omitempty"` // 用户名称。
DisplayName string `json:"displayname,omitempty"` // 小程序名称
} `json:"weapp,omitempty"`
}
WeAppMessage 小程序消息 类型为:weapp