Package org.sourcelab.github.client
Class GithubClient
java.lang.Object
org.sourcelab.github.client.GithubClient
API Client for Buildkite's REST Api.
See API Documentation:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancancelWorkflow(CancelWorkflowOptions options) Cancel a Workflow.<T> TexecuteRequest(Request<T> request) Execute the given request, returning the parsed response, or throwing the appropriate exception if an error was returned from the API.Get the currently authenticated user.Get runs for a given workflow..Get runs for a given workflow..Get runs for a given repository.Get workflows for a given repository.<T> TnextPage(PageableResponse<T> response) Retrieve the next page of results from the previously retrieved request.octoCat()Make a 'test' or 'hello world' request to the Github API.booleanRequest a re-run of a specific job Id for a given workflow.Request a re-run of a specific job Id for a given workflow.booleanrerunWorkflow(RerunWorkflowOptions options) Re-run a Workflow.userRepos(UserReposFilterCriteria options) Get current authenticated user's repositories.
-
Constructor Details
-
GithubClient
Constructor.- Parameters:
configuration- The configuration for the org.sourcelab.github.client.
-
-
Method Details
-
octoCat
Make a 'test' or 'hello world' request to the Github API. Can be used to validate connectivity to the API.- Returns:
- Response details from the ping request.
- Throws:
GithubException- if API returns an error response.
-
getAuthenticatedUser
Get the currently authenticated user.- Returns:
- Current authenticated user.
- Throws:
GithubException- if API returns an error response.
-
userRepos
Get current authenticated user's repositories.- Parameters:
options- Filter criteria.- Returns:
- Response object.
- Throws:
GithubException- if API returns an error response.
-
getWorkflowsForRepository
public WorkflowsForRepositoryResponse getWorkflowsForRepository(WorkflowFilterCriteria options) throws GithubException Get workflows for a given repository.- Parameters:
options- Filter criteria.- Returns:
- Response object.
- Throws:
GithubException- if API returns an error response.
-
getRunsForWorkflow
public WorkflowRunsResponse getRunsForWorkflow(WorkflowRunFilterCriteria options) throws GithubException Get runs for a given workflow..- Parameters:
options- Filter criteria.- Returns:
- Response object.
- Throws:
GithubException- if API returns an error response.
-
getWorkflowRunsForRepository
public WorkflowRunsResponse getWorkflowRunsForRepository(WorkflowRunFilterCriteria options) throws GithubException Get runs for a given repository.- Parameters:
options- Filter criteria.- Returns:
- Response object.
- Throws:
GithubException- if API returns an error response.
-
rerunWorkflow
Re-run a Workflow.- Parameters:
options- Defines which workflow to re-run.- Returns:
- true on success, false on error.
- Throws:
GithubException- if API returns an error response.
-
cancelWorkflow
Cancel a Workflow.- Parameters:
options- Defines which workflow to cancel- Returns:
- true on success, false on error.
- Throws:
GithubException- if API returns an error response.
-
getJobsForWorkflowRun
public WorkflowJobsResponse getJobsForWorkflowRun(WorkflowJobFilterCriteria options) throws GithubException Get runs for a given workflow..- Parameters:
options- Filter criteria.- Returns:
- Response object.
- Throws:
GithubException- if API returns an error response.
-
rerunJobFromWorkflow
Request a re-run of a specific job Id for a given workflow.- Parameters:
options- Criteria of which job to re-run.- Returns:
- true on success, false on error.
- Throws:
GithubException- if API returns an error response.
-
rerunJobsFromWorkflow
public RerunMultipleJobsResponse rerunJobsFromWorkflow(RerunJobsFromWorkflowOptions options) throws GithubException Request a re-run of a specific job Id for a given workflow.- Parameters:
options- Criteria of which job to re-run.- Returns:
- true on success, false on error.
- Throws:
GithubException- if API returns an error response.
-
nextPage
Retrieve the next page of results from the previously retrieved request.- Type Parameters:
T- The parsed return object representing the result.- Parameters:
response- Previously retrieved result/response to retrieve the next page of results for.- Returns:
- The next page of results.
- Throws:
InvalidPagingRequestException- if no next page exists to retrieve.GithubException- if API returns an error response.
-
executeRequest
Execute the given request, returning the parsed response, or throwing the appropriate exception if an error was returned from the API. This method scoped public to allow for user defined requests to be executed by the library as an extension point.- Type Parameters:
T- The parsed response object.- Parameters:
request- The request to execute.- Returns:
- The parsed response object.
- Throws:
GithubException- if API returns an error response.
-