txim/callback/general.go

54 lines
5.8 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package callback
// 通用消息结构体
// TIMMessage 消息体
type TIMMessage struct {
MsgType string `json:"MsgType,omitempty"` // 消息元素类别目前支持的消息对象包括TIMTextElem(文本消息)TIMLocationElem(位置消息)TIMFaceElem(表情消息)TIMCustomElem(自定义消息)TIMSoundElem(语音消息)TIMImageElem(图像消息)TIMFileElem(文件消息)TIMVideoFileElem(视频消息)
MsgContent TIMMessageContent `json:"MsgContent,omitempty"` // 消息元素的内容,不同的 MsgType 有不同的 MsgContent 格式
}
// TIMMessageContent 消息结构体
// https://cloud.tencent.com/document/product/269/2720
type TIMMessageContent struct {
Text string `json:"Text,omitempty"` // [TIMTextElem]消息内容
Desc string `json:"Desc,omitempty"` // [TIMLocationElem]地理位置描述信息。 | [TIMCustomElem]自定义消息描述信息。
Latitude float64 `json:"Latitude,omitempty"` // [TIMLocationElem]纬度
Longitude float64 `json:"Longitude,omitempty"` // [TIMLocationElem]经度
Index int `json:"Index,omitempty"` // [TIMFaceElem]表情索引,用户自定义
Data string `json:"Data,omitempty"` // [TIMFaceElem]额外数据 | [TIMCustomElem]自定义消息数据。
Ext string `json:"Ext,omitempty"` // [TIMCustomElem]扩展字段
Sound string `json:"Sound,omitempty"` // [TIMCustomElem]自定义 APNs 推送铃音
URL string `json:"Url,omitempty"` // [TIMSoundElem]语音下载地址,可通过该 URL 地址直接下载相应语音 | [TIMFileElem]文件下载标记
UUID string `json:"UUID,omitempty"` // [TIMSoundElem]语音的唯一标识,客户端用于索引语音的键值 | [TIMImageElem]图片的唯一标识 | [TIMFileElem]文件的唯一标识
Size int `json:"Size,omitempty"` // [TIMSoundElem]语音数据大小,单位:字节。
Second int `json:"Second,omitempty"` // [TIMSoundElem]语音时长,单位:秒。
DownloadFlag int `json:"Download_Flag,omitempty"` // [TIMSoundElem]语音下载方式标记。目前 Download_Flag 取值只能为2表示可通过Url字段值的 URL 地址直接下载语音。 | [TIMFileElem]文件下载方式标记
ImageFormat int `json:"ImageFormat,omitempty"` // [TIMImageElem]图片格式。JPG = 1GIF = 2PNG = 3BMP = 4其他 = 255
ImageInfoArray []TIMMessageImageInfoArray `json:"ImageInfoArray,omitempty"` // [TIMImageElem]原图、缩略图或者大图下载信息
FileSize int `json:"FileSize,omitempty"` // [TIMFileElem]文件数据大小,单位:字节
FileName string `json:"FileName,omitempty"` // [TIMFileElem]文件名称
VideoURL string `json:"VideoUrl,omitempty"` // [TIMVideoFileElem]视频下载地址。可通过该 URL 地址直接下载相应视频
VideoUUID string `json:"VideoUUID,omitempty"` // [TIMVideoFileElem]视频的唯一标识,客户端用于索引视频的键值
VideoSize int `json:"VideoSize,omitempty"` // [TIMVideoFileElem]视频数据大小,单位:字节
VideoSecond int `json:"VideoSecond,omitempty"` // [TIMVideoFileElem]视频时长,单位:秒
VideoFormat string `json:"VideoFormat,omitempty"` // [TIMVideoFileElem]视频格式,例如 mp4
VideoDownloadFlag int `json:"VideoDownloadFlag,omitempty"` // [TIMVideoFileElem]视频下载方式标记。目前 VideoDownloadFlag 取值只能为2表示可通过VideoUrl字段值的 URL 地址直接下载视频
ThumbURL string `json:"ThumbUrl,omitempty"` // [TIMVideoFileElem]视频缩略图下载地址。可通过该 URL 地址直接下载相应视频缩略图
ThumbUUID string `json:"ThumbUUID,omitempty"` // [TIMVideoFileElem]视频缩略图的唯一标识,客户端用于索引视频缩略图的键值
ThumbSize int `json:"ThumbSize,omitempty"` // [TIMVideoFileElem]缩略图大小,单位:字节
ThumbWidth int `json:"ThumbWidth,omitempty"` // [TIMVideoFileElem]缩略图宽度,单位为像素
ThumbHeight int `json:"ThumbHeight,omitempty"` // [TIMVideoFileElem]缩略图高度,单位为像素
ThumbFormat string `json:"ThumbFormat,omitempty"` // [TIMVideoFileElem]缩略图格式,例如 JPG、BMP 等
ThumbDownloadFlag int `json:"ThumbDownloadFlag,omitempty"` // [TIMVideoFileElem]视频缩略图下载方式标记。目前 ThumbDownloadFlag 取值只能为2表示可通过ThumbUrl字段值的 URL 地址直接下载视频缩略图
}
// TIMMessageImageInfoArray 图片消息数组
type TIMMessageImageInfoArray struct {
Type int `json:"Type,omitempty"` // 图片类型: 1-原图2-大图3-缩略图
Size int `json:"Size,omitempty"` // 图片数据大小,单位:字节
Width int `json:"Width,omitempty"` // 图片宽度,单位为像素
Height int `json:"Height,omitempty"` // 图片高度,单位为像素
URL string `json:"URL,omitempty"` // 图片下载地址
}