@@ -155,18 +155,6 @@ def delete(self, id, **kwargs):
155155 raise NotImplementedError
156156 self .gitlab .delete (self .obj_cls , id , ** args )
157157
158- def _custom_list (self , url , cls , ** kwargs ):
159- r = self .gitlab ._raw_get (url , ** kwargs )
160- raise_error_from_response (r , GitlabListError )
161-
162- l = []
163- for j in r .json ():
164- o = cls (self .gitlab , j )
165- o ._from_api = True
166- l .append (o )
167-
168- return l
169-
170158
171159class GitlabObject (object ):
172160 """Base class for all classes that interface with GitLab."""
@@ -569,6 +557,7 @@ def search(self, query, **kwargs):
569557
570558 Args:
571559 query (str): The query string to send to GitLab for the search.
560+ all (bool): If True, return all the items, without pagination
572561 **kwargs: Additional arguments to send to GitLab.
573562
574563 Returns:
@@ -579,7 +568,7 @@ def search(self, query, **kwargs):
579568 GitlabListError: If the server fails to perform the request.
580569 """
581570 url = self .obj_cls ._url + '?search=' + query
582- return self ._custom_list (url , self .obj_cls , ** kwargs )
571+ return self .gitlab . _raw_list (url , self .obj_cls , ** kwargs )
583572
584573 def get_by_username (self , username , ** kwargs ):
585574 """Get a user by its username.
@@ -596,7 +585,7 @@ def get_by_username(self, username, **kwargs):
596585 GitlabGetError: If the server fails to perform the request.
597586 """
598587 url = self .obj_cls ._url + '?username=' + username
599- results = self ._custom_list (url , self .obj_cls , ** kwargs )
588+ results = self .gitlab . _raw_list (url , self .obj_cls , ** kwargs )
600589 assert len (results ) in (0 , 1 )
601590 try :
602591 return results [0 ]
@@ -712,10 +701,15 @@ class GroupManager(BaseManager):
712701 def search (self , query , ** kwargs ):
713702 """Searches groups by name.
714703
715- Returns a list of matching groups.
704+ Args:
705+ query (str): The search string
706+ all (bool): If True, return all the items, without pagination
707+
708+ Returns:
709+ list(Group): a list of matching groups.
716710 """
717711 url = '/groups?search=' + query
718- return self ._custom_list (url , Group , ** kwargs )
712+ return self .gitlab . _raw_list (url , self . obj_cls , ** kwargs )
719713
720714
721715class Hook (GitlabObject ):
@@ -1524,35 +1518,38 @@ def search(self, query, **kwargs):
15241518
15251519 Args:
15261520 query (str): The query string to send to GitLab for the search.
1521+ all (bool): If True, return all the items, without pagination
15271522 **kwargs: Additional arguments to send to GitLab.
15281523
15291524 Returns:
15301525 list(Project): A list of matching projects.
15311526 """
1532- return self ._custom_list ("/projects/search/" + query , Project ,
1533- ** kwargs )
1527+ return self .gitlab . _raw_list ("/projects/search/" + query , Project ,
1528+ ** kwargs )
15341529
15351530 def all (self , ** kwargs ):
15361531 """List all the projects (need admin rights).
15371532
15381533 Args:
1534+ all (bool): If True, return all the items, without pagination
15391535 **kwargs: Additional arguments to send to GitLab.
15401536
15411537 Returns:
15421538 list(Project): The list of projects.
15431539 """
1544- return self ._custom_list ("/projects/all" , Project , ** kwargs )
1540+ return self .gitlab . _raw_list ("/projects/all" , Project , ** kwargs )
15451541
15461542 def owned (self , ** kwargs ):
15471543 """List owned projects.
15481544
15491545 Args:
1546+ all (bool): If True, return all the items, without pagination
15501547 **kwargs: Additional arguments to send to GitLab.
15511548
15521549 Returns:
15531550 list(Project): The list of owned projects.
15541551 """
1555- return self ._custom_list ("/projects/owned" , Project , ** kwargs )
1552+ return self .gitlab . _raw_list ("/projects/owned" , Project , ** kwargs )
15561553
15571554
15581555class UserProjectManager (BaseManager ):
0 commit comments