Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-10 19:58:25 +0000
committerChris Aniszczyk2011-04-10 20:00:03 +0000
commitbd1c7a97db7009b85ee1490719f722ce745e2370 (patch)
treee92d39c7704bb5e4924f566f8bc681b5395bc3b5
parent185223750c7c8e6e4af6d2cae12c1327735c871a (diff)
downloadegit-github-bd1c7a97db7009b85ee1490719f722ce745e2370.tar.gz
egit-github-bd1c7a97db7009b85ee1490719f722ce745e2370.tar.xz
egit-github-bd1c7a97db7009b85ee1490719f722ce745e2370.zip
Add support for getting an issue's comments
Change-Id: I7709adc3d71ab5e0cf533f44a9a35f1db1f04b62 Signed-off-by: Kevin Sawicki <kevin@github.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java5
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IssueService.java26
2 files changed, 31 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java
index 424e26d2..eab673d3 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java
@@ -28,6 +28,11 @@ public interface IGitHubConstants {
String SEGMENT_ISSUES = "/issues"; //$NON-NLS-1$
/**
+ * SEGMENT_COMMENTS
+ */
+ String SEGMENT_COMMENTS = "/comments"; //$NON-NLS-1$
+
+ /**
* SUFFIX_JSON
*/
String SUFFIX_JSON = ".json"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IssueService.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IssueService.java
index 4d3e978d..ac80645b 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IssueService.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IssueService.java
@@ -10,7 +10,10 @@
*******************************************************************************/
package org.eclipse.mylyn.github.internal;
+import com.google.gson.reflect.TypeToken;
+
import java.io.IOException;
+import java.util.List;
import org.eclipse.core.runtime.Assert;
@@ -54,4 +57,27 @@ public class IssueService {
return this.client.get(builder.toString(), Issue.class);
}
+ /**
+ * Get an issue's comments
+ *
+ * @param user
+ * @param repository
+ * @param id
+ * @return list of matching issues
+ * @throws IOException
+ */
+ public List<Comment> getComments(String user, String repository, String id)
+ throws IOException {
+ StringBuilder builder = new StringBuilder(
+ IGitHubConstants.SEGMENT_REPOS);
+ builder.append('/').append(user).append('/').append(repository);
+ builder.append(IGitHubConstants.SEGMENT_ISSUES);
+ builder.append('/').append(id);
+ builder.append(IGitHubConstants.SEGMENT_COMMENTS).append(
+ IGitHubConstants.SUFFIX_JSON);
+ TypeToken<List<Comment>> commentToken = new TypeToken<List<Comment>>() {
+ };
+ return this.client.get(builder.toString(), commentToken.getType());
+ }
+
}

Back to the top