79 lines
2.3 KiB
Go
79 lines
2.3 KiB
Go
package entity
|
|
|
|
// Text is a plain-text body. Stored as JSON bytes, never as a raw SQL string column.
|
|
type Text struct {
|
|
Body string `json:"body"`
|
|
}
|
|
|
|
// Image references uploaded objects. Bytes are not stored in messages.content.
|
|
// WeChat-style: bubble uses thumb_key, tap-to-view uses key (compressed),
|
|
// 「查看原图」uses orig_key when the sender opted in.
|
|
// Clients PUT JPEG/PNG only (convert HEIC/WebP locally); the server does not transcode.
|
|
type Image struct {
|
|
Key string `json:"key"`
|
|
Mime string `json:"mime,omitempty"`
|
|
Width int `json:"w,omitempty"`
|
|
Height int `json:"h,omitempty"`
|
|
Size int64 `json:"size,omitempty"`
|
|
ThumbKey string `json:"thumb_key,omitempty"`
|
|
OrigKey string `json:"orig_key,omitempty"`
|
|
OrigSize int64 `json:"orig_size,omitempty"`
|
|
OrigW int `json:"orig_w,omitempty"`
|
|
OrigH int `json:"orig_h,omitempty"`
|
|
}
|
|
|
|
// Voice is an audio clip in object storage.
|
|
type Voice struct {
|
|
Key string `json:"key"`
|
|
DurationMS int `json:"duration_ms"`
|
|
Size int64 `json:"size,omitempty"`
|
|
}
|
|
|
|
// Video is a video clip in object storage.
|
|
type Video struct {
|
|
Key string `json:"key"`
|
|
Mime string `json:"mime,omitempty"`
|
|
Width int `json:"w,omitempty"`
|
|
Height int `json:"h,omitempty"`
|
|
DurationMS int `json:"duration_ms,omitempty"`
|
|
Size int64 `json:"size,omitempty"`
|
|
CoverKey string `json:"cover_key,omitempty"`
|
|
}
|
|
|
|
// Emoji is a sticker from a pack (not an image file in content).
|
|
type Emoji struct {
|
|
Pack string `json:"pack"`
|
|
ID string `json:"id"`
|
|
}
|
|
|
|
// GIF is an animated image in object storage.
|
|
type GIF struct {
|
|
Key string `json:"key"`
|
|
Mime string `json:"mime,omitempty"`
|
|
Width int `json:"w,omitempty"`
|
|
Height int `json:"h,omitempty"`
|
|
Size int64 `json:"size,omitempty"`
|
|
}
|
|
|
|
// File is a generic attachment in object storage.
|
|
type File struct {
|
|
Key string `json:"key"`
|
|
Name string `json:"name"`
|
|
Size int64 `json:"size"`
|
|
Mime string `json:"mime,omitempty"`
|
|
}
|
|
|
|
// Location is a geographic pin.
|
|
type Location struct {
|
|
Lat float64 `json:"lat"`
|
|
Lng float64 `json:"lng"`
|
|
Name string `json:"name,omitempty"`
|
|
Address string `json:"address,omitempty"`
|
|
}
|
|
|
|
// System is a server-generated notice (member join, recall hint, etc.).
|
|
type System struct {
|
|
Kind string `json:"kind"`
|
|
Body string `json:"body,omitempty"`
|
|
}
|