summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-10 16:18:32 (EDT)
committer Chris Aniszczyk2011-04-10 16:24:37 (EDT)
commitf3ab380f132fef3b18f94a9be80268c757322200 (patch)
treee6268676a39a259232591ff5ee37bdebab75e25e
parentbd1c7a97db7009b85ee1490719f722ce745e2370 (diff)
downloadegit-github-f3ab380f132fef3b18f94a9be80268c757322200.zip
egit-github-f3ab380f132fef3b18f94a9be80268c757322200.tar.gz
egit-github-f3ab380f132fef3b18f94a9be80268c757322200.tar.bz2
Add support for getting a list of issues matching filtersrefs/changes/48/3048/2
Added constants for allowable filter keys and values. Change-Id: Ie175af2cc7b47afdf3e89f0f413e371306e0653d 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/IssueService.java58
1 files changed, 58 insertions, 0 deletions
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 ac80645..9e94379 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
@@ -14,6 +14,7 @@ import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.runtime.Assert;
@@ -25,6 +26,41 @@ import org.eclipse.core.runtime.Assert;
*/
public class IssueService {
+ /**
+ * Filter by issue assignee
+ */
+ public static final String FILTER_ASSIGNEE = "assignee"; //$NON-NLS-1$
+
+ /**
+ * Filter by issue's milestone
+ */
+ public static final String FILTER_MILESTONE = "milestone"; //$NON-NLS-1$
+
+ /**
+ * Filter by user mentioned in issue
+ */
+ public static final String FILTER_MENTIONED = "mentioned"; //$NON-NLS-1$
+
+ /**
+ * Filter by issue's labels
+ */
+ public static final String FILTER_LABELS = "labels"; //$NON-NLS-1$
+
+ /**
+ * Filter by issue's state
+ */
+ public static final String FILTER_STATE = "state"; //$NON-NLS-1$
+
+ /**
+ * Issue open state filter value
+ */
+ public static final String STATE_OPEN = "open";
+
+ /**
+ * Issue closed state filter value
+ */
+ public static final String STATE_CLOSED = "closed";
+
private GitHubClient client;
/**
@@ -80,4 +116,26 @@ public class IssueService {
return this.client.get(builder.toString(), commentToken.getType());
}
+ /**
+ * Get a list of {@link Issue} objects that match the specified filter data
+ *
+ * @param user
+ * @param repository
+ * @param filterData
+ * @return list of issues
+ * @throws IOException
+ */
+ public List<Issue> getIssues(String user, String repository,
+ Map<String, String> filterData) throws IOException {
+ StringBuilder builder = new StringBuilder(
+ IGitHubConstants.SEGMENT_REPOS);
+ builder.append('/').append(user).append('/').append(repository);
+ builder.append(IGitHubConstants.SEGMENT_ISSUES).append(
+ IGitHubConstants.SUFFIX_JSON);
+ TypeToken<List<Issue>> issueToken = new TypeToken<List<Issue>>() {
+ };
+ return this.client.get(builder.toString(), filterData,
+ issueToken.getType());
+ }
+
}