Skip to content

Commit e46d665

Browse files
tristanlinstimols
authored andcommitted
Add methods GitlabAPI#getProjectPipeline(...) (timols#353)
* Add methods GitlabAPI#getProjectPipeline(...) * Add missing / at pipeline url
1 parent 66de6d1 commit e46d665

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/main/java/org/gitlab/api/GitlabAPI.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,29 @@ public GitlabUpload uploadFile(GitlabProject project, File file) throws IOExcept
976976
return dispatch().withAttachment("file", file).to(tailUrl, GitlabUpload.class);
977977
}
978978

979+
/**
980+
* Get a project's pipeline
981+
*
982+
* @param project the project
983+
* @param pipeline the pipeline
984+
* @return The project pipeline
985+
*/
986+
public GitlabPipeline getProjectPipeline(GitlabProject project, GitlabPipeline pipeline) throws IOException {
987+
return getProjectPipeline(project.getId(), pipeline.getId());
988+
}
989+
990+
/**
991+
* Get a project's pipeline
992+
*
993+
* @param projectId the project id
994+
* @param pipelineId the pipeline id
995+
* @return The project pipeline
996+
*/
997+
public GitlabPipeline getProjectPipeline(Integer projectId, Integer pipelineId) throws IOException {
998+
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabPipeline.URL + "/" + sanitizeId(pipelineId, "pipelineId");
999+
return retrieve().to(tailUrl, GitlabPipeline.class);
1000+
}
1001+
9791002
/**
9801003
* Gets a list of a project's jobs in Gitlab
9811004
*

0 commit comments

Comments
 (0)