Skip to content

Commit c292923

Browse files
authored
added reviewers to MergeRequestChanges (gitlab4j#958)
1 parent 69ba436 commit c292923

File tree

3 files changed

+80
-42
lines changed

3 files changed

+80
-42
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ public void setTotalTimeSpent(ChangeContainer<Integer> totalTimeSpent) {
114114
}
115115

116116
@SuppressWarnings("unchecked")
117-
public <T> ChangeContainer<T> get(String property){
117+
public <T> ChangeContainer<T> get(String property) {
118118

119-
if(otherProperties.containsKey(property)){
119+
if (otherProperties.containsKey(property)) {
120120
try {
121121
final ChangeContainer<Object> container = otherProperties.get(property);
122-
// noinspection unchecked : It's duty from caller to be sure to do that
122+
// noinspection unchecked : It's duty from caller to be sure to do that
123123
return container != null ? (ChangeContainer<T>) container : null;
124124
} catch (ClassCastException e) {
125125
return null;

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package org.gitlab4j.api.webhook;
22

3+
import java.util.List;
4+
5+
import org.gitlab4j.api.models.Reviewer;
6+
37
public class MergeRequestChanges extends EventChanges {
48

59
private ChangeContainer<String> mergeStatus;
10+
private ChangeContainer<List<Reviewer>> reviewers;
611

712
public ChangeContainer<String> getMergeStatus() {
813
return mergeStatus;
@@ -11,4 +16,13 @@ public ChangeContainer<String> getMergeStatus() {
1116
public void setMergeStatus(ChangeContainer<String> mergeStatus) {
1217
this.mergeStatus = mergeStatus;
1318
}
19+
20+
public ChangeContainer<List<Reviewer>> getReviewers() {
21+
return reviewers;
22+
}
23+
24+
public void setReviewers(ChangeContainer<List<Reviewer>> reviewers) {
25+
this.reviewers = reviewers;
26+
}
27+
1428
}

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

Lines changed: 63 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -131,56 +131,80 @@
131131
],
132132
"changes": {
133133
"author_id": {
134-
"current":2
134+
"current": 2
135135
},
136136
"updated_at": {
137-
"previous": "2013-09-15T16:50:55Z",
138-
"current": "2013-12-03T17:23:34Z"
137+
"previous": "2013-09-15T16:50:55Z",
138+
"current": "2013-12-03T17:23:34Z"
139139
},
140140
"updated_by_id": {
141-
"previous": 2,
142-
"current": 6
141+
"previous": 2,
142+
"current": 6
143143
},
144-
"id":{
145-
"previous":123,
146-
"current":456
147-
},
148-
"iid":{
149-
"previous":12,
150-
"current":34
144+
"id": {
145+
"previous": 123,
146+
"current": 456
147+
},
148+
"iid": {
149+
"previous": 12,
150+
"current": 34
151151
},
152152
"merge_status": {
153-
"current": "unchecked"
153+
"current": "unchecked"
154154
},
155155
"milestone_id": {
156-
"previous":0,
157-
"current":1
156+
"previous": 0,
157+
"current": 1
158158
},
159159
"labels": {
160-
"previous": [{
161-
"id": 206,
162-
"title": "API",
163-
"color": "#ffffff",
164-
"project_id": 14,
165-
"created_at": "2013-12-03T17:15:43Z",
166-
"updated_at": "2013-12-03T17:15:43Z",
167-
"template": false,
168-
"description": "API related issues",
169-
"type": "ProjectLabel",
170-
"group_id": 41
171-
}],
172-
"current": [{
173-
"id": 205,
174-
"title": "Platform",
175-
"color": "#123123",
176-
"project_id": 14,
177-
"created_at": "2013-12-03T17:15:43Z",
178-
"updated_at": "2013-12-03T17:15:43Z",
179-
"template": false,
180-
"description": "Platform related issues",
181-
"type": "ProjectLabel",
182-
"group_id": 41
183-
}]
160+
"previous": [
161+
{
162+
"id": 206,
163+
"title": "API",
164+
"color": "#ffffff",
165+
"project_id": 14,
166+
"created_at": "2013-12-03T17:15:43Z",
167+
"updated_at": "2013-12-03T17:15:43Z",
168+
"template": false,
169+
"description": "API related issues",
170+
"type": "ProjectLabel",
171+
"group_id": 41
172+
}
173+
],
174+
"current": [
175+
{
176+
"id": 205,
177+
"title": "Platform",
178+
"color": "#123123",
179+
"project_id": 14,
180+
"created_at": "2013-12-03T17:15:43Z",
181+
"updated_at": "2013-12-03T17:15:43Z",
182+
"template": false,
183+
"description": "Platform related issues",
184+
"type": "ProjectLabel",
185+
"group_id": 41
186+
}
187+
]
188+
},
189+
"reviewers": {
190+
"previous": [
191+
{
192+
"id": 2,
193+
"name": "John Doe",
194+
"username": "jdoe",
195+
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
196+
"email": "jdoe@example.com"
197+
}
198+
],
199+
"current": [
200+
{
201+
"id": 3,
202+
"name": "Paul Smith",
203+
"username": "psmith",
204+
"avatar_url": "https://www.gravatar.com/avatar/0?s=80&d=identicon",
205+
"email": "psmith@example.com"
206+
}
207+
]
184208
}
185209
},
186210
"assignees": [

0 commit comments

Comments
 (0)