summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-15 10:15:37 +0100
committerErik Johnston <erik@matrix.org>2016-09-15 10:15:37 +0100
commitf3eead066044083457b3a60ee67d3d1fb2b8e4c8 (patch)
tree4cf4a989ae1ed139a327a7d25733d03f1fec5856 /synapse/rest/client
parentRemove support for aggregate room lists (diff)
downloadsynapse-f3eead066044083457b3a60ee67d3d1fb2b8e4c8.tar.xz
Allow paginating both forwards and backwards
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/v1/room.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py
index c40913c7d1..00b7738e0b 100644
--- a/synapse/rest/client/v1/room.py
+++ b/synapse/rest/client/v1/room.py
@@ -23,7 +23,9 @@ from synapse.api.constants import EventTypes, Membership
 from synapse.api.filtering import Filter
 from synapse.types import UserID, RoomID, RoomAlias
 from synapse.events.utils import serialize_event, format_event_for_client_v2
-from synapse.http.servlet import parse_json_object_from_request, parse_string
+from synapse.http.servlet import (
+    parse_json_object_from_request, parse_string, parse_integer
+)
 
 import logging
 import urllib
@@ -317,11 +319,21 @@ class PublicRoomListRestServlet(ClientV1RestServlet):
             else:
                 pass
 
+        limit = parse_integer(request, "limit", 0)
+        next_batch = parse_string(request, "since", None)
+
         handler = self.hs.get_room_list_handler()
         if server:
-            data = yield handler.get_remote_public_room_list(server)
+            data = yield handler.get_remote_public_room_list(
+                server,
+                limit=limit,
+                next_batch=next_batch,
+            )
         else:
-            data = yield handler.get_local_public_room_list()
+            data = yield handler.get_local_public_room_list(
+                limit=limit,
+                next_batch=next_batch,
+            )
 
         defer.returnValue((200, data))