From d32334cdfb09b25a97c4731721ce9be836f95300 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Sun, 12 Mar 2017 07:24:44 +0900 Subject: Endpoint for APIv4: /files/{file_id}/link (#5607) * APIv4: /files/{file_id}/link * updated public link --- model/client4.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'model') 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 { -- cgit v1.2.3-1-g7c22