Skip to content
Merged
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
29 changes: 29 additions & 0 deletions src/main/java/org/gitlab4j/api/JobApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,35 @@ public List<Job> getJobsForPipeline(Object projectIdOrPath, int pipelineId, JobS
return (response.readEntity(new GenericType<List<Job>>() {}));
}

/**
* Get a Pager of jobs in a pipeline.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/pipelines/:pipeline_id/jobs</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path to get the pipelines for
* @param pipelineId the pipeline ID to get the list of jobs for
* @param itemsPerPage the number of Job instances that will be fetched per page
* @return a list containing the jobs for the specified project ID and pipeline ID
* @throws GitLabApiException if any exception occurs during execution
*/
public Pager<Job> getJobsForPipeline(Object projectIdOrPath, int pipelineId, int itemsPerPage) throws GitLabApiException {
return (new Pager<Job>(this, Job.class, itemsPerPage, getDefaultPerPageParam(),
"projects", getProjectIdOrPath(projectIdOrPath), "pipelines", pipelineId, "jobs"));
}

/**
* Get a Stream of jobs in a pipeline.
* <pre><code>GitLab Endpoint: GET /projects/:id/pipelines/:pipeline_id/jobs</code></pre>
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param pipelineId the pipeline ID to get the list of jobs for
* @return a Stream containing the jobs for the specified project ID
* @throws GitLabApiException if any exception occurs during execution
*/
public Stream<Job> getJobsStream(Object projectIdOrPath, int pipelineId) throws GitLabApiException {
return (getJobsForPipeline(projectIdOrPath, pipelineId, getDefaultPerPage()).stream());
}

/**
* Get single job in a project.
*
Expand Down