diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2016-02-12 09:16:36 +0100 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2016-02-12 09:16:42 +0100 |
commit | b79af1d8a8515a419267a8f8e8937c9134bcea3a (patch) | |
tree | ca9e3eb333e121541c18b6f87db9f3f7bd512cac /gitlab/objects.py | |
parent | 073d8d5d84efa64ad2a13f8dc405e51840f47585 (diff) | |
download | gitlab-b79af1d8a8515a419267a8f8e8937c9134bcea3a.tar.gz |
Improve the doc for UserManager
Describe parameters, return values and exceptions for search() and
get_by_username().
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r-- | gitlab/objects.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py index 8e94cb2..5dfc80a 100644 --- a/gitlab/objects.py +++ b/gitlab/objects.py @@ -568,7 +568,16 @@ class UserManager(BaseManager): def search(self, query, **kwargs): """Search users. - Returns a list of matching users. + Args: + query (str): The query string to send to GitLab for the search. + **kwargs: Additional arguments to send to GitLab. + + Returns: + list(User): A list of matching users. + + Raises: + GitlabConnectionError: If the server cannot be reached. + GitlabListError: If the server fails to perform the request. """ url = self.obj_cls._url + '?search=' + query return self._custom_list(url, self.obj_cls, **kwargs) @@ -576,8 +585,16 @@ class UserManager(BaseManager): def get_by_username(self, username, **kwargs): """Get a user by its username. - Returns a User object or None if the named user does not - exist. + Args: + username (str): The name of the user. + **kwargs: Additional arguments to send to GitLab. + + Returns: + User: The matching user. + + Raises: + GitlabConnectionError: If the server cannot be reached. + GitlabGetError: If the server fails to perform the request. """ url = self.obj_cls._url + '?username=' + username results = self._custom_list(url, self.obj_cls, **kwargs) |