[APIV4] GET /users/{user_id}/status - user status endpoint for apiV4 (#5824)
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
28ad645153
Коммит
5bf6ae04df
@@ -190,6 +190,10 @@ func (c *Client4) GetPreferencesRoute(userId string) string {
|
||||
return fmt.Sprintf(c.GetUserRoute(userId) + "/preferences")
|
||||
}
|
||||
|
||||
func (c *Client4) GetStatusRoute(userId string) string {
|
||||
return fmt.Sprintf(c.GetUserRoute(userId) + "/status")
|
||||
}
|
||||
|
||||
func (c *Client4) GetSamlRoute() string {
|
||||
return fmt.Sprintf("/saml")
|
||||
}
|
||||
@@ -1764,3 +1768,15 @@ func (c *Client4) CreateCommand(cmd *Command) (*Command, *Response) {
|
||||
return CommandFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
// Status Section
|
||||
|
||||
// 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 {
|
||||
return nil, &Response{StatusCode: r.StatusCode, Error: err}
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return StatusFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ type Status struct {
|
||||
Status string `json:"status"`
|
||||
Manual bool `json:"manual"`
|
||||
LastActivityAt int64 `json:"last_activity_at"`
|
||||
ActiveChannel string `json:"active_channel" db:"-"`
|
||||
ActiveChannel string `json:"-" db:"-"`
|
||||
}
|
||||
|
||||
func (o *Status) ToJson() string {
|
||||
|
||||
Ссылка в новой задаче
Block a user