diff options
Diffstat (limited to 'model/client4.go')
-rw-r--r-- | model/client4.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index 34176bfb3..9b0cce294 100644 --- a/model/client4.go +++ b/model/client4.go @@ -903,6 +903,15 @@ func (c *Client4) GetFileThumbnail(fileId string) ([]byte, *Response) { } } +// GetFileLink gets the public link of a file by id. +func (c *Client4) GetFileLink(fileId string) (string, *Response) { + if r, err := c.DoApiGet(c.GetFileRoute(fileId)+"/link", ""); err != nil { + return "", &Response{StatusCode: r.StatusCode, Error: err} + } else { + return MapFromJson(r.Body)["link"], BuildResponse(r) + } +} + // GetFileInfosForPost gets all the file info objects attached to a post. func (c *Client4) GetFileInfosForPost(postId string, etag string) ([]*FileInfo, *Response) { if r, err := c.DoApiGet(c.GetPostRoute(postId)+"/files/info", etag); err != nil { |