8000 can now update pull requests (documentation TODO) · armanawn/github3.py@a5abd49 · GitHub
[go: up one dir, main page]

Skip to content

Commit a5abd49

Browse files
author
Michael Gelbart
committed
can now update pull requests (documentation TODO)
1 parent 09e2ff8 commit a5abd49

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

github3/repos/repo.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,15 @@ def _create_pull(self, data):
325325
json = self._json(self._post(url, data=data), 201)
326326
return self._instance_or_null(PullRequest, json)
327327

328+
329+
def _update_pull(self, data, number):
330+
self._remove_none(data)
331+
json = None
332+
if int(number) > 0:
333+
url = self._build_url('pulls', str(number), base_url=self._api)
334+
json = self._json(self._patch(url, data=dumps(data)), 200)
335+
return self._instance_or_null(PullRequest, json)
336+
328337
@requires_auth
329338
def add_collaborator(self, username, permission='push'):
330339
"""Add ``username`` as a collaborator to a repository.
@@ -913,6 +922,15 @@ def create_pull(self, title, base, head, body=None):
913922
'head': head}
914923
return self._create_pull(data)
915924

925+
@requires_auth
926+
def update_pull(self, number, title=None, body=None, state=None, base=None):
927+
"""
928+
TODO!!!!
929+
"""
930+
data = {'title': title, 'body': body, 'state': state,
931+
'base': base}
932+
return self._update_pull(data, number)
933+
916934
@requires_auth
917935
def create_pull_from_issue(self, issue, base, head):
918936
"""Create a pull request from issue #``issue``.

0 commit comments

Comments
 (0)
0