Skip to content

Commit

Permalink
JavaDocs and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman committed Feb 13, 2020
1 parent eb4ce6d commit 7591215
Show file tree
Hide file tree
Showing 36 changed files with 705 additions and 313 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public PagedIterable<GHAppInstallation> listInstallations() {
return root.createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath("/app/installations")
.fetchIterable(GHAppInstallation[].class, item -> item.wrapUp(root));
.toIterable(GHAppInstallation[].class, item -> item.wrapUp(root));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHCommit.java
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public PagedIterable<GHCommitComment> listComments() {
return owner.root.createRequest()
.withUrlPath(
String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha))
.fetchIterable(GHCommitComment[].class, item -> item.wrap(owner));
.toIterable(GHCommitComment[].class, item -> item.wrap(owner));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHCommitComment.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public PagedIterable<GHReaction> listReactions() {
return owner.root.createRequest()
.withPreview(SQUIRREL_GIRL)
.withUrlPath(getApiTail() + "/reactions")
.fetchIterable(GHReaction[].class, item -> item.wrap(owner.root));
.toIterable(GHReaction[].class, item -> item.wrap(owner.root));
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/kohsuke/github/GHCommitQueryBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public GHCommitQueryBuilder until(long timestamp) {
* @return the paged iterable
*/
public PagedIterable<GHCommit> list() {
return req.withUrlPath(repo.getApiTailUrl("commits"))
.fetchIterable(GHCommit[].class, item -> item.wrapUp(repo));
return req.withUrlPath(repo.getApiTailUrl("commits")).toIterable(GHCommit[].class, item -> item.wrapUp(repo));
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public PagedIterable<GHContent> listDirectoryContent() throws IOException {
if (!isDirectory())
throw new IllegalStateException(path + " is not a directory");

return root.createRequest().setRawUrlPath(url).fetchIterable(GHContent[].class, item -> item.wrap(repository));
return root.createRequest().setRawUrlPath(url).toIterable(GHContent[].class, item -> item.wrap(repository));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHDeployment.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public GHDeploymentStatusBuilder createStatus(GHDeploymentState state) {
public PagedIterable<GHDeploymentStatus> listStatuses() {
return root.createRequest()
.withUrlPath(statuses_url)
.fetchIterable(GHDeploymentStatus[].class, item -> item.wrap(owner));
.toIterable(GHDeploymentStatus[].class, item -> item.wrap(owner));
}

}
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHGist.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public GHGist fork() throws IOException {
public PagedIterable<GHGist> listForks() {
return root.createRequest()
.withUrlPath(getApiTailUrl("forks"))
.fetchIterable(GHGist[].class, item -> item.wrapUp(root));
.toIterable(GHGist[].class, item -> item.wrapUp(root));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/kohsuke/github/GHIssue.java
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ public List<GHIssueComment> getComments() throws IOException {
public PagedIterable<GHIssueComment> listComments() throws IOException {
return root.createRequest()
.withUrlPath(getIssuesApiRoute() + "/comments")
.fetchIterable(GHIssueComment[].class, item -> item.wrapUp(this));
.toIterable(GHIssueComment[].class, item -> item.wrapUp(this));
}

@Preview
Expand All @@ -468,7 +468,7 @@ public PagedIterable<GHReaction> listReactions() {
return owner.root.createRequest()
.withPreview(SQUIRREL_GIRL)
.withUrlPath(getApiRoute() + "/reactions")
.fetchIterable(GHReaction[].class, item -> item.wrap(owner.root));
.toIterable(GHReaction[].class, item -> item.wrap(owner.root));
}

/**
Expand Down Expand Up @@ -717,6 +717,6 @@ protected static List<String> getLogins(Collection<GHUser> users) {
public PagedIterable<GHIssueEvent> listEvents() throws IOException {
return root.createRequest()
.withUrlPath(owner.getApiTailUrl(String.format("/issues/%s/events", number)))
.fetchIterable(GHIssueEvent[].class, item -> item.wrapUp(this));
.toIterable(GHIssueEvent[].class, item -> item.wrapUp(this));
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHIssueComment.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public PagedIterable<GHReaction> listReactions() {
return owner.root.createRequest()
.withPreview(SQUIRREL_GIRL)
.withUrlPath(getApiRoute() + "/reactions")
.fetchIterable(GHReaction[].class, item -> item.wrap(owner.root));
.toIterable(GHReaction[].class, item -> item.wrap(owner.root));
}

private String getApiRoute() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public enum Sort {
*/
public PagedIterable<GHMarketplaceAccountPlan> createRequest() throws IOException {
return builder.withUrlPath(String.format("/marketplace_listing/plans/%d/accounts", this.planId))
.fetchIterable(GHMarketplaceAccountPlan[].class, item -> item.wrapUp(root));
.toIterable(GHMarketplaceAccountPlan[].class, item -> item.wrapUp(root));
}

}
4 changes: 2 additions & 2 deletions src/main/java/org/kohsuke/github/GHMyself.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public PagedIterable<GHRepository> listRepositories(final int pageSize, final Re
return root.createRequest()
.with("type", repoType)
.withUrlPath("/user/repos")
.fetchIterable(GHRepository[].class, item -> item.wrap(root))
.toIterable(GHRepository[].class, item -> item.wrap(root))
.withPageSize(pageSize);
}

Expand Down Expand Up @@ -213,7 +213,7 @@ public PagedIterable<GHMembership> listOrgMemberships(final GHMembership.State s
return root.createRequest()
.with("state", state)
.withUrlPath("/user/memberships/orgs")
.fetchIterable(GHMembership[].class, item -> item.wrap(root));
.toIterable(GHMembership[].class, item -> item.wrap(root));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/kohsuke/github/GHNotificationStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ GHThread fetch() {

req.setHeader("If-Modified-Since", lastModified);

GitHubResponse<GHThread[]> response = req.withUrlPath(apiUrl)
.fetchArrayResponse(GHThread[].class);
Requester requester = req.withUrlPath(apiUrl);
GitHubResponse<GHThread[]> response = ((GitHubPageContentsIterable<GHThread>) requester
.toIterable(requester.client, GHThread[].class, null)).toResponse();
threads = response.body();

if (threads == null) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/kohsuke/github/GHOrganization.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public Map<String, GHTeam> getTeams() throws IOException {
public PagedIterable<GHTeam> listTeams() throws IOException {
return root.createRequest()
.withUrlPath(String.format("/orgs/%s/teams", login))
.fetchIterable(GHTeam[].class, item -> item.wrapUp(this));
.toIterable(GHTeam[].class, item -> item.wrapUp(this));
}

/**
Expand Down Expand Up @@ -301,7 +301,7 @@ private PagedIterable<GHUser> listMembers(final String suffix, final String filt
String filterParams = (filter == null) ? "" : ("?filter=" + filter);
return root.createRequest()
.withUrlPath(String.format("/orgs/%s/%s%s", login, suffix, filterParams))
.fetchIterable(GHUser[].class, item -> item.wrapUp(root));
.toIterable(GHUser[].class, item -> item.wrapUp(root));
}

/**
Expand Down Expand Up @@ -330,7 +330,7 @@ public PagedIterable<GHProject> listProjects(final GHProject.ProjectStateFilter
.withPreview(INERTIA)
.with("state", status)
.withUrlPath(String.format("/orgs/%s/projects", login))
.fetchIterable(GHProject[].class, item -> item.wrap(root));
.toIterable(GHProject[].class, item -> item.wrap(root));
}

/**
Expand Down Expand Up @@ -517,7 +517,7 @@ public List<GHPullRequest> getPullRequests() throws IOException {
public PagedIterable<GHEventInfo> listEvents() throws IOException {
return root.createRequest()
.withUrlPath(String.format("/orgs/%s/events", login))
.fetchIterable(GHEventInfo[].class, item -> item.wrapUp(root));
.toIterable(GHEventInfo[].class, item -> item.wrapUp(root));
}

/**
Expand All @@ -532,7 +532,7 @@ public PagedIterable<GHEventInfo> listEvents() throws IOException {
public PagedIterable<GHRepository> listRepositories(final int pageSize) {
return root.createRequest()
.withUrlPath("/orgs/" + login + "/repos")
.fetchIterable(GHRepository[].class, item -> item.wrap(root))
.toIterable(GHRepository[].class, item -> item.wrap(root))
.withPageSize(pageSize);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public PagedIterable<GHRepository> listRepositories() {
public PagedIterable<GHRepository> listRepositories(final int pageSize) {
return root.createRequest()
.withUrlPath("/users/" + login + "/repos")
.fetchIterable(GHRepository[].class, item -> item.wrap(root))
.toIterable(GHRepository[].class, item -> item.wrap(root))
.withPageSize(pageSize);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public PagedIterable<GHProjectColumn> listColumns() throws IOException {
return root.createRequest()
.withPreview(INERTIA)
.withUrlPath(String.format("/projects/%d/columns", id))
.fetchIterable(GHProjectColumn[].class, item -> item.wrap(project));
.toIterable(GHProjectColumn[].class, item -> item.wrap(project));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHProjectColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public PagedIterable<GHProjectCard> listCards() throws IOException {
return root.createRequest()
.withPreview(INERTIA)
.withUrlPath(String.format("/projects/columns/%d/cards", id))
.fetchIterable(GHProjectCard[].class, item -> item.wrap(column));
.toIterable(GHProjectCard[].class, item -> item.wrap(column));
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/kohsuke/github/GHPullRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public void refresh() throws IOException {
public PagedIterable<GHPullRequestFileDetail> listFiles() {
return root.createRequest()
.withUrlPath(String.format("%s/files", getApiRoute()))
.fetchIterable(GHPullRequestFileDetail[].class, null);
.toIterable(GHPullRequestFileDetail[].class, null);
}

/**
Expand All @@ -406,7 +406,7 @@ public PagedIterable<GHPullRequestFileDetail> listFiles() {
public PagedIterable<GHPullRequestReview> listReviews() {
return root.createRequest()
.withUrlPath(String.format("%s/reviews", getApiRoute()))
.fetchIterable(GHPullRequestReview[].class, item -> item.wrapUp(this));
.toIterable(GHPullRequestReview[].class, item -> item.wrapUp(this));
}

/**
Expand All @@ -419,7 +419,7 @@ public PagedIterable<GHPullRequestReview> listReviews() {
public PagedIterable<GHPullRequestReviewComment> listReviewComments() throws IOException {
return root.createRequest()
.withUrlPath(getApiRoute() + COMMENTS_ACTION)
.fetchIterable(GHPullRequestReviewComment[].class, item -> item.wrapUp(this));
.toIterable(GHPullRequestReviewComment[].class, item -> item.wrapUp(this));
}

/**
Expand All @@ -430,7 +430,7 @@ public PagedIterable<GHPullRequestReviewComment> listReviewComments() throws IOE
public PagedIterable<GHPullRequestCommitDetail> listCommits() {
return root.createRequest()
.withUrlPath(String.format("%s/commits", getApiRoute()))
.fetchIterable(GHPullRequestCommitDetail[].class, item -> item.wrapUp(this));
.toIterable(GHPullRequestCommitDetail[].class, item -> item.wrapUp(this));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ public GHPullRequestQueryBuilder direction(GHDirection d) {
public PagedIterable<GHPullRequest> list() {
return req.withPreview(SHADOW_CAT)
.withUrlPath(repo.getApiTailUrl("pulls"))
.fetchIterable(GHPullRequest[].class, item -> item.wrapUp(repo));
.toIterable(GHPullRequest[].class, item -> item.wrapUp(repo));
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHPullRequestReview.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,6 @@ public void dismiss(String message) throws IOException {
public PagedIterable<GHPullRequestReviewComment> listReviewComments() throws IOException {
return owner.root.createRequest()
.withUrlPath(getApiRoute() + "/comments")
.fetchIterable(GHPullRequestReviewComment[].class, item -> item.wrapUp(owner));
.toIterable(GHPullRequestReviewComment[].class, item -> item.wrapUp(owner));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,6 @@ public PagedIterable<GHReaction> listReactions() {
return owner.root.createRequest()
.withPreview(SQUIRREL_GIRL)
.withUrlPath(getApiRoute() + "/reactions")
.fetchIterable(GHReaction[].class, item -> item.wrap(owner.root));
.toIterable(GHReaction[].class, item -> item.wrap(owner.root));
}
}
Loading

0 comments on commit 7591215

Please sign in to comment.