summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2022-01-30 10:44:08 -0800
committerJohn L. Villalovos <john@sodarock.com>2022-01-30 10:44:08 -0800
commita57334f1930752c70ea15847a39324fa94042460 (patch)
tree8a5032d8ead259ff3d78615bc51140a488f882b6 /gitlab/v4/objects
parent7a13b9bfa4aead6c731f9a92e0946dba7577c61b (diff)
downloadgitlab-a57334f1930752c70ea15847a39324fa94042460.tar.gz
chore: create new ArrayAttribute class
Create a new ArrayAttribute class. This is to indicate types which are sent to the GitLab server as arrays https://docs.gitlab.com/ee/api/#array At this stage it is identical to the CommaSeparatedListAttribute class but will be used later to support the array types sent to GitLab. This is the second step in a series of steps of our goal to add full support for the GitLab API data types[1]: * array * hash * array of hashes Step one was: commit 5127b1594c00c7364e9af15e42d2e2f2d909449b [1] https://docs.gitlab.com/ee/api/#encoding-api-parameters-of-array-and-hash-types Related: #1698
Diffstat (limited to 'gitlab/v4/objects')
-rw-r--r--gitlab/v4/objects/groups.py7
-rw-r--r--gitlab/v4/objects/issues.py15
-rw-r--r--gitlab/v4/objects/members.py4
-rw-r--r--gitlab/v4/objects/merge_requests.py14
-rw-r--r--gitlab/v4/objects/milestones.py4
-rw-r--r--gitlab/v4/objects/projects.py2
-rw-r--r--gitlab/v4/objects/settings.py12
-rw-r--r--gitlab/v4/objects/users.py2
8 files changed, 24 insertions, 36 deletions
diff --git a/gitlab/v4/objects/groups.py b/gitlab/v4/objects/groups.py
index 5e2ac00..a3a1051 100644
--- a/gitlab/v4/objects/groups.py
+++ b/gitlab/v4/objects/groups.py
@@ -314,10 +314,7 @@ class GroupManager(CRUDMixin, RESTManager):
"shared_runners_setting",
),
)
- _types = {
- "avatar": types.ImageAttribute,
- "skip_groups": types.CommaSeparatedListAttribute,
- }
+ _types = {"avatar": types.ImageAttribute, "skip_groups": types.ArrayAttribute}
def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Group:
return cast(Group, super().get(id=id, lazy=lazy, **kwargs))
@@ -377,7 +374,7 @@ class GroupSubgroupManager(ListMixin, RESTManager):
"with_custom_attributes",
"min_access_level",
)
- _types = {"skip_groups": types.CommaSeparatedListAttribute}
+ _types = {"skip_groups": types.ArrayAttribute}
class GroupDescendantGroup(RESTObject):
diff --git a/gitlab/v4/objects/issues.py b/gitlab/v4/objects/issues.py
index 3452daf..f20252b 100644
--- a/gitlab/v4/objects/issues.py
+++ b/gitlab/v4/objects/issues.py
@@ -65,10 +65,7 @@ class IssueManager(RetrieveMixin, RESTManager):
"updated_after",
"updated_before",
)
- _types = {
- "iids": types.CommaSeparatedListAttribute,
- "labels": types.CommaSeparatedListAttribute,
- }
+ _types = {"iids": types.ArrayAttribute, "labels": types.CommaSeparatedListAttribute}
def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Issue:
return cast(Issue, super().get(id=id, lazy=lazy, **kwargs))
@@ -98,10 +95,7 @@ class GroupIssueManager(ListMixin, RESTManager):
"updated_after",
"updated_before",
)
- _types = {
- "iids": types.CommaSeparatedListAttribute,
- "labels": types.CommaSeparatedListAttribute,
- }
+ _types = {"iids": types.ArrayAttribute, "labels": types.CommaSeparatedListAttribute}
class ProjectIssue(
@@ -239,10 +233,7 @@ class ProjectIssueManager(CRUDMixin, RESTManager):
"discussion_locked",
),
)
- _types = {
- "iids": types.CommaSeparatedListAttribute,
- "labels": types.CommaSeparatedListAttribute,
- }
+ _types = {"iids": types.ArrayAttribute, "labels": types.CommaSeparatedListAttribute}
def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
diff --git a/gitlab/v4/objects/members.py b/gitlab/v4/objects/members.py
index 16fb925..5ee0b0e 100644
--- a/gitlab/v4/objects/members.py
+++ b/gitlab/v4/objects/members.py
@@ -41,7 +41,7 @@ class GroupMemberManager(CRUDMixin, RESTManager):
_update_attrs = RequiredOptional(
required=("access_level",), optional=("expires_at",)
)
- _types = {"user_ids": types.CommaSeparatedListAttribute}
+ _types = {"user_ids": types.ArrayAttribute}
def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
@@ -101,7 +101,7 @@ class ProjectMemberManager(CRUDMixin, RESTManager):
_update_attrs = RequiredOptional(
required=("access_level",), optional=("expires_at",)
)
- _types = {"user_ids": types.CommaSeparatedListAttribute}
+ _types = {"user_ids": types.ArrayAttribute}
def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
diff --git a/gitlab/v4/objects/merge_requests.py b/gitlab/v4/objects/merge_requests.py
index 7f0be4b..edd7d01 100644
--- a/gitlab/v4/objects/merge_requests.py
+++ b/gitlab/v4/objects/merge_requests.py
@@ -95,8 +95,8 @@ class MergeRequestManager(ListMixin, RESTManager):
"deployed_after",
)
_types = {
- "approver_ids": types.CommaSeparatedListAttribute,
- "approved_by_ids": types.CommaSeparatedListAttribute,
+ "approver_ids": types.ArrayAttribute,
+ "approved_by_ids": types.ArrayAttribute,
"in": types.CommaSeparatedListAttribute,
"labels": types.CommaSeparatedListAttribute,
}
@@ -133,8 +133,8 @@ class GroupMergeRequestManager(ListMixin, RESTManager):
"wip",
)
_types = {
- "approver_ids": types.CommaSeparatedListAttribute,
- "approved_by_ids": types.CommaSeparatedListAttribute,
+ "approver_ids": types.ArrayAttribute,
+ "approved_by_ids": types.ArrayAttribute,
"labels": types.CommaSeparatedListAttribute,
}
@@ -455,9 +455,9 @@ class ProjectMergeRequestManager(CRUDMixin, RESTManager):
"wip",
)
_types = {
- "approver_ids": types.CommaSeparatedListAttribute,
- "approved_by_ids": types.CommaSeparatedListAttribute,
- "iids": types.CommaSeparatedListAttribute,
+ "approver_ids": types.ArrayAttribute,
+ "approved_by_ids": types.ArrayAttribute,
+ "iids": types.ArrayAttribute,
"labels": types.CommaSeparatedListAttribute,
}
diff --git a/gitlab/v4/objects/milestones.py b/gitlab/v4/objects/milestones.py
index dc6266a..da75826 100644
--- a/gitlab/v4/objects/milestones.py
+++ b/gitlab/v4/objects/milestones.py
@@ -93,7 +93,7 @@ class GroupMilestoneManager(CRUDMixin, RESTManager):
optional=("title", "description", "due_date", "start_date", "state_event"),
)
_list_filters = ("iids", "state", "search")
- _types = {"iids": types.CommaSeparatedListAttribute}
+ _types = {"iids": types.ArrayAttribute}
def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
@@ -177,7 +177,7 @@ class ProjectMilestoneManager(CRUDMixin, RESTManager):
optional=("title", "description", "due_date", "start_date", "state_event"),
)
_list_filters = ("iids", "state", "search")
- _types = {"iids": types.CommaSeparatedListAttribute}
+ _types = {"iids": types.ArrayAttribute}
def get(
self, id: Union[str, int], lazy: bool = False, **kwargs: Any
diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py
index 354e56e..23f3d3c 100644
--- a/gitlab/v4/objects/projects.py
+++ b/gitlab/v4/objects/projects.py
@@ -125,7 +125,7 @@ class ProjectGroupManager(ListMixin, RESTManager):
"shared_min_access_level",
"shared_visible_only",
)
- _types = {"skip_groups": types.CommaSeparatedListAttribute}
+ _types = {"skip_groups": types.ArrayAttribute}
class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTObject):
diff --git a/gitlab/v4/objects/settings.py b/gitlab/v4/objects/settings.py
index 3075d9c..9be545c 100644
--- a/gitlab/v4/objects/settings.py
+++ b/gitlab/v4/objects/settings.py
@@ -80,12 +80,12 @@ class ApplicationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
),
)
_types = {
- "asset_proxy_allowlist": types.CommaSeparatedListAttribute,
- "disabled_oauth_sign_in_sources": types.CommaSeparatedListAttribute,
- "domain_allowlist": types.CommaSeparatedListAttribute,
- "domain_denylist": types.CommaSeparatedListAttribute,
- "import_sources": types.CommaSeparatedListAttribute,
- "restricted_visibility_levels": types.CommaSeparatedListAttribute,
+ "asset_proxy_allowlist": types.ArrayAttribute,
+ "disabled_oauth_sign_in_sources": types.ArrayAttribute,
+ "domain_allowlist": types.ArrayAttribute,
+ "domain_denylist": types.ArrayAttribute,
+ "import_sources": types.ArrayAttribute,
+ "restricted_visibility_levels": types.ArrayAttribute,
}
@exc.on_http_error(exc.GitlabUpdateError)
diff --git a/gitlab/v4/objects/users.py b/gitlab/v4/objects/users.py
index e3553b0..b2de337 100644
--- a/gitlab/v4/objects/users.py
+++ b/gitlab/v4/objects/users.py
@@ -369,7 +369,7 @@ class ProjectUserManager(ListMixin, RESTManager):
_obj_cls = ProjectUser
_from_parent_attrs = {"project_id": "id"}
_list_filters = ("search", "skip_users")
- _types = {"skip_users": types.CommaSeparatedListAttribute}
+ _types = {"skip_users": types.ArrayAttribute}
class UserEmail(ObjectDeleteMixin, RESTObject):