Class 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
    Version:
    $Id: 9d852605cb29964fd4fab11d4a921057607190b3 $
    Author:
    Yegor Bugayenko (yegor256@gmail.com)
    Suppressed Checkstyle violations:
    ClassDataAbstractionCouplingCheck (500 lines), MultipleStringLiteralsCheck (500 lines)
    • Constructor Detail

      • 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 Detail

      • 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 javax.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:
        Meta API
      • emojis

        public javax.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:
        Emojis API
      • 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