APIv4 POST /posts/{post_id/pin & unpin (#5906)
* APIv4 get /posts/{post_id}/pin & unpin
* remove PinnedPost from api test helper
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
5f6d50bff1
Коммит
5d56fbb036
@@ -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 {
|
||||
|
||||
Ссылка в новой задаче
Block a user