Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.github.core/src/org/eclipse/mylyn')
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubClient.java13
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IssueService.java57
2 files changed, 70 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubClient.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubClient.java
index 765e90be..fd2d2eaf 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubClient.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubClient.java
@@ -167,6 +167,19 @@ public class GitHubClient {
*
* @param <V>
* @param uri
+ * @param type
+ * @return V
+ * @throws IOException
+ */
+ public <V> V get(String uri, Type type) throws IOException {
+ return get(uri, null, type);
+ }
+
+ /**
+ * Get response from uri and bind to specified type
+ *
+ * @param <V>
+ * @param uri
* @param params
* @param type
* @return V
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
new file mode 100644
index 00000000..4d3e978d
--- /dev/null
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IssueService.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2011 GitHub Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.mylyn.github.internal;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * Issue service class for listing, searching, and fetching {@link Issue}
+ * objects using a {@link GitHubClient}.
+ *
+ * @author Kevin Sawicki (kevin@github.com)
+ */
+public class IssueService {
+
+ private GitHubClient client;
+
+ /**
+ * Create issue service
+ *
+ * @param client
+ * cannot be null
+ */
+ public IssueService(GitHubClient client) {
+ Assert.isNotNull(client, "Client cannot be null"); //$NON-NLS-1$
+ this.client = client;
+ }
+
+ /**
+ * Get issue
+ *
+ * @param user
+ * @param repository
+ * @param id
+ * @return issue
+ * @throws IOException
+ */
+ public Issue getIssue(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).append(IGitHubConstants.SUFFIX_JSON);
+ return this.client.get(builder.toString(), Issue.class);
+ }
+
+}

Back to the top