Skip to content

Commit 603a351

Browse files
committed
fix(objects): allow lists for filters for in all objects
1 parent a6b6cd4 commit 603a351

File tree

10 files changed

+62
-12
lines changed

10 files changed

+62
-12
lines changed

gitlab/v4/objects/deploy_tokens.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from gitlab import types
12
from gitlab.base import RequiredOptional, RESTManager, RESTObject
23
from gitlab.mixins import CreateMixin, DeleteMixin, ListMixin, ObjectDeleteMixin
34

@@ -39,6 +40,7 @@ class GroupDeployTokenManager(ListMixin, CreateMixin, DeleteMixin, RESTManager):
3940
"username",
4041
),
4142
)
43+
_types = {"scopes": types.ListAttribute}
4244

4345

4446
class ProjectDeployToken(ObjectDeleteMixin, RESTObject):
@@ -59,3 +61,4 @@ class ProjectDeployTokenManager(ListMixin, CreateMixin, DeleteMixin, RESTManager
5961
"username",
6062
),
6163
)
64+
_types = {"scopes": types.ListAttribute}

gitlab/v4/objects/groups.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class GroupManager(CRUDMixin, RESTManager):
244244
"default_branch_protection",
245245
),
246246
)
247-
_types = {"avatar": types.ImageAttribute}
247+
_types = {"avatar": types.ImageAttribute, "skip_groups": types.ListAttribute}
248248

249249
@exc.on_http_error(exc.GitlabImportError)
250250
def import_group(self, file, path, name, parent_id=None, **kwargs):
@@ -293,3 +293,4 @@ class GroupSubgroupManager(ListMixin, RESTManager):
293293
"owned",
294294
"with_custom_attributes",
295295
)
296+
_types = {"skip_groups": types.ListAttribute}

gitlab/v4/objects/issues.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class IssueManager(RetrieveMixin, RESTManager):
6262
"updated_after",
6363
"updated_before",
6464
)
65-
_types = {"labels": types.ListAttribute}
65+
_types = {"iids": types.ListAttribute, "labels": types.ListAttribute}
6666

6767

6868
class GroupIssue(RESTObject):
@@ -89,7 +89,7 @@ class GroupIssueManager(ListMixin, RESTManager):
8989
"updated_after",
9090
"updated_before",
9191
)
92-
_types = {"labels": types.ListAttribute}
92+
_types = {"iids": types.ListAttribute, "labels": types.ListAttribute}
9393

9494

9595
class ProjectIssue(

gitlab/v4/objects/members.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from gitlab import cli
1+
from gitlab import cli, types
22
from gitlab import exceptions as exc
33
from gitlab.base import RequiredOptional, RESTManager, RESTObject
44
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
@@ -26,6 +26,7 @@ class GroupMemberManager(CRUDMixin, RESTManager):
2626
_update_attrs = RequiredOptional(
2727
required=("access_level",), optional=("expires_at",)
2828
)
29+
_types = {"user_ids": types.ListAttribute}
2930

3031
@cli.register_custom_action("GroupMemberManager")
3132
@exc.on_http_error(exc.GitlabListError)
@@ -67,6 +68,7 @@ class ProjectMemberManager(CRUDMixin, RESTManager):
6768
_update_attrs = RequiredOptional(
6869
required=("access_level",), optional=("expires_at",)
6970
)
71+
_types = {"user_ids": types.ListAttribute}
7072

7173
@cli.register_custom_action("ProjectMemberManager")
7274
@exc.on_http_error(exc.GitlabListError)

gitlab/v4/objects/merge_requests.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,19 @@ class MergeRequestManager(ListMixin, RESTManager):
6262
"scope",
6363
"author_id",
6464
"assignee_id",
65+
"approver_ids",
66+
"approved_by_ids",
6567
"my_reaction_emoji",
6668
"source_branch",
6769
"target_branch",
6870
"search",
6971
"wip",
7072
)
71-
_types = {"labels": types.ListAttribute}
73+
_types = {
74+
"approver_ids": types.ListAttribute,
75+
"approved_by_ids": types.ListAttribute,
76+
"labels": types.ListAttribute,
77+
}
7278

7379

7480
class GroupMergeRequest(RESTObject):
@@ -93,13 +99,19 @@ class GroupMergeRequestManager(ListMixin, RESTManager):
9399
"scope",
94100
"author_id",
95101
"assignee_id",
102+
"approver_ids",
103+
"approved_by_ids",
96104
"my_reaction_emoji",
97105
"source_branch",
98106
"target_branch",
99107
"search",
100108
"wip",
101109
)
102-
_types = {"labels": types.ListAttribute}
110+
_types = {
111+
"approver_ids": types.ListAttribute,
112+
"approved_by_ids": types.ListAttribute,
113+
"labels": types.ListAttribute,
114+
}
103115

104116

105117
class ProjectMergeRequest(
@@ -377,15 +389,23 @@ class ProjectMergeRequestManager(CRUDMixin, RESTManager):
377389
"updated_after",
378390
"updated_before",
379391
"scope",
392+
"iids",
380393
"author_id",
381394
"assignee_id",
395+
"approver_ids",
396+
"approved_by_ids",
382397
"my_reaction_emoji",
383398
"source_branch",
384399
"target_branch",
385400
"search",
386401
"wip",
387402
)
388-
_types = {"labels": types.ListAttribute}
403+
_types = {
404+
"approver_ids": types.ListAttribute,
405+
"approved_by_ids": types.ListAttribute,
406+
"iids": types.ListAttribute,
407+
"labels": types.ListAttribute,
408+
}
389409

390410

391411
class ProjectMergeRequestDiff(RESTObject):

gitlab/v4/objects/milestones.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from gitlab import cli
1+
from gitlab import cli, types
22
from gitlab import exceptions as exc
33
from gitlab.base import RequiredOptional, RESTManager, RESTObject, RESTObjectList
44
from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin
@@ -86,6 +86,7 @@ class GroupMilestoneManager(CRUDMixin, RESTManager):
8686
optional=("title", "description", "due_date", "start_date", "state_event"),
8787
)
8888
_list_filters = ("iids", "state", "search")
89+
_types = {"iids": types.ListAttribute}
8990

9091

9192
class ProjectMilestone(SaveMixin, ObjectDeleteMixin, RESTObject):
@@ -159,3 +160,4 @@ class ProjectMilestoneManager(CRUDMixin, RESTManager):
159160
optional=("title", "description", "due_date", "start_date", "state_event"),
160161
)
161162
_list_filters = ("iids", "state", "search")
163+
_types = {"iids": types.ListAttribute}

gitlab/v4/objects/projects.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@ class ProjectManager(CRUDMixin, RESTManager):
676676
"service_desk_enabled",
677677
),
678678
)
679-
_types = {"avatar": types.ImageAttribute}
680679
_list_filters = (
681680
"archived",
682681
"id_after",
@@ -695,13 +694,15 @@ class ProjectManager(CRUDMixin, RESTManager):
695694
"sort",
696695
"starred",
697696
"statistics",
697+
"topic",
698698
"visibility",
699699
"wiki_checksum_failed",
700700
"with_custom_attributes",
701701
"with_issues_enabled",
702702
"with_merge_requests_enabled",
703703
"with_programming_language",
704704
)
705+
_types = {"avatar": types.ImageAttribute, "topic": types.ListAttribute}
705706

706707
def import_project(
707708
self,

gitlab/v4/objects/runners.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from gitlab import cli
1+
from gitlab import cli, types
22
from gitlab import exceptions as exc
33
from gitlab.base import RequiredOptional, RESTManager, RESTObject
44
from gitlab.mixins import (
@@ -40,7 +40,6 @@ class Runner(SaveMixin, ObjectDeleteMixin, RESTObject):
4040
class RunnerManager(CRUDMixin, RESTManager):
4141
_path = "/runners"
4242
_obj_cls = Runner
43-
_list_filters = ("scope",)
4443
_create_attrs = RequiredOptional(
4544
required=("token",),
4645
optional=(
@@ -65,6 +64,8 @@ class RunnerManager(CRUDMixin, RESTManager):
6564
"maximum_timeout",
6665
),
6766
)
67+
_list_filters = ("scope", "tag_list")
68+
_types = {"tag_list": types.ListAttribute}
6869

6970
@cli.register_custom_action("RunnerManager", tuple(), ("scope",))
7071
@exc.on_http_error(exc.GitlabListError)
@@ -122,6 +123,8 @@ class GroupRunnerManager(NoUpdateMixin, RESTManager):
122123
_obj_cls = GroupRunner
123124
_from_parent_attrs = {"group_id": "id"}
124125
_create_attrs = RequiredOptional(required=("runner_id",))
126+
_list_filters = ("scope", "tag_list")
127+
_types = {"tag_list": types.ListAttribute}
125128

126129

127130
class ProjectRunner(ObjectDeleteMixin, RESTObject):
@@ -133,3 +136,5 @@ class ProjectRunnerManager(NoUpdateMixin, RESTManager):
133136
_obj_cls = ProjectRunner
134137
_from_parent_attrs = {"project_id": "id"}
135138
_create_attrs = RequiredOptional(required=("runner_id",))
139+
_list_filters = ("scope", "tag_list")
140+
_types = {"tag_list": types.ListAttribute}

gitlab/v4/objects/settings.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from gitlab import types
12
from gitlab import exceptions as exc
23
from gitlab.base import RequiredOptional, RESTManager, RESTObject
34
from gitlab.mixins import GetWithoutIdMixin, SaveMixin, UpdateMixin
@@ -35,13 +36,18 @@ class ApplicationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
3536
"default_snippet_visibility",
3637
"default_group_visibility",
3738
"outbound_local_requests_whitelist",
39+
"disabled_oauth_sign_in_sources",
3840
"domain_whitelist",
3941
"domain_blacklist_enabled",
4042
"domain_blacklist",
43+
"domain_allowlist",
44+
"domain_denylist_enabled",
45+
"domain_denylist",
4146
"external_authorization_service_enabled",
4247
"external_authorization_service_url",
4348
"external_authorization_service_default_label",
4449
"external_authorization_service_timeout",
50+
"import_sources",
4551
"user_oauth_applications",
4652
"after_sign_out_path",
4753
"container_registry_token_expire_delay",
@@ -65,12 +71,21 @@ class ApplicationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
6571
"asset_proxy_enabled",
6672
"asset_proxy_url",
6773
"asset_proxy_whitelist",
74+
"asset_proxy_allowlist",
6875
"geo_node_allowed_ips",
6976
"allow_local_requests_from_hooks_and_services",
7077
"allow_local_requests_from_web_hooks_and_services",
7178
"allow_local_requests_from_system_hooks",
7279
),
7380
)
81+
_types = {
82+
"asset_proxy_allowlist": types.ListAttribute,
83+
"disabled_oauth_sign_in_sources": types.ListAttribute,
84+
"domain_allowlist": types.ListAttribute,
85+
"domain_denylist": types.ListAttribute,
86+
"import_sources": types.ListAttribute,
87+
"restricted_visibility_levels": types.ListAttribute,
88+
}
7489

7590
@exc.on_http_error(exc.GitlabUpdateError)
7691
def update(self, id=None, new_data=None, **kwargs):

gitlab/v4/objects/users.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ class ProjectUserManager(ListMixin, RESTManager):
328328
_path = "/projects/%(project_id)s/users"
329329
_obj_cls = ProjectUser
330330
_from_parent_attrs = {"project_id": "id"}
331-
_list_filters = ("search",)
331+
_list_filters = ("search", "skip_users")
332+
_types = {"skip_users": types.ListAttribute}
332333

333334

334335
class UserEmail(ObjectDeleteMixin, RESTObject):

0 commit comments

Comments
 (0)