Add 'mock/' from commit '2041d3ce6377da091eca17cf9d8ad176a3024616'
git-subtree-dir: mock git-subtree-mainline:8216d7c706git-subtree-split:2041d3ce63
This commit is contained in:
35
mock/model/message.go
Normal file
35
mock/model/message.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
type Message struct {
|
||||
Text string `json:"text"`
|
||||
Guid string `json:"guid"`
|
||||
Sender *string `json:"sender,omitempty"` // Optional: nil means from "me"
|
||||
Date Date `json:"date"`
|
||||
|
||||
// Map of attachment GUID to attachment metadata
|
||||
AttachmentGUIDs []string `json:"fileTransferGUIDs,omitempty"`
|
||||
AttachmentMetadata *map[string]AttributionInfo `json:"attachmentMetadata,omitempty"` // Optional
|
||||
}
|
||||
|
||||
type AttributionInfo struct {
|
||||
ThumbnailWidth int `json:"pgensw"`
|
||||
ThumbnailHeight int `json:"pgensh"`
|
||||
}
|
||||
|
||||
func (c Message) MarshalZerologObject(e *zerolog.Event) {
|
||||
e.Str("guid", c.Guid)
|
||||
e.Str("text", c.Text)
|
||||
e.Time("date", time.Time(c.Date))
|
||||
|
||||
if c.Sender != nil {
|
||||
e.Str("sender", *c.Sender)
|
||||
} else {
|
||||
e.Str("sender", "(Me)")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user