This package contains a collection of classes that will allow for easy calls out to the GitHub API.
For authentication, which GitHub requires in order to use their API, you need to generate a GitHub API token for your account. Click here to learn how to generate an access token.
A GitHubApiClient object instance can be created like so, where user
is your GitHub username and token
is your GitHub API access token:
GitHubApiClient gitHubApiClient = new GitHubApiClient(user, token);
From here, you can call any of the available methods to get a response from GitHub with the desired info.
For example, if you wanted to get info about a repo, you would call the getRepoInfo
method.
The below will return info for this repo:
GitHubApiClient gitHubApiClient = new GitHubApiClient(user, token);
GetRepoInfoResponse repoInfo = gitHubApiClient.getRepoInfo("CSC109", "GitHubApiClient");
Required imports:
import github.tools.client.GitHubApiClient;
import github.tools.responseObjects.*;
Click here for descriptions/examples for each GitHub Api Client method.