Package com.jcabi.github
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
RetryWireto 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)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jcabi.github.Github
Github.Time
-
-
Constructor Summary
Constructors Constructor Description RtGithub()Public ctor, for anonymous access to Github.RtGithub(com.jcabi.http.Request req)Public ctor, with a custom request.RtGithub(String token)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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.json.JsonObjectemojis()Get emojis.com.jcabi.http.Requestentry()RESTful request, an entry point to the Github API.Gistsgists()Get Gists API entry point.Gitignoresgitignores()Get gitignores.Limitslimits()Rate limit API entry point.Markdownmarkdown()Get Markdown API entry point.javax.json.JsonObjectmeta()Get meta information.Organizationsorganizations()Get Organizations API entry point.Reposrepos()Get repositories.Searchsearch()Search API entry point.Usersusers()Get Users API entry point.
-
-
-
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 namepwd- 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 tokendomain- 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:GithubRESTful request, an entry point to the Github API.
-
organizations
public Organizations organizations()
Description copied from interface:GithubGet Organizations API entry point.- Specified by:
organizationsin interfaceGithub- Returns:
- Organizations API entry point
-
meta
public javax.json.JsonObject meta() throws IOExceptionDescription copied from interface:GithubGet meta information.- Specified by:
metain interfaceGithub- Returns:
- JSON with meta
- Throws:
IOException- If there is any I/O problem- See Also:
- Meta API
-
emojis
public javax.json.JsonObject emojis() throws IOExceptionDescription copied from interface:GithubGet emojis.- Specified by:
emojisin interfaceGithub- Returns:
- JSON with emojis
- Throws:
IOException- If there is any I/O problem- See Also:
- Emojis API
-
gitignores
public Gitignores gitignores() throws IOException
Description copied from interface:GithubGet gitignores.- Specified by:
gitignoresin interfaceGithub- Returns:
- Gitignotes API
- Throws:
IOException- If there is any I/O problem- See Also:
- Gitignore API
-
-