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 ec20e51

Browse filesBrowse files
committed
adding a new payload implementation for PushEvent
1 parent 930a582 commit ec20e51
Copy full SHA for ec20e51

File tree

Expand file treeCollapse file tree

1 file changed

+80
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+80
-2
lines changed

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHEventPayload.java
+80-2Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package org.kohsuke.github;
22

33
import java.io.Reader;
4+
import java.util.List;
45

56
/**
67
* Base type for types used in databinding of the event payload.
78
*
89
* @see GitHub#parseEventPayload(Reader, Class)
910
* @see GHEventInfo#getPayload(Class)
1011
*/
12+
@SuppressWarnings("UnusedDeclaration")
1113
public abstract class GHEventPayload {
1214
protected GitHub root;
1315

@@ -21,7 +23,7 @@ public abstract class GHEventPayload {
2123
/**
2224
* A pull request status has changed.
2325
*
24-
* @see http://developer.github.com/v3/activity/events/types/#pullrequestevent
26+
* @see <a href="http://developer.github.com/v3/activity/events/types/#pullrequestevent">authoritative source</a>
2527
*/
2628
public static class PullRequest extends GHEventPayload {
2729
private String action;
@@ -61,7 +63,7 @@ void wrapUp(GitHub root) {
6163
/**
6264
* A comment was added to an issue
6365
*
64-
* @see http://developer.github.com/v3/activity/events/types/#issuecommentevent
66+
* @see <a href="http://developer.github.com/v3/activity/events/types/#issuecommentevent">authoritative source</a>
6567
*/
6668
public static class IssueComment extends GHEventPayload {
6769
private String action;
@@ -105,4 +107,80 @@ void wrapUp(GitHub root) {
105107
comment.wrapUp(issue);
106108
}
107109
}
110+
111+
/**
112+
* A commit was pushed.
113+
*
114+
* @see <a href="http://developer.github.com/v3/activity/events/types/#pushevent">authoritative source</a>
115+
*/
116+
public static class Push extends GHEventPayload {
117+
private String head;
118+
String ref;
119+
int size;
120+
List<PushCommit> commits;
121+
122+
/**
123+
* The SHA of the HEAD commit on the repository
124+
*/
125+
public String getHead() {
126+
return head;
127+
}
128+
129+
/**
130+
* The full Git ref that was pushed. Example: “refs/heads/master”
131+
*/
132+
public String getRef() {
133+
return ref;
134+
}
135+
136+
/**
137+
* The number of commits in the push.
138+
* Is this always the same as {@code getCommits().size()}?
139+
*/
140+
public int getSize() {
141+
return size;
142+
}
143+
144+
/**
145+
* The list of pushed commits.
146+
*/
147+
public List<PushCommit> getCommits() {
148+
return commits;
149+
}
150+
151+
/**
152+
* Commit in a push
153+
*/
154+
public static class PushCommit {
155+
private GitUser author;
156+
private String url, sha, message;
157+
private boolean distinct;
158+
159+
public GitUser getAuthor() {
160+
return author;
161+
}
162+
163+
/**
164+
* Points to the commit API resource.
165+
*/
166+
public String getUrl() {
167+
return url;
168+
}
169+
170+
public String getSha() {
171+
return sha;
172+
}
173+
174+
public String getMessage() {
175+
return message;
176+
}
177+
178+
/**
179+
* Whether this commit is distinct from any that have been pushed before.
180+
*/
181+
public boolean isDistinct() {
182+
return distinct;
183+
}
184+
}
185+
}
108186
}

0 commit comments

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