summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-03-31 22:58:47 +0900
committerChristopher Speller <crspeller@gmail.com>2017-03-31 09:58:47 -0400
commit5d56fbb036cc7044eae639c92836e0b14ffe7dab (patch)
treeb497427cc50b4ca80694bde93e81878458660e0b /model
parent5f6d50bff1b4098bc0ef3c120e7b12104e5c4894 (diff)
downloadchat-5d56fbb036cc7044eae639c92836e0b14ffe7dab.tar.gz
chat-5d56fbb036cc7044eae639c92836e0b14ffe7dab.tar.bz2
chat-5d56fbb036cc7044eae639c92836e0b14ffe7dab.zip
APIv4 POST /posts/{post_id/pin & unpin (#5906)
* APIv4 get /posts/{post_id}/pin & unpin * remove PinnedPost from api test helper
Diffstat (limited to 'model')
-rw-r--r--model/client4.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index a43950a68..e62ce57bd 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -1249,6 +1249,26 @@ func (c *Client4) PatchPost(postId string, patch *PostPatch) (*Post, *Response)
}
}
+// PinPost pin a post based on provided post id string.
+func (c *Client4) PinPost(postId string) (bool, *Response) {
+ if r, err := c.DoApiPost(c.GetPostRoute(postId)+"/pin", ""); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
+// UnpinPost unpin a post based on provided post id string.
+func (c *Client4) UnpinPost(postId string) (bool, *Response) {
+ if r, err := c.DoApiPost(c.GetPostRoute(postId)+"/unpin", ""); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), 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 {