Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
0b9ac1d0
Unverified
Commit
0b9ac1d0
authored
Nov 15, 2021
by
Gautier de Saint Martin Lacaze
Committed by
GitHub
Nov 15, 2021
Browse files
Merge pull request #692 from opensource21/Fix-631
Added Paging- and Stream-Support for Jobs in Pipeline.
parents
18d69022
fde7749f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/JobApi.java
View file @
0b9ac1d0
...
...
@@ -162,6 +162,35 @@ public class JobApi extends AbstractApi implements Constants {
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.
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment