Skip to content

Commit e789cee

Browse files
author
Gauvain Pocentek
committed
[v4] Add projects.list() attributes
All the ProjectManager filter methods can now be handled by projects.list().
1 parent 6684c13 commit e789cee

File tree

1 file changed

+3
-37
lines changed

1 file changed

+3
-37
lines changed

gitlab/v4/objects.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,9 @@ class Project(GitlabObject):
17761776
_constructorTypes = {'owner': 'User', 'namespace': 'Group'}
17771777
optionalListAttrs = ['search']
17781778
requiredCreateAttrs = ['name']
1779-
optionalListAttrs = ['search']
1779+
optionalListAttrs = ['search', 'owned', 'starred', 'archived',
1780+
'visibility', 'order_by', 'sort', 'simple',
1781+
'membership', 'statistics']
17801782
optionalCreateAttrs = ['path', 'namespace_id', 'description',
17811783
'issues_enabled', 'merge_requests_enabled',
17821784
'builds_enabled', 'wiki_enabled',
@@ -2167,42 +2169,6 @@ def delete_all(self, **kwargs):
21672169
class ProjectManager(BaseManager):
21682170
obj_cls = Project
21692171

2170-
def all(self, **kwargs):
2171-
"""List all the projects (need admin rights).
2172-
2173-
Args:
2174-
all (bool): If True, return all the items, without pagination
2175-
**kwargs: Additional arguments to send to GitLab.
2176-
2177-
Returns:
2178-
list(gitlab.Gitlab.Project): The list of projects.
2179-
"""
2180-
return self.gitlab._raw_list("/projects/all", Project, **kwargs)
2181-
2182-
def owned(self, **kwargs):
2183-
"""List owned projects.
2184-
2185-
Args:
2186-
all (bool): If True, return all the items, without pagination
2187-
**kwargs: Additional arguments to send to GitLab.
2188-
2189-
Returns:
2190-
list(gitlab.Gitlab.Project): The list of owned projects.
2191-
"""
2192-
return self.gitlab._raw_list("/projects/owned", Project, **kwargs)
2193-
2194-
def starred(self, **kwargs):
2195-
"""List starred projects.
2196-
2197-
Args:
2198-
all (bool): If True, return all the items, without pagination
2199-
**kwargs: Additional arguments to send to GitLab.
2200-
2201-
Returns:
2202-
list(gitlab.Gitlab.Project): The list of starred projects.
2203-
"""
2204-
return self.gitlab._raw_list("/projects/starred", Project, **kwargs)
2205-
22062172

22072173
class GroupProject(Project):
22082174
_url = '/groups/%(group_id)s/projects'

0 commit comments

Comments
 (0)