mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Add assignee removal/addition support to PRs (#1241)
Add assignee removal/addition support to PRs Fixes #1109 Add test for new PR assignee functionality Add record file Addressed comments on #1016
This commit is contained in:
committed by
Steve Kowalik
parent
db29483729
commit
a163ba1562
@@ -794,6 +794,36 @@ class PullRequest(github.GithubObject.CompletableGithubObject):
|
||||
)
|
||||
return github.PullRequestMergeStatus.PullRequestMergeStatus(self._requester, headers, data, completed=True)
|
||||
|
||||
def add_to_assignees(self, *assignees):
|
||||
"""
|
||||
:calls: `POST /repos/:owner/:repo/issues/:number/assignees <https://developer.github.com/v3/issues/assignees>`_
|
||||
:param assignees: list of :class:`github.NamedUser.NamedUser` or string
|
||||
:rtype: None
|
||||
"""
|
||||
assert all(isinstance(element, (github.NamedUser.NamedUser, str)) for element in assignees), assignees
|
||||
post_parameters = {"assignees": [assignee.login if isinstance(assignee, github.NamedUser.NamedUser) else assignee for assignee in assignees]}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST",
|
||||
self.url + "/assignees",
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def remove_from_assignees(self, *assignees):
|
||||
"""
|
||||
:calls: `DELETE /repos/:owner/:repo/issues/:number/assignees <https://developer.github.com/v3/issues/assignees>`_
|
||||
:param assignees: list of :class:`github.NamedUser.NamedUser` or string
|
||||
:rtype: None
|
||||
"""
|
||||
assert all(isinstance(element, (github.NamedUser.NamedUser, str)) for element in assignees), assignees
|
||||
post_parameters = {"assignees": [assignee.login if isinstance(assignee, github.NamedUser.NamedUser) else assignee for assignee in assignees]}
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"DELETE",
|
||||
self.url + "/assignees",
|
||||
input=post_parameters
|
||||
)
|
||||
self._useAttributes(data)
|
||||
|
||||
def _initAttributes(self):
|
||||
self._additions = github.GithubObject.NotSet
|
||||
self._assignee = github.GithubObject.NotSet
|
||||
|
||||
Reference in New Issue
Block a user