public class GitHub extends Object
| Modifier and Type | Method and Description |
|---|---|
static GitHub |
connect()
Obtains the credential from "~/.github"
|
static GitHub |
connect(String login,
String oauthAccessToken) |
static GitHub |
connect(String login,
String oauthAccessToken,
String password)
Deprecated.
Either OAuth token or password is sufficient, so there's no point in passing both.
Use
connectUsingPassword(String, String) or connectUsingOAuth(String). |
static GitHub |
connectAnonymously()
Connects to GitHub anonymously.
|
static GitHub |
connectToEnterprise(String apiUrl,
String oauthAccessToken)
Version that connects to GitHub Enterprise.
|
static GitHub |
connectToEnterprise(String apiUrl,
String login,
String password) |
static GitHub |
connectUsingOAuth(String oauthAccessToken) |
static GitHub |
connectUsingOAuth(String githubServer,
String oauthAccessToken) |
static GitHub |
connectUsingPassword(String login,
String password) |
GHRepository |
createRepository(String name,
String description,
String homepage,
boolean isPublic)
Creates a new repository.
|
GHAuthorization |
createToken(Collection<String> scope,
String note,
String noteUrl)
Creates a new authorization.
|
List<GHEventInfo> |
getEvents()
Public events visible to you.
|
Map<String,GHOrganization> |
getMyOrganizations()
This method returns a shallowly populated organizations.
|
GHMyself |
getMyself()
Gets the
GHUser that represents yourself. |
GHOrganization |
getOrganization(String name) |
GHRateLimit |
getRateLimit()
Gets the current rate limit.
|
GHRepository |
getRepository(String name)
Gets the repository object from 'user/reponame' string that GitHub calls as "repository name"
|
protected GHUser |
getUser(GHUser orig)
Interns the given
GHUser. |
GHUser |
getUser(String login)
Obtains the object that represents the named user.
|
boolean |
isAnonymous()
Is this an anonymous connection
|
boolean |
isCredentialValid()
Ensures that the credential is valid.
|
<T extends GHEventPayload> |
parseEventPayload(Reader r,
Class<T> type)
Parses the GitHub event object.
|
public static GitHub connect() throws IOException
IOExceptionpublic static GitHub connectToEnterprise(String apiUrl, String oauthAccessToken) throws IOException
apiUrl - The URL of GitHub (or GitHub enterprise) API endpoint, such as "https://api.github.com" or
"http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL.
For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated.IOExceptionpublic static GitHub connectToEnterprise(String apiUrl, String login, String password) throws IOException
IOExceptionpublic static GitHub connect(String login, String oauthAccessToken) throws IOException
IOExceptionpublic static GitHub connect(String login, String oauthAccessToken, String password) throws IOException
connectUsingPassword(String, String) or connectUsingOAuth(String).IOExceptionpublic static GitHub connectUsingPassword(String login, String password) throws IOException
IOExceptionpublic static GitHub connectUsingOAuth(String oauthAccessToken) throws IOException
IOExceptionpublic static GitHub connectUsingOAuth(String githubServer, String oauthAccessToken) throws IOException
IOExceptionpublic static GitHub connectAnonymously() throws IOException
IOExceptionpublic boolean isAnonymous()
true if operations that require authentication will fail.public GHRateLimit getRateLimit() throws IOException
IOException@WithBridgeMethods(value=GHUser.class) public GHMyself getMyself() throws IOException
GHUser that represents yourself.IOExceptionpublic GHUser getUser(String login) throws IOException
IOExceptionprotected GHUser getUser(GHUser orig) throws IOException
GHUser.IOExceptionpublic GHOrganization getOrganization(String name) throws IOException
IOExceptionpublic GHRepository getRepository(String name) throws IOException
IOExceptionGHRepository.getName()public Map<String,GHOrganization> getMyOrganizations() throws IOException
getOrganization(String)
TODO: make this automatic.IOExceptionpublic List<GHEventInfo> getEvents() throws IOException
IOExceptionpublic <T extends GHEventPayload> T parseEventPayload(Reader r, Class<T> type) throws IOException
IOExceptionpublic GHRepository createRepository(String name, String description, String homepage, boolean isPublic) throws IOException
IOExceptionpublic GHAuthorization createToken(Collection<String> scope, String note, String noteUrl) throws IOException
connectUsingOAuth(String) in the future.IOExceptionpublic boolean isCredentialValid()
throws IOException
IOExceptionCopyright © 2014. All rights reserved.