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
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)
-
-
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.JsonObject
emojis()
Get emojis.com.jcabi.http.Request
entry()
RESTful request, an entry point to the Github API.Gists
gists()
Get Gists API entry point.Gitignores
gitignores()
Get gitignores.Limits
limits()
Rate limit API entry point.Markdown
markdown()
Get Markdown API entry point.javax.json.JsonObject
meta()
Get meta information.Organizations
organizations()
Get Organizations API entry point.Repos
repos()
Get repositories.Search
search()
Search API entry point.Users
users()
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:Github
RESTful request, an entry point to the Github API.
-
organizations
public Organizations organizations()
Description copied from interface:Github
Get Organizations API entry point.- Specified by:
organizations
in interfaceGithub
- Returns:
- Organizations API entry point
-
meta
public javax.json.JsonObject meta() throws IOException
Description copied from interface:Github
Get meta information.- Specified by:
meta
in 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 IOException
Description copied from interface:Github
Get emojis.- Specified by:
emojis
in 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:Github
Get gitignores.- Specified by:
gitignores
in interfaceGithub
- Returns:
- Gitignotes API
- Throws:
IOException
- If there is any I/O problem- See Also:
- Gitignore API
-
-