Package com.spotify.github.v3.clients
Class GitHubClient
- java.lang.Object
-
- com.spotify.github.v3.clients.GitHubClient
-
public class GitHubClient extends Object
Github client is a main communication entry point. Provides lower level communication functionality as well as acts as a factory for the higher level API clients.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GitHubClient
create(URI baseUrl, byte[] privateKey, Integer appId)
Create a github api client with a given base URL and a path to a key.static GitHubClient
create(URI baseUrl, byte[] privateKey, Integer appId, Integer installationId)
Create a github api client with a given base URL and a path to a key.static GitHubClient
create(URI baseUrl, File privateKey, Integer appId)
Create a github api client with a given base URL and a path to a key.static GitHubClient
create(URI baseUrl, File privateKey, Integer appId, Integer installationId)
Create a github api client with a given base URL and a path to a key.static GitHubClient
create(URI baseUrl, String token)
Create a github api client with a given base URL and authorization token.static GitHubClient
create(okhttp3.OkHttpClient httpClient, URI baseUrl, byte[] privateKey, Integer appId)
Create a github api client with a given base URL and a path to a key.static GitHubClient
create(okhttp3.OkHttpClient httpClient, URI baseUrl, byte[] privateKey, Integer appId, Integer installationId)
Create a github api client with a given base URL and a path to a key.static GitHubClient
create(okhttp3.OkHttpClient httpClient, URI baseUrl, File privateKey, Integer appId)
Create a github api client with a given base URL and a path to a key.static GitHubClient
create(okhttp3.OkHttpClient httpClient, URI baseUrl, File privateKey, Integer appId, Integer installationId)
Create a github api client with a given base URL and a path to a key.static GitHubClient
create(okhttp3.OkHttpClient httpClient, URI baseUrl, String token)
Create a github api client with a given base URL and authorization token.ChecksClient
createChecksClient(String owner, String repo)
Create a checks API clientGitDataClient
createGitDataClient(String owner, String repo)
Create a GitData API clientRepositoryClient
createRepositoryClient(String owner, String repo)
Create a repository API clientSearchClient
createSearchClient()
Create search API clientOptional<String>
getAccessToken()
Optional<byte[]>
getPrivateKey()
static GitHubClient
scopeForInstallationId(GitHubClient client, int installationId)
Receives a github client and scopes it to a certain installation ID.GitHubClient
withTracer(Tracer tracer)
-
-
-
Method Detail
-
create
public static GitHubClient create(URI baseUrl, String token)
Create a github api client with a given base URL and authorization token.- Parameters:
baseUrl
- base URLtoken
- authorization token- Returns:
- github api client
-
create
public static GitHubClient create(URI baseUrl, File privateKey, Integer appId)
Create a github api client with a given base URL and a path to a key.- Parameters:
baseUrl
- base URLprivateKey
- the private key PEM fileappId
- the github app ID- Returns:
- github api client
-
create
public static GitHubClient create(URI baseUrl, byte[] privateKey, Integer appId)
Create a github api client with a given base URL and a path to a key.- Parameters:
baseUrl
- base URLprivateKey
- the private key as byte arrayappId
- the github app ID- Returns:
- github api client
-
create
public static GitHubClient create(URI baseUrl, File privateKey, Integer appId, Integer installationId)
Create a github api client with a given base URL and a path to a key.- Parameters:
baseUrl
- base URLprivateKey
- the private key PEM fileappId
- the github app IDinstallationId
- the installationID to be authenticated as- Returns:
- github api client
-
create
public static GitHubClient create(URI baseUrl, byte[] privateKey, Integer appId, Integer installationId)
Create a github api client with a given base URL and a path to a key.- Parameters:
baseUrl
- base URLprivateKey
- the private key as byte arrayappId
- the github app IDinstallationId
- the installationID to be authenticated as- Returns:
- github api client
-
create
public static GitHubClient create(okhttp3.OkHttpClient httpClient, URI baseUrl, File privateKey, Integer appId)
Create a github api client with a given base URL and a path to a key.- Parameters:
httpClient
- an instance of OkHttpClientbaseUrl
- base URLprivateKey
- the private key PEM fileappId
- the github app ID- Returns:
- github api client
-
create
public static GitHubClient create(okhttp3.OkHttpClient httpClient, URI baseUrl, byte[] privateKey, Integer appId)
Create a github api client with a given base URL and a path to a key.- Parameters:
httpClient
- an instance of OkHttpClientbaseUrl
- base URLprivateKey
- the private key as byte arrayappId
- the github app ID- Returns:
- github api client
-
create
public static GitHubClient create(okhttp3.OkHttpClient httpClient, URI baseUrl, File privateKey, Integer appId, Integer installationId)
Create a github api client with a given base URL and a path to a key.- Parameters:
httpClient
- an instance of OkHttpClientbaseUrl
- base URLprivateKey
- the private key PEM fileappId
- the github app ID- Returns:
- github api client
-
create
public static GitHubClient create(okhttp3.OkHttpClient httpClient, URI baseUrl, byte[] privateKey, Integer appId, Integer installationId)
Create a github api client with a given base URL and a path to a key.- Parameters:
httpClient
- an instance of OkHttpClientbaseUrl
- base URLprivateKey
- the private key as byte arrayappId
- the github app ID- Returns:
- github api client
-
create
public static GitHubClient create(okhttp3.OkHttpClient httpClient, URI baseUrl, String token)
Create a github api client with a given base URL and authorization token.- Parameters:
httpClient
- an instance of OkHttpClientbaseUrl
- base URLtoken
- authorization token- Returns:
- github api client
-
scopeForInstallationId
public static GitHubClient scopeForInstallationId(GitHubClient client, int installationId)
Receives a github client and scopes it to a certain installation ID.- Parameters:
client
- the github client with a valid private keyinstallationId
- the installation ID to be scoped- Returns:
- github api client
-
withTracer
public GitHubClient withTracer(Tracer tracer)
-
getPrivateKey
public Optional<byte[]> getPrivateKey()
-
createRepositoryClient
public RepositoryClient createRepositoryClient(String owner, String repo)
Create a repository API client- Parameters:
owner
- repository ownerrepo
- repository name- Returns:
- repository API client
-
createGitDataClient
public GitDataClient createGitDataClient(String owner, String repo)
Create a GitData API client- Parameters:
owner
- repository ownerrepo
- repository name- Returns:
- GitData API client
-
createSearchClient
public SearchClient createSearchClient()
Create search API client- Returns:
- search API client
-
createChecksClient
public ChecksClient createChecksClient(String owner, String repo)
Create a checks API client- Parameters:
owner
- repository ownerrepo
- repository name- Returns:
- checks API client
-
-