Skip to content

Commit 02c9337

Browse files
lesiakgmessner
authored andcommitted
Fix #411 Added missing fields in merge_request (#412)
Added fields: - allow_collaboration - allow_maintainer_to_push - closed_at - closed_by - discussion_locked - merged_at - merged_by - task_completion_status - time_stats Renamed fields: - merge_when_build_succeeds to merge_when_pipeline_succeeds
1 parent 8dc9a96 commit 02c9337

File tree

3 files changed

+140
-5
lines changed

3 files changed

+140
-5
lines changed

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

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,27 @@
1010

1111
public class MergeRequest {
1212

13+
private Boolean allowCollaboration;
14+
private Boolean allowMaintainerToPush;
1315
private Integer approvalsBeforeMerge;
1416
private Assignee assignee;
1517
private Author author;
1618
private List<Diff> changes;
19+
private Date closedAt;
20+
private Participant closedBy;
1721
private Date createdAt;
1822
private String description;
23+
private Boolean discussionLocked;
1924
private Integer downvotes;
2025
private Boolean forceRemoveSourceBranch;
2126
private Integer id;
2227
private Integer iid;
2328
private List<String> labels;
2429
private String mergeCommitSha;
2530
private String mergeStatus;
26-
private Boolean mergeWhenBuildSucceeds;
31+
private Date mergedAt;
32+
private Participant mergedBy;
33+
private Boolean mergeWhenPipelineSucceeds;
2734
private Milestone milestone;
2835
private Integer projectId;
2936
private String sha;
@@ -35,6 +42,8 @@ public class MergeRequest {
3542
private Boolean subscribed;
3643
private String targetBranch;
3744
private Integer targetProjectId;
45+
private TaskCompletionStatus taskCompletionStatus;
46+
private TimeStats timeStats;
3847
private String title;
3948
private Date updatedAt;
4049
private Integer upvotes;
@@ -51,6 +60,22 @@ public class MergeRequest {
5160
@JsonDeserialize(using = JacksonJson.UserListDeserializer.class)
5261
private List<User> approvedBy;
5362

63+
public Boolean getAllowCollaboration() {
64+
return allowCollaboration;
65+
}
66+
67+
public void setAllowCollaboration(Boolean allowCollaboration) {
68+
this.allowCollaboration = allowCollaboration;
69+
}
70+
71+
public Boolean getAllowMaintainerToPush() {
72+
return allowMaintainerToPush;
73+
}
74+
75+
public void setAllowMaintainerToPush(Boolean allowMaintainerToPush) {
76+
this.allowMaintainerToPush = allowMaintainerToPush;
77+
}
78+
5479
public Integer getApprovalsBeforeMerge() {
5580
return approvalsBeforeMerge;
5681
}
@@ -83,6 +108,22 @@ public void setChanges(List<Diff> changes) {
83108
this.changes = changes;
84109
}
85110

111+
public Date getClosedAt() {
112+
return closedAt;
113+
}
114+
115+
public void setClosedAt(Date closedAt) {
116+
this.closedAt = closedAt;
117+
}
118+
119+
public Participant getClosedBy() {
120+
return closedBy;
121+
}
122+
123+
public void setClosedBy(Participant closedBy) {
124+
this.closedBy = closedBy;
125+
}
126+
86127
public Date getCreatedAt() {
87128
return createdAt;
88129
}
@@ -99,6 +140,14 @@ public void setDescription(String description) {
99140
this.description = description;
100141
}
101142

143+
public Boolean getDiscussionLocked() {
144+
return discussionLocked;
145+
}
146+
147+
public void setDiscussionLocked(Boolean discussionLocked) {
148+
this.discussionLocked = discussionLocked;
149+
}
150+
102151
public Integer getDownvotes() {
103152
return downvotes;
104153
}
@@ -155,12 +204,28 @@ public void setMergeStatus(String mergeStatus) {
155204
this.mergeStatus = mergeStatus;
156205
}
157206

158-
public Boolean getMergeWhenBuildSucceeds() {
159-
return mergeWhenBuildSucceeds;
207+
public Date getMergedAt() {
208+
return mergedAt;
209+
}
210+
211+
public void setMergedAt(Date mergedAt) {
212+
this.mergedAt = mergedAt;
213+
}
214+
215+
public Participant getMergedBy() {
216+
return mergedBy;
217+
}
218+
219+
public void setMergedBy(Participant mergedBy) {
220+
this.mergedBy = mergedBy;
221+
}
222+
223+
public Boolean getMergeWhenPipelineSucceeds() {
224+
return mergeWhenPipelineSucceeds;
160225
}
161226

162-
public void setMergeWhenBuildSucceeds(Boolean mergeWhenBuildSucceeds) {
163-
this.mergeWhenBuildSucceeds = mergeWhenBuildSucceeds;
227+
public void setMergeWhenPipelineSucceeds(Boolean mergeWhenPipelineSucceeds) {
228+
this.mergeWhenPipelineSucceeds = mergeWhenPipelineSucceeds;
164229
}
165230

166231
public Milestone getMilestone() {
@@ -251,6 +316,22 @@ public void setTargetProjectId(Integer targetProjectId) {
251316
this.targetProjectId = targetProjectId;
252317
}
253318

319+
public TaskCompletionStatus getTaskCompletionStatus() {
320+
return taskCompletionStatus;
321+
}
322+
323+
public void setTaskCompletionStatus(TaskCompletionStatus taskCompletionStatus) {
324+
this.taskCompletionStatus = taskCompletionStatus;
325+
}
326+
327+
public TimeStats getTimeStats() {
328+
return timeStats;
329+
}
330+
331+
public void setTimeStats(TimeStats timeStats) {
332+
this.timeStats = timeStats;
333+
}
334+
254335
public String getTitle() {
255336
return title;
256337
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.gitlab4j.api.models;
2+
3+
import org.gitlab4j.api.utils.JacksonJson;
4+
5+
public class TaskCompletionStatus {
6+
7+
private Integer count;
8+
private Integer completedCount;
9+
10+
public Integer getCount() {
11+
return count;
12+
}
13+
14+
public void setCount(Integer count) {
15+
this.count = count;
16+
}
17+
18+
public Integer getCompletedCount() {
19+
return completedCount;
20+
}
21+
22+
public void setCompletedCount(Integer completedCount) {
23+
this.completedCount = completedCount;
24+
}
25+
26+
@Override
27+
public String toString() {
28+
return (JacksonJson.toJsonString(this));
29+
}
30+
31+
}

src/test/resources/org/gitlab4j/api/merge-request.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010
"downvotes":0,
1111
"created_at": "2016-12-03T17:23:34Z",
1212
"updated_at": "2016-12-03T17:23:34Z",
13+
"merged_at": "2016-12-03T17:23:34Z",
14+
"merged_by": {
15+
"id": 7,
16+
"name": "James Bond",
17+
"username": "james.bond",
18+
"state": "active",
19+
"avatar_url": "https://www.google.com/",
20+
"web_url": "https://www.google.com/"
21+
},
1322
"author":{
1423
"id":1,
1524
"username": "admin",
@@ -26,6 +35,20 @@
2635
"state":"active",
2736
"created_at":"2012-04-29T08:46:00Z"
2837
},
38+
"allow_collaboration": false,
39+
"allow_maintainer_to_push": false,
40+
"discussion_locked": false,
41+
"merge_when_pipeline_succeeds": false,
42+
"task_completion_status":{
43+
"count":0,
44+
"completed_count":0
45+
},
46+
"time_stats": {
47+
"time_estimate": 0,
48+
"total_time_spent": 0,
49+
"human_time_estimate": "3h30m",
50+
"human_total_time_spent": "0m"
51+
},
2952
"diff_refs": {
3053
"base_sha": "c380d3acebd181f13629a25d2e2acca46ffe1e00",
3154
"head_sha": "2be7ddb704c7b6b83732fdd5b9f09d5a397b5f8f",

0 commit comments

Comments
 (0)