diff --git a/src/main/java/org/kohsuke/github/GitHub.java b/src/main/java/org/kohsuke/github/GitHub.java
index 62c1b4e80c..60fe15e493 100644
--- a/src/main/java/org/kohsuke/github/GitHub.java
+++ b/src/main/java/org/kohsuke/github/GitHub.java
@@ -166,6 +166,16 @@ public static GitHub connect() throws IOException {
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 static GitHub connect() throws IOException {
* "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 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();
}
diff --git a/src/main/java/org/kohsuke/github/GitHubBuilder.java b/src/main/java/org/kohsuke/github/GitHubBuilder.java
index 62a99a6272..e54359892c 100644
--- a/src/main/java/org/kohsuke/github/GitHubBuilder.java
+++ b/src/main/java/org/kohsuke/github/GitHubBuilder.java
@@ -154,6 +154,12 @@ public static GitHubBuilder fromProperties(Properties props) {
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 /api/v3 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;