summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/notification_settings.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/notification_settings.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/notification_settings.py')
-rw-r--r--gitlab/v4/objects/notification_settings.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/gitlab/v4/objects/notification_settings.py b/gitlab/v4/objects/notification_settings.py
index f1f7cce..b5a3797 100644
--- a/gitlab/v4/objects/notification_settings.py
+++ b/gitlab/v4/objects/notification_settings.py
@@ -1,3 +1,5 @@
+from typing import Any, cast, Optional, Union
+
from gitlab.base import RequiredOptional, RESTManager, RESTObject
from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin
@@ -36,6 +38,11 @@ class NotificationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
),
)
+ def get(
+ self, id: Optional[Union[int, str]] = None, **kwargs: Any
+ ) -> Optional[NotificationSettings]:
+ return cast(Optional[NotificationSettings], super().get(id=id, **kwargs))
+
class GroupNotificationSettings(NotificationSettings):
pass
@@ -46,6 +53,11 @@ class GroupNotificationSettingsManager(NotificationSettingsManager):
_obj_cls = GroupNotificationSettings
_from_parent_attrs = {"group_id": "id"}
+ def get(
+ self, id: Optional[Union[int, str]] = None, **kwargs: Any
+ ) -> Optional[GroupNotificationSettings]:
+ return cast(Optional[GroupNotificationSettings], super().get(id=id, **kwargs))
+
class ProjectNotificationSettings(NotificationSettings):
pass
@@ -55,3 +67,8 @@ class ProjectNotificationSettingsManager(NotificationSettingsManager):
_path = "/projects/{project_id}/notification_settings"
_obj_cls = ProjectNotificationSettings
_from_parent_attrs = {"project_id": "id"}
+
+ def get(
+ self, id: Optional[Union[int, str]] = None, **kwargs: Any
+ ) -> Optional[ProjectNotificationSettings]:
+ return cast(Optional[ProjectNotificationSettings], super().get(id=id, **kwargs))