Class GitHubApi

java.lang.Object
io.github.intisy.gradle.github.api.GitHubApi

public final class GitHubApi extends Object
The single entry point for consuming the GitHub client outside a Gradle build.

Construct one with create(GitHubConfig, ResourceSettings, GitHubLogger) (or the two-argument overload, which logs to System.err, or the no-argument overload, which additionally defaults to fully anonymous access), then reach each capability through its accessor: credentials(), repositories(), releases(), publishing(), sourceBuilds(), downloads(), resolver().

  • Method Details

    • create

      public static GitHubApi create(GitHubConfig config, ResourceSettings resources, GitHubLogger logger)
      Parameters:
      config - the access token and auth/cli/resilience settings.
      resources - the configured resource repository, if any.
      logger - receives diagnostic output.
      Returns:
      a new client wired to the given configuration and logger.
    • create

      public static GitHubApi create(GitHubConfig config, ResourceSettings resources)
      Parameters:
      config - the access token and auth/cli/resilience settings.
      resources - the configured resource repository, if any.
      Returns:
      a new client wired to the given configuration, logging to System.err.
    • create

      public static GitHubApi create()
      Same as create(GitHubConfig, ResourceSettings, GitHubLogger), defaulting to an anonymous GitHubConfig, a default ResourceSettings, and logging to System.err via ConsoleGitHubLogger.
      Returns:
      a new client for fully anonymous, unauthenticated access.
    • credentials

      public Credentials credentials()
      Returns:
      the resolved API token and SSH key for this client's configuration.
    • repositories

      public Repositories repositories()
      Returns:
      the client's checkout-cloning, pulling and inspection capability.
    • releases

      public Releases releases()
      Returns:
      the client's release lookup and jar download capability.
    • publishing

      public Publishing publishing()
      Returns:
      the client's release creation and asset upload capability.
    • sourceBuilds

      public SourceBuilds sourceBuilds()
      Returns:
      the client's build-from-source capability, backed by a shared cache directory whose entries are keyed by owner, repo, and resolved commit (or, for an arbitrary clone URL, a derived identity and resolved ref).
    • downloads

      public Downloads downloads()
      Returns:
      the client's jar-download capability, for a URL with no repository or git host involved, backed by a shared cache directory whose entries are keyed by a hash of the URL.
    • resolver

      public JarResolver resolver()
      Returns:
      the client's ResolutionRequest-based resolver, dispatching to releases(), sourceBuilds(), or downloads() by the request's own strategy.