mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Implement POST /users/status/ids for apiv4 (#5894)
This commit is contained in:
committed by
Corey Hulen
parent
ee3b983a63
commit
29e6db5713
@@ -194,10 +194,14 @@ func (c *Client4) GetPreferencesRoute(userId string) string {
|
||||
return fmt.Sprintf(c.GetUserRoute(userId) + "/preferences")
|
||||
}
|
||||
|
||||
func (c *Client4) GetStatusRoute(userId string) string {
|
||||
func (c *Client4) GetUserStatusRoute(userId string) string {
|
||||
return fmt.Sprintf(c.GetUserRoute(userId) + "/status")
|
||||
}
|
||||
|
||||
func (c *Client4) GetUserStatusesRoute() string {
|
||||
return fmt.Sprintf(c.GetUsersRoute() + "/status")
|
||||
}
|
||||
|
||||
func (c *Client4) GetSamlRoute() string {
|
||||
return fmt.Sprintf("/saml")
|
||||
}
|
||||
@@ -1989,10 +1993,20 @@ func (c *Client4) CreateCommand(cmd *Command) (*Command, *Response) {
|
||||
|
||||
// GetUserStatus returns a user based on the provided user id string.
|
||||
func (c *Client4) GetUserStatus(userId, etag string) (*Status, *Response) {
|
||||
if r, err := c.DoApiGet(c.GetStatusRoute(userId), etag); err != nil {
|
||||
if r, err := c.DoApiGet(c.GetUserStatusRoute(userId), etag); err != nil {
|
||||
return nil, &Response{StatusCode: r.StatusCode, Error: err}
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return StatusFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
// GetUsersStatusesByIds returns a list of users status based on the provided user ids.
|
||||
func (c *Client4) GetUsersStatusesByIds(userIds []string) ([]*Status, *Response) {
|
||||
if r, err := c.DoApiPost(c.GetUserStatusesRoute()+"/ids", ArrayToJson(userIds)); err != nil {
|
||||
return nil, &Response{StatusCode: r.StatusCode, Error: err}
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return StatusListFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user