diff --git a/chat.go b/chat.go index 7aecf27..5fcb11b 100644 --- a/chat.go +++ b/chat.go @@ -472,6 +472,34 @@ func (k *Keybase) ReadChannel(channel chat1.ChatChannel) (chat1.Thread, error) { return k.Read(opts) } +// ReadChannelNext fetches the next page of messages for a chat channel. +func (k *Keybase) ReadChannelNext(channel chat1.ChatChannel, next []byte, num int) (chat1.Thread, error) { + page := chat1.Pagination{ + Next: next, + Num: num, + } + + opts := ReadMessageOptions{ + Channel: channel, + Pagination: &page, + } + return k.Read(opts) +} + +// ReadChannelPrevious fetches the previous page of messages for a chat channel +func (k *Keybase) ReadChannelPrevious(channel chat1.ChatChannel, previous []byte, num int) (chat1.Thread, error) { + page := chat1.Pagination{ + Previous: previous, + Num: num, + } + + opts := ReadMessageOptions{ + Channel: channel, + Pagination: &page, + } + return k.Read(opts) +} + // ReadConversation fetches chat messages for a conversation func (k *Keybase) ReadConversation(conv chat1.ConvIDStr) (chat1.Thread, error) { opts := ReadMessageOptions{ @@ -480,6 +508,34 @@ func (k *Keybase) ReadConversation(conv chat1.ConvIDStr) (chat1.Thread, error) { return k.Read(opts) } +// ReadConversationNext fetches the next page of messages for a conversation. +func (k *Keybase) ReadConversationNext(conv chat1.ConvIDStr, next []byte, num int) (chat1.Thread, error) { + page := chat1.Pagination{ + Next: next, + Num: num, + } + + opts := ReadMessageOptions{ + ConversationID: conv, + Pagination: &page, + } + return k.Read(opts) +} + +// ReadConversationPrevious fetches the previous page of messages for a chat channel +func (k *Keybase) ReadConversationPrevious(conv chat1.ConvIDStr, previous []byte, num int) (chat1.Thread, error) { + page := chat1.Pagination{ + Previous: previous, + Num: num, + } + + opts := ReadMessageOptions{ + ConversationID: conv, + Pagination: &page, + } + return k.Read(opts) +} + // ReadMessage fetches the chat message with the specified message id from a conversation. func (c Chat) ReadMessage(messageID int) (*ChatAPI, error) { m := ChatAPI{