org.gitlab4j.api.ResourceStateEventsApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gitlab4j-api Show documentation
Show all versions of gitlab4j-api Show documentation
GitLab4J-API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories and servers via the GitLab REST API.
package org.gitlab4j.api;
import java.util.List;
import java.util.stream.Stream;
import org.gitlab4j.api.models.IssueEvent;
/**
* This class provides an entry point to all the GitLab Resource state events API
* @see Resource state events API at GitLab
*/
public class ResourceStateEventsApi extends AbstractApi {
public ResourceStateEventsApi(GitLabApi gitLabApi) {
super(gitLabApi);
}
/**
* Gets a list of all state events for a single issue.
*
* GitLab Endpoint: GET /projects/:id/issues/:issue_iid/resource_state_events
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param issueIid the IID of the issue
* @return a List of IssueEvent for the specified issue
* @throws GitLabApiException if any exception occurs
*/
public List getIssueStateEvents(Object projectIdOrPath, Long issueIid) throws GitLabApiException {
return (getIssueStateEvents(projectIdOrPath, issueIid, getDefaultPerPage()).all());
}
/**
* Gets a Pager of all state events for a single issue.
*
* GitLab Endpoint: GET /projects/:id/issues/:issue_iid/resource_state_events
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param issueIid the IID of the issue
* @param itemsPerPage the number of LabelEvent instances that will be fetched per page
* @return the Pager of IssueEvent instances for the specified issue IID
* @throws GitLabApiException if any exception occurs
*/
public Pager getIssueStateEvents(Object projectIdOrPath, Long issueIid, int itemsPerPage) throws GitLabApiException {
return (new Pager(this, IssueEvent.class, itemsPerPage, null,
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "resource_state_events"));
}
/**
* Gets a Stream of all state events for a single issue.
*
* GitLab Endpoint: GET /projects/:id/issues/:issue_iid/resource_state_events
*
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
* @param issueIid the IID of the issue
* @return a Stream of IssueEvent for the specified issue
* @throws GitLabApiException if any exception occurs
*/
public Stream getIssueStateEventsStream(Object projectIdOrPath, Long issueIid) throws GitLabApiException {
return (getIssueStateEvents(projectIdOrPath, issueIid, getDefaultPerPage()).stream());
}
}