Skip to content

Commit 1ee472c

Browse files
committed
Added support for labels in webhook events (#325).
1 parent 5211cde commit 1ee472c

File tree

4 files changed

+138
-0
lines changed

4 files changed

+138
-0
lines changed

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

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

3+
import java.util.List;
4+
35
import javax.xml.bind.annotation.XmlAccessType;
46
import javax.xml.bind.annotation.XmlAccessorType;
57

@@ -17,7 +19,10 @@ public class IssueEvent extends AbstractEvent {
1719
private EventProject project;
1820
private EventRepository repository;
1921
private ObjectAttributes objectAttributes;
22+
private List<Assignee> assignees;
2023
private Assignee assignee;
24+
private List<EventLabel> labels;
25+
private EventChanges changes;
2126

2227
public String getObjectKind() {
2328
return (OBJECT_KIND);
@@ -52,6 +57,14 @@ public void setRepository(EventRepository repository) {
5257
this.repository = repository;
5358
}
5459

60+
public List<Assignee> getAssignees() {
61+
return assignees;
62+
}
63+
64+
public void setAssignees(List<Assignee> assignees) {
65+
this.assignees = assignees;
66+
}
67+
5568
public Assignee getAssignee() {
5669
return assignee;
5770
}
@@ -60,6 +73,22 @@ public void setAssignee(Assignee assignee) {
6073
this.assignee = assignee;
6174
}
6275

76+
public List<EventLabel> getLabels() {
77+
return labels;
78+
}
79+
80+
public void setLabels(List<EventLabel> labels) {
81+
this.labels = labels;
82+
}
83+
84+
public EventChanges getChanges() {
85+
return changes;
86+
}
87+
88+
public void setChanges(EventChanges changes) {
89+
this.changes = changes;
90+
}
91+
6392
public ObjectAttributes getObjectAttributes() {
6493
return this.objectAttributes;
6594
}

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

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

3+
import java.util.List;
4+
35
import javax.xml.bind.annotation.XmlAccessType;
46
import javax.xml.bind.annotation.XmlAccessorType;
57

@@ -16,6 +18,8 @@ public class MergeRequestEvent extends AbstractEvent {
1618
private EventProject project;
1719
private EventRepository repository;
1820
private ObjectAttributes objectAttributes;
21+
private List<EventLabel> labels;
22+
private EventChanges changes;
1923

2024
public String getObjectKind() {
2125
return (OBJECT_KIND);
@@ -58,6 +62,22 @@ public void setObjectAttributes(ObjectAttributes objectAttributes) {
5862
this.objectAttributes = objectAttributes;
5963
}
6064

65+
public List<EventLabel> getLabels() {
66+
return labels;
67+
}
68+
69+
public void setLabels(List<EventLabel> labels) {
70+
this.labels = labels;
71+
}
72+
73+
public EventChanges getChanges() {
74+
return changes;
75+
}
76+
77+
public void setChanges(EventChanges changes) {
78+
this.changes = changes;
79+
}
80+
6181
@XmlAccessorType(XmlAccessType.FIELD)
6282
public static class ObjectAttributes extends EventMergeRequest {
6383
}

src/test/resources/org/gitlab4j/api/issue-event.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,56 @@
4141
"url": "http://example.com/diaspora/issues/23",
4242
"action": "open"
4343
},
44+
"assignees": [{
45+
"name": "User1",
46+
"username": "user1",
47+
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
48+
}],
4449
"assignee": {
4550
"name": "User1",
4651
"username": "user1",
4752
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
53+
},
54+
"labels": [{
55+
"id": 206,
56+
"title": "API",
57+
"color": "#ffffff",
58+
"project_id": 14,
59+
"created_at": "2013-12-03T17:15:43Z",
60+
"updated_at": "2013-12-03T17:15:43Z",
61+
"template": false,
62+
"description": "API related issues",
63+
"type": "ProjectLabel",
64+
"group_id": 41
65+
}],
66+
"changes": {
67+
"updated_by_id": [null, 1],
68+
"updated_at": ["2017-09-15T16:50:55Z", "2017-09-15T16:52:00Z"],
69+
"labels": {
70+
"previous": [{
71+
"id": 206,
72+
"title": "API",
73+
"color": "#ffffff",
74+
"project_id": 14,
75+
"created_at": "2013-12-03T17:15:43Z",
76+
"updated_at": "2013-12-03T17:15:43Z",
77+
"template": false,
78+
"description": "API related issues",
79+
"type": "ProjectLabel",
80+
"group_id": 41
81+
}],
82+
"current": [{
83+
"id": 205,
84+
"title": "Platform",
85+
"color": "#123123",
86+
"project_id": 14,
87+
"created_at": "2013-12-03T17:15:43Z",
88+
"updated_at": "2013-12-03T17:15:43Z",
89+
"template": false,
90+
"description": "Platform related issues",
91+
"type": "ProjectLabel",
92+
"group_id": 41
93+
}]
94+
}
4895
}
4996
}

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,47 @@
9090
"username": "user1",
9191
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon"
9292
}
93+
},
94+
"labels": [{
95+
"id": 206,
96+
"title": "API",
97+
"color": "#ffffff",
98+
"project_id": 14,
99+
"created_at": "2013-12-03T17:15:43Z",
100+
"updated_at": "2013-12-03T17:15:43Z",
101+
"template": false,
102+
"description": "API related issues",
103+
"type": "ProjectLabel",
104+
"group_id": 41
105+
}],
106+
"changes": {
107+
"updated_by_id": [null, 1],
108+
"updated_at": ["2017-09-15T16:50:55Z", "2017-09-15T16:52:00Z"],
109+
"labels": {
110+
"previous": [{
111+
"id": 206,
112+
"title": "API",
113+
"color": "#ffffff",
114+
"project_id": 14,
115+
"created_at": "2013-12-03T17:15:43Z",
116+
"updated_at": "2013-12-03T17:15:43Z",
117+
"template": false,
118+
"description": "API related issues",
119+
"type": "ProjectLabel",
120+
"group_id": 41
121+
}],
122+
"current": [{
123+
"id": 205,
124+
"title": "Platform",
125+
"color": "#123123",
126+
"project_id": 14,
127+
"created_at": "2013-12-03T17:15:43Z",
128+
"updated_at": "2013-12-03T17:15:43Z",
129+
"template": false,
130+
"description": "Platform related issues",
131+
"type": "ProjectLabel",
132+
"group_id": 41
133+
}]
134+
}
93135
}
94136
}

0 commit comments

Comments
 (0)