summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-03-12 07:24:44 +0900
committerenahum <nahumhbl@gmail.com>2017-03-11 19:24:44 -0300
commitd32334cdfb09b25a97c4731721ce9be836f95300 (patch)
treef9da2fa15b6b70d2b27e8a98b868b0377a6b70d9 /model
parentce772b87da3266f7261986ed2c9048c3d3d5ebe0 (diff)
downloadchat-d32334cdfb09b25a97c4731721ce9be836f95300.tar.gz
chat-d32334cdfb09b25a97c4731721ce9be836f95300.tar.bz2
chat-d32334cdfb09b25a97c4731721ce9be836f95300.zip
Endpoint for APIv4: /files/{file_id}/link (#5607)
* APIv4: /files/{file_id}/link * updated public link
Diffstat (limited to 'model')
-rw-r--r--model/client4.go9
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 {