diff --git a/gitlab/v4/objects/deploy_tokens.py b/gitlab/v4/objects/deploy_tokens.py index 59cccd40d..c7476641e 100644 --- a/gitlab/v4/objects/deploy_tokens.py +++ b/gitlab/v4/objects/deploy_tokens.py @@ -1,3 +1,4 @@ +from gitlab import types from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import CreateMixin, DeleteMixin, ListMixin, ObjectDeleteMixin @@ -39,6 +40,7 @@ class GroupDeployTokenManager(ListMixin, CreateMixin, DeleteMixin, RESTManager): "username", ), ) + _types = {"scopes": types.ListAttribute} class ProjectDeployToken(ObjectDeleteMixin, RESTObject): @@ -59,3 +61,4 @@ class ProjectDeployTokenManager(ListMixin, CreateMixin, DeleteMixin, RESTManager "username", ), ) + _types = {"scopes": types.ListAttribute} diff --git a/gitlab/v4/objects/groups.py b/gitlab/v4/objects/groups.py index 4a84e9991..9e2760156 100644 --- a/gitlab/v4/objects/groups.py +++ b/gitlab/v4/objects/groups.py @@ -252,7 +252,7 @@ class GroupManager(CRUDMixin, RESTManager): "shared_runners_setting", ), ) - _types = {"avatar": types.ImageAttribute} + _types = {"avatar": types.ImageAttribute, "skip_groups": types.ListAttribute} @exc.on_http_error(exc.GitlabImportError) def import_group(self, file, path, name, parent_id=None, **kwargs): @@ -302,3 +302,4 @@ class GroupSubgroupManager(ListMixin, RESTManager): "with_custom_attributes", "min_access_level", ) + _types = {"skip_groups": types.ListAttribute} diff --git a/gitlab/v4/objects/issues.py b/gitlab/v4/objects/issues.py index c3c35d325..bf0e76604 100644 --- a/gitlab/v4/objects/issues.py +++ b/gitlab/v4/objects/issues.py @@ -62,7 +62,7 @@ class IssueManager(RetrieveMixin, RESTManager): "updated_after", "updated_before", ) - _types = {"labels": types.ListAttribute} + _types = {"iids": types.ListAttribute, "labels": types.ListAttribute} class GroupIssue(RESTObject): @@ -89,7 +89,7 @@ class GroupIssueManager(ListMixin, RESTManager): "updated_after", "updated_before", ) - _types = {"labels": types.ListAttribute} + _types = {"iids": types.ListAttribute, "labels": types.ListAttribute} class ProjectIssue( diff --git a/gitlab/v4/objects/members.py b/gitlab/v4/objects/members.py index 2bb9d5485..2686587f0 100644 --- a/gitlab/v4/objects/members.py +++ b/gitlab/v4/objects/members.py @@ -1,4 +1,4 @@ -from gitlab import cli +from gitlab import cli, types from gitlab import exceptions as exc from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin @@ -26,6 +26,7 @@ class GroupMemberManager(CRUDMixin, RESTManager): _update_attrs = RequiredOptional( required=("access_level",), optional=("expires_at",) ) + _types = {"user_ids": types.ListAttribute} @cli.register_custom_action("GroupMemberManager") @exc.on_http_error(exc.GitlabListError) @@ -67,6 +68,7 @@ class ProjectMemberManager(CRUDMixin, RESTManager): _update_attrs = RequiredOptional( required=("access_level",), optional=("expires_at",) ) + _types = {"user_ids": types.ListAttribute} @cli.register_custom_action("ProjectMemberManager") @exc.on_http_error(exc.GitlabListError) diff --git a/gitlab/v4/objects/merge_requests.py b/gitlab/v4/objects/merge_requests.py index 6c166b882..711a95f34 100644 --- a/gitlab/v4/objects/merge_requests.py +++ b/gitlab/v4/objects/merge_requests.py @@ -62,13 +62,19 @@ class MergeRequestManager(ListMixin, RESTManager): "scope", "author_id", "assignee_id", + "approver_ids", + "approved_by_ids", "my_reaction_emoji", "source_branch", "target_branch", "search", "wip", ) - _types = {"labels": types.ListAttribute} + _types = { + "approver_ids": types.ListAttribute, + "approved_by_ids": types.ListAttribute, + "labels": types.ListAttribute, + } class GroupMergeRequest(RESTObject): @@ -93,13 +99,19 @@ class GroupMergeRequestManager(ListMixin, RESTManager): "scope", "author_id", "assignee_id", + "approver_ids", + "approved_by_ids", "my_reaction_emoji", "source_branch", "target_branch", "search", "wip", ) - _types = {"labels": types.ListAttribute} + _types = { + "approver_ids": types.ListAttribute, + "approved_by_ids": types.ListAttribute, + "labels": types.ListAttribute, + } class ProjectMergeRequest( @@ -377,15 +389,23 @@ class ProjectMergeRequestManager(CRUDMixin, RESTManager): "updated_after", "updated_before", "scope", + "iids", "author_id", "assignee_id", + "approver_ids", + "approved_by_ids", "my_reaction_emoji", "source_branch", "target_branch", "search", "wip", ) - _types = {"labels": types.ListAttribute} + _types = { + "approver_ids": types.ListAttribute, + "approved_by_ids": types.ListAttribute, + "iids": types.ListAttribute, + "labels": types.ListAttribute, + } class ProjectMergeRequestDiff(RESTObject): diff --git a/gitlab/v4/objects/milestones.py b/gitlab/v4/objects/milestones.py index 463fbf61c..5dded37f8 100644 --- a/gitlab/v4/objects/milestones.py +++ b/gitlab/v4/objects/milestones.py @@ -1,4 +1,4 @@ -from gitlab import cli +from gitlab import cli, types from gitlab import exceptions as exc from gitlab.base import RequiredOptional, RESTManager, RESTObject, RESTObjectList from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin @@ -86,6 +86,7 @@ class GroupMilestoneManager(CRUDMixin, RESTManager): optional=("title", "description", "due_date", "start_date", "state_event"), ) _list_filters = ("iids", "state", "search") + _types = {"iids": types.ListAttribute} class ProjectMilestone(SaveMixin, ObjectDeleteMixin, RESTObject): @@ -159,3 +160,4 @@ class ProjectMilestoneManager(CRUDMixin, RESTManager): optional=("title", "description", "due_date", "start_date", "state_event"), ) _list_filters = ("iids", "state", "search") + _types = {"iids": types.ListAttribute} diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py index 3dba95dbd..4618292ab 100644 --- a/gitlab/v4/objects/projects.py +++ b/gitlab/v4/objects/projects.py @@ -676,7 +676,6 @@ class ProjectManager(CRUDMixin, RESTManager): "service_desk_enabled", ), ) - _types = {"avatar": types.ImageAttribute} _list_filters = ( "archived", "id_after", @@ -695,6 +694,7 @@ class ProjectManager(CRUDMixin, RESTManager): "sort", "starred", "statistics", + "topic", "visibility", "wiki_checksum_failed", "with_custom_attributes", @@ -702,6 +702,7 @@ class ProjectManager(CRUDMixin, RESTManager): "with_merge_requests_enabled", "with_programming_language", ) + _types = {"avatar": types.ImageAttribute, "topic": types.ListAttribute} def import_project( self, diff --git a/gitlab/v4/objects/runners.py b/gitlab/v4/objects/runners.py index e6ac51160..15875abd5 100644 --- a/gitlab/v4/objects/runners.py +++ b/gitlab/v4/objects/runners.py @@ -1,4 +1,4 @@ -from gitlab import cli +from gitlab import cli, types from gitlab import exceptions as exc from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import ( @@ -40,7 +40,6 @@ class Runner(SaveMixin, ObjectDeleteMixin, RESTObject): class RunnerManager(CRUDMixin, RESTManager): _path = "/runners" _obj_cls = Runner - _list_filters = ("scope",) _create_attrs = RequiredOptional( required=("token",), optional=( @@ -65,6 +64,8 @@ class RunnerManager(CRUDMixin, RESTManager): "maximum_timeout", ), ) + _list_filters = ("scope", "tag_list") + _types = {"tag_list": types.ListAttribute} @cli.register_custom_action("RunnerManager", tuple(), ("scope",)) @exc.on_http_error(exc.GitlabListError) @@ -122,6 +123,8 @@ class GroupRunnerManager(NoUpdateMixin, RESTManager): _obj_cls = GroupRunner _from_parent_attrs = {"group_id": "id"} _create_attrs = RequiredOptional(required=("runner_id",)) + _list_filters = ("scope", "tag_list") + _types = {"tag_list": types.ListAttribute} class ProjectRunner(ObjectDeleteMixin, RESTObject): @@ -133,3 +136,5 @@ class ProjectRunnerManager(NoUpdateMixin, RESTManager): _obj_cls = ProjectRunner _from_parent_attrs = {"project_id": "id"} _create_attrs = RequiredOptional(required=("runner_id",)) + _list_filters = ("scope", "tag_list") + _types = {"tag_list": types.ListAttribute} diff --git a/gitlab/v4/objects/settings.py b/gitlab/v4/objects/settings.py index a3d6ed9b4..6b7537bcd 100644 --- a/gitlab/v4/objects/settings.py +++ b/gitlab/v4/objects/settings.py @@ -1,3 +1,4 @@ +from gitlab import types from gitlab import exceptions as exc from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin @@ -35,13 +36,18 @@ class ApplicationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager): "default_snippet_visibility", "default_group_visibility", "outbound_local_requests_whitelist", + "disabled_oauth_sign_in_sources", "domain_whitelist", "domain_blacklist_enabled", "domain_blacklist", + "domain_allowlist", + "domain_denylist_enabled", + "domain_denylist", "external_authorization_service_enabled", "external_authorization_service_url", "external_authorization_service_default_label", "external_authorization_service_timeout", + "import_sources", "user_oauth_applications", "after_sign_out_path", "container_registry_token_expire_delay", @@ -65,12 +71,21 @@ class ApplicationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager): "asset_proxy_enabled", "asset_proxy_url", "asset_proxy_whitelist", + "asset_proxy_allowlist", "geo_node_allowed_ips", "allow_local_requests_from_hooks_and_services", "allow_local_requests_from_web_hooks_and_services", "allow_local_requests_from_system_hooks", ), ) + _types = { + "asset_proxy_allowlist": types.ListAttribute, + "disabled_oauth_sign_in_sources": types.ListAttribute, + "domain_allowlist": types.ListAttribute, + "domain_denylist": types.ListAttribute, + "import_sources": types.ListAttribute, + "restricted_visibility_levels": types.ListAttribute, + } @exc.on_http_error(exc.GitlabUpdateError) def update(self, id=None, new_data=None, **kwargs): diff --git a/gitlab/v4/objects/users.py b/gitlab/v4/objects/users.py index c90a7c910..8a8db710e 100644 --- a/gitlab/v4/objects/users.py +++ b/gitlab/v4/objects/users.py @@ -328,7 +328,8 @@ class ProjectUserManager(ListMixin, RESTManager): _path = "/projects/%(project_id)s/users" _obj_cls = ProjectUser _from_parent_attrs = {"project_id": "id"} - _list_filters = ("search",) + _list_filters = ("search", "skip_users") + _types = {"skip_users": types.ListAttribute} class UserEmail(ObjectDeleteMixin, RESTObject): diff --git a/tools/functional/api/test_groups.py b/tools/functional/api/test_groups.py index 5a7065051..c44c175f9 100644 --- a/tools/functional/api/test_groups.py +++ b/tools/functional/api/test_groups.py @@ -33,6 +33,10 @@ def test_groups(gl): assert group3.parent_id == p_id assert group2.subgroups.list()[0].id == group3.id + filtered_groups = gl.groups.list(skip_groups=[group3.id, group4.id]) + assert group3 not in filtered_groups + assert group3 not in filtered_groups + group1.members.create( {"access_level": gitlab.const.OWNER_ACCESS, "user_id": user.id} )