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:
Pavan Kunisetty
2019-10-22 21:34:55 +11:00
committed by Steve Kowalik
parent db29483729
commit a163ba1562
4 changed files with 72 additions and 1 deletions
+30
View File
@@ -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