aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/requests/repos/commits.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygithub3/requests/repos/commits.py')
-rw-r--r--pygithub3/requests/repos/commits.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/pygithub3/requests/repos/commits.py b/pygithub3/requests/repos/commits.py
new file mode 100644
index 0000000..49df2a1
--- /dev/null
+++ b/pygithub3/requests/repos/commits.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+
+from . import Request
+from pygithub3.resources.repos import Commit, GitCommit, Comment, Diff
+
+
+class List(Request):
+
+ uri = 'repos/{user}/{repo}/commits'
+ resource = GitCommit
+
+
+class Get(Request):
+
+ uri = 'repos/{user}/{repo}/commits/{sha}'
+ resource = Commit
+
+
+class List_comments(Request):
+
+ uri = 'repos/{user}/{repo}/comments'
+ resource = Comment
+
+ def clean_uri(self):
+ if self.sha:
+ return 'repos/{user}/{repo}/commits/{sha}/comments'
+
+
+class Create_comment(Request):
+
+ uri = 'repos/{user}/{repo}/commits/{sha}/comments'
+ resource = Comment
+ body_schema = {
+ 'schema': ('body', 'commit_id', 'line', 'path', 'position'),
+ 'required': ('body', 'commit_id', 'line', 'path', 'position'),
+ }
+
+
+class Get_comment(Request):
+
+ uri = 'repos/{user}/{repo}/comments/{comment_id}'
+ resource = Comment
+
+
+class Update_comment(Request):
+
+ uri = 'repos/{user}/{repo}/comments/{comment_id}'
+ resource = Comment
+ body_schema = {
+ 'schema': ('body', ),
+ 'required': ('body', ),
+ }
+
+
+class Compare(Request):
+
+ uri = 'repos/{user}/{repo}/compare/{base}...{head}'
+ resource = Diff
+
+
+class Delete_comment(Request):
+
+ uri = 'repos/{user}/{repo}/comments/{comment_id}'