mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-18 08:21:22 +00:00
Compare commits
7 Commits
github-api
...
github-api
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83a718c9db | ||
|
|
2abf03ccb7 | ||
|
|
a59810a487 | ||
|
|
9cc9e06ad1 | ||
|
|
0108a0c146 | ||
|
|
4188758d84 | ||
|
|
2144100f81 |
2
pom.xml
2
pom.xml
@@ -7,7 +7,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>github-api</artifactId>
|
<artifactId>github-api</artifactId>
|
||||||
<version>1.46</version>
|
<version>1.47</version>
|
||||||
<name>GitHub API for Java</name>
|
<name>GitHub API for Java</name>
|
||||||
<url>http://github-api.kohsuke.org/</url>
|
<url>http://github-api.kohsuke.org/</url>
|
||||||
<description>GitHub API for Java</description>
|
<description>GitHub API for Java</description>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ package org.kohsuke.github;
|
|||||||
* See http://developer.github.com/v3/events/types/
|
* See http://developer.github.com/v3/events/types/
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
* @author Kohsuke Kawaguchi
|
||||||
|
* @see GHEventInfo
|
||||||
*/
|
*/
|
||||||
public enum GHEvent {
|
public enum GHEvent {
|
||||||
COMMIT_COMMENT,
|
COMMIT_COMMENT,
|
||||||
@@ -22,6 +23,7 @@ public enum GHEvent {
|
|||||||
MEMBER,
|
MEMBER,
|
||||||
PUBLIC,
|
PUBLIC,
|
||||||
PULL_REQUEST,
|
PULL_REQUEST,
|
||||||
|
PULL_REQUEST_REVIEW_COMMENT,
|
||||||
PUSH,
|
PUSH,
|
||||||
TEAM_ADD,
|
TEAM_ADD,
|
||||||
WATCH
|
WATCH
|
||||||
|
|||||||
@@ -143,7 +143,24 @@ public class GHRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<GHIssue> getIssues(GHIssueState state) throws IOException {
|
public List<GHIssue> getIssues(GHIssueState state) throws IOException {
|
||||||
return Arrays.asList(GHIssue.wrap(root.retrieve().to("/repos/" + owner.login + "/" + name + "/issues?state=" + state.toString().toLowerCase(), GHIssue[].class), this));
|
return listIssues(state).asList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists up all the issues in this repository.
|
||||||
|
*/
|
||||||
|
public PagedIterable<GHIssue> listIssues(final GHIssueState state) {
|
||||||
|
return new PagedIterable<GHIssue>() {
|
||||||
|
public PagedIterator<GHIssue> iterator() {
|
||||||
|
return new PagedIterator<GHIssue>(root.retrieve().asIterator(getApiTailUrl("issues?state="+state.toString().toLowerCase(Locale.ENGLISH)), GHIssue[].class)) {
|
||||||
|
@Override
|
||||||
|
protected void wrapUp(GHIssue[] page) {
|
||||||
|
for (GHIssue c : page)
|
||||||
|
c.wrap(GHRepository.this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public GHReleaseBuilder createRelease(String tag) {
|
public GHReleaseBuilder createRelease(String tag) {
|
||||||
|
|||||||
@@ -79,6 +79,12 @@ public class AppTest extends TestCase {
|
|||||||
o.close();
|
o.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testGetIssues() throws Exception {
|
||||||
|
List<GHIssue> closedIssues = gitHub.getUser("kohsuke").getRepository("github-api").getIssues(GHIssueState.CLOSED);
|
||||||
|
// prior to using PagedIterable GHRepository.getIssues(GHIssueState) would only retrieve 30 issues
|
||||||
|
assertTrue(closedIssues.size() > 30);
|
||||||
|
}
|
||||||
|
|
||||||
public void testRateLimit() throws IOException {
|
public void testRateLimit() throws IOException {
|
||||||
System.out.println(gitHub.getRateLimit());
|
System.out.println(gitHub.getRateLimit());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user