MM-16477 Add api to get users modified since a given time (#11406)

* MM-16477 Add api to get users modified since a given time

* Address feedback
This commit is contained in:
Harrison Healey
2019-06-27 09:37:03 -04:00
committed by GitHub
parent 89a41dc381
commit 4b96437370
12 changed files with 176 additions and 47 deletions

View File

@@ -936,6 +936,26 @@ func (c *Client4) GetUsersByIds(userIds []string) ([]*User, *Response) {
return UserListFromJson(r.Body), BuildResponse(r)
}
// GetUsersByIds returns a list of users based on the provided user ids.
func (c *Client4) GetUsersByIdsWithOptions(userIds []string, options *UserGetByIdsOptions) ([]*User, *Response) {
v := url.Values{}
if options.Since != 0 {
v.Set("since", fmt.Sprintf("%d", options.Since))
}
url := c.GetUsersRoute() + "/ids"
if len(v) > 0 {
url += "?" + v.Encode()
}
r, err := c.DoApiPost(url, ArrayToJson(userIds))
if err != nil {
return nil, BuildErrorResponse(r, err)
}
defer closeBody(r)
return UserListFromJson(r.Body), BuildResponse(r)
}
// GetUsersByUsernames returns a list of users based on the provided usernames.
func (c *Client4) GetUsersByUsernames(usernames []string) ([]*User, *Response) {
r, err := c.DoApiPost(c.GetUsersRoute()+"/usernames", ArrayToJson(usernames))