An error occurred while loading the file. Please try again.
An error occurred while loading the file. Please try again.
An error occurred while loading the file. Please try again.
-
Greg Messner authoredaea79432
package org.gitlab4j.api;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.gitlab4j.api.GitLabApi.ApiVersion;
import org.gitlab4j.api.models.Event;
import org.gitlab4j.api.models.Issue;
import org.gitlab4j.api.models.Member;
import org.gitlab4j.api.models.Project;
import org.gitlab4j.api.models.ProjectHook;
import org.gitlab4j.api.models.Visibility;
/**
* This class provides an entry point to all the GitLab API project calls.
*/
public class ProjectApi extends AbstractApi implements Constants {
public ProjectApi(GitLabApi gitLabApi) {
super(gitLabApi);
}
/**
* Get a list of projects accessible by the authenticated user.
*
* GET /projects
*
* @return a list of projects accessible by the authenticated user
* @throws GitLabApiException if any exception occurs
*/
public List<Project> getProjects() throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects");
return (response.readEntity(new GenericType<List<Project>>() {}));
}
/**
* Get a list of projects accessible by the authenticated user and in the specified page range.
*
* GET /projects
*
* @param page the page to get
* @param perPage the number of projects per page
* @return a list of projects accessible by the authenticated user
* @throws GitLabApiException if any exception occurs
*/
public List<Project> getProjects(int page, int perPage) throws GitLabApiException {
Response response = get(Response.Status.OK, getPageQueryParams(page, perPage), "projects");
return (response.readEntity(new GenericType<List<Project>>() { }));
}
/**
* Get a Pager instance of projects accessible by the authenticated user.
*
* GET /projects
*
* @param itemsPerPage the number of Project instances that will be fetched per page
* @return a Pager instance of projects accessible by the authenticated user
* @throws GitLabApiException if any exception occurs
*/
public Pager<Project> getProjects(int itemsPerPage) throws GitLabApiException {
return (new Pager<Project>(this, Project.class, itemsPerPage, null, "projects"));
}
/**
* Get a list of projects accessible by the authenticated user and matching the supplied filter parameters.