Private
Public Access
1
0
Files
Kordophone/model/message.go

35 lines
709 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"` // Optional: nil means from "me"
Date time.Time `json:"date"`
// Map of attachment GUID to attachment metadata
Attachments *map[string]AttributionInfo `json:"attachmentMetadata"` // 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", c.Date)
if c.Sender != nil {
e.Str("sender", *c.Sender)
} else {
e.Str("sender", "(Me)")
}
}