diff options
author | 2012-04-28 23:43:28 +0200 | |
---|---|---|
committer | 2012-04-28 23:43:28 +0200 | |
commit | c24e6efbb59065dcb6655d47bb7b0254f2753bff (patch) | |
tree | 32290846e640555ec4804c53c4aab62cbbe7bd13 /pygithub3/requests/pull_requests/comments.py | |
parent | :sparkles: Release 0.3 :sparkles: (diff) | |
parent | docstring link typo (diff) | |
download | python-github3-c24e6efbb59065dcb6655d47bb7b0254f2753bff.tar.xz python-github3-c24e6efbb59065dcb6655d47bb7b0254f2753bff.zip |
Merged pull request #4 from natw:services/pull_requests
Diffstat (limited to 'pygithub3/requests/pull_requests/comments.py')
-rw-r--r-- | pygithub3/requests/pull_requests/comments.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/pygithub3/requests/pull_requests/comments.py b/pygithub3/requests/pull_requests/comments.py new file mode 100644 index 0000000..fa1e5b6 --- /dev/null +++ b/pygithub3/requests/pull_requests/comments.py @@ -0,0 +1,43 @@ +from pygithub3.requests.base import Request +from pygithub3.resources.pull_requests import Comment + + +class List(Request): + uri = 'repos/{user}/{repo}/pulls/{number}/comments' + resource = Comment + + +class Get(Request): + uri = 'repos/{user}/{repo}/pulls/comments/{number}' + resource = Comment + + +class Create(Request): + uri = 'repos/{user}/{repo}/pulls/{number}/comments' + resource = Comment + body_schema = { + 'schema': ('body', 'commit_id', 'path', 'position', 'in_reply_to'), + 'required': ('body',), + } + + def validate_body(self, body): + if (not ('commit_id' in body and + 'path' in body and + 'position' in body) and + not 'in_reply_to' in body): + raise ValidationError('supply either in_reply_to or commit_id, ' + 'path, and position') + + +class Edit(Request): + uri = 'repos/{user}/{repo}/pulls/comments/{number}' + resource = Comment + body_schema = { + 'schema': ('body',), + 'required': ('body',), + } + + +class Delete(Request): + uri = 'repos/{user}/{repo}/pulls/comments/{number}' + resource = Comment |