summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-03-30 00:06:51 +0900
committerCorey Hulen <corey@hulen.com>2017-03-29 08:06:51 -0700
commit2f15523fe88c3a382abda1e64b2ef962c3ab5128 (patch)
treeb82d0f98d68c16fd23e886072f8a513d8450bef0 /model/client4.go
parent31830ffc7b578de643f5748227e4b783ee0782dd (diff)
downloadchat-2f15523fe88c3a382abda1e64b2ef962c3ab5128.tar.gz
chat-2f15523fe88c3a382abda1e64b2ef962c3ab5128.tar.bz2
chat-2f15523fe88c3a382abda1e64b2ef962c3ab5128.zip
APIv4 put /posts/{post_id}/patch (#5883)
* APIv4 put /posts/{post_id}/patch * Add props and edit permission
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index 72d8951b9..5259cb915 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -1193,6 +1193,16 @@ func (c *Client4) UpdatePost(postId string, post *Post) (*Post, *Response) {
}
}
+// PatchPost partially updates a post. Any missing fields are not updated.
+func (c *Client4) PatchPost(postId string, patch *PostPatch) (*Post, *Response) {
+ if r, err := c.DoApiPut(c.GetPostRoute(postId)+"/patch", patch.ToJson()); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return PostFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// GetPost gets a single post.
func (c *Client4) GetPost(postId string, etag string) (*Post, *Response) {
if r, err := c.DoApiGet(c.GetPostRoute(postId), etag); err != nil {