aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/requests/repos/commits.py
blob: c31ad046472fda6320295cfce4ebdcca29b39d2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

from . import Request
from pygithub3.resources.repos import GitCommit, Comment, Diff


class List(Request):

    uri = 'repos/{user}/{repo}/commits'
    resource = GitCommit


class Get(Request):

    uri = 'repos/{user}/{repo}/commits/{sha}'
    resource = GitCommit


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}'