diff --git a/doc/3/controllers/collection/list/index.md b/doc/3/controllers/collection/list/index.md
new file mode 100644
index 00000000..646eaf6f
--- /dev/null
+++ b/doc/3/controllers/collection/list/index.md
@@ -0,0 +1,45 @@
+---
+code: true
+type: page
+title: list
+description: Returns the collection list of an index
+---
+
+# list
+
+Returns the list of collections associated to a provided index.
+The returned list is sorted in alphanumerical order.
+
+
+
+```java
+public CompletableFuture> list(
+ final String index) throws NotConnectedException, InternalException
+```
+
+
+| Arguments | Type | Description |
+| --------- | ---------------------- | ------------- |
+| `index` |
String
| Index name |
+
+## Returns
+
+Returns a `ConcurrentHashMap` containing the following properties:
+
+| Property | Type | Description |
+| ------------- | ------------------- | ------------------------------------------------------------------ |
+| `type` |
String
| Types of returned collections (`all`, `realtime` or `stored`) |
+| `collections` |
ArrayList
| List of collections |
+| `from` |
Integer
| Offset of the first result |
+| `size` |
Integer
| Maximum number of returned results |
+
+Each object in the `collections` array contains the following properties:
+
+| Property | Type | Description |
+| -------- | ----------------- | ---------------------------------------- |
+| `name` |
String
| Collection name |
+| `type` |
String
| Collection type (`realtime` or `stored`) |
+
+## Usage
+
+<<< ./snippets/list.java
\ No newline at end of file
diff --git a/doc/3/controllers/collection/list/snippets/list.java b/doc/3/controllers/collection/list/snippets/list.java
new file mode 100644
index 00000000..05bd5975
--- /dev/null
+++ b/doc/3/controllers/collection/list/snippets/list.java
@@ -0,0 +1,22 @@
+ ConcurrentHashMap result = kuzzle
+ .getCollectionController()
+ .list("nyc-open-data")
+ .get();
+
+/*
+ {
+ size=10,
+ collections=[
+ {
+ name=dark-taxi,
+ type=stored
+ },
+ {
+ name=pink-taxi,
+ type=stored
+ }
+ ],
+ from=0,
+ type=all
+ }
+ */
\ No newline at end of file
diff --git a/doc/3/controllers/collection/list/snippets/list.test.yml b/doc/3/controllers/collection/list/snippets/list.test.yml
new file mode 100644
index 00000000..b748fa01
--- /dev/null
+++ b/doc/3/controllers/collection/list/snippets/list.test.yml
@@ -0,0 +1,7 @@
+name: collection#list
+description: Returns the collection list of an index
+hooks:
+ before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/pink-taxi && curl -X PUT kuzzle:7512/nyc-open-data/dark-taxi
+ after:
+template: default
+expected: Success
\ No newline at end of file
diff --git a/src/main/java/io/kuzzle/sdk/API/Controllers/CollectionController.java b/src/main/java/io/kuzzle/sdk/API/Controllers/CollectionController.java
index a1e2d278..c5831c54 100644
--- a/src/main/java/io/kuzzle/sdk/API/Controllers/CollectionController.java
+++ b/src/main/java/io/kuzzle/sdk/API/Controllers/CollectionController.java
@@ -276,4 +276,27 @@ public CompletableFuture> updateSpecifications
.thenApplyAsync(
(response) -> (ConcurrentHashMap) response.result);
}
+
+ /**
+ * List collections.
+ *
+ * @param index
+ * @return a CompletableFuture
+ * @throws NotConnectedException
+ * @throws InternalException
+ */
+ public CompletableFuture> list(
+ final String index) throws NotConnectedException, InternalException {
+
+ final KuzzleMap query = new KuzzleMap();
+ query
+ .put("index", index)
+ .put("controller", "collection")
+ .put("action", "list");
+
+ return kuzzle
+ .query(query)
+ .thenApplyAsync(
+ (response) -> (ConcurrentHashMap) response.result);
+ }
}
diff --git a/src/test/java/io/kuzzle/test/API/Controllers/CollectionTest.java b/src/test/java/io/kuzzle/test/API/Controllers/CollectionTest.java
index 6a865821..edd2de00 100644
--- a/src/test/java/io/kuzzle/test/API/Controllers/CollectionTest.java
+++ b/src/test/java/io/kuzzle/test/API/Controllers/CollectionTest.java
@@ -155,7 +155,6 @@ public void getMappingCollectionTest() throws NotConnectedException, InternalExc
String index = "nyc-open-data";
String collection = "yellow-taxi";
-
ArgumentCaptor arg = ArgumentCaptor.forClass(KuzzleMap.class);
kuzzleMock.getCollectionController().getMapping(index, collection);
@@ -374,4 +373,31 @@ public void updateSpecificationsCollectionThrowWhenNotConnected() throws NotConn
kuzzleMock.getCollectionController().updateSpecifications(index, collection, specifications);
}
+
+ @Test
+ public void listCollectionTest() throws NotConnectedException, InternalException {
+
+ Kuzzle kuzzleMock = spy(new Kuzzle(networkProtocol));
+ String index = "nyc-open-data";
+
+ ArgumentCaptor arg = ArgumentCaptor.forClass(KuzzleMap.class);
+
+ kuzzleMock.getCollectionController().list(index);
+ Mockito.verify(kuzzleMock, Mockito.times(1)).query(arg.capture());
+
+ assertEquals((arg.getValue()).getString("controller"), "collection");
+ assertEquals((arg.getValue()).getString("action"), "list");
+ assertEquals((arg.getValue()).getString("index"), "nyc-open-data");
+ }
+
+ @Test(expected = NotConnectedException.class)
+ public void listCollectionShouldThrowWhenNotConnected() throws NotConnectedException, InternalException {
+ AbstractProtocol fakeNetworkProtocol = Mockito.mock(WebSocket.class);
+ Mockito.when(fakeNetworkProtocol.getState()).thenAnswer((Answer) invocation -> ProtocolState.CLOSE);
+
+ Kuzzle kuzzleMock = spy(new Kuzzle(fakeNetworkProtocol));
+ String index = "nyc-open-data";
+
+ kuzzleMock.getCollectionController().list(index);
+ }
}