prompt: adds ls, help, mark
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
type Conversation struct {
|
||||
Date time.Time `json:"date"`
|
||||
@@ -10,3 +15,22 @@ type Conversation struct {
|
||||
LastMessagePreview string `json:"lastMessagePreview"`
|
||||
Guid string `json:"guid"`
|
||||
}
|
||||
|
||||
func (c *Conversation) GetDisplayName() string {
|
||||
if c.DisplayName == nil {
|
||||
return strings.Join(c.Participants, ",")
|
||||
}
|
||||
|
||||
return *c.DisplayName
|
||||
}
|
||||
|
||||
func (c Conversation) MarshalZerologObject(e *zerolog.Event) {
|
||||
e.Str("guid", c.Guid)
|
||||
e.Time("date", c.Date)
|
||||
e.Int("unreadCount", c.UnreadCount)
|
||||
e.Str("lastMessagePreview", c.LastMessagePreview)
|
||||
e.Strs("participants", c.Participants)
|
||||
if c.DisplayName != nil {
|
||||
e.Str("displayName", *c.DisplayName)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user