IDEA-131201 github tasks: allow to specify, whether to load all issues or assigned...
[idea/community.git] / plugins / github / src / org / jetbrains / plugins / github / api / GithubApiUtil.java
index dd51519db9f5ea5fbb1ea4eaaf2a41a5d4f856b0..ccf4f9b3548def03fd4229e12c06bade63cd9b3a 100644 (file)
@@ -493,11 +493,13 @@ public class GithubApiUtil {
   public static List<GithubIssue> getIssuesQueried(@NotNull GithubConnection connection,
                                                    @NotNull String user,
                                                    @NotNull String repo,
+                                                   @Nullable String assignedUser,
                                                    @Nullable String query,
                                                    boolean withClosed) throws IOException {
     try {
       String state = withClosed ? "" : " state:open";
-      query = URLEncoder.encode("repo:" + user + "/" + repo + " " + query + state, CharsetToolkit.UTF8);
+      String assignee = StringUtil.isEmptyOrSpaces(assignedUser) ? "" : " assignee:" + assignedUser;
+      query = URLEncoder.encode("repo:" + user + "/" + repo + state + assignee + " " + query, CharsetToolkit.UTF8);
       String path = "/search/issues?q=" + query;
 
       //TODO: Use bodyHtml for issues - GitHub does not support this feature for SearchApi yet