8000 feat(api): add additional parameter to project/group iteration searc… · python-gitlab/python-gitlab@623dac9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 623dac9

Browse files
cristianocasellaCristiano Casellanejch
authored
feat(api): add additional parameter to project/group iteration search (#2796)
Co-authored-by: Cristiano Casella <cristiano.casella@seacom.it> Co-authored-by: Nejc Habjan <hab.nejc@gmail.com>
1 parent d569128 commit 623dac9

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

docs/gl_objects/iterations.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,13 @@ List iterations for a project's ancestor groups::
3131
List iterations for a group::
3232

3333
iterations = group.iterations.list()
34+
35+
Unavailable filters or keyword conflicts::
36+
37+
In case you are trying to pass a parameter that collides with a python
38+
keyword (i.e. `in`) or with python-gitlab's internal arguments, you'll have
39+
to use the `query_parameters` argument:
40+
41+
```
42+
group.iterations.list(query_parameters={"in": "title"})
43+
```

gitlab/v4/objects/iterations.py

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

@@ -16,11 +17,37 @@ class GroupIterationManager(ListMixin, RESTManager):
1617
_path = "/groups/{group_id}/iterations"
1718
_obj_cls = GroupIteration
1819
_from_parent_attrs = {"group_id": "id"}
19-
_list_filters = ("state", "search", "include_ancestors")
20+
# When using the API, the "in" keyword collides with python's "in" keyword
21+
# raising a SyntaxError.
22+
# For this reason, we have to use the query_parameters argument:
23+
# group.iterations.list(query_parameters={"in": "title"})
24+
_list_filters = (
25+
"include_ancestors",
26+
"include_descendants",
8000 27+
"in",
28+
"search",
29+
"state",
30+
"updated_after",
31+
"updated_before",
32+
)
33+
_types = {"in": types.ArrayAttribute}
2034

2135

2236
class ProjectIterationManager(ListMixin, RESTManager):
2337
_path = "/projects/{project_id}/iterations"
2438
_obj_cls = GroupIteration
2539
_from_parent_attrs = {"project_id": "id"}
26-
_list_filters = ("state", "search", "include_ancestors")
40+
# When using the API, the "in" keyword collides with python's "in" keyword
41+
# raising a SyntaxError.
42+
# For this reason, we have to use the query_parameters argument:
43+
# project.iterations.list(query_parameters={"in": "title"})
44+
_list_filters = (
45+
"include_ancestors",
46+
"include_descendants",
47+
"in",
48+
"search",
49+
"state",
50+
"updated_after",
51+
"updated_before",
52+
)
53+
_types = {"in": types.ArrayAttribute}

0 commit comments

Comments
 (0)
0