WIP: Attachments

This commit is contained in:
Philipp Heckel 2022-01-02 23:56:12 +01:00
parent 09515f26df
commit eb5b86ffe2
13 changed files with 444 additions and 46 deletions

View file

@ -18,14 +18,21 @@ const (
// message represents a message published to a topic
type message struct {
ID string `json:"id"` // Random message ID
Time int64 `json:"time"` // Unix time in seconds
Event string `json:"event"` // One of the above
Topic string `json:"topic"`
Priority int `json:"priority,omitempty"`
Tags []string `json:"tags,omitempty"`
Title string `json:"title,omitempty"`
Message string `json:"message,omitempty"`
ID string `json:"id"` // Random message ID
Time int64 `json:"time"` // Unix time in seconds
Event string `json:"event"` // One of the above
Topic string `json:"topic"`
Priority int `json:"priority,omitempty"`
Tags []string `json:"tags,omitempty"`
Title string `json:"title,omitempty"`
Message string `json:"message,omitempty"`
Attachment *attachment `json:"attachment,omitempty"`
}
type attachment struct {
Name string `json:"name"`
Type string `json:"type"`
URL string `json:"url"`
}
// messageEncoder is a function that knows how to encode a message