MM-25263 Add group members to search and get users and create getGroupStats endpoint (#14733)

Add tests for SearchInGroup
Этот коммит содержится в:
Farhan Munshi
2020-06-18 10:22:35 -04:00
коммит произвёл GitHub
родитель f6c934d7e0
Коммит 77bee1d4f1
18 изменённых файлов: 517 добавлений и 2 удалений

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

@@ -994,6 +994,17 @@ func (c *Client4) GetUsersWithoutTeam(page int, perPage int, etag string) ([]*Us
return UserListFromJson(r.Body), BuildResponse(r)
}
// GetUsersInGroup returns a page of users in a group. Page counting starts at 0.
func (c *Client4) GetUsersInGroup(groupID string, page int, perPage int, etag string) ([]*User, *Response) {
query := fmt.Sprintf("?in_group=%v&page=%v&per_page=%v", groupID, page, perPage)
r, err := c.DoApiGet(c.GetUsersRoute()+query, etag)
if err != nil {
return nil, BuildErrorResponse(r, err)
}
defer closeBody(r)
return UserListFromJson(r.Body), BuildResponse(r)
}
// GetUsersByIds returns a list of users based on the provided user ids.
func (c *Client4) GetUsersByIds(userIds []string) ([]*User, *Response) {
r, err := c.DoApiPost(c.GetUsersRoute()+"/ids", ArrayToJson(userIds))
@@ -5127,3 +5138,13 @@ func (c *Client4) RequestTrialLicense(users int) (bool, *Response) {
defer closeBody(r)
return CheckStatusOK(r), BuildResponse(r)
}
// GetGroupStats retrieves stats for a Mattermost Group
func (c *Client4) GetGroupStats(groupID string) (*GroupStats, *Response) {
r, appErr := c.DoApiGet(c.GetGroupRoute(groupID)+"/stats", "")
if appErr != nil {
return nil, BuildErrorResponse(r, appErr)
}
defer closeBody(r)
return GroupStatsFromJson(r.Body), BuildResponse(r)
}