@@ -10,7 +10,7 @@ public class GitlabMergeRequest {
1010 public static final String STATUS_OPENED = "opened" ;
1111 public static final String STATUS_MERGED = "merged" ;
1212 public static final String STATUS_CLOSED = "closed" ;
13-
13+
1414 private Integer id ;
1515 private Integer iid ;
1616 private String title ;
@@ -23,10 +23,18 @@ public class GitlabMergeRequest {
2323 private GitlabMilestone milestone ;
2424
2525 private String [] labels ;
26+
2627 private List <GitlabCommitDiff > changes ;
2728
28- private int upvotes ;
29- private int downvotes ;
29+ private Integer upvotes ;
30+
31+ private Integer downvotes ;
32+
33+ @ JsonProperty ("updated_at" )
34+ private Date updatedAt ;
35+
36+ @ JsonProperty ("created_at" )
37+ private Date createdAt ;
3038
3139 @ JsonProperty ("target_branch" )
3240 private String targetBranch ;
@@ -46,23 +54,64 @@ public class GitlabMergeRequest {
4654 @ JsonProperty ("milestone_id" )
4755 private Integer milestoneId ;
4856
49- @ JsonProperty ("updated_at " )
50- private Date updatedAt ;
57+ @ JsonProperty ("work_in_progress " )
58+ private Boolean workInProgress ;
5159
52- @ JsonProperty ("created_at " )
53- private Date createdAt ;
60+ @ JsonProperty ("merge_when_pipeline_succeeds " )
61+ private Boolean mergeWhenPipelineSucceeds ;
5462
55- @ JsonProperty ("merge_commit_sha" )
56- private String mergeCommitSHA ;
57-
5863 @ JsonProperty ("merge_status" )
5964 private String mergeStatus ;
6065
66+ @ JsonProperty ("sha" )
67+ private String sha ;
68+
69+ @ JsonProperty ("merge_commit_sha" )
70+ private String mergeCommitSHA ;
71+
72+ @ JsonProperty ("user_notes_count" )
73+ private Integer userNotesCount ;
74+
75+ @ JsonProperty ("discussion_locked" )
76+ private Boolean discussionLocked ;
77+
78+ @ JsonProperty ("should_remove_source_branch" )
79+ private Boolean shouldRemoveSourceBranch ;
80+
81+ @ JsonProperty ("force_remove_source_branch" )
82+ private Boolean forceRemoveSourceBranch ;
83+
6184 @ JsonProperty ("web_url" )
6285 private String webUrl ;
6386
64- @ JsonProperty ("sha" )
65- private String sha ;
87+ private Boolean squash ;
88+
89+ @ JsonProperty ("changes_count" )
90+ private Integer changesCount ;
91+
92+ @ JsonProperty ("merged_by" )
93+ private GitlabUser mergedBy ;
94+
95+ @ JsonProperty ("merged_at" )
96+ private Date mergedAt ;
97+
98+ @ JsonProperty ("closed_by" )
99+ private GitlabUser closedBy ;
100+
101+ @ JsonProperty ("closed_at" )
102+ private Date closedAt ;
103+
104+ @ JsonProperty ("latest_build_started_at" )
105+ private Date latestBuildStartedAt ;
106+
107+ @ JsonProperty ("latest_build_finished_at" )
108+ private Date latestBuildFinishedAt ;
109+
110+ @ JsonProperty ("first_deployed_to_production_at" )
111+ private Date firstDeployedToProductionAt ;
112+
113+ @ JsonProperty ("diff_refs" )
114+ private DiffRefs diffRefs ;
66115
67116 public Integer getId () {
68117 return id ;
@@ -281,4 +330,96 @@ public String getSha() {
281330 public void setSha (String sha ) {
282331 this .sha = sha ;
283332 }
333+
334+ public Boolean isWorkInProgress () {
335+ return workInProgress ;
336+ }
337+
338+
339+ public Boolean isMergeWhenPipelineSucceeds () {
340+ return mergeWhenPipelineSucceeds ;
341+ }
342+
343+ public Integer getUserNotesCount () {
344+ return userNotesCount ;
345+ }
346+
347+ public Boolean isDiscussionLocked () {
348+ return discussionLocked ;
349+ }
350+
351+ public Boolean isShouldRemoveSourceBranch () {
352+ return shouldRemoveSourceBranch ;
353+ }
354+
355+ public boolean isForceRemoveSourceBranch () {
356+ return forceRemoveSourceBranch ;
357+ }
358+
359+ public Boolean isSquash () {
360+ return squash ;
361+ }
362+
363+ public Integer getChangesCount () {
364+ return changesCount ;
365+ }
366+
367+ public GitlabUser getMergedBy () {
368+ return mergedBy ;
369+ }
370+
371+ public Date getMergedAt () {
372+ return mergedAt ;
373+ }
374+
375+ public GitlabUser getClosedBy () {
376+ return closedBy ;
377+ }
378+
379+ public Date getClosedAt () {
380+ return closedAt ;
381+ }
382+
383+ public Date getLatestBuildStartedAt () {
384+ return latestBuildStartedAt ;
385+ }
386+
387+ public Date getLatestBuildFinishedAt () {
388+ return latestBuildFinishedAt ;
389+ }
390+
391+ public Date getFirstDeployedToProductionAt () {
392+ return firstDeployedToProductionAt ;
393+ }
394+
395+ public String getBaseSha () {
396+ return diffRefs == null ? null : diffRefs .baseSha ;
397+ }
398+
399+ public String getHeadSha () {
400+ return diffRefs == null ? null : diffRefs .headSha ;
401+ }
402+
403+ public String getStartSha () {
404+ return diffRefs == null ? null : diffRefs .startSha ;
405+ }
406+
407+ /**
408+ * Class representing the diff_refs json object, which is just a collection
409+ * of sha references of the merge request. It is currently not provided by
410+ * GitLab when fetching multiple merge requests.
411+ *
412+ * @author Patrizio Bonzani
413+ */
414+ private static class DiffRefs {
415+
416+ @ JsonProperty ("base_sha" )
417+ private String baseSha ;
418+
419+ @ JsonProperty ("head_sha" )
420+ private String headSha ;
421+
422+ @ JsonProperty ("start_sha" )
423+ private String startSha ;
424+ }
284425}
0 commit comments