gitlab4j-api icon indicating copy to clipboard operation
gitlab4j-api copied to clipboard

JobApi doesn't allow to specify several JobScope

Open cmoine opened this issue 1 year ago • 1 comments
trafficstars

We cannot provide several JobScope for this method whereas Gitlab API allows it: see org.gitlab4j.api.JobApi#getJobs(java.lang.Object, org.gitlab4j.api.Constants.JobScope)

Workaround is for instance:

GitLabApiForm formData = new GitLabApiForm().withParam("scope", Arrays.asList(Constants.JobScope.SUCCESS, Constants.JobScope.RUNNING, Constants.JobScope.PENDING));
JobApi jobApi = gitLabApi.getJobApi();
Pager<Job> jobPager = new Pager<>(jobApi, Job.class, gitLabApi.getDefaultPerPage(), formData.asMap(),
            "projects", jobApi.getProjectIdOrPath(PROJECT_ID), "jobs");

Note: I can provide a PR if you want ;-)

cmoine avatar Feb 19 '24 12:02 cmoine

If I read the doc correctly it says:

string or array of strings

https://docs.gitlab.com/ee/api/jobs.html

So yes if you create a PR, I will be happy to integrate it

jmini avatar Feb 22 '24 16:02 jmini