diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2017-01-06 18:10:00 +0100 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-01-06 12:10:00 -0500 |
commit | 61771a0fc53a9c50f096b0dcc422f12ce80baf20 (patch) | |
tree | 148bfc997976a536782ad8effd302ec6f1a4dbda /model/client.go | |
parent | c96a36e9b33952efaed17f0f440c60b676464dbf (diff) | |
download | chat-61771a0fc53a9c50f096b0dcc422f12ce80baf20.tar.gz chat-61771a0fc53a9c50f096b0dcc422f12ce80baf20.tar.bz2 chat-61771a0fc53a9c50f096b0dcc422f12ce80baf20.zip |
inital draft (#4883)
Diffstat (limited to 'model/client.go')
-rw-r--r-- | model/client.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/model/client.go b/model/client.go index 540bc747f..b5c22c6ca 100644 --- a/model/client.go +++ b/model/client.go @@ -1471,6 +1471,21 @@ func (c *Client) GetPostById(postId string, etag string) (*PostList, *ResponseMe } } +// GetPermalink returns a post list, based on the provided channel and post ID. +func (c *Client) GetPermalink(channelId string, postId string, etag string) (*PostList, *ResponseMetadata) { + if r, err := c.DoApiGet(c.GetTeamRoute()+fmt.Sprintf("/pltmp/%v", postId), "", etag); err != nil { + return nil, &ResponseMetadata{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return PostListFromJson(r.Body), + &ResponseMetadata{ + StatusCode: r.StatusCode, + RequestId: r.Header.Get(HEADER_REQUEST_ID), + Etag: r.Header.Get(HEADER_ETAG_SERVER), + } + } +} + func (c *Client) DeletePost(channelId string, postId string) (*Result, *AppError) { if r, err := c.DoApiPost(c.GetChannelRoute(channelId)+fmt.Sprintf("/posts/%v/delete", postId), ""); err != nil { return nil, err |