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
Этот коммит содержится в:
Harrison Healey
2019-06-27 09:37:03 -04:00
коммит произвёл GitHub
родитель 89a41dc381
Коммит 4b96437370
12 изменённых файлов: 176 добавлений и 47 удалений

Просмотреть файл

@@ -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))

Просмотреть файл

@@ -29,3 +29,8 @@ type UserGetOptions struct {
// Page size
PerPage int
}
type UserGetByIdsOptions struct {
// Since filters the users based on their UpdateAt timestamp.
Since int64
}