From 3b0984102c53bb219b51dca4642a0eb3d231d305 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 21 Sep 2019 22:30:16 -0400 Subject: [PATCH] Add Mark method to Chat --- chat.go | 16 ++++++++++++++++ types.go | 1 + 2 files changed, 17 insertions(+) diff --git a/chat.go b/chat.go index 97b47e6..8009e23 100644 --- a/chat.go +++ b/chat.go @@ -363,3 +363,19 @@ func (c Chat) Unpin() (ChatAPI, error) { } return r, nil } + +// Mark marks a conversation as read up to a specified message +func (c Chat) Mark(messageID int) (ChatAPI, error) { + m := ChatAPI{ + Params: ¶ms{}, + } + m.Method = "mark" + m.Params.Options.Channel = c.Channel + m.Params.Options.MessageID = messageID + + r, err := chatAPIOut(c.keybase, m) + if err != nil { + return ChatAPI{}, err + } + return r, nil +} diff --git a/types.go b/types.go index 0a84229..da04e7f 100644 --- a/types.go +++ b/types.go @@ -470,6 +470,7 @@ type chat interface { LoadFlip(messageID int, conversationID string, flipConversationID string, gameID string) (ChatAPI, error) Pin(messageID int) (ChatAPI, error) Unpin() (ChatAPI, error) + Mark(messageID int) (ChatAPI, error) } type chatAPI interface {