package models import ( "encoding/json" "time" ) type Datagram struct { Id string Uri string Protocol string Adapter string Type string Target *string } type Message struct { Datagram Author string Content string Attachments []Attachment ReplyTo *string Replies []string ReplyCount int Mentions []string Created time.Time Visibility string Aux map[string]string } type Author struct { Datagram Name string ProfileData interface{} ProfilePic string Messages []Message } type Attachment struct { Src string ThumbSrc string Desc string CreatedAt time.Time Size uint64 } type SocketData interface { ToDatagram() []byte } func (self Message) ToDatagram() []byte { data, err := json.Marshal(self) if err != nil { panic(err.Error()) } return data }