summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/users.py
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2021-12-01 16:04:16 -0800
committerJohn L. Villalovos <john@sodarock.com>2021-12-08 07:36:35 -0800
commitd27c50ab9d55dd715a7bee5b0c61317f8565c8bf (patch)
tree48173d761de29daf78fb9573ff693a74edf601f1 /gitlab/v4/objects/users.py
parent494535337b71592effeca57bb1ff2e735ebeb58a (diff)
downloadgitlab-d27c50ab9d55dd715a7bee5b0c61317f8565c8bf.tar.gz
chore: add get() methods for GetWithoutIdMixin based classesjlvillal/get_without_id
Add the get() methods for the GetWithoutIdMixin based classes. Update the tests/meta/test_ensure_type_hints.py tests to check to ensure that the get methods are defined with the correct return type.
Diffstat (limited to 'gitlab/v4/objects/users.py')
-rw-r--r--gitlab/v4/objects/users.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/gitlab/v4/objects/users.py b/gitlab/v4/objects/users.py
index fac448a..568e019 100644
--- a/gitlab/v4/objects/users.py
+++ b/gitlab/v4/objects/users.py
@@ -3,7 +3,7 @@ GitLab API:
https://docs.gitlab.com/ee/api/users.html
https://docs.gitlab.com/ee/api/projects.html#list-projects-starred-by-a-user
"""
-from typing import Any, cast, Dict, List, Union
+from typing import Any, cast, Dict, List, Optional, Union
import requests
@@ -120,6 +120,11 @@ class CurrentUserStatusManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
_obj_cls = CurrentUserStatus
_update_attrs = RequiredOptional(optional=("emoji", "message"))
+ def get(
+ self, id: Optional[Union[int, str]] = None, **kwargs: Any
+ ) -> Optional[CurrentUserStatus]:
+ return cast(Optional[CurrentUserStatus], super().get(id=id, **kwargs))
+
class CurrentUser(RESTObject):
_id_attr = None
@@ -135,6 +140,11 @@ class CurrentUserManager(GetWithoutIdMixin, RESTManager):
_path = "/user"
_obj_cls = CurrentUser
+ def get(
+ self, id: Optional[Union[int, str]] = None, **kwargs: Any
+ ) -> Optional[CurrentUser]:
+ return cast(Optional[CurrentUser], super().get(id=id, **kwargs))
+
class User(SaveMixin, ObjectDeleteMixin, RESTObject):
_short_print_attr = "username"
@@ -390,6 +400,11 @@ class UserStatusManager(GetWithoutIdMixin, RESTManager):
_obj_cls = UserStatus
_from_parent_attrs = {"user_id": "id"}
+ def get(
+ self, id: Optional[Union[int, str]] = None, **kwargs: Any
+ ) -> Optional[UserStatus]:
+ return cast(Optional[UserStatus], super().get(id=id, **kwargs))
+
class UserActivitiesManager(ListMixin, RESTManager):
_path = "/user/activities"