mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
Filter team members by role (#491)
* Team: support filtering members by role * Team: support adding membership with role
This commit is contained in:
committed by
Wan Liuyang
parent
3d31252337
commit
10ee17a25c
+9
-3
@@ -228,16 +228,22 @@ class Team(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user