Skip to content

Commit

Permalink
Due-diligence & hygiene updates to GitHub.java
Browse files Browse the repository at this point in the history
  • Loading branch information
awittha committed May 23, 2019
1 parent fad203a commit 0848556
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/org/kohsuke/github/GitHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public static GitHub connect() throws IOException {
* @deprecated
* Use {@link #connectToEnterpriseWithOAuth(String, String, String)}
*/
@Deprecated
public static GitHub connectToEnterprise(String apiUrl, String oauthAccessToken) throws IOException {
return connectToEnterpriseWithOAuth(apiUrl,null,oauthAccessToken);
}
Expand All @@ -194,6 +195,7 @@ public static GitHub connectToEnterpriseWithOAuth(String apiUrl, String login, S
* @deprecated
* Use with caution. Login with password is not a preferred method.
*/
@Deprecated
public static GitHub connectToEnterprise(String apiUrl, String login, String password) throws IOException {
return new GitHubBuilder().withEndpoint(apiUrl).withPassword(login, password).build();
}
Expand All @@ -207,6 +209,7 @@ public static GitHub connect(String login, String oauthAccessToken) throws IOExc
* Either OAuth token or password is sufficient, so there's no point in passing both.
* Use {@link #connectUsingPassword(String, String)} or {@link #connectUsingOAuth(String)}.
*/
@Deprecated
public static GitHub connect(String login, String oauthAccessToken, String password) throws IOException {
return new GitHubBuilder().withOAuthToken(oauthAccessToken, login).withPassword(login, password).build();
}
Expand Down Expand Up @@ -380,7 +383,7 @@ public GHMyself getMyself() throws IOException {
requireCredential();
synchronized (this) {
if (this.myself != null) return myself;

GHMyself u = retrieve().to("/user", GHMyself.class);

u.root = this;
Expand All @@ -402,7 +405,7 @@ public GHUser getUser(String login) throws IOException {
return u;
}


/**
* clears all cached data in order for external changes (modifications and del
*/
Expand Down Expand Up @@ -486,6 +489,7 @@ public GHRepository getRepository(String name) throws IOException {
@Preview @Deprecated
public PagedIterable<GHLicense> listLicenses() throws IOException {
return new PagedIterable<GHLicense>() {
@Override
public PagedIterator<GHLicense> _iterator(int pageSize) {
return new PagedIterator<GHLicense>(retrieve().withPreview(DRAX).asIterator("/licenses", GHLicense[].class, pageSize)) {
@Override
Expand All @@ -503,6 +507,7 @@ protected void wrapUp(GHLicense[] page) {
*/
public PagedIterable<GHUser> listUsers() throws IOException {
return new PagedIterable<GHUser>() {
@Override
public PagedIterator<GHUser> _iterator(int pageSize) {
return new PagedIterator<GHUser>(retrieve().asIterator("/users", GHUser[].class, pageSize)) {
@Override
Expand Down Expand Up @@ -620,6 +625,7 @@ public <T extends GHEventPayload> T parseEventPayload(Reader r, Class<T> type) t
* @deprecated
* Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect.
*/
@Deprecated
public GHRepository createRepository(String name, String description, String homepage, boolean isPublic) throws IOException {
return createRepository(name).description(description).homepage(homepage).private_(!isPublic).create();
}
Expand Down Expand Up @@ -855,6 +861,7 @@ public PagedIterable<GHRepository> listAllPublicRepositories() {
*/
public PagedIterable<GHRepository> listAllPublicRepositories(final String since) {
return new PagedIterable<GHRepository>() {
@Override
public PagedIterator<GHRepository> _iterator(int pageSize) {
return new PagedIterator<GHRepository>(retrieve().with("since",since).asIterator("/repositories", GHRepository[].class, pageSize)) {
@Override
Expand Down

0 comments on commit 0848556

Please sign in to comment.