python-gitlab / python-gitlab

A python wrapper for the GitLab API.

Home Page:https://python-gitlab.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing parameters in iteration search

cristianocasella opened this issue · comments

Description of the problem, including code/CLI snippet

In https://github.com/python-gitlab/python-gitlab/blob/main/gitlab/v4/objects/iterations.py the iteration implementation let you to filter the list with a search parameter.

According to the API doc (https://docs.gitlab.com/ee/api/iterations.html) by default this parameter filter the title of the iteration.

If the iteration is created by a cadence, title and description will be empty, so you will not be able to search for a specific iteration.

Expected Behavior

I would like to pass the additional parameter, documented in the API, "in" to select where the search will be performed, and search in "cadence_title" for cadence derivated iterations.

Actual Behavior

The search is only performed on the iteration title, that is empty when built from a cadence.

Specifications

  • python-gitlab version: 4.4.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 16.8.1 EE

Update

After a first iteration we decided to extend the scope to all the new parameters available

Thanks for the report and the PR @cristianocasella!

Note that the list filter attribute is only used for the CLI. You can pass arbitrary arguments to the list methods when using the API already.

The problem with the in keyword is that it collides with python's in keyword so you'll always get a SyntaxError. For this reason, we have to use the query_parameters argument:

group.iterations.list(query_parameters={"in": "title"}) 

See https://python-gitlab.readthedocs.io/en/stable/api-usage.html#managers for more details.

Thanks for the report and the PR @cristianocasella!

Note that the list filter attribute is only used for the CLI. You can pass arbitrary arguments to the list methods when using the API already.

The problem with the in keyword is that it collides with python's in keyword so you'll always get a SyntaxError. For this reason, we have to use the query_parameters argument:

group.iterations.list(query_parameters={"in": "title"}) 

See https://python-gitlab.readthedocs.io/en/stable/api-usage.html#managers for more details.

Really thanks for your support and hint.

I decided to extend the PR to all the parameters currently available, to save other people time I also added your help above into the project documentation.

Let me know if it works for you