Skip to content

Commit

Permalink
Filter team members by role (#491)
Browse files Browse the repository at this point in the history
* Team: support filtering members by role

* Team: support adding membership with role
  • Loading branch information
mgorny authored and sfdye committed Mar 17, 2018
1 parent 3d31252 commit 10ee17a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions github/Team.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,22 @@ def edit(self, name, permission=github.GithubObject.NotSet):
)
self._useAttributes(data)

def get_members(self):
def get_members(self, role=github.GithubObject.NotSet):
"""
:calls: `GET /teams/:id/members <http://developer.github.com/v3/orgs/teams>`_
:calls: `GET /teams/:id/members <https://developer.github.com/v3/teams/members/#list-team-members>`_
:param role: string
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser`
"""
assert role is github.GithubObject.NotSet or isinstance(role, (str, unicode)), role
url_parameters = dict()
if role is not github.GithubObject.NotSet:
assert role in ['member', 'maintainer', 'all']
url_parameters["role"] = role
return github.PaginatedList.PaginatedList(
github.NamedUser.NamedUser,
self._requester,
self.url + "/members",
None
url_parameters
)

def get_repos(self):
Expand Down

0 comments on commit 10ee17a

Please sign in to comment.