Class 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 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 URL
        token - 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 URL
        privateKey - the private key PEM file
        appId - 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 URL
        privateKey - the private key PEM file
        appId - the github app ID
        installationId - 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 OkHttpClient
        baseUrl - base URL
        privateKey - the private key PEM file
        appId - 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 OkHttpClient
        baseUrl - base URL
        privateKey - the private key PEM file
        appId - 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 OkHttpClient
        baseUrl - base URL
        token - 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 key
        installationId - the installation ID to be scoped
        Returns:
        github api client
      • createRepositoryClient

        public RepositoryClient createRepositoryClient​(String owner,
                                                       String repo)
        Create a repository API client
        Parameters:
        owner - repository owner
        repo - repository name
        Returns:
        repository API client
      • createGitDataClient

        public GitDataClient createGitDataClient​(String owner,
                                                 String repo)
        Create a GitData API client
        Parameters:
        owner - repository owner
        repo - repository name
        Returns:
        GitData API client
      • createSearchClient

        public SearchClient createSearchClient()
        Create search API client
        Returns:
        search API client