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 d22c77c

Browse filesBrowse files
method for listing repositories for a GHAppInstallation
1 parent 3a11b7c commit d22c77c
Copy full SHA for d22c77c

File tree

Expand file treeCollapse file tree

1 file changed

+32
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+32
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHAppInstallation.java
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
import com.fasterxml.jackson.annotation.JsonProperty;
44

55
import java.io.IOException;
6+
import java.net.MalformedURLException;
67
import java.net.URL;
78
import java.util.List;
89
import java.util.Map;
910

1011
import static org.kohsuke.github.Previews.GAMBIT;
12+
import static org.kohsuke.github.Previews.MACHINE_MAN;
1113

1214
/**
1315
* A Github App Installation.
@@ -117,6 +119,36 @@ public String getRepositoriesUrl() {
117119
return repositoriesUrl;
118120
}
119121

122+
/**
123+
* List repositories that this app installation can access.
124+
*
125+
* @return the paged iterable
126+
*/
127+
@Preview
128+
@Deprecated
129+
public PagedSearchIterable<GHRepository> listRepositories() {
130+
GitHubRequest request;
131+
132+
try {
133+
request = root.createRequest().withPreview(MACHINE_MAN).withUrlPath("/installation/repositories").build();
134+
} catch (MalformedURLException e) {
135+
throw new GHException("", e);
136+
}
137+
138+
return new PagedSearchIterable<>(root, request, GHAppInstallationRepositoryResult.class);
139+
}
140+
141+
private static class GHAppInstallationRepositoryResult extends SearchResult<GHRepository> {
142+
private GHRepository[] repositories;
143+
144+
@Override
145+
GHRepository[] getItems(GitHub root) {
146+
for (GHRepository item : repositories)
147+
item.wrap(root);
148+
return repositories;
149+
}
150+
}
151+
120152
/**
121153
* Sets repositories url.
122154
*

0 commit comments

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