Skip to content

Commit 29b8d04

Browse files
committed
Brought into spec with latest GitLab API docs (#357).
1 parent c987485 commit 29b8d04

File tree

10 files changed

+403
-129
lines changed

10 files changed

+403
-129
lines changed

src/main/java/org/gitlab4j/api/models/Job.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public class Job {
2525
private String webUrl;
2626
private String stage;
2727
private JobStatus status;
28+
private String when;
29+
private Boolean manual;
2830

2931
public Integer getId() {
3032
return id;
@@ -170,6 +172,22 @@ public void setRunner(Runner runner) {
170172
this.runner = runner;
171173
}
172174

175+
public String getWhen() {
176+
return when;
177+
}
178+
179+
public void setWhen(String when) {
180+
this.when = when;
181+
}
182+
183+
public Boolean getManual() {
184+
return manual;
185+
}
186+
187+
public void setManual(Boolean manual) {
188+
this.manual = manual;
189+
}
190+
173191
public Job withId(Integer id) {
174192
this.id = id;
175193
return this;
@@ -245,6 +263,16 @@ public Job withStatus(JobStatus status) {
245263
return this;
246264
}
247265

266+
public Job withWhen(String when) {
267+
this.when = when;
268+
return this;
269+
}
270+
271+
public Job withManual(Boolean manual) {
272+
this.manual = manual;
273+
return this;
274+
}
275+
248276
@Override
249277
public String toString() {
250278
return (JacksonJson.toJsonString(this));

src/main/java/org/gitlab4j/api/models/JobStatus.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*/
3434
public enum JobStatus {
3535

36-
RUNNING, PENDING, SUCCESS, FAILED, CANCELED, SKIPPED, MANUAL;
36+
CREATED, RUNNING, PENDING, SUCCESS, FAILED, CANCELED, SKIPPED, MANUAL;
3737

3838
private static JacksonJsonEnumHelper<JobStatus> enumHelper = new JacksonJsonEnumHelper<>(JobStatus.class);
3939

src/main/java/org/gitlab4j/api/webhook/Event.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
include=JsonTypeInfo.As.PROPERTY,
99
property="object_kind")
1010
@JsonSubTypes({
11-
@JsonSubTypes.Type(value = BuildEvent.class, name = BuildEvent.OBJECT_KIND),
1211
@JsonSubTypes.Type(value = IssueEvent.class, name = IssueEvent.OBJECT_KIND),
12+
@JsonSubTypes.Type(value = JobEvent.class, name = JobEvent.OBJECT_KIND),
1313
@JsonSubTypes.Type(value = MergeRequestEvent.class, name = MergeRequestEvent.OBJECT_KIND),
1414
@JsonSubTypes.Type(value = NoteEvent.class, name = NoteEvent.OBJECT_KIND),
1515
@JsonSubTypes.Type(value = PipelineEvent.class, name = PipelineEvent.OBJECT_KIND),
Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
package org.gitlab4j.api.webhook;
2+
3+
import java.util.Date;
4+
5+
import org.gitlab4j.api.models.User;
6+
import org.gitlab4j.api.utils.JacksonJson;
7+
8+
public class JobEvent extends AbstractEvent {
9+
10+
public static final String JOB_HOOK_X_GITLAB_EVENT = "Job Hook";
11+
public static final String OBJECT_KIND = "job";
12+
13+
private String ref;
14+
private Boolean tag;
15+
private String beforeSha;
16+
private String sha;
17+
private Integer jobId;
18+
private String jobName;
19+
private String jobStage;
20+
private String jobStatus;
21+
private Date jobStarted_at;
22+
private Date jobFinished_at;
23+
private Integer jobDuration;
24+
private Boolean jobAllowFailure;
25+
private String jobFailureReason;
26+
private Integer projectId;
27+
private String projectName;
28+
private User user;
29+
private JobCommit commit;
30+
private EventRepository repository;
31+
32+
public String getObjectKind() {
33+
return (OBJECT_KIND);
34+
}
35+
36+
public void setObjectKind(String objectKind) {
37+
if (!OBJECT_KIND.equals(objectKind))
38+
throw new RuntimeException("Invalid object_kind (" + objectKind + "), must be '" + OBJECT_KIND + "'");
39+
}
40+
41+
public String getRef() {
42+
return ref;
43+
}
44+
45+
public void setRef(String ref) {
46+
this.ref = ref;
47+
}
48+
49+
public Boolean getTag() {
50+
return tag;
51+
}
52+
53+
public void setTag(Boolean tag) {
54+
this.tag = tag;
55+
}
56+
57+
public String getBeforeSha() {
58+
return beforeSha;
59+
}
60+
61+
public void setBeforeSha(String beforeSha) {
62+
this.beforeSha = beforeSha;
63+
}
64+
65+
public String getSha() {
66+
return sha;
67+
}
68+
69+
public void setSha(String sha) {
70+
this.sha = sha;
71+
}
72+
73+
public Integer getJobId() {
74+
return jobId;
75+
}
76+
77+
public void setJobId(Integer jobId) {
78+
this.jobId = jobId;
79+
}
80+
81+
public String getJobName() {
82+
return jobName;
83+
}
84+
85+
public void setJobName(String jobName) {
86+
this.jobName = jobName;
87+
}
88+
89+
public String getJobStage() {
90+
return jobStage;
91+
}
92+
93+
public void setJobStage(String jobStage) {
94+
this.jobStage = jobStage;
95+
}
96+
97+
public String getJobStatus() {
98+
return jobStatus;
99+
}
100+
101+
public void setJobStatus(String jobStatus) {
102+
this.jobStatus = jobStatus;
103+
}
104+
105+
public Date getJobStarted_at() {
106+
return jobStarted_at;
107+
}
108+
109+
public void setJobStarted_at(Date jobStarted_at) {
110+
this.jobStarted_at = jobStarted_at;
111+
}
112+
113+
public Date getJobFinished_at() {
114+
return jobFinished_at;
115+
}
116+
117+
public void setJobFinished_at(Date jobFinished_at) {
118+
this.jobFinished_at = jobFinished_at;
119+
}
120+
121+
public Integer getJobDuration() {
122+
return jobDuration;
123+
}
124+
125+
public void setJobDuration(Integer jobDuration) {
126+
this.jobDuration = jobDuration;
127+
}
128+
129+
public Boolean getJobAllowFailure() {
130+
return jobAllowFailure;
131+
}
132+
133+
public void setJobAllowFailure(Boolean jobAllowFailure) {
134+
this.jobAllowFailure = jobAllowFailure;
135+
}
136+
137+
public String getJobFailureReason() {
138+
return jobFailureReason;
139+
}
140+
141+
public void setJobFailureReason(String jobFailureReason) {
142+
this.jobFailureReason = jobFailureReason;
143+
}
144+
145+
public Integer getProjectId() {
146+
return projectId;
147+
}
148+
149+
public void setProjectId(Integer projectId) {
150+
this.projectId = projectId;
151+
}
152+
153+
public String getProjectName() {
154+
return projectName;
155+
}
156+
157+
public void setProjectName(String projectName) {
158+
this.projectName = projectName;
159+
}
160+
161+
public User getUser() {
162+
return user;
163+
}
164+
165+
public void setUser(User user) {
166+
this.user = user;
167+
}
168+
169+
public JobCommit getCommit() {
170+
return commit;
171+
}
172+
173+
public void setCommit(JobCommit commit) {
174+
this.commit = commit;
175+
}
176+
177+
public EventRepository getRepository() {
178+
return repository;
179+
}
180+
181+
public void setRepository(EventRepository repository) {
182+
this.repository = repository;
183+
}
184+
185+
public class JobCommit {
186+
187+
private Integer id;
188+
private String sha;
189+
private String message;
190+
private String authorName;
191+
private String authorEmail;
192+
private String status;
193+
private Integer duration;
194+
private Date startedAt;
195+
private Date finishedAt;
196+
197+
public Integer getId() {
198+
return id;
199+
}
200+
201+
public void setId(Integer id) {
202+
this.id = id;
203+
}
204+
205+
public String getSha() {
206+
return sha;
207+
}
208+
209+
public void setSha(String sha) {
210+
this.sha = sha;
211+
}
212+
213+
public String getMessage() {
214+
return message;
215+
}
216+
217+
public void setMessage(String message) {
218+
this.message = message;
219+
}
220+
221+
public String getAuthorName() {
222+
return authorName;
223+
}
224+
225+
public void setAuthorName(String authorName) {
226+
this.authorName = authorName;
227+
}
228+
229+
public String getAuthorEmail() {
230+
return authorEmail;
231+
}
232+
233+
public void setAuthorEmail(String authorEmail) {
234+
this.authorEmail = authorEmail;
235+
}
236+
237+
public String getStatus() {
238+
return status;
239+
}
240+
241+
public void setStatus(String status) {
242+
this.status = status;
243+
}
244+
245+
public Integer getDuration() {
246+
return duration;
247+
}
248+
249+
public void setDuration(Integer duration) {
250+
this.duration = duration;
251+
}
252+
253+
public Date getStartedAt() {
254+
return startedAt;
255+
}
256+
257+
public void setStartedAt(Date startedAt) {
258+
this.startedAt = startedAt;
259+
}
260+
261+
public Date getFinishedAt() {
262+
return finishedAt;
263+
}
264+
265+
public void setFinishedAt(Date finishedAt) {
266+
this.finishedAt = finishedAt;
267+
}
268+
269+
@Override
270+
public String toString() {
271+
return (JacksonJson.toJsonString(this));
272+
}
273+
}
274+
275+
@Override
276+
public String toString() {
277+
return (JacksonJson.toJsonString(this));
278+
}
279+
}

0 commit comments

Comments
 (0)