Implements pollUpdates
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
type Conversation struct {
|
||||
Date time.Time `json:"date"`
|
||||
Participants []string `json:"participantDisplayNames"`
|
||||
DisplayName *string `json:"displayName"` // Optional
|
||||
DisplayName *string `json:"displayName,omitempty"` // Optional
|
||||
UnreadCount int `json:"unreadCount"`
|
||||
LastMessagePreview string `json:"lastMessagePreview"`
|
||||
Guid string `json:"guid"`
|
||||
|
||||
26
model/update.go
Normal file
26
model/update.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package model
|
||||
|
||||
import "github.com/rs/zerolog"
|
||||
|
||||
type UpdateItem struct {
|
||||
MessageSequenceNumber int `json:"messageSequenceNumber"`
|
||||
Conversation *Conversation `json:"conversation,omitempty"`
|
||||
Message *Message `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func New(conversation *Conversation, message *Message) *UpdateItem {
|
||||
return &UpdateItem{
|
||||
Conversation: conversation,
|
||||
Message: message,
|
||||
}
|
||||
}
|
||||
|
||||
func (i *UpdateItem) MarshalZerologObject(e *zerolog.Event) {
|
||||
e.Int("messageSequenceNumber", i.MessageSequenceNumber)
|
||||
if i.Conversation != nil {
|
||||
e.Object("conversation", i.Conversation)
|
||||
}
|
||||
if i.Message != nil {
|
||||
e.Object("message", i.Message)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user