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
74 changes: 68 additions & 6 deletions src/main/java/org/gitlab4j/api/RunnersApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public RunnersApi(GitLabApi gitLabApi) {
* @throws GitLabApiException if any exception occurs
*/
public List<Runner> getRunners() throws GitLabApiException {
return getRunners(null);
return getRunners(null, null, null);
}

/**
* Get a list of specific runners available to the user.
* Get a list of all available runners available to the user with pagination support.
*
* GET /runners
*
Expand All @@ -39,8 +39,39 @@ public List<Runner> getRunners() throws GitLabApiException {
* @throws GitLabApiException if any exception occurs
*/
public List<Runner> getRunners(Runner.RunnerStatus scope) throws GitLabApiException {
return getRunners(scope, null, null);
}

/**
* Get a list of all available runners available to the user with pagination support.
*
* GET /runners
*
* @param page The page offset of runners
* @param perPage The number of runners to get after the page offset
* @return List of Runners
* @throws GitLabApiException if any exception occurs
*/
public List<Runner> getRunners(int page, int perPage) throws GitLabApiException {
return getRunners(null, page, perPage);
}

/**
* Get a list of specific runners available to the user.
*
* GET /runners
*
* @param scope The scope of specific runners to show, one of: active, paused, online; showing all runners null
* @param page The page offset of runners
* @param perPage The number of runners to get after the page offset
* @return List of Runners
* @throws GitLabApiException if any exception occurs
*/
public List<Runner> getRunners(Runner.RunnerStatus scope, Integer page, Integer perPage) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("scope", scope, false);
.withParam("scope", scope, false)
.withParam("page", page, false)
.withParam("per_page", perPage, false);
Response response = get(Response.Status.OK, formData.asMap(), "runners");
return (response.readEntity(new GenericType<List<Runner>>() {
}));
Expand Down Expand Up @@ -84,7 +115,7 @@ public Pager<Runner> getRunners(Runner.RunnerStatus scope, int itemsPerPage) thr
* @throws GitLabApiException if any exception occurs
*/
public List<Runner> getAllRunners() throws GitLabApiException {
return getAllRunners(null);
return getAllRunners(null, null, null);
}

/**
Expand All @@ -97,8 +128,38 @@ public List<Runner> getAllRunners() throws GitLabApiException {
* @throws GitLabApiException if any exception occurs
*/
public List<Runner> getAllRunners(Runner.RunnerStatus scope) throws GitLabApiException {
return getAllRunners(scope, null, null);
}

/**
* Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.
*
* GET /runners/all
*
* @param page The page offset of runners
* @param perPage The number of runners to get after the page offset * @return List of Runners
* @throws GitLabApiException if any exception occurs
*/
public List<Runner> getAllRunners(int page, int perPage) throws GitLabApiException {
return getAllRunners(null, page, perPage);
}

/**
* Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.
*
* GET /runners/all
*
* @param scope The scope of specific runners to show, one of: active, paused, online; showing all runners null
* @param page The page offset of runners
* @param perPage The number of runners to get after the page offset
* @return List of Runners
* @throws GitLabApiException if any exception occurs
*/
public List<Runner> getAllRunners(Runner.RunnerStatus scope, Integer page, Integer perPage) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("scope", scope, false);
.withParam("scope", scope, false)
.withParam("page", page, false)
.withParam("per_page", perPage, false);
Response response = get(Response.Status.OK, formData.asMap(), "runners", "all");
return (response.readEntity(new GenericType<List<Runner>>() {
}));
Expand Down Expand Up @@ -133,6 +194,7 @@ public Pager<Runner> getAllRunners(Runner.RunnerStatus scope, int itemsPerPage)
return (new Pager<>(this, Runner.class, itemsPerPage, formData.asMap(), "runners"));
}


/**
* Get details of a runner.
*
Expand Down Expand Up @@ -296,7 +358,7 @@ public List<Runner> getProjectRunners(Integer projectId) throws GitLabApiExcepti
*
* GET /projects/:id/runners
*
* @param projectId The ID of the project owned by the authenticated user
* @param projectId The ID of the project owned by the authenticated user
* @param itemsPerPage the number of Project instances that will be fetched per page
* @return Pager of all Runner available in the project
* @throws GitLabApiException if any exception occurs
Expand Down