diff --git a/docs/gl_objects/iterations.rst b/docs/gl_objects/iterations.rst index 8db0c2e85..8ff7f4149 100644 --- a/docs/gl_objects/iterations.rst +++ b/docs/gl_objects/iterations.rst @@ -31,3 +31,13 @@ List iterations for a project's ancestor groups:: List iterations for a group:: iterations = group.iterations.list() + +Unavailable filters or keyword conflicts:: + + In case you are trying to pass a parameter that collides with a python + keyword (i.e. `in`) or with python-gitlab's internal arguments, you'll have + to use the `query_parameters` argument: + + ``` + group.iterations.list(query_parameters={"in": "title"}) + ``` diff --git a/gitlab/v4/objects/iterations.py b/gitlab/v4/objects/iterations.py index 30895ff46..eac3f1f4e 100644 --- a/gitlab/v4/objects/iterations.py +++ b/gitlab/v4/objects/iterations.py @@ -1,3 +1,4 @@ +from gitlab import types from gitlab.base import RESTManager, RESTObject from gitlab.mixins import ListMixin @@ -16,11 +17,37 @@ class GroupIterationManager(ListMixin, RESTManager): _path = "/groups/{group_id}/iterations" _obj_cls = GroupIteration _from_parent_attrs = {"group_id": "id"} - _list_filters = ("state", "search", "include_ancestors") + # When using the API, the "in" keyword collides with python's "in" keyword + # raising a SyntaxError. + # For this reason, we have to use the query_parameters argument: + # group.iterations.list(query_parameters={"in": "title"}) + _list_filters = ( + "include_ancestors", + "include_descendants", + "in", + "search", + "state", + "updated_after", + "updated_before", + ) + _types = {"in": types.ArrayAttribute} class ProjectIterationManager(ListMixin, RESTManager): _path = "/projects/{project_id}/iterations" _obj_cls = GroupIteration _from_parent_attrs = {"project_id": "id"} - _list_filters = ("state", "search", "include_ancestors") + # When using the API, the "in" keyword collides with python's "in" keyword + # raising a SyntaxError. + # For this reason, we have to use the query_parameters argument: + # project.iterations.list(query_parameters={"in": "title"}) + _list_filters = ( + "include_ancestors", + "include_descendants", + "in", + "search", + "state", + "updated_after", + "updated_before", + ) + _types = {"in": types.ArrayAttribute}