Class RtGitHub

java.lang.Object
com.jcabi.github.RtGitHub
All Implemented Interfaces:
GitHub

@Immutable @Loggable(1) public final class RtGitHub extends Object implements GitHub
GitHub client, starting point to the entire library.

This is how you start communicating with GitHub API:

 GitHub github = new RtGitHub(oauthKey);
 Repo repo = github.repos().get(
     new Coordinates.Simple("jcabi/jcabi-github")
 );
 Issues issues = repo.issues();
 Issue issue = issues.create("issue title", "issue body");
 issue.comments().post("issue comment");

It is strongly recommended to use RetryWire to avoid accidental I/O exceptions:

 GitHub github = new RtGitHub(
   new RtGitHub(oauthKey).entry().through(RetryWire.class)
 );
Since:
0.1
Suppressed Checkstyle violations:
ClassDataAbstractionCouplingCheck (500 lines), MultipleStringLiteralsCheck (500 lines)
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.jcabi.github.GitHub

    GitHub.Time
  • Constructor Summary

    Constructors
    Constructor
    Description
    Public ctor, for anonymous access to GitHub.
    RtGitHub(com.jcabi.http.Request req)
    Public ctor, with a custom request.
    Public ctor, for authentication with OAuth2 token.
    RtGitHub(String user, String pwd)
    Public ctor, for HTTP Basic Authentication.
    RtGitHub(String user, String pwd, URI domain)
    Public ctor, for HTTP Basic Authentication.
    RtGitHub(String token, URI domain)
    Public ctor, for authentication with OAuth2 token.
    RtGitHub(URI domain)
    Public ctor, for anonymous access to GitHub.

    Use this ctor when you want to access GitHub's API over a custom domain, other than https//api.github.com.

    For instance, if you have your own instance of GitHub deployed somewhere.
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.json.JsonObject
    Get emojis.
    com.jcabi.http.Request
    RESTful request, an entry point to the GitHub API.
    boolean
     
    Get Gists API entry point.
    Get gitignores.
    int
     
    Rate limit API entry point.
    Get Markdown API entry point.
    jakarta.json.JsonObject
    Get meta information.
    Get Organizations API entry point.
    Get repositories.
    Search API entry point.
    Get Users API entry point.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RtGitHub

      public RtGitHub()
      Public ctor, for anonymous access to GitHub.
      Since:
      0.4
    • RtGitHub

      public RtGitHub(URI domain)
      Public ctor, for anonymous access to GitHub.

      Use this ctor when you want to access GitHub's API over a custom domain, other than https//api.github.com.

      For instance, if you have your own instance of GitHub deployed somewhere.
           final GitHub myGitHub = new RtGitHub(
               URI.create("https://github.mydomain.com")
           );
       
      Parameters:
      domain - Your domain.
    • RtGitHub

      public RtGitHub(String user, String pwd)
      Public ctor, for HTTP Basic Authentication.
      Parameters:
      user - User name
      pwd - Password
      Since:
      0.4
    • RtGitHub

      public RtGitHub(String user, String pwd, URI domain)
      Public ctor, for HTTP Basic Authentication. Use this ctor when you want to access GitHub's API over a custom domain, other than https//api.github.com.

      For instance, if you have your own instance of GitHub deployed somewhere.
           final GitHub myGitHub = new RtGitHub(
               "john_doe", "johnspassword",
               URI.create("https://github.mydomain.com")
           );
       
      Parameters:
      user - User's username.
      pwd - User's password.
      domain - Your custom domain.
    • RtGitHub

      public RtGitHub(String token, URI domain)
      Public ctor, for authentication with OAuth2 token. Use this ctor when you want to access GitHub's API over a custom domain, other than https//api.github.com.

      For instance, if you have your own instance of GitHub deployed somewhere.
           final GitHub myGitHub = new RtGitHub(
               "john_doe", "johnspassword",
               URI.create("https://github.mydomain.com")
           );
       
      Parameters:
      token - OAuth token
      domain - Your custom domain.
    • RtGitHub

      public RtGitHub(String token)
      Public ctor, for authentication with OAuth2 token.
      Parameters:
      token - OAuth token
    • RtGitHub

      public RtGitHub(com.jcabi.http.Request req)
      Public ctor, with a custom request.
      Parameters:
      req - Request to start from
      Since:
      0.4
  • Method Details

    • entry

      public com.jcabi.http.Request entry()
      Description copied from interface: GitHub
      RESTful request, an entry point to the GitHub API.
      Specified by:
      entry in interface GitHub
      Returns:
      Request
    • repos

      public Repos repos()
      Description copied from interface: GitHub
      Get repositories.
      Specified by:
      repos in interface GitHub
      Returns:
      Repositories
    • gists

      public Gists gists()
      Description copied from interface: GitHub
      Get Gists API entry point.
      Specified by:
      gists in interface GitHub
      Returns:
      Gists API entry point
    • users

      public Users users()
      Description copied from interface: GitHub
      Get Users API entry point.
      Specified by:
      users in interface GitHub
      Returns:
      Users API entry point
    • organizations

      public Organizations organizations()
      Description copied from interface: GitHub
      Get Organizations API entry point.
      Specified by:
      organizations in interface GitHub
      Returns:
      Organizations API entry point
    • limits

      public Limits limits()
      Description copied from interface: GitHub
      Rate limit API entry point.
      Specified by:
      limits in interface GitHub
      Returns:
      Rate limit API
    • search

      public Search search()
      Description copied from interface: GitHub
      Search API entry point.
      Specified by:
      search in interface GitHub
      Returns:
      Search API
    • meta

      public jakarta.json.JsonObject meta() throws IOException
      Description copied from interface: GitHub
      Get meta information.
      Specified by:
      meta in interface GitHub
      Returns:
      JSON with meta
      Throws:
      IOException - If there is any I/O problem
      See Also:
    • emojis

      public jakarta.json.JsonObject emojis() throws IOException
      Description copied from interface: GitHub
      Get emojis.
      Specified by:
      emojis in interface GitHub
      Returns:
      JSON with emojis
      Throws:
      IOException - If there is any I/O problem
      See Also:
    • gitignores

      public Gitignores gitignores()
      Description copied from interface: GitHub
      Get gitignores.
      Specified by:
      gitignores in interface GitHub
      Returns:
      Gitignotes API
      See Also:
    • markdown

      public Markdown markdown()
      Description copied from interface: GitHub
      Get Markdown API entry point.
      Specified by:
      markdown in interface GitHub
      Returns:
      Markdown API entry point
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object