diff options
Diffstat (limited to 'model')
-rw-r--r-- | model/client4.go | 10 | ||||
-rw-r--r-- | model/user_search.go | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index f6d665e1c..420b8d510 100644 --- a/model/client4.go +++ b/model/client4.go @@ -487,6 +487,16 @@ func (c *Client4) GetUsersByIds(userIds []string) ([]*User, *Response) { } } +// SearchUsers returns a list of users based on some search criteria. +func (c *Client4) SearchUsers(search *UserSearch) ([]*User, *Response) { + if r, err := c.DoApiPost(c.GetUsersRoute()+"/search", search.ToJson()); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return UserListFromJson(r.Body), BuildResponse(r) + } +} + // UpdateUser updates a user in the system based on the provided user struct. func (c *Client4) UpdateUser(user *User) (*User, *Response) { if r, err := c.DoApiPut(c.GetUserRoute(user.Id), user.ToJson()); err != nil { diff --git a/model/user_search.go b/model/user_search.go index 4bbd2bd78..1ef881130 100644 --- a/model/user_search.go +++ b/model/user_search.go @@ -14,6 +14,7 @@ type UserSearch struct { InChannelId string `json:"in_channel_id"` NotInChannelId string `json:"not_in_channel_id"` AllowInactive bool `json:"allow_inactive"` + WithoutTeam bool `json:"without_team"` } // ToJson convert a User to a json string |