From ace228c4e52bd25dca24d1a5b35eff97740e5ea2 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 24 Feb 2017 06:15:13 -0500 Subject: Implement GET /posts/{post_id}/files/info endpoint for APIv4 (#5519) --- model/client4.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'model') diff --git a/model/client4.go b/model/client4.go index 1e4ba86ac..6b9a389c9 100644 --- a/model/client4.go +++ b/model/client4.go @@ -783,6 +783,16 @@ func (c *Client4) GetFile(fileId string) ([]byte, *Response) { } } +// 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 { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return FileInfosFromJson(r.Body), BuildResponse(r) + } +} + // General Section // GetPing will ping the server and to see if it is up and running. -- cgit v1.2.3-1-g7c22