Skip to content

Commit b79af1d

Browse files
author
Gauvain Pocentek
committed
Improve the doc for UserManager
Describe parameters, return values and exceptions for search() and get_by_username().
1 parent 073d8d5 commit b79af1d

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

gitlab/objects.py

+20-3
Original file line numberDiff line numberDiff line change
@@ -568,16 +568,33 @@ class UserManager(BaseManager):
568568
def search(self, query, **kwargs):
569569
"""Search users.
570570
571-
Returns a list of matching users.
571+
Args:
572+
query (str): The query string to send to GitLab for the search.
573+
**kwargs: Additional arguments to send to GitLab.
574+
575+
Returns:
576+
list(User): A list of matching users.
577+
578+
Raises:
579+
GitlabConnectionError: If the server cannot be reached.
580+
GitlabListError: If the server fails to perform the request.
572581
"""
573582
url = self.obj_cls._url + '?search=' + query
574583
return self._custom_list(url, self.obj_cls, **kwargs)
575584

576585
def get_by_username(self, username, **kwargs):
577586
"""Get a user by its username.
578587
579-
Returns a User object or None if the named user does not
580-
exist.
588+
Args:
589+
username (str): The name of the user.
590+
**kwargs: Additional arguments to send to GitLab.
591+
592+
Returns:
593+
User: The matching user.
594+
595+
Raises:
596+
GitlabConnectionError: If the server cannot be reached.
597+
GitlabGetError: If the server fails to perform the request.
581598
"""
582599
url = self.obj_cls._url + '?username=' + username
583600
results = self._custom_list(url, self.obj_cls, **kwargs)

0 commit comments

Comments
 (0)