From c272c050925e9ce5a4c6148598242dfa11901ee6 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 16 Feb 2020 23:21:20 -0500 Subject: [PATCH] Add GetConversations --- chat.go | 16 ++++++++++++++++ types.go | 1 + 2 files changed, 17 insertions(+) diff --git a/chat.go b/chat.go index 057deba..da6c6b9 100644 --- a/chat.go +++ b/chat.go @@ -421,6 +421,22 @@ func (k *Keybase) DeleteByConvID(convID chat1.ConvIDStr, msgID chat1.MessageID) return r, nil } +// GetConversations returns a list of all conversations. Optionally, you can filter by unread +func (k *Keybase) GetConversations(unreadOnly bool) (SendResponse, error) { + var r SendResponse + + opts := SendMessageOptions{ + UnreadOnly: unreadOnly, + } + + r, err := k.SendMessage("list", opts) + if err != nil { + return r, err + } + + return r, nil +} + // ChatList returns a list of all conversations. // You can pass a Channel to use as a filter here, but you'll probably want to // leave the TopicName empty. diff --git a/types.go b/types.go index 4b422e3..79d1879 100644 --- a/types.go +++ b/types.go @@ -55,6 +55,7 @@ type SendMessageOptions struct { ConfirmLumenSend bool `json:"confirm_lumen_send"` ReplyTo *chat1.MessageID `json:"reply_to,omitempty"` ExplodingLifetime *ExplodingLifetime `json:"exploding_lifetime,omitempty"` + UnreadOnly bool `json:"unread_only,omitempty"` } type sendMessageParams struct {