From 61771a0fc53a9c50f096b0dcc422f12ce80baf20 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Fri, 6 Jan 2017 18:10:00 +0100 Subject: inital draft (#4883) --- model/client.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'model') 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 -- cgit v1.2.3-1-g7c22