From 4e8d19ee2ba760ac366f89743b873df15d8e1def Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 27 Aug 2014 16:42:33 +0100 Subject: Added RestServlet for /rooms/$roomid/state --- synapse/rest/room.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'synapse/rest/room.py') diff --git a/synapse/rest/room.py b/synapse/rest/room.py index 3f2530b141..2d30eeaf38 100644 --- a/synapse/rest/room.py +++ b/synapse/rest/room.py @@ -322,6 +322,21 @@ class RoomMessageListRestServlet(RestServlet): defer.returnValue((200, msgs)) +# TODO: Needs unit testing +class RoomStateRestServlet(RestServlet): + PATTERN = client_path_pattern("/rooms/(?P[^/]*)/state$") + + @defer.inlineCallbacks + def on_GET(self, request, room_id): + user = yield self.auth.get_user_by_req(request) + # TODO: Get all the current state for this room and return in the same + # format as initial sync, that is: + # [ + # { state event }, { state event } + # ] + defer.returnValue((200, [])) + + class RoomTriggerBackfill(RestServlet): PATTERN = client_path_pattern("/rooms/(?P[^/]*)/backfill$") @@ -436,3 +451,4 @@ def register_servlets(hs, http_server): RoomMembershipRestServlet(hs).register(http_server) RoomSendEventRestServlet(hs).register(http_server) PublicRoomListRestServlet(hs).register(http_server) + RoomStateRestServlet(hs).register(http_server) -- cgit 1.4.1 From f64887e15c3b554d375e3ae3585aa592ace550dc Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 27 Aug 2014 16:49:01 +0100 Subject: Added RestServlet for /rooms/$roomid/initialSync --- synapse/rest/room.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'synapse/rest/room.py') diff --git a/synapse/rest/room.py b/synapse/rest/room.py index 2d30eeaf38..ebe4e24432 100644 --- a/synapse/rest/room.py +++ b/synapse/rest/room.py @@ -337,6 +337,35 @@ class RoomStateRestServlet(RestServlet): defer.returnValue((200, [])) +# TODO: Needs unit testing +class RoomInitialSyncRestServlet(RestServlet): + PATTERN = client_path_pattern("/rooms/(?P[^/]*)/initialSync$") + + @defer.inlineCallbacks + def on_GET(self, request, room_id): + user = yield self.auth.get_user_by_req(request) + # TODO: Get all the initial sync data for this room and return in the + # same format as initial sync, that is: + # { + # membership: join, + # messages: [ + # chunk: [ msg events ], + # start: s_tok, + # end: e_tok + # ], + # room_id: foo, + # state: [ + # { state event } , { state event } + # ] + # } + # Probably worth keeping the keys room_id and membership for parity with + # /initialSync even though they must be joined to sync this and know the + # room ID, so clients can reuse the same code (room_id and membership + # are MANDATORY for /initialSync, so the code will expect it to be + # there) + defer.returnValue((200, {})) + + class RoomTriggerBackfill(RestServlet): PATTERN = client_path_pattern("/rooms/(?P[^/]*)/backfill$") @@ -452,3 +481,4 @@ def register_servlets(hs, http_server): RoomSendEventRestServlet(hs).register(http_server) PublicRoomListRestServlet(hs).register(http_server) RoomStateRestServlet(hs).register(http_server) + RoomInitialSyncRestServlet(hs).register(http_server) -- cgit 1.4.1