1
1
package org .kohsuke .github ;
2
2
3
3
import java .io .Reader ;
4
+ import java .util .List ;
4
5
5
6
/**
6
7
* Base type for types used in databinding of the event payload.
7
8
*
8
9
* @see GitHub#parseEventPayload(Reader, Class)
9
10
* @see GHEventInfo#getPayload(Class)
10
11
*/
12
+ @ SuppressWarnings ("UnusedDeclaration" )
11
13
public abstract class GHEventPayload {
12
14
protected GitHub root ;
13
15
@@ -21,7 +23,7 @@ public abstract class GHEventPayload {
21
23
/**
22
24
* A pull request status has changed.
23
25
*
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>
25
27
*/
26
28
public static class PullRequest extends GHEventPayload {
27
29
private String action ;
@@ -61,7 +63,7 @@ void wrapUp(GitHub root) {
61
63
/**
62
64
* A comment was added to an issue
63
65
*
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>
65
67
*/
66
68
public static class IssueComment extends GHEventPayload {
67
69
private String action ;
@@ -105,4 +107,80 @@ void wrapUp(GitHub root) {
105
107
comment .wrapUp (issue );
106
108
}
107
109
}
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
+ }
108
186
}
0 commit comments