implement ability to list members on a team by role

This commit is contained in:
Tadas Giniotis
2020-09-30 23:36:55 +03:00
parent d4c5c6a1e0
commit 9a918e3bac

View File

@@ -145,6 +145,22 @@ public class GHTeam extends GHObject implements Refreshable {
return GHDiscussion.readAll(this);
}
/**
* List members with specified role paged iterable.
*
* @param role
* the role
* @return the paged iterable
* @throws IOException
* the io exception
*/
public PagedIterable<GHUser> listMembers(String role) throws IOException {
return root.createRequest()
.withUrlPath(api("/members"))
.with("role", role)
.toIterable(GHUser[].class, item -> item.wrapUp(root));
}
/**
* Gets a single discussion by ID.
*
@@ -171,7 +187,7 @@ public class GHTeam extends GHObject implements Refreshable {
* the io exception
*/
public PagedIterable<GHUser> listMembers() throws IOException {
return root.createRequest().withUrlPath(api("/members")).toIterable(GHUser[].class, item -> item.wrapUp(root));
return listMembers("all");
}
/**