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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
89a41dc381
Коммит
4b96437370
@@ -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
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user