Implementation endpoint of APIv4: GET /files/{file_id}/thumbnail (#5553)

* APIv4: GET /files/{file_id}/thumbnail

* added delay time
Этот коммит содержится в:
Saturnino Abril
2017-03-01 10:18:36 +09:00
коммит произвёл enahum
родитель 2a621f7470
Коммит 28c218db3b
3 изменённых файлов: 96 добавлений и 0 удалений

Просмотреть файл

@@ -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 {