Skip to content

Commit 01f8dfa

Browse files
committed
Remove extraneous classes
1 parent 024cb8f commit 01f8dfa

12 files changed

+39
-145
lines changed

src/main/java/org/kohsuke/github/GHAppInstallationsIterable.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/main/java/org/kohsuke/github/GHArtifactsIterable.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/main/java/org/kohsuke/github/GHCheckRunsIterable.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/main/java/org/kohsuke/github/GHMyself.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public enum RepositoryListFilter {
3838
PUBLIC;
3939
}
4040

41+
/** The Constant APP_INSTALLATIONS_URL. */
42+
public static final String APP_INSTALLATIONS_URL = "/user/installations";
43+
4144
/**
4245
* Create default GHMyself instance
4346
*/
@@ -110,7 +113,11 @@ public synchronized Map<String, GHRepository> getAllRepositories() {
110113
* app installations accessible to the user access token</a>
111114
*/
112115
public PagedIterable<GHAppInstallation> getAppInstallations() {
113-
return new GHAppInstallationsIterable(root());
116+
return new PagedIterable<>(new PaginatedEndpoint<>(root().getClient(),
117+
root().createRequest().withUrlPath(APP_INSTALLATIONS_URL).build(),
118+
GHAppInstallationsPage.class,
119+
GHAppInstallation.class,
120+
null));
114121
}
115122

116123
/**

src/main/java/org/kohsuke/github/GHRepository.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,8 @@ public PagedIterable<GHCheckRun> getCheckRuns(String ref) {
11921192
GitHubRequest request = root().createRequest()
11931193
.withUrlPath(String.format("/repos/%s/%s/commits/%s/check-runs", getOwnerName(), name, ref))
11941194
.build();
1195-
return new GHCheckRunsIterable(this, request);
1195+
return new PagedIterable<>(new PaginatedEndpoint<>(root()
1196+
.getClient(), request, GHCheckRunsPage.class, GHCheckRun.class, item -> item.wrap(this)));
11961197
}
11971198

11981199
/**
@@ -1211,7 +1212,8 @@ public PagedIterable<GHCheckRun> getCheckRuns(String ref, Map<String, Object> pa
12111212
.withUrlPath(String.format("/repos/%s/%s/commits/%s/check-runs", getOwnerName(), name, ref))
12121213
.with(params)
12131214
.build();
1214-
return new GHCheckRunsIterable(this, request);
1215+
return new PagedIterable<>(new PaginatedEndpoint<>(root()
1216+
.getClient(), request, GHCheckRunsPage.class, GHCheckRun.class, item -> item.wrap(this)));
12151217
}
12161218

12171219
/**
@@ -2548,7 +2550,11 @@ public boolean isVulnerabilityAlertsEnabled() throws IOException {
25482550
* @return the paged iterable
25492551
*/
25502552
public PagedIterable<GHArtifact> listArtifacts() {
2551-
return new GHArtifactsIterable(this, root().createRequest().withUrlPath(getApiTailUrl("actions/artifacts")));
2553+
return new PagedIterable<>(new PaginatedEndpoint<>(this.root().getClient(),
2554+
root().createRequest().withUrlPath(getApiTailUrl("actions/artifacts")).build(),
2555+
GHArtifactsPage.class,
2556+
GHArtifact.class,
2557+
item -> item.wrapUp(this)));
25522558
}
25532559

25542560
/**
@@ -2956,7 +2962,11 @@ public List<String> listTopics() throws IOException {
29562962
* @return the paged iterable
29572963
*/
29582964
public PagedIterable<GHWorkflow> listWorkflows() {
2959-
return new GHWorkflowsIterable(this);
2965+
return new PagedIterable<>(new PaginatedEndpoint<>(root().getClient(),
2966+
root().createRequest().withUrlPath(getApiTailUrl("actions/workflows")).build(),
2967+
GHWorkflowsPage.class,
2968+
GHWorkflow.class,
2969+
item -> item.wrapUp(this)));
29602970
}
29612971

29622972
/**

src/main/java/org/kohsuke/github/GHWorkflow.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ public String getState() {
153153
* @return the paged iterable
154154
*/
155155
public PagedIterable<GHWorkflowRun> listRuns() {
156-
return new GHWorkflowRunsIterable(owner, root().createRequest().withUrlPath(getApiRoute(), "runs"));
156+
return new PagedIterable<>(new PaginatedEndpoint<>(owner.root().getClient(),
157+
root().createRequest().withUrlPath(getApiRoute(), "runs").build(),
158+
GHWorkflowRunsPage.class,
159+
GHWorkflowRun.class,
160+
item -> item.wrapUp(owner)));
157161
}
158162

159163
private String getApiRoute() {

src/main/java/org/kohsuke/github/GHWorkflowJobQueryBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public GHWorkflowJobQueryBuilder latest() {
4848
*/
4949
@Override
5050
public PagedIterable<GHWorkflowJob> list() {
51-
return new GHWorkflowJobsIterable(repo, req.build());
51+
return new PagedIterable<>(new PaginatedEndpoint<>(repo.root()
52+
.getClient(), req.build(), GHWorkflowJobsPage.class, GHWorkflowJob.class, item -> item.wrapUp(repo)));
5253
}
5354
}

src/main/java/org/kohsuke/github/GHWorkflowJobsIterable.java

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/main/java/org/kohsuke/github/GHWorkflowRun.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,11 @@ public PagedIterable<GHWorkflowJob> listAllJobs() {
558558
* @return the paged iterable
559559
*/
560560
public PagedIterable<GHArtifact> listArtifacts() {
561-
return new GHArtifactsIterable(owner, root().createRequest().withUrlPath(getApiRoute(), "artifacts"));
561+
return new PagedIterable<>(new PaginatedEndpoint<>(owner.root().getClient(),
562+
root().createRequest().withUrlPath(getApiRoute(), "artifacts").build(),
563+
GHArtifactsPage.class,
564+
GHArtifact.class,
565+
item -> item.wrapUp(owner)));
562566
}
563567

564568
/**

src/main/java/org/kohsuke/github/GHWorkflowRunQueryBuilder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ public GHWorkflowRunQueryBuilder headSha(String headSha) {
133133
*/
134134
@Override
135135
public PagedIterable<GHWorkflowRun> list() {
136-
return new GHWorkflowRunsIterable(repo, req.withUrlPath(repo.getApiTailUrl("actions/runs")));
136+
return new PagedIterable<>(new PaginatedEndpoint<>(repo.root().getClient(),
137+
req.withUrlPath(repo.getApiTailUrl("actions/runs")).build(),
138+
GHWorkflowRunsPage.class,
139+
GHWorkflowRun.class,
140+
item -> item.wrapUp(repo)));
137141
}
138142

139143
/**

src/main/java/org/kohsuke/github/GHWorkflowRunsIterable.java

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/java/org/kohsuke/github/GHWorkflowsIterable.java

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)