diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-11-03 11:34:52 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-11-03 11:34:52 -0500 |
commit | 188182a3a4499965dbbde254aed0ae5e60e71dc5 (patch) | |
tree | c8827517f2a65790b0f1e6fcaad5ff517710fcc2 /model | |
parent | 65acb1b201147ee20d3a07f97073ab7cd8c0efc2 (diff) | |
download | chat-188182a3a4499965dbbde254aed0ae5e60e71dc5.tar.gz chat-188182a3a4499965dbbde254aed0ae5e60e71dc5.tar.bz2 chat-188182a3a4499965dbbde254aed0ae5e60e71dc5.zip |
Adding ability to fetch posts around a specifc post
Diffstat (limited to 'model')
-rw-r--r-- | model/client.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/model/client.go b/model/client.go index 19183098e..a15cb5eaf 100644 --- a/model/client.go +++ b/model/client.go @@ -618,6 +618,24 @@ func (c *Client) GetPostsSince(channelId string, time int64) (*Result, *AppError } } +func (c *Client) GetPostsBefore(channelId string, postid string, offset int, limit int, etag string) (*Result, *AppError) { + if r, err := c.DoApiGet(fmt.Sprintf("/channels/%v/post/%v/before/%v/%v", channelId, postid, offset, limit), "", etag); err != nil { + return nil, err + } else { + return &Result{r.Header.Get(HEADER_REQUEST_ID), + r.Header.Get(HEADER_ETAG_SERVER), PostListFromJson(r.Body)}, nil + } +} + +func (c *Client) GetPostsAfter(channelId string, postid string, offset int, limit int, etag string) (*Result, *AppError) { + if r, err := c.DoApiGet(fmt.Sprintf("/channels/%v/post/%v/after/%v/%v", channelId, postid, offset, limit), "", etag); err != nil { + return nil, err + } else { + return &Result{r.Header.Get(HEADER_REQUEST_ID), + r.Header.Get(HEADER_ETAG_SERVER), PostListFromJson(r.Body)}, nil + } +} + func (c *Client) GetPost(channelId string, postId string, etag string) (*Result, *AppError) { if r, err := c.DoApiGet(fmt.Sprintf("/channels/%v/post/%v", channelId, postId), "", etag); err != nil { return nil, err |