Private
Public Access
1
0
Files
Kordophone/mock/model/message.go
2025-09-06 19:35:49 -07:00

36 lines
824 B
Go

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)")
}
}