aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/services/pull_requests/comments.py
diff options
context:
space:
mode:
authorNat Williams <nwilliams@leapfrogonline.com>2012-04-17 17:35:31 -0500
committerNat Williams <nwilliams@leapfrogonline.com>2012-04-17 17:35:31 -0500
commit4539f80aa44e500422c5071d8e3d74de321b6225 (patch)
tree2efa8b3e2eaa19de229209b6d316e098944399d2 /pygithub3/services/pull_requests/comments.py
parentmore specific exception for missing Request classes (diff)
downloadpython-github3-4539f80aa44e500422c5071d8e3d74de321b6225.tar.xz
python-github3-4539f80aa44e500422c5071d8e3d74de321b6225.zip
add pull request API
there are a few little issues remaining. Mostly regarding handling meaningful non-20x response codes
Diffstat (limited to 'pygithub3/services/pull_requests/comments.py')
-rw-r--r--pygithub3/services/pull_requests/comments.py73
1 files changed, 73 insertions, 0 deletions
diff --git a/pygithub3/services/pull_requests/comments.py b/pygithub3/services/pull_requests/comments.py
new file mode 100644
index 0000000..3aa6d0e
--- /dev/null
+++ b/pygithub3/services/pull_requests/comments.py
@@ -0,0 +1,73 @@
+from pygithub3.services.base import Service, MimeTypeMixin
+
+
+class Comments(Service, MimeTypeMixin):
+ """Consume `Review Comments API
+ <http://developer.github.com/v3/pulls/comments/>`_
+
+ """
+
+ def list(self, number, user=None, repo=None):
+ """List all the comments for a pull request
+
+ :param str number: The number of the pull request
+ :param str user: Username
+ :param str repo: Repository
+
+ """
+ return self._get_result(
+ self.make_request('pull_requests.comments.list', number=number,
+ user=user, repo=repo)
+ )
+
+ def get(self, number, user=None, repo=None):
+ """Get a single comment
+
+ :param str number: The comment to get
+ :param str user: Username
+ :param str repo: Repository
+
+ """
+ return self._get(
+ self.make_request('pull_requests.comments.get', number=number,
+ user=user, repo=repo)
+ )
+
+ def create(self, number, body, user=None, repo=None):
+ """Create a comment
+
+ :param str number: the pull request to comment on
+ :param str user: Username
+ :param str repo: Repository
+
+ """
+ return self._post(
+ self.make_request('pull_requests.comments.create', number=number,
+ body=body, user=user, repo=repo)
+ )
+
+ def edit(self, number, body, user=None, repo=None):
+ """Edit a comment
+
+ :param str number: The id of the comment to edit
+ :param str user: Username
+ :param str repo: Repository
+
+ """
+ return self._patch(
+ self.make_request('pull_requests.comments.edit', number=number,
+ body=body, user=user, repo=repo)
+ )
+
+ def delete(self, number, user=None, repo=None):
+ """Delete a comment
+
+ :param str number: The comment to delete
+ :param str user: Username
+ :param str repo: Repository
+
+ """
+ return self._delete(
+ self.make_request('pull_requests.comments.delete', number=number,
+ user=user, repo=repo)
+ )