diff options
author | Mika Mäenpää <mika.j.maenpaa@tut.fi> | 2014-10-09 13:30:09 +0300 |
---|---|---|
committer | Mika Mäenpää <mika.j.maenpaa@tut.fi> | 2014-10-16 09:29:22 +0300 |
commit | ad63e17ce7b6fd8c8eef993a44a1b18cc73fc4be (patch) | |
tree | c01216d0752e0bb23a75c26ad53481726a4ce920 /gitlab.py | |
parent | 221f41806d0dad67adada158a9352aa9e2f2036f (diff) | |
download | gitlab-ad63e17ce7b6fd8c8eef993a44a1b18cc73fc4be.tar.gz |
Classes for ProjectLabels and ProjectFiles
Diffstat (limited to 'gitlab.py')
-rw-r--r-- | gitlab.py | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -908,6 +908,29 @@ class ProjectMilestone(GitlabObject): shortPrintAttr = 'title' +class ProjectLabel(GitlabObject): + _url = '/projects/%(project_id)s/labels' + requiredUrlAttrs = ['project_id'] + requiredDeleteAttrs = ['name'] + requiredCreateAttrs = ['name', 'color'] + # FIXME: new_name is only valid with update + optionalCreateAttrs = ['new_name'] + shortPrintAttr = 'name' + + +class ProjectFile(GitlabObject): + _url = '/projects/%(project_id)s/repository/files' + canList = False + requiredUrlAttrs = ['project_id'] + requiredGetAttrs = ['file_path', 'ref'] + requiredCreateAttrs = ['file_path', 'branch_name', 'content', + 'commit_message'] + optionalCreateAttrs = ['encoding'] + requiredDeleteAttrs = ['branch_name', 'commit_message'] + getListWhenNoId = False + shortPrintAttr = 'name' + + class ProjectSnippetNote(GitlabObject): _url = '/projects/%(project_id)s/snippets/%(snippet_id)s/notes' _constructorTypes = {'author': 'User'} @@ -1025,6 +1048,16 @@ class Project(GitlabObject): project_id=self.id, **kwargs) + def Label(self, id=None, **kwargs): + return self._getListOrObject(ProjectLabel, id, + project_id=self.id, + **kwargs) + + def File(self, id=None, **kwargs): + return self._getListOrObject(ProjectFile, id, + project_id=self.id, + **kwargs) + def Tag(self, id=None, **kwargs): return self._getListOrObject(ProjectTag, id, project_id=self.id, |