summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-05-24 17:10:23 +0100
committerErik Johnston <erik@matrix.org>2016-05-25 10:14:38 +0100
commit26c7f08465a23c28fafbef4bf45d249b8404a300 (patch)
treef1a15eb914c0e6a6537fc060527e259a4d2a6060 /synapse/rest
parentMerge branch 'erikj/sync_refactor' of github.com:matrix-org/synapse into erik... (diff)
downloadsynapse-26c7f08465a23c28fafbef4bf45d249b8404a300.tar.xz
Implement basic pagination
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v2_alpha/sync.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/rest/client/v2_alpha/sync.py b/synapse/rest/client/v2_alpha/sync.py
index e1ece5d406..3df9743132 100644
--- a/synapse/rest/client/v2_alpha/sync.py
+++ b/synapse/rest/client/v2_alpha/sync.py
@@ -19,7 +19,7 @@ from synapse.http.servlet import (
     RestServlet, parse_string, parse_integer, parse_boolean,
     parse_json_object_from_request,
 )
-from synapse.handlers.sync import SyncConfig
+from synapse.handlers.sync import SyncConfig, SyncPaginationConfig
 from synapse.types import SyncNextBatchToken
 from synapse.events.utils import (
     serialize_event, format_event_for_client_v2_without_room_id,
@@ -116,6 +116,7 @@ class SyncRestServlet(RestServlet):
 
         filter_id = body.get("filter_id", None)
         filter_dict = body.get("filter", None)
+        pagination_config = body.get("pagination_config", None)
 
         if filter_dict is not None and filter_id is not None:
             raise SynapseError(
@@ -143,6 +144,10 @@ class SyncRestServlet(RestServlet):
             filter_collection=filter_collection,
             is_guest=requester.is_guest,
             request_key=request_key,
+            pagination_config=SyncPaginationConfig(
+                order=pagination_config["order"],
+                limit=pagination_config["limit"],
+            ) if pagination_config else None,
         )
 
         if since is not None:
@@ -213,6 +218,7 @@ class SyncRestServlet(RestServlet):
             filter_collection=filter,
             is_guest=requester.is_guest,
             request_key=request_key,
+            pagination_config=None,
         )
 
         if since is not None: