summary refs log tree commit diff
path: root/synapse/rest/client/v1
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2016-09-16 13:17:29 +0100
committerGitHub <noreply@github.com>2016-09-16 13:17:29 +0100
commit9e1283c8240068575dcf41d12b97fcd771e0c0e0 (patch)
tree3e85a6708c9dc9210237e7d027a2802e011a5bbf /synapse/rest/client/v1
parentMerge pull request #1125 from matrix-org/erikj/public_room_cache (diff)
parentComment (diff)
downloadsynapse-9e1283c8240068575dcf41d12b97fcd771e0c0e0.tar.xz
Merge pull request #1126 from matrix-org/erikj/public_room_cache
Add very basic filter API to /publicRooms
Diffstat (limited to 'synapse/rest/client/v1')
-rw-r--r--synapse/rest/client/v1/room.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py
index db0cd4380a..5584bfbfc0 100644
--- a/synapse/rest/client/v1/room.py
+++ b/synapse/rest/client/v1/room.py
@@ -337,6 +337,34 @@ class PublicRoomListRestServlet(ClientV1RestServlet):
 
         defer.returnValue((200, data))
 
+    @defer.inlineCallbacks
+    def on_POST(self, request):
+        yield self.auth.get_user_by_req(request)
+
+        server = parse_string(request, "server", default=None)
+        content = parse_json_object_from_request(request)
+
+        limit = int(content.get("limit", 100))
+        since_token = content.get("since", None)
+        search_filter = content.get("filter", None)
+
+        handler = self.hs.get_room_list_handler()
+        if server:
+            data = yield handler.get_remote_public_room_list(
+                server,
+                limit=limit,
+                since_token=since_token,
+                search_filter=search_filter,
+            )
+        else:
+            data = yield handler.get_local_public_room_list(
+                limit=limit,
+                since_token=since_token,
+                search_filter=search_filter,
+            )
+
+        defer.returnValue((200, data))
+
 
 # TODO: Needs unit testing
 class RoomMemberListRestServlet(ClientV1RestServlet):