@@ -713,6 +713,27 @@ def transfer_project(self, to_project_id, **kwargs):
713713 path = '/groups/%d/projects/%d' % (self .id , to_project_id )
714714 self .manager .gitlab .http_post (path , ** kwargs )
715715
716+ @cli .register_custom_action ('Group' , ('scope' , 'search' ))
717+ @exc .on_http_error (exc .GitlabSearchError )
718+ def search (self , scope , search , ** kwargs ):
719+ """Search the group resources matching the provided string.'
720+
721+ Args:
722+ scope (str): Scope of the search
723+ search (str): Search string
724+ **kwargs: Extra options to send to the server (e.g. sudo)
725+
726+ Raises:
727+ GitlabAuthenticationError: If authentication is not correct
728+ GitlabSearchError: If the server failed to perform the request
729+
730+ Returns:
731+ GitlabList: A list of dicts describing the resources found.
732+ """
733+ data = {'scope' : scope , 'search' : search }
734+ path = '/groups/%d/search' % self .get_id ()
735+ return self .manager .gitlab .http_list (path , query_data = data , ** kwargs )
736+
716737
717738class GroupManager (CRUDMixin , RESTManager ):
718739 _path = '/groups'
@@ -2867,6 +2888,27 @@ def upload(self, filename, filedata=None, filepath=None, **kwargs):
28672888 "markdown" : data ['markdown' ]
28682889 }
28692890
2891+ @cli .register_custom_action ('Project' , ('scope' , 'search' ))
2892+ @exc .on_http_error (exc .GitlabSearchError )
2893+ def search (self , scope , search , ** kwargs ):
2894+ """Search the project resources matching the provided string.'
2895+
2896+ Args:
2897+ scope (str): Scope of the search
2898+ search (str): Search string
2899+ **kwargs: Extra options to send to the server (e.g. sudo)
2900+
2901+ Raises:
2902+ GitlabAuthenticationError: If authentication is not correct
2903+ GitlabSearchError: If the server failed to perform the request
2904+
2905+ Returns:
2906+ GitlabList: A list of dicts describing the resources found.
2907+ """
2908+ data = {'scope' : scope , 'search' : search }
2909+ path = '/projects/%d/search' % self .get_id ()
2910+ return self .manager .gitlab .http_list (path , query_data = data , ** kwargs )
2911+
28702912
28712913class ProjectManager (CRUDMixin , RESTManager ):
28722914 _path = '/projects'
0 commit comments