diff options
author | 2012-05-12 23:08:55 +0200 | |
---|---|---|
committer | 2012-05-12 23:08:55 +0200 | |
commit | 748b320dd244341694c0d247d04c7f57ad4c052e (patch) | |
tree | 37b7ffad24d21f398dbb0592395b65599594c40b /pygithub3/requests/pull_requests/comments.py | |
parent | New install environment to prod and dev (diff) | |
parent | Some fixes/typos and 'validate_body' related (diff) | |
download | python-github3-748b320dd244341694c0d247d04c7f57ad4c052e.tar.xz python-github3-748b320dd244341694c0d247d04c7f57ad4c052e.zip |
Merge 'services/pull_requests'
Diffstat (limited to 'pygithub3/requests/pull_requests/comments.py')
-rw-r--r-- | pygithub3/requests/pull_requests/comments.py | 46 |
1 files changed, 46 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..dd69894 --- /dev/null +++ b/pygithub3/requests/pull_requests/comments.py @@ -0,0 +1,46 @@ +# -*- encoding: utf-8 -*- + +from pygithub3.requests.base import Request, ValidationError +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 clean_body(self): + if (not ('commit_id' in self.body and + 'path' in self.body and + 'position' in self.body) and + not 'in_reply_to' in self.body): + raise ValidationError('supply either in_reply_to or commit_id, ' + 'path, and position') + return self.body + + +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 |