From 2e70de09b96a6201c95e8da787c37422ac57af07 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 26 Aug 2014 16:19:17 +0100 Subject: Renaming: /im/sync >> /initialSync. /rooms/$roomid/members/list >> /rooms/$roomid/members. /rooms$roomid/messages/list >> /room/$roomid/messages. Updated cmdclient, tests and webclient. --- synapse/rest/__init__.py | 5 +++-- synapse/rest/im.py | 40 ---------------------------------------- synapse/rest/initial_sync.py | 40 ++++++++++++++++++++++++++++++++++++++++ synapse/rest/room.py | 4 ++-- 4 files changed, 45 insertions(+), 44 deletions(-) delete mode 100644 synapse/rest/im.py create mode 100644 synapse/rest/initial_sync.py (limited to 'synapse/rest') diff --git a/synapse/rest/__init__.py b/synapse/rest/__init__.py index da18933b63..47896612ce 100644 --- a/synapse/rest/__init__.py +++ b/synapse/rest/__init__.py @@ -15,7 +15,8 @@ from . import ( - room, events, register, login, profile, public, presence, im, directory + room, events, register, login, profile, public, presence, initial_sync, + directory ) @@ -41,5 +42,5 @@ class RestServletFactory(object): profile.register_servlets(hs, client_resource) public.register_servlets(hs, client_resource) presence.register_servlets(hs, client_resource) - im.register_servlets(hs, client_resource) + initial_sync.register_servlets(hs, client_resource) directory.register_servlets(hs, client_resource) diff --git a/synapse/rest/im.py b/synapse/rest/im.py deleted file mode 100644 index 63a77716a0..0000000000 --- a/synapse/rest/im.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2014 matrix.org -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from twisted.internet import defer - -from synapse.api.streams import PaginationConfig -from base import RestServlet, client_path_pattern - - -class ImSyncRestServlet(RestServlet): - PATTERN = client_path_pattern("/im/sync$") - - @defer.inlineCallbacks - def on_GET(self, request): - user = yield self.auth.get_user_by_req(request) - with_feedback = "feedback" in request.args - pagination_config = PaginationConfig.from_request(request) - handler = self.handlers.message_handler - content = yield handler.snapshot_all_rooms( - user_id=user.to_string(), - pagin_config=pagination_config, - feedback=with_feedback) - - defer.returnValue((200, content)) - - -def register_servlets(hs, http_server): - ImSyncRestServlet(hs).register(http_server) diff --git a/synapse/rest/initial_sync.py b/synapse/rest/initial_sync.py new file mode 100644 index 0000000000..fab748f562 --- /dev/null +++ b/synapse/rest/initial_sync.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# Copyright 2014 matrix.org +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from twisted.internet import defer + +from synapse.api.streams import PaginationConfig +from base import RestServlet, client_path_pattern + + +class InitialSyncRestServlet(RestServlet): + PATTERN = client_path_pattern("/initialSync$") + + @defer.inlineCallbacks + def on_GET(self, request): + user = yield self.auth.get_user_by_req(request) + with_feedback = "feedback" in request.args + pagination_config = PaginationConfig.from_request(request) + handler = self.handlers.message_handler + content = yield handler.snapshot_all_rooms( + user_id=user.to_string(), + pagin_config=pagination_config, + feedback=with_feedback) + + defer.returnValue((200, content)) + + +def register_servlets(hs, http_server): + InitialSyncRestServlet(hs).register(http_server) diff --git a/synapse/rest/room.py b/synapse/rest/room.py index 6771da8fcd..b031ad1bc4 100644 --- a/synapse/rest/room.py +++ b/synapse/rest/room.py @@ -306,7 +306,7 @@ class FeedbackRestServlet(RestServlet): class RoomMemberListRestServlet(RestServlet): - PATTERN = client_path_pattern("/rooms/(?P[^/]*)/members/list$") + PATTERN = client_path_pattern("/rooms/(?P[^/]*)/members$") @defer.inlineCallbacks def on_GET(self, request, room_id): @@ -333,7 +333,7 @@ class RoomMemberListRestServlet(RestServlet): class RoomMessageListRestServlet(RestServlet): - PATTERN = client_path_pattern("/rooms/(?P[^/]*)/messages/list$") + PATTERN = client_path_pattern("/rooms/(?P[^/]*)/messages$") @defer.inlineCallbacks def on_GET(self, request, room_id): -- cgit 1.4.1