Skip to content

Commit da424c8

Browse files
committed
Remove extraneous classes
1 parent 024cb8f commit da424c8

11 files changed

+35
-123
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/GHMyself.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ public synchronized Map<String, GHRepository> getAllRepositories() {
9999
return Collections.unmodifiableMap(repositories);
100100
}
101101

102+
/** The Constant APP_INSTALLATIONS_URL. */
103+
public static final String APP_INSTALLATIONS_URL = "/user/installations";
104+
102105
/**
103106
* Lists installations of your GitHub App that the authenticated user has explicit permission to access. You must
104107
* use a user-to-server OAuth access token, created for a user who has authorized your GitHub App, to access this
@@ -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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2548,7 +2548,11 @@ public boolean isVulnerabilityAlertsEnabled() throws IOException {
25482548
* @return the paged iterable
25492549
*/
25502550
public PagedIterable<GHArtifact> listArtifacts() {
2551-
return new GHArtifactsIterable(this, root().createRequest().withUrlPath(getApiTailUrl("actions/artifacts")));
2551+
return new PagedIterable<>(new PaginatedEndpoint<>(this.root().getClient(),
2552+
root().createRequest().withUrlPath(getApiTailUrl("actions/artifacts")).build(),
2553+
GHArtifactsPage.class,
2554+
GHArtifact.class,
2555+
item -> item.wrapUp(this)));
25522556
}
25532557

25542558
/**
@@ -2956,7 +2960,11 @@ public List<String> listTopics() throws IOException {
29562960
* @return the paged iterable
29572961
*/
29582962
public PagedIterable<GHWorkflow> listWorkflows() {
2959-
return new GHWorkflowsIterable(this);
2963+
return new PagedIterable<>(new PaginatedEndpoint<>(root().getClient(),
2964+
root().createRequest().withUrlPath(getApiTailUrl("actions/workflows")).build(),
2965+
GHWorkflowsPage.class,
2966+
GHWorkflow.class,
2967+
item -> item.wrapUp(this)));
29602968
}
29612969

29622970
/**

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)