|
5 | 5 | import org.gitlab.api.http.GitlabHTTPRequestor; |
6 | 6 | import org.gitlab.api.http.Query; |
7 | 7 | import org.gitlab.api.models.*; |
| 8 | +import org.gitlab.api.query.PaginationQuery; |
| 9 | +import org.gitlab.api.query.PipelinesQuery; |
| 10 | +import org.gitlab.api.query.ProjectsQuery; |
8 | 11 | import org.slf4j.Logger; |
9 | 12 | import org.slf4j.LoggerFactory; |
10 | 13 |
|
@@ -843,6 +846,16 @@ public List<GitlabProject> getProjectsWithPagination(int page, int perPage) thro |
843 | 846 | return getProjectsWithPagination(pagination); |
844 | 847 | } |
845 | 848 |
|
| 849 | + /** |
| 850 | + * Get a list of projects accessible by the authenticated user. |
| 851 | + * |
| 852 | + * @return A list of gitlab projects |
| 853 | + */ |
| 854 | + public List<GitlabProject> getProjects(ProjectsQuery projectsQuery) { |
| 855 | + String tailUrl = GitlabProject.URL + projectsQuery; |
| 856 | + return retrieve().getAll(tailUrl, GitlabProject[].class); |
| 857 | + } |
| 858 | + |
846 | 859 | /** |
847 | 860 | * Get a list of projects by pagination accessible by the authenticated user. |
848 | 861 | * |
@@ -999,6 +1012,47 @@ public GitlabPipeline getProjectPipeline(Integer projectId, Integer pipelineId) |
999 | 1012 | return retrieve().to(tailUrl, GitlabPipeline.class); |
1000 | 1013 | } |
1001 | 1014 |
|
| 1015 | + /** |
| 1016 | + * Get a list of a project's pipelines in Gitlab |
| 1017 | + * |
| 1018 | + * @param project the project |
| 1019 | + * @return A list of project pipelines |
| 1020 | + */ |
| 1021 | + public List<GitlabPipeline> getProjectPipelines(GitlabProject project) { |
| 1022 | + return getProjectPipelines(project.getId()); |
| 1023 | + } |
| 1024 | + |
| 1025 | + /** |
| 1026 | + * Get a list of a project's pipelines in Gitlab |
| 1027 | + * |
| 1028 | + * @param projectId the project id |
| 1029 | + * @return A list of project pipelines |
| 1030 | + */ |
| 1031 | + public List<GitlabPipeline> getProjectPipelines(Integer projectId) { |
| 1032 | + return getProjectPipelines(projectId, new PipelinesQuery().withPerPage(PaginationQuery.MAX_ITEMS_PER_PAGE)); |
| 1033 | + } |
| 1034 | + |
| 1035 | + /** |
| 1036 | + * Get a list of a project's pipelines in Gitlab |
| 1037 | + * |
| 1038 | + * @param project the project |
| 1039 | + * @return A list of project pipelines |
| 1040 | + */ |
| 1041 | + public List<GitlabPipeline> getProjectPipelines(GitlabProject project, PipelinesQuery pipelinesQuery) { |
| 1042 | + return getProjectPipelines(project.getId(), pipelinesQuery); |
| 1043 | + } |
| 1044 | + |
| 1045 | + /** |
| 1046 | + * Get a list of a project's pipelines in Gitlab |
| 1047 | + * |
| 1048 | + * @param projectId the project id |
| 1049 | + * @return A list of project pipelines |
| 1050 | + */ |
| 1051 | + public List<GitlabPipeline> getProjectPipelines(Integer projectId, PipelinesQuery pipelinesQuery) { |
| 1052 | + String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabPipeline.URL + pipelinesQuery; |
| 1053 | + return retrieve().getAll(tailUrl, GitlabPipeline[].class); |
| 1054 | + } |
| 1055 | + |
1002 | 1056 | /** |
1003 | 1057 | * Gets a list of a project's jobs in Gitlab |
1004 | 1058 | * |
|
0 commit comments