@@ -139,9 +139,22 @@ public Stream<Job> getJobsStream(Object projectIdOrPath, JobScope scope) throws
139139 * @throws GitLabApiException if any exception occurs during execution
140140 */
141141 public List <Job > getJobsForPipeline (Object projectIdOrPath , long pipelineId ) throws GitLabApiException {
142- Response response = get (Response .Status .OK , getDefaultPerPageParam (),
143- "projects" , getProjectIdOrPath (projectIdOrPath ), "pipelines" , pipelineId , "jobs" );
144- return (response .readEntity (new GenericType <List <Job >>() {}));
142+ return getJobsForPipeline (projectIdOrPath , pipelineId , (Boolean ) null );
143+ }
144+
145+ /**
146+ * Get a list of jobs in a pipeline.
147+ *
148+ * <pre><code>GitLab Endpoint: GET /projects/:id/pipelines/:pipeline_id/jobs</code></pre>
149+ *
150+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path to get the pipelines for
151+ * @param pipelineId the pipeline ID to get the list of jobs for
152+ * @param includeRetried Include retried jobs in the response
153+ * @return a list containing the jobs for the specified project ID and pipeline ID
154+ * @throws GitLabApiException if any exception occurs during execution
155+ */
156+ public List <Job > getJobsForPipeline (Object projectIdOrPath , long pipelineId , Boolean includeRetried ) throws GitLabApiException {
157+ return getJobsForPipeline (projectIdOrPath , pipelineId , null , includeRetried );
145158 }
146159
147160 /**
@@ -156,7 +169,26 @@ public List<Job> getJobsForPipeline(Object projectIdOrPath, long pipelineId) thr
156169 * @throws GitLabApiException if any exception occurs during execution
157170 */
158171 public List <Job > getJobsForPipeline (Object projectIdOrPath , long pipelineId , JobScope scope ) throws GitLabApiException {
159- GitLabApiForm formData = new GitLabApiForm ().withParam ("scope" , scope ).withParam (PER_PAGE_PARAM , getDefaultPerPage ());
172+ return getJobsForPipeline (projectIdOrPath , pipelineId , scope , false );
173+ }
174+
175+ /**
176+ * Get a list of jobs in a pipeline.
177+ *
178+ * <pre><code>GitLab Endpoint: GET /projects/:id/pipelines/:pipeline_id/jobs</code></pre>
179+ *
180+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path to get the pipelines for
181+ * @param pipelineId the pipeline ID to get the list of jobs for
182+ * @param scope the scope of jobs, one of: CREATED, PENDING, RUNNING, FAILED, SUCCESS, CANCELED, SKIPPED, MANUAL
183+ * @param includeRetried Include retried jobs in the response
184+ * @return a list containing the jobs for the specified project ID and pipeline ID
185+ * @throws GitLabApiException if any exception occurs during execution
186+ */
187+ public List <Job > getJobsForPipeline (Object projectIdOrPath , long pipelineId , JobScope scope , Boolean includeRetried ) throws GitLabApiException {
188+ GitLabApiForm formData = new GitLabApiForm ()
189+ .withParam ("scope" , scope )
190+ .withParam ("include_retried" , includeRetried )
191+ .withParam (PER_PAGE_PARAM , getDefaultPerPage ());
160192 Response response = get (Response .Status .OK , formData .asMap (), "projects" , getProjectIdOrPath (projectIdOrPath ), "pipelines" , pipelineId , "jobs" );
161193 return (response .readEntity (new GenericType <List <Job >>() {}));
162194 }
0 commit comments