Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Rebert2014-11-03 00:04:33 +0000
committerChris Rebert2015-03-04 08:37:00 +0000
commitf1d59a3fbc06d7df00910d84eaff988cd8b12ea4 (patch)
tree01d957bd781db7a9a1a5eea55c870c11665fffe6
parent7d3493e7c34575910021fcd803fad85925ba9598 (diff)
downloadegit-github-f1d59a3fbc06d7df00910d84eaff988cd8b12ea4.tar.gz
egit-github-f1d59a3fbc06d7df00910d84eaff988cd8b12ea4.tar.xz
egit-github-f1d59a3fbc06d7df00910d84eaff988cd8b12ea4.zip
Added `label` field to the IssueEvent class
Relevant GitHub API docs: https://developer.github.com/v3/issues/events/#attributes This field is only present when the event is one of: - `labeled` - `unlabeled` The `label` field's value is a Label, but with no `url`. Bug: 449416 Change-Id: I31cf1aeea57770be63db0cf9bf9822ac5dcbc768 Signed-off-by: Chris Rebert <eclipse@rebertia.com>
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueEventTest.java4
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IssueEvent.java18
2 files changed, 22 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueEventTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueEventTest.java
index 058cb63d..67f372b2 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueEventTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueEventTest.java
@@ -18,6 +18,7 @@ import java.util.Date;
import org.eclipse.egit.github.core.Issue;
import org.eclipse.egit.github.core.IssueEvent;
+import org.eclipse.egit.github.core.Label;
import org.eclipse.egit.github.core.User;
import org.junit.Test;
@@ -37,6 +38,7 @@ public class IssueEventTest {
assertNull(event.getCreatedAt());
assertNull(event.getEvent());
assertEquals(0, event.getId());
+ assertNull(event.getLabel());
assertNull(event.getUrl());
assertNull(event.getIssue());
}
@@ -53,6 +55,8 @@ public class IssueEventTest {
assertEquals(new Date(60000), event.setCreatedAt(new Date(60000))
.getCreatedAt());
assertEquals(4356, event.setId(4356).getId());
+ Label label = new Label().setName("Lab El").setColor("563d7c");
+ assertEquals(label, event.setLabel(label).getLabel());
assertEquals("commit", event.setEvent("commit").getEvent());
assertEquals("url://a", event.setUrl("url://a").getUrl());
Issue issue = new Issue().setNumber(30);
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IssueEvent.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IssueEvent.java
index 8197b534..68772f0f 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IssueEvent.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IssueEvent.java
@@ -37,6 +37,8 @@ public class IssueEvent implements Serializable {
private User actor;
+ private Label label;
+
/**
* @return createdAt
*/
@@ -148,4 +150,20 @@ public class IssueEvent implements Serializable {
this.actor = actor;
return this;
}
+
+ /**
+ * @return label
+ */
+ public Label getLabel() {
+ return label;
+ }
+
+ /**
+ * @param label
+ * @return this issue event
+ */
+ public IssueEvent setLabel(Label label) {
+ this.label = label;
+ return this;
+ }
}

Back to the top