From 6f93c0520f738950a7c67dbeca8d1ac8257e2661 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Fri, 1 Apr 2022 22:01:04 +0200 Subject: feat(user): support getting user SSH key by id --- gitlab/v4/objects/users.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gitlab/v4') diff --git a/gitlab/v4/objects/users.py b/gitlab/v4/objects/users.py index b2de337..ddcee70 100644 --- a/gitlab/v4/objects/users.py +++ b/gitlab/v4/objects/users.py @@ -429,12 +429,15 @@ class UserKey(ObjectDeleteMixin, RESTObject): pass -class UserKeyManager(ListMixin, CreateMixin, DeleteMixin, RESTManager): +class UserKeyManager(RetrieveMixin, CreateMixin, DeleteMixin, RESTManager): _path = "/users/{user_id}/keys" _obj_cls = UserKey _from_parent_attrs = {"user_id": "id"} _create_attrs = RequiredOptional(required=("title", "key")) + def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> UserKey: + return cast(UserKey, super().get(id=id, lazy=lazy, **kwargs)) + class UserIdentityProviderManager(DeleteMixin, RESTManager): """Manager for user identities. -- cgit v1.2.1