diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2013-12-26 14:56:33 +0100 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2013-12-26 14:56:33 +0100 |
commit | bd6b4aca6dea4b533c4ab15ee649be7b9aabd761 (patch) | |
tree | 6a220908c6bcb4673afe23d3fc011d9bee3d7bc0 /gitlab.py | |
parent | 2b4924e2fb5ddf32f7ed5e4d9dc055e57612f9c2 (diff) | |
download | gitlab-bd6b4aca6dea4b533c4ab15ee649be7b9aabd761.tar.gz |
support projects listing: search, all, owned
Diffstat (limited to 'gitlab.py')
-rw-r--r-- | gitlab.py | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -337,6 +337,32 @@ class Gitlab(object): """ return self._getListOrObject(Project, id, **kwargs) + def _list_projects(self, url): + r = self.rawGet(url) + if r.status_code != 200: + raise GitlabListError + + l = [] + for o in r.json(): + l.append(Project(self, o)) + + return l + + def search_projects(self, query): + """Searches projects by name. + + Returns a list of matching projects. + """ + return self._list_projects("/projects/search/" + query) + + def all_projects(self): + """Lists all the projects (need admin rights).""" + return self._list_projects("/projects/all") + + def owned_projects(self): + """Lists owned projects.""" + return self._list_projects("/projects/owned") + def Group(self, id=None, **kwargs): """Creates/gets/lists group(s) known by the GitLab server. |