50 lines
793 B
Go
50 lines
793 B
Go
package models
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
type Message struct {
|
|
Uri string
|
|
Author string
|
|
Protocol string
|
|
Adapter 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 {
|
|
Id string
|
|
Name string
|
|
ProfileData interface{}
|
|
ProfileUri string
|
|
ProfilePic string
|
|
}
|
|
|
|
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
|
|
}
|