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 d940d43

Browse filesBrowse files
committed
added more event support
1 parent 3ad3dd9 commit d940d43
Copy full SHA for d940d43

File tree

Expand file treeCollapse file tree

4 files changed

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

4 files changed

+55
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHOrganization.java
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,21 @@ public List<GHPullRequest> getPullRequests() throws IOException {
156156
}
157157
return all;
158158
}
159+
160+
/**
161+
* Lists events performed by a user (this includes private events if the caller is authenticated.
162+
*/
163+
public PagedIterable<GHEventInfo> listEvents() throws IOException {
164+
return new PagedIterable<GHEventInfo>() {
165+
public PagedIterator<GHEventInfo> iterator() {
166+
return new PagedIterator<GHEventInfo>(root.retrieve().asIterator(String.format("/orgs/%s/events", login), GHEventInfo[].class)) {
167+
@Override
168+
protected void wrapUp(GHEventInfo[] page) {
169+
for (GHEventInfo c : page)
170+
c.wrapUp(root);
171+
}
172+
};
173+
}
174+
};
175+
}
159176
}

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHPerson.java
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ public GHRepository getRepository(String name) throws IOException {
135135
}
136136
}
137137

138+
/**
139+
* Lists events for an organization or an user.
140+
*/
141+
public abstract PagedIterable<GHEventInfo> listEvents() throws IOException;
142+
138143
/**
139144
* Gravatar ID of this user, like 0cb9832a01c22c083390f3c5dcb64105
140145
*

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHRepository.java
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,22 @@ public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, Strin
528528
.to(String.format("/repos/%s/%s/statuses/%s",owner.login,this.name,sha1),GHCommitStatus.class).wrapUp(root);
529529
}
530530

531+
/**
532+
* Lists repository events.
533+
*/
534+
public PagedIterable<GHEventInfo> listEvents() throws IOException {
535+
return new PagedIterable<GHEventInfo>() {
536+
public PagedIterator<GHEventInfo> iterator() {
537+
return new PagedIterator<GHEventInfo>(root.retrieve().asIterator(String.format("/repos/%s/%s/events", owner.login, name), GHEventInfo[].class)) {
538+
@Override
539+
protected void wrapUp(GHEventInfo[] page) {
540+
for (GHEventInfo c : page)
541+
c.wrapUp(root);
542+
}
543+
};
544+
}
545+
};
546+
}
531547

532548
/**
533549
*

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHUser.java
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,23 @@ public GHPersonSet<GHOrganization> getOrganizations() throws IOException {
103103
return orgs;
104104
}
105105

106+
/**
107+
* Lists events performed by a user (this includes private events if the caller is authenticated.
108+
*/
109+
public PagedIterable<GHEventInfo> listEvents() throws IOException {
110+
return new PagedIterable<GHEventInfo>() {
111+
public PagedIterator<GHEventInfo> iterator() {
112+
return new PagedIterator<GHEventInfo>(root.retrieve().asIterator(String.format("/users/%s/events", login), GHEventInfo[].class)) {
113+
@Override
114+
protected void wrapUp(GHEventInfo[] page) {
115+
for (GHEventInfo c : page)
116+
c.wrapUp(root);
117+
}
118+
};
119+
}
120+
};
121+
}
122+
106123
@Override
107124
public String toString() {
108125
return "User:"+login;

0 commit comments

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