Class MkGitHub

java.lang.Object
com.jcabi.github.mock.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
Suppressed Checkstyle violations:
ClassDataAbstractionCoupling (500 lines)
  • Constructor Details

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

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 jakarta.json.JsonObject meta()
      Description copied from interface: GitHub
      Get meta information.
      Specified by:
      meta in interface GitHub
      Returns:
      JSON with meta
      See Also:
    • search

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

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

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

      public GitHub relogin(String login)
      Relogin.
      Parameters:
      login - User to login
      Returns:
      GitHub
    • randomRepo

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