From 1c832e9cdd1f11b0ef91eb63f5a6e434999f9db4 Mon Sep 17 00:00:00 2001 From: David Medina Date: Sat, 18 Feb 2012 16:40:08 +0100 Subject: Repos commits added --- pygithub3/requests/repos/commits.py | 64 +++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 pygithub3/requests/repos/commits.py (limited to 'pygithub3/requests/repos/commits.py') 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}' -- cgit v1.2.3-59-g8ed1b