Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
1ee472c2
Commit
1ee472c2
authored
Apr 05, 2019
by
Greg Messner
Browse files
Added support for labels in webhook events (#325).
parent
5211cded
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/webhook/IssueEvent.java
View file @
1ee472c2
package
org.gitlab4j.api.webhook
;
package
org.gitlab4j.api.webhook
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
...
@@ -17,7 +19,10 @@ public class IssueEvent extends AbstractEvent {
...
@@ -17,7 +19,10 @@ public class IssueEvent extends AbstractEvent {
private
EventProject
project
;
private
EventProject
project
;
private
EventRepository
repository
;
private
EventRepository
repository
;
private
ObjectAttributes
objectAttributes
;
private
ObjectAttributes
objectAttributes
;
private
List
<
Assignee
>
assignees
;
private
Assignee
assignee
;
private
Assignee
assignee
;
private
List
<
EventLabel
>
labels
;
private
EventChanges
changes
;
public
String
getObjectKind
()
{
public
String
getObjectKind
()
{
return
(
OBJECT_KIND
);
return
(
OBJECT_KIND
);
...
@@ -52,6 +57,14 @@ public class IssueEvent extends AbstractEvent {
...
@@ -52,6 +57,14 @@ public class IssueEvent extends AbstractEvent {
this
.
repository
=
repository
;
this
.
repository
=
repository
;
}
}
public
List
<
Assignee
>
getAssignees
()
{
return
assignees
;
}
public
void
setAssignees
(
List
<
Assignee
>
assignees
)
{
this
.
assignees
=
assignees
;
}
public
Assignee
getAssignee
()
{
public
Assignee
getAssignee
()
{
return
assignee
;
return
assignee
;
}
}
...
@@ -60,6 +73,22 @@ public class IssueEvent extends AbstractEvent {
...
@@ -60,6 +73,22 @@ public class IssueEvent extends AbstractEvent {
this
.
assignee
=
assignee
;
this
.
assignee
=
assignee
;
}
}
public
List
<
EventLabel
>
getLabels
()
{
return
labels
;
}
public
void
setLabels
(
List
<
EventLabel
>
labels
)
{
this
.
labels
=
labels
;
}
public
EventChanges
getChanges
()
{
return
changes
;
}
public
void
setChanges
(
EventChanges
changes
)
{
this
.
changes
=
changes
;
}
public
ObjectAttributes
getObjectAttributes
()
{
public
ObjectAttributes
getObjectAttributes
()
{
return
this
.
objectAttributes
;
return
this
.
objectAttributes
;
}
}
...
...
src/main/java/org/gitlab4j/api/webhook/MergeRequestEvent.java
View file @
1ee472c2
package
org.gitlab4j.api.webhook
;
package
org.gitlab4j.api.webhook
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
...
@@ -16,6 +18,8 @@ public class MergeRequestEvent extends AbstractEvent {
...
@@ -16,6 +18,8 @@ public class MergeRequestEvent extends AbstractEvent {
private
EventProject
project
;
private
EventProject
project
;
private
EventRepository
repository
;
private
EventRepository
repository
;
private
ObjectAttributes
objectAttributes
;
private
ObjectAttributes
objectAttributes
;
private
List
<
EventLabel
>
labels
;
private
EventChanges
changes
;
public
String
getObjectKind
()
{
public
String
getObjectKind
()
{
return
(
OBJECT_KIND
);
return
(
OBJECT_KIND
);
...
@@ -58,6 +62,22 @@ public class MergeRequestEvent extends AbstractEvent {
...
@@ -58,6 +62,22 @@ public class MergeRequestEvent extends AbstractEvent {
this
.
objectAttributes
=
objectAttributes
;
this
.
objectAttributes
=
objectAttributes
;
}
}
public
List
<
EventLabel
>
getLabels
()
{
return
labels
;
}
public
void
setLabels
(
List
<
EventLabel
>
labels
)
{
this
.
labels
=
labels
;
}
public
EventChanges
getChanges
()
{
return
changes
;
}
public
void
setChanges
(
EventChanges
changes
)
{
this
.
changes
=
changes
;
}
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
static
class
ObjectAttributes
extends
EventMergeRequest
{
public
static
class
ObjectAttributes
extends
EventMergeRequest
{
}
}
...
...
src/test/resources/org/gitlab4j/api/issue-event.json
View file @
1ee472c2
...
@@ -41,9 +41,56 @@
...
@@ -41,9 +41,56 @@
"url"
:
"http://example.com/diaspora/issues/23"
,
"url"
:
"http://example.com/diaspora/issues/23"
,
"action"
:
"open"
"action"
:
"open"
},
},
"assignees"
:
[{
"name"
:
"User1"
,
"username"
:
"user1"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
}],
"assignee"
:
{
"assignee"
:
{
"name"
:
"User1"
,
"name"
:
"User1"
,
"username"
:
"user1"
,
"username"
:
"user1"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
},
"labels"
:
[{
"id"
:
206
,
"title"
:
"API"
,
"color"
:
"#ffffff"
,
"project_id"
:
14
,
"created_at"
:
"2013-12-03T17:15:43Z"
,
"updated_at"
:
"2013-12-03T17:15:43Z"
,
"template"
:
false
,
"description"
:
"API related issues"
,
"type"
:
"ProjectLabel"
,
"group_id"
:
41
}],
"changes"
:
{
"updated_by_id"
:
[
null
,
1
],
"updated_at"
:
[
"2017-09-15T16:50:55Z"
,
"2017-09-15T16:52:00Z"
],
"labels"
:
{
"previous"
:
[{
"id"
:
206
,
"title"
:
"API"
,
"color"
:
"#ffffff"
,
"project_id"
:
14
,
"created_at"
:
"2013-12-03T17:15:43Z"
,
"updated_at"
:
"2013-12-03T17:15:43Z"
,
"template"
:
false
,
"description"
:
"API related issues"
,
"type"
:
"ProjectLabel"
,
"group_id"
:
41
}],
"current"
:
[{
"id"
:
205
,
"title"
:
"Platform"
,
"color"
:
"#123123"
,
"project_id"
:
14
,
"created_at"
:
"2013-12-03T17:15:43Z"
,
"updated_at"
:
"2013-12-03T17:15:43Z"
,
"template"
:
false
,
"description"
:
"Platform related issues"
,
"type"
:
"ProjectLabel"
,
"group_id"
:
41
}]
}
}
}
}
}
\ No newline at end of file
src/test/resources/org/gitlab4j/api/merge-request-event.json
View file @
1ee472c2
...
@@ -90,5 +90,47 @@
...
@@ -90,5 +90,47 @@
"username"
:
"user1"
,
"username"
:
"user1"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
"avatar_url"
:
"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40
\u
0026d=identicon"
}
}
},
"labels"
:
[{
"id"
:
206
,
"title"
:
"API"
,
"color"
:
"#ffffff"
,
"project_id"
:
14
,
"created_at"
:
"2013-12-03T17:15:43Z"
,
"updated_at"
:
"2013-12-03T17:15:43Z"
,
"template"
:
false
,
"description"
:
"API related issues"
,
"type"
:
"ProjectLabel"
,
"group_id"
:
41
}],
"changes"
:
{
"updated_by_id"
:
[
null
,
1
],
"updated_at"
:
[
"2017-09-15T16:50:55Z"
,
"2017-09-15T16:52:00Z"
],
"labels"
:
{
"previous"
:
[{
"id"
:
206
,
"title"
:
"API"
,
"color"
:
"#ffffff"
,
"project_id"
:
14
,
"created_at"
:
"2013-12-03T17:15:43Z"
,
"updated_at"
:
"2013-12-03T17:15:43Z"
,
"template"
:
false
,
"description"
:
"API related issues"
,
"type"
:
"ProjectLabel"
,
"group_id"
:
41
}],
"current"
:
[{
"id"
:
205
,
"title"
:
"Platform"
,
"color"
:
"#123123"
,
"project_id"
:
14
,
"created_at"
:
"2013-12-03T17:15:43Z"
,
"updated_at"
:
"2013-12-03T17:15:43Z"
,
"template"
:
false
,
"description"
:
"Platform related issues"
,
"type"
:
"ProjectLabel"
,
"group_id"
:
41
}]
}
}
}
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment