Class MkGithub

  • All Implemented Interfaces:
    Github

    @Immutable
    @Loggable(1)
    public final class MkGithub
    extends Object
    implements Github
    Mock Github client.

    This is how you use it:

     GitHub gitHub = new MkGithub("username");
     Repos.RepoCreate create = new Repos.RepoCreate("dummy", false);
     Repo repo = gitHub.repos().create(create);
     Issue issue = repo.issues().create("title", "body");

    By default, it works with a temporary file, which will be deleted on JVM exit:

     Github github = new MkGithub("jeff");
    Since:
    0.5
    Version:
    $Id: 6c637fcb5975d327bffb218d61f3e433960bd45e $
    Author:
    Yegor Bugayenko (yegor256@gmail.com)
    Suppressed Checkstyle violations:
    ClassDataAbstractionCoupling (500 lines)
    • Constructor Detail

      • MkGithub

        public MkGithub()
                 throws IOException
        Public ctor.
        Throws:
        IOException - If there is any I/O problem
      • MkGithub

        public MkGithub​(String login)
                 throws IOException
        Public ctor.
        Parameters:
        login - User to login
        Throws:
        IOException - If there is any I/O problem
      • MkGithub

        public MkGithub​(MkStorage stg,
                        String login)
        Public ctor.
        Parameters:
        stg - Storage
        login - User to login
    • 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
      • meta

        public javax.json.JsonObject meta()
        Description copied from interface: Github
        Get meta information.
        Specified by:
        meta in interface Github
        Returns:
        JSON with meta
        See Also:
        Meta API
      • search

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

        public javax.json.JsonObject emojis()
        Description copied from interface: Github
        Get emojis.
        Specified by:
        emojis in interface Github
        Returns:
        JSON with emojis
        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
      • relogin

        public Github relogin​(String login)
                       throws IOException
        Relogin.
        Parameters:
        login - User to login
        Returns:
        Github
        Throws:
        IOException - If there is any I/O problem
      • randomRepo

        public Repo randomRepo()
                        throws IOException
        Create repo with random name.
        Returns:
        Repo
        Throws:
        IOException - If fails