diff options
author | Erik Johnston <erik@matrix.org> | 2016-09-15 17:35:20 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-09-15 17:35:20 +0100 |
commit | c33b25fd8d7a91652dc7f887178a47343c6c9ed2 (patch) | |
tree | 69cb3ddb6eb2b82040568c32625af5f111097c6a /synapse/rest/client/v1/room.py | |
parent | Handling expiring stream extrems correctly. (diff) | |
download | synapse-c33b25fd8d7a91652dc7f887178a47343c6c9ed2.tar.xz |
Change the way we calculate new_limit in /publicRooms and add POST API
Diffstat (limited to 'synapse/rest/client/v1/room.py')
-rw-r--r-- | synapse/rest/client/v1/room.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py index db0cd4380a..be14ae1061 100644 --- a/synapse/rest/client/v1/room.py +++ b/synapse/rest/client/v1/room.py @@ -337,6 +337,35 @@ class PublicRoomListRestServlet(ClientV1RestServlet): defer.returnValue((200, data)) + @defer.inlineCallbacks + def on_POST(self, request): + # FIXME + # 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): |