diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2021-10-11 23:32:10 +0200 |
---|---|---|
committer | Nejc Habjan <hab.nejc@gmail.com> | 2021-10-14 23:41:12 +0200 |
commit | e1828b15ac96844307dadba1440b22a836d4b12b (patch) | |
tree | aa253d8fbfc08ddff400aa4bf04df0dce6e8ad4d /gitlab/v4/objects/users.py | |
parent | 79785f0bee2ef6cc9872f816a78c13583dfb77ab (diff) | |
download | gitlab-feat/starred-projects.tar.gz |
feat(objects): list starred projects of a userfeat/starred-projects
Diffstat (limited to 'gitlab/v4/objects/users.py')
-rw-r--r-- | gitlab/v4/objects/users.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gitlab/v4/objects/users.py b/gitlab/v4/objects/users.py index e4bbcf1..4f8721a 100644 --- a/gitlab/v4/objects/users.py +++ b/gitlab/v4/objects/users.py @@ -1,3 +1,8 @@ +""" +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 import requests @@ -38,6 +43,8 @@ __all__ = [ "UserManager", "ProjectUser", "ProjectUserManager", + "StarredProject", + "StarredProjectManager", "UserEmail", "UserEmailManager", "UserActivities", @@ -129,6 +136,7 @@ class User(SaveMixin, ObjectDeleteMixin, RESTObject): memberships: "UserMembershipManager" personal_access_tokens: UserPersonalAccessTokenManager projects: "UserProjectManager" + starred_projects: "StarredProjectManager" status: "UserStatusManager" @cli.register_custom_action("User") @@ -502,6 +510,32 @@ class UserProjectManager(ListMixin, CreateMixin, RESTManager): return ListMixin.list(self, path=path, **kwargs) +class StarredProject(RESTObject): + pass + + +class StarredProjectManager(ListMixin, RESTManager): + _path = "/users/%(user_id)s/starred_projects" + _obj_cls = StarredProject + _from_parent_attrs = {"user_id": "id"} + _list_filters = ( + "archived", + "membership", + "min_access_level", + "order_by", + "owned", + "search", + "simple", + "sort", + "starred", + "statistics", + "visibility", + "with_custom_attributes", + "with_issues_enabled", + "with_merge_requests_enabled", + ) + + class UserFollowersManager(ListMixin, RESTManager): _path = "/users/%(user_id)s/followers" _obj_cls = User |