| Constructor and Description |
|---|
GitHubBuilder()
Instantiates a new Git hub builder.
|
| Modifier and Type | Method and Description |
|---|---|
GitHub |
build()
Builds a
GitHub instance. |
GitHubBuilder |
clone() |
static GitHubBuilder |
fromEnvironment()
Creates
GitHubBuilder by picking up coordinates from environment variables. |
static GitHubBuilder |
fromEnvironment(String loginVariableName,
String passwordVariableName,
String oauthVariableName)
Deprecated.
Use
fromEnvironment() to pick up standard set of environment variables, so that different
clients of this library will all recognize one consistent set of coordinates. |
static GitHubBuilder |
fromEnvironment(String loginVariableName,
String passwordVariableName,
String oauthVariableName,
String endpointVariableName)
Deprecated.
Use
fromEnvironment() to pick up standard set of environment variables, so that different
clients of this library will all recognize one consistent set of coordinates. |
static GitHubBuilder |
fromProperties(Properties props)
From properties git hub builder.
|
static GitHubBuilder |
fromPropertyFile()
From property file git hub builder.
|
static GitHubBuilder |
fromPropertyFile(String propertyFileName)
From property file git hub builder.
|
GitHubBuilder |
withAbuseLimitHandler(AbuseLimitHandler handler)
Adds a
AbuseLimitHandler to this GitHubBuilder. |
GitHubBuilder |
withAppInstallationToken(String appInstallationToken)
Configures
GitHubBuilder with Installation Token generated by the GitHub Application |
GitHubBuilder |
withConnector(HttpConnector connector)
With connector git hub builder.
|
GitHubBuilder |
withEndpoint(String endpoint)
With endpoint git hub builder.
|
GitHubBuilder |
withJwtToken(String jwtToken)
With jwt token git hub builder.
|
GitHubBuilder |
withOAuthToken(String oauthToken)
With o auth token git hub builder.
|
GitHubBuilder |
withOAuthToken(String oauthToken,
String user)
With o auth token git hub builder.
|
GitHubBuilder |
withPassword(String user,
String password)
With password git hub builder.
|
GitHubBuilder |
withProxy(Proxy p)
Configures connector that uses HTTP library in JRE but use a specific
proxy, instead of the system default one.
|
GitHubBuilder |
withRateLimitChecker(RateLimitChecker coreRateLimitChecker)
Adds a
RateLimitChecker to this GitHubBuilder. |
GitHubBuilder |
withRateLimitHandler(RateLimitHandler handler)
Adds a
RateLimitHandler to this GitHubBuilder. |
public static GitHubBuilder fromEnvironment(String loginVariableName, String passwordVariableName, String oauthVariableName) throws IOException
fromEnvironment() to pick up standard set of environment variables, so that different
clients of this library will all recognize one consistent set of coordinates.loginVariableName - the login variable namepasswordVariableName - the password variable nameoauthVariableName - the oauth variable nameIOException - the io exceptionpublic static GitHubBuilder fromEnvironment(String loginVariableName, String passwordVariableName, String oauthVariableName, String endpointVariableName) throws IOException
fromEnvironment() to pick up standard set of environment variables, so that different
clients of this library will all recognize one consistent set of coordinates.loginVariableName - the login variable namepasswordVariableName - the password variable nameoauthVariableName - the oauth variable nameendpointVariableName - the endpoint variable nameIOException - the io exceptionpublic static GitHubBuilder fromEnvironment() throws IOException
GitHubBuilder by picking up coordinates from environment variables.
The following environment variables are recognized:
See class javadoc for the relationship between these coordinates.
For backward compatibility, the following environment variables are recognized but discouraged: login, password, oauth
IOException - the io exceptionpublic static GitHubBuilder fromPropertyFile() throws IOException
IOException - the io exceptionpublic static GitHubBuilder fromPropertyFile(String propertyFileName) throws IOException
propertyFileName - the property file nameIOException - the io exceptionpublic static GitHubBuilder fromProperties(Properties props)
props - the propspublic GitHubBuilder withEndpoint(String endpoint)
endpoint - 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.public GitHubBuilder withPassword(String user, String password)
user - the userpassword - the passwordpublic GitHubBuilder withOAuthToken(String oauthToken)
oauthToken - the oauth tokenpublic GitHubBuilder withOAuthToken(String oauthToken, String user)
oauthToken - the oauth tokenuser - the userpublic GitHubBuilder withAppInstallationToken(String appInstallationToken)
GitHubBuilder with Installation Token generated by the GitHub ApplicationappInstallationToken - A string containing the GitHub App installation tokenGHAppInstallation#createToken(java.util.Map)public GitHubBuilder withJwtToken(String jwtToken)
jwtToken - the jwt tokenpublic GitHubBuilder withConnector(HttpConnector connector)
connector - the connectorpublic GitHubBuilder withRateLimitHandler(RateLimitHandler handler)
RateLimitHandler to this GitHubBuilder.
GitHub allots a certain number of requests to each user or application per period of time (usually per hour). The
number of requests remaining is returned in the response header and can also be requested using
GitHub.getRateLimit(). This requests per interval is referred to as the "rate limit".
When the remaining number of requests reaches zero, the next request will return an error. If this happens,
RateLimitHandler.onError(IOException, HttpURLConnection) will be called.
NOTE: GitHub treats clients that exceed their rate limit very harshly. If possible, clients should avoid
exceeding their rate limit. Consider adding a RateLimitChecker to automatically check the rate limit for
each request and wait if needed.
handler - the handlerwithRateLimitChecker(RateLimitChecker)public GitHubBuilder withAbuseLimitHandler(AbuseLimitHandler handler)
AbuseLimitHandler to this GitHubBuilder.
When a client sends too many requests in a short time span, GitHub may return an error and set a header telling
the client to not make any more request for some period of time. If this happens,
AbuseLimitHandler.onError(IOException, HttpURLConnection) will be called.
handler - the handlerpublic GitHubBuilder withRateLimitChecker(@Nonnull RateLimitChecker coreRateLimitChecker)
RateLimitChecker to this GitHubBuilder.
GitHub allots a certain number of requests to each user or application per period of time (usually per hour). The
number of requests remaining is returned in the response header and can also be requested using
GitHub.getRateLimit(). This requests per interval is referred to as the "rate limit".
GitHub prefers that clients stop before exceeding their rate limit rather than stopping after they exceed it. The
RateLimitChecker is called before each request to check the rate limit and wait if the checker criteria
are met.
Checking your rate limit using GitHub.getRateLimit() does not effect your rate limit, but each
GitHub instance will attempt to cache and reuse the last seen rate limit rather than making a new
request.
coreRateLimitChecker - the RateLimitChecker for core GitHub API requestspublic GitHubBuilder withProxy(Proxy p)
p - the ppublic GitHub build() throws IOException
GitHub instance.IOException - the io exceptionpublic GitHubBuilder clone()
Copyright © 2020. All rights reserved.