Extend extensions-api Projects with list methods

ListParameter can be constructed with a fluent interface.

Change-Id: Ic9222bcfc9b4ca4211c9f9621ca524ce952e7a52
diff --git a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/Projects.java b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/Projects.java
index a0f22b9..02351cd 100644
--- a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/Projects.java
+++ b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/Projects.java
@@ -14,12 +14,67 @@
 
 package com.google.gerrit.extensions.api.projects;
 
+import com.google.gerrit.extensions.common.ProjectInfo;
 import com.google.gerrit.extensions.restapi.NotImplementedException;
 import com.google.gerrit.extensions.restapi.RestApiException;
 
+import java.util.List;
+
 public interface Projects {
   ProjectApi name(String name) throws RestApiException;
 
+  List<ProjectInfo> list() throws RestApiException;
+  List<ProjectInfo> list(ListParameter listParameter) throws RestApiException;
+
+  public class ListParameter {
+    private boolean description;
+    private String prefix;
+    private int limit;
+    private int start;
+
+    public ListParameter() {}
+
+    public ListParameter(String prefix) {
+      this.prefix = prefix;
+    }
+
+    public ListParameter withDescription(boolean description) {
+      this.description = description;
+      return this;
+    }
+
+    public ListParameter withPrefix(String prefix) {
+      this.prefix = prefix;
+      return this;
+    }
+
+    public ListParameter withLimit(int limit) {
+      this.limit = limit;
+      return this;
+    }
+
+    public ListParameter withStart(int start) {
+      this.start = start;
+      return this;
+    }
+
+    public boolean getDescription() {
+      return description;
+    }
+
+    public String getPrefix() {
+      return prefix;
+    }
+
+    public int getLimit() {
+      return limit;
+    }
+
+    public int getStart() {
+      return start;
+    }
+  }
+
   /**
    * A default implementation which allows source compatibility
    * when adding new methods to the interface.
@@ -29,5 +84,15 @@
     public ProjectApi name(String name) throws RestApiException {
       throw new NotImplementedException();
     }
+
+    @Override
+    public List<ProjectInfo> list() throws RestApiException {
+      throw new NotImplementedException();
+    }
+
+    @Override
+    public List<ProjectInfo> list(ListParameter listParameter) throws RestApiException {
+      throw new NotImplementedException();
+    }
   }
 }