8000 feat(api): add additional parameter to project/group iteration search by cristianocasella · Pull Request #2796 · python-gitlab/python-gitlab · GitHub
[go: up one dir, main page]

Skip to content

feat(api): add additional parameter to project/group iteration search #2796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/gl_objects/iterations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
```
31 changes: 29 additions & 2 deletions gitlab/v4/objects/iterations.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from gitlab import types
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import ListMixin

Expand All @@ -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}
0