Consolidate generic search results

Phabricator treats generic searches in maniphest or projects all the
same. By modelling them in a single class, we avoid duplication and
benefit especially if we need to implement fetching more than a page of
search results at some point.

Change-Id: Ie067fec8842d1df1d5c4ff5dde333416de37a177
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/Conduit.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/Conduit.java
index be28ab2..39c0ce5 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/Conduit.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/Conduit.java
@@ -22,10 +22,9 @@
 import com.google.inject.Inject;
 import com.google.inject.assistedinject.Assisted;
 import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ConduitPing;
+import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.GenericSearch;
 import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ManiphestEdit;
-import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ManiphestResults;
 import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ManiphestSearch;
-import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ProjectResults;
 import com.googlesource.gerrit.plugins.its.phabricator.conduit.results.ProjectSearch;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -77,7 +76,7 @@
   }
 
   /** Runs the API's 'maniphest.search' method */
-  public ManiphestResults maniphestSearch(int taskId) throws ConduitException {
+  public GenericSearch maniphestSearch(int taskId) throws ConduitException {
     HashMap<String, Object> params = new HashMap<>();
     HashMap<String, Object> params2 = new HashMap<>();
     HashMap<String, Object> params3 = new HashMap<>();
@@ -93,7 +92,7 @@
     params.put("attachments", params3);
 
     JsonElement callResult = conduitConnection.call("maniphest.search", params, token);
-    ManiphestResults result = gson.fromJson(callResult, ManiphestResults.class);
+    GenericSearch result = gson.fromJson(callResult, GenericSearch.class);
     return result;
   }
 
@@ -115,7 +114,7 @@
 
       Set<String> projectPhids = Sets.newHashSet(projectPhid);
 
-      ManiphestResults taskSearch = maniphestSearch(taskId);
+      GenericSearch taskSearch = maniphestSearch(taskId);
       JsonArray maniphestResultEntryValue = taskSearch.getData().getAsJsonArray();
 
       for (JsonElement jsonElement : maniphestResultEntryValue) {
@@ -183,7 +182,7 @@
     params.put("constraints", params2);
 
     JsonElement callResult = conduitConnection.call("project.search", params, token);
-    ProjectResults projectResult = gson.fromJson(callResult, ProjectResults.class);
+    GenericSearch projectResult = gson.fromJson(callResult, GenericSearch.class);
     JsonArray projectResultData = projectResult.getData().getAsJsonArray();
 
     ProjectSearch result = null;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ProjectResults.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/GenericSearch.java
similarity index 97%
rename from src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ProjectResults.java
rename to src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/GenericSearch.java
index fcd9b44..c1efd07 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ProjectResults.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/GenericSearch.java
@@ -39,7 +39,7 @@
  * }
  * </pre>
  */
-public class ProjectResults {
+public class GenericSearch {
   private JsonElement data;
 
   public JsonElement getData() {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ManiphestResults.java b/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ManiphestResults.java
deleted file mode 100644
index 8a28795..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/its/phabricator/conduit/results/ManiphestResults.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2018 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.its.phabricator.conduit.results;
-
-import com.google.gson.JsonElement;
-
-/**
- * Models the result for API methods
- *
- * <p>JSON looks like:
- *
- * <pre>
- * {
- *   "data": [
- *     { ... }
- *   ],
- *   "maps": {},
- *   "query": {
- *     "queryKey": null
- *   },
- *   "cursor": {
- *     "limit": 100,
- *     "after": null,
- *     "before": null,
- *     "order": null
- *   }
- * }
- * </pre>
- */
-public class ManiphestResults {
-  private JsonElement data;
-
-  public JsonElement getData() {
-    return data;
-  }
-}