Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4849619

Browse filesBrowse files
committed
None of the connectToEnterprise methods are preferrable so document accordingly
1 parent 46dce17 commit 4849619
Copy full SHA for 4849619

File tree

Expand file treeCollapse file tree

2 files changed

+22
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+22
-4
lines changed

‎src/main/java/org/kohsuke/github/GitHub.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GitHub.java
+16-4Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ public static GitHub connect() throws IOException {
166166
return GitHubBuilder.fromCredentials().build();
167167
}
168168

169+
/**
170+
* Version that connects to GitHub Enterprise.
171+
*
172+
* @deprecated
173+
* Use {@link #connectToEnterpriseWithOAuth(String, String, String)}
174+
*/
175+
public static GitHub connectToEnterprise(String apiUrl, String oauthAccessToken) throws IOException {
176+
return connectToEnterpriseWithOAuth(apiUrl,null,oauthAccessToken);
177+
}
178+
169179
/**
170180
* Version that connects to GitHub Enterprise.
171181
*
@@ -174,14 +184,16 @@ public static GitHub connect() throws IOException {
174184
* "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has <tt>/api/v3</tt> in the URL.
175185
* For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated.
176186
*/
177-
public static GitHub connectToEnterprise(String apiUrl, String oauthAccessToken) throws IOException {
178-
return new GitHubBuilder().withEndpoint(apiUrl).withOAuthToken(oauthAccessToken).build();
179-
}
180-
181187
public static GitHub connectToEnterpriseWithOAuth(String apiUrl, String login, String oauthAccessToken) throws IOException {
182188
return new GitHubBuilder().withEndpoint(apiUrl).withOAuthToken(oauthAccessToken, login).build();
183189
}
184190

191+
/**
192+
* Version that connects to GitHub Enterprise.
193+
*
194+
* @deprecated
195+
* Use with caution. Login with password is not a preferred method.
196+
*/
185197
public static GitHub connectToEnterprise(String apiUrl, String login, String password) throws IOException {
186198
return new GitHubBuilder().withEndpoint(apiUrl).withPassword(login, password).build();
187199
}

‎src/main/java/org/kohsuke/github/GitHubBuilder.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GitHubBuilder.java
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ public static GitHubBuilder fromProperties(Properties props) {
154154
return self;
155155
}
156156

157+
/**
158+
* @param endpoint
159+
* The URL of GitHub (or GitHub enterprise) API endpoint, such as "https://api.github.com" or
160+
* "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has <tt>/api/v3</tt> in the URL.
161+
* For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated.
162+
*/
157163
public GitHubBuilder withEndpoint(String endpoint) {
158164
this.endpoint = endpoint;
159165
return this;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.