mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
Merge pull request #389
This commit is contained in:
@@ -166,6 +166,16 @@ public class GitHub {
|
||||
return GitHubBuilder.fromCredentials().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Version that connects to GitHub Enterprise.
|
||||
*
|
||||
* @deprecated
|
||||
* Use {@link #connectToEnterpriseWithOAuth(String, String, String)}
|
||||
*/
|
||||
public static GitHub connectToEnterprise(String apiUrl, String oauthAccessToken) throws IOException {
|
||||
return connectToEnterpriseWithOAuth(apiUrl,null,oauthAccessToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* Version that connects to GitHub Enterprise.
|
||||
*
|
||||
@@ -174,10 +184,16 @@ public class GitHub {
|
||||
* "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has <tt>/api/v3</tt> in the URL.
|
||||
* For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated.
|
||||
*/
|
||||
public static GitHub connectToEnterprise(String apiUrl, String oauthAccessToken) throws IOException {
|
||||
return new GitHubBuilder().withEndpoint(apiUrl).withOAuthToken(oauthAccessToken).build();
|
||||
public static GitHub connectToEnterpriseWithOAuth(String apiUrl, String login, String oauthAccessToken) throws IOException {
|
||||
return new GitHubBuilder().withEndpoint(apiUrl).withOAuthToken(oauthAccessToken, login).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Version that connects to GitHub Enterprise.
|
||||
*
|
||||
* @deprecated
|
||||
* Use with caution. Login with password is not a preferred method.
|
||||
*/
|
||||
public static GitHub connectToEnterprise(String apiUrl, String login, String password) throws IOException {
|
||||
return new GitHubBuilder().withEndpoint(apiUrl).withPassword(login, password).build();
|
||||
}
|
||||
|
||||
@@ -154,6 +154,12 @@ public class GitHubBuilder {
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param 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 <tt>/api/v3</tt> in the URL.
|
||||
* For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated.
|
||||
*/
|
||||
public GitHubBuilder withEndpoint(String endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user