MM-18357: Adds pagination to team search. (#12910)

* MM-18357: Adds pagination to team search.

* MM-18357: Adds new client method for paginated requests.

* MM-18357: Adds feedback about non-supported pagination-permissions combo.

* MM-18357: Removes unnecessary conversion.

* MM-18357: Removes paginate parameter and uses nil on page and perpage instead.
Этот коммит содержится в:
Martin Kraft
2019-11-28 08:11:02 -05:00
коммит произвёл GitHub
родитель 955f8c4e8e
Коммит 14bcd1f0a1
11 изменённых файлов: 187 добавлений и 7 удалений

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

@@ -1661,6 +1661,23 @@ func (c *Client4) SearchTeams(search *TeamSearch) ([]*Team, *Response) {
return TeamListFromJson(r.Body), BuildResponse(r)
}
// SearchTeamsPaged returns a page of teams and the total count matching the provided search term.
func (c *Client4) SearchTeamsPaged(search *TeamSearch) ([]*Team, int64, *Response) {
if search.Page == nil {
search.Page = NewInt(0)
}
if search.PerPage == nil {
search.PerPage = NewInt(100)
}
r, err := c.DoApiPost(c.GetTeamsRoute()+"/search", search.ToJson())
if err != nil {
return nil, 0, BuildErrorResponse(r, err)
}
defer closeBody(r)
twc := TeamsWithCountFromJson(r.Body)
return twc.Teams, twc.TotalCount, BuildResponse(r)
}
// TeamExists returns true or false if the team exist or not.
func (c *Client4) TeamExists(name, etag string) (bool, *Response) {
r, err := c.DoApiGet(c.GetTeamByNameRoute(name)+"/exists", etag)