diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2017-03-01 10:18:36 +0900 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2017-02-28 22:18:36 -0300 |
commit | 28c218db3bbdcc0776be1be91ff4acbd0586f590 (patch) | |
tree | 10259512af822b378a93e105cb2608e039324001 /model | |
parent | 2a621f7470476b0f10d6241a13fdcfd838748edd (diff) | |
download | chat-28c218db3bbdcc0776be1be91ff4acbd0586f590.tar.gz chat-28c218db3bbdcc0776be1be91ff4acbd0586f590.tar.bz2 chat-28c218db3bbdcc0776be1be91ff4acbd0586f590.zip |
Implementation endpoint of APIv4: GET /files/{file_id}/thumbnail (#5553)
* APIv4: GET /files/{file_id}/thumbnail
* added delay time
Diffstat (limited to 'model')
-rw-r--r-- | model/client4.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index 8d2423ad9..d3bb6534d 100644 --- a/model/client4.go +++ b/model/client4.go @@ -882,6 +882,17 @@ func (c *Client4) GetFile(fileId string) ([]byte, *Response) { } } +// GetFileThumbnail gets the bytes for a file by id. +func (c *Client4) GetFileThumbnail(fileId string) ([]byte, *Response) { + if r, err := c.DoApiGet(c.GetFileRoute(fileId)+"/thumbnail", ""); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else if data, err := ioutil.ReadAll(r.Body); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: NewAppError("GetFileThumbnail", "model.client.read_file.app_error", nil, err.Error(), r.StatusCode)} + } else { + return data, 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 { |