summaryrefslogtreecommitdiff
path: root/gitlab.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2014-10-24 08:02:18 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2014-10-24 08:02:18 +0200
commit928b9f09291a45283ed371b931288b1caddb5b1c (patch)
tree35f6f19e1fd8a4c995d4e117b1c85fba7904db66 /gitlab.py
parentafe0ab4b7ecf9a37b88a3d8f77a2c17d95e571d3 (diff)
parentad63e17ce7b6fd8c8eef993a44a1b18cc73fc4be (diff)
downloadgitlab-928b9f09291a45283ed371b931288b1caddb5b1c.tar.gz
Merge pull request #45 from mjmaenpaa/labels_files
Classes for ProjectLabels and ProjectFiles
Diffstat (limited to 'gitlab.py')
-rw-r--r--gitlab.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/gitlab.py b/gitlab.py
index 68ba4d9..6491571 100644
--- a/gitlab.py
+++ b/gitlab.py
@@ -965,6 +965,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'}
@@ -1081,6 +1104,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,