|
|
@ -62,7 +62,7 @@ class RoomCreateRestServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_POST(self, request): |
|
|
|
def on_POST(self, request): |
|
|
|
auth_user, client = yield self.auth.get_user_by_req(request) |
|
|
|
auth_user, _ = yield self.auth.get_user_by_req(request) |
|
|
|
|
|
|
|
|
|
|
|
room_config = self.get_room_config(request) |
|
|
|
room_config = self.get_room_config(request) |
|
|
|
info = yield self.make_room(room_config, auth_user, None) |
|
|
|
info = yield self.make_room(room_config, auth_user, None) |
|
|
@ -125,7 +125,7 @@ class RoomStateEventRestServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_GET(self, request, room_id, event_type, state_key): |
|
|
|
def on_GET(self, request, room_id, event_type, state_key): |
|
|
|
user, client = yield self.auth.get_user_by_req(request) |
|
|
|
user, _ = yield self.auth.get_user_by_req(request) |
|
|
|
|
|
|
|
|
|
|
|
msg_handler = self.handlers.message_handler |
|
|
|
msg_handler = self.handlers.message_handler |
|
|
|
data = yield msg_handler.get_room_data( |
|
|
|
data = yield msg_handler.get_room_data( |
|
|
@ -143,7 +143,7 @@ class RoomStateEventRestServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_PUT(self, request, room_id, event_type, state_key, txn_id=None): |
|
|
|
def on_PUT(self, request, room_id, event_type, state_key, txn_id=None): |
|
|
|
user, client = yield self.auth.get_user_by_req(request) |
|
|
|
user, token_id = yield self.auth.get_user_by_req(request) |
|
|
|
|
|
|
|
|
|
|
|
content = _parse_json(request) |
|
|
|
content = _parse_json(request) |
|
|
|
|
|
|
|
|
|
|
@ -159,7 +159,7 @@ class RoomStateEventRestServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
msg_handler = self.handlers.message_handler |
|
|
|
msg_handler = self.handlers.message_handler |
|
|
|
yield msg_handler.create_and_send_event( |
|
|
|
yield msg_handler.create_and_send_event( |
|
|
|
event_dict, client=client, txn_id=txn_id, |
|
|
|
event_dict, token_id=token_id, txn_id=txn_id, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
defer.returnValue((200, {})) |
|
|
|
defer.returnValue((200, {})) |
|
|
@ -175,7 +175,7 @@ class RoomSendEventRestServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_POST(self, request, room_id, event_type, txn_id=None): |
|
|
|
def on_POST(self, request, room_id, event_type, txn_id=None): |
|
|
|
user, client = yield self.auth.get_user_by_req(request) |
|
|
|
user, token_id = yield self.auth.get_user_by_req(request) |
|
|
|
content = _parse_json(request) |
|
|
|
content = _parse_json(request) |
|
|
|
|
|
|
|
|
|
|
|
msg_handler = self.handlers.message_handler |
|
|
|
msg_handler = self.handlers.message_handler |
|
|
@ -186,7 +186,7 @@ class RoomSendEventRestServlet(ClientV1RestServlet): |
|
|
|
"room_id": room_id, |
|
|
|
"room_id": room_id, |
|
|
|
"sender": user.to_string(), |
|
|
|
"sender": user.to_string(), |
|
|
|
}, |
|
|
|
}, |
|
|
|
client=client, |
|
|
|
token_id=token_id, |
|
|
|
txn_id=txn_id, |
|
|
|
txn_id=txn_id, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -220,7 +220,7 @@ class JoinRoomAliasServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_POST(self, request, room_identifier, txn_id=None): |
|
|
|
def on_POST(self, request, room_identifier, txn_id=None): |
|
|
|
user, client = yield self.auth.get_user_by_req(request) |
|
|
|
user, token_id = yield self.auth.get_user_by_req(request) |
|
|
|
|
|
|
|
|
|
|
|
# the identifier could be a room alias or a room id. Try one then the |
|
|
|
# the identifier could be a room alias or a room id. Try one then the |
|
|
|
# other if it fails to parse, without swallowing other valid |
|
|
|
# other if it fails to parse, without swallowing other valid |
|
|
@ -250,7 +250,7 @@ class JoinRoomAliasServlet(ClientV1RestServlet): |
|
|
|
"sender": user.to_string(), |
|
|
|
"sender": user.to_string(), |
|
|
|
"state_key": user.to_string(), |
|
|
|
"state_key": user.to_string(), |
|
|
|
}, |
|
|
|
}, |
|
|
|
client=client, |
|
|
|
token_id=token_id, |
|
|
|
txn_id=txn_id, |
|
|
|
txn_id=txn_id, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -289,7 +289,7 @@ class RoomMemberListRestServlet(ClientV1RestServlet): |
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_GET(self, request, room_id): |
|
|
|
def on_GET(self, request, room_id): |
|
|
|
# TODO support Pagination stream API (limit/tokens) |
|
|
|
# TODO support Pagination stream API (limit/tokens) |
|
|
|
user, client = yield self.auth.get_user_by_req(request) |
|
|
|
user, _ = yield self.auth.get_user_by_req(request) |
|
|
|
handler = self.handlers.room_member_handler |
|
|
|
handler = self.handlers.room_member_handler |
|
|
|
members = yield handler.get_room_members_as_pagination_chunk( |
|
|
|
members = yield handler.get_room_members_as_pagination_chunk( |
|
|
|
room_id=room_id, |
|
|
|
room_id=room_id, |
|
|
@ -317,7 +317,7 @@ class RoomMessageListRestServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_GET(self, request, room_id): |
|
|
|
def on_GET(self, request, room_id): |
|
|
|
user, client = yield self.auth.get_user_by_req(request) |
|
|
|
user, _ = yield self.auth.get_user_by_req(request) |
|
|
|
pagination_config = PaginationConfig.from_request( |
|
|
|
pagination_config = PaginationConfig.from_request( |
|
|
|
request, default_limit=10, |
|
|
|
request, default_limit=10, |
|
|
|
) |
|
|
|
) |
|
|
@ -341,7 +341,7 @@ class RoomStateRestServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_GET(self, request, room_id): |
|
|
|
def on_GET(self, request, room_id): |
|
|
|
user, client = yield self.auth.get_user_by_req(request) |
|
|
|
user, _ = yield self.auth.get_user_by_req(request) |
|
|
|
handler = self.handlers.message_handler |
|
|
|
handler = self.handlers.message_handler |
|
|
|
# Get all the current state for this room |
|
|
|
# Get all the current state for this room |
|
|
|
events = yield handler.get_state_events( |
|
|
|
events = yield handler.get_state_events( |
|
|
@ -357,7 +357,7 @@ class RoomInitialSyncRestServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_GET(self, request, room_id): |
|
|
|
def on_GET(self, request, room_id): |
|
|
|
user, client = yield self.auth.get_user_by_req(request) |
|
|
|
user, _ = yield self.auth.get_user_by_req(request) |
|
|
|
pagination_config = PaginationConfig.from_request(request) |
|
|
|
pagination_config = PaginationConfig.from_request(request) |
|
|
|
content = yield self.handlers.message_handler.room_initial_sync( |
|
|
|
content = yield self.handlers.message_handler.room_initial_sync( |
|
|
|
room_id=room_id, |
|
|
|
room_id=room_id, |
|
|
@ -402,7 +402,7 @@ class RoomMembershipRestServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_POST(self, request, room_id, membership_action, txn_id=None): |
|
|
|
def on_POST(self, request, room_id, membership_action, txn_id=None): |
|
|
|
user, client = yield self.auth.get_user_by_req(request) |
|
|
|
user, token_id = yield self.auth.get_user_by_req(request) |
|
|
|
|
|
|
|
|
|
|
|
content = _parse_json(request) |
|
|
|
content = _parse_json(request) |
|
|
|
|
|
|
|
|
|
|
@ -427,7 +427,7 @@ class RoomMembershipRestServlet(ClientV1RestServlet): |
|
|
|
"sender": user.to_string(), |
|
|
|
"sender": user.to_string(), |
|
|
|
"state_key": state_key, |
|
|
|
"state_key": state_key, |
|
|
|
}, |
|
|
|
}, |
|
|
|
client=client, |
|
|
|
token_id=token_id, |
|
|
|
txn_id=txn_id, |
|
|
|
txn_id=txn_id, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -457,7 +457,7 @@ class RoomRedactEventRestServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_POST(self, request, room_id, event_id, txn_id=None): |
|
|
|
def on_POST(self, request, room_id, event_id, txn_id=None): |
|
|
|
user, client = yield self.auth.get_user_by_req(request) |
|
|
|
user, token_id = yield self.auth.get_user_by_req(request) |
|
|
|
content = _parse_json(request) |
|
|
|
content = _parse_json(request) |
|
|
|
|
|
|
|
|
|
|
|
msg_handler = self.handlers.message_handler |
|
|
|
msg_handler = self.handlers.message_handler |
|
|
@ -469,7 +469,7 @@ class RoomRedactEventRestServlet(ClientV1RestServlet): |
|
|
|
"sender": user.to_string(), |
|
|
|
"sender": user.to_string(), |
|
|
|
"redacts": event_id, |
|
|
|
"redacts": event_id, |
|
|
|
}, |
|
|
|
}, |
|
|
|
client=client, |
|
|
|
token_id=token_id, |
|
|
|
txn_id=txn_id, |
|
|
|
txn_id=txn_id, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -497,7 +497,7 @@ class RoomTypingRestServlet(ClientV1RestServlet): |
|
|
|
|
|
|
|
|
|
|
|
@defer.inlineCallbacks |
|
|
|
@defer.inlineCallbacks |
|
|
|
def on_PUT(self, request, room_id, user_id): |
|
|
|
def on_PUT(self, request, room_id, user_id): |
|
|
|
auth_user, client = yield self.auth.get_user_by_req(request) |
|
|
|
auth_user, _ = yield self.auth.get_user_by_req(request) |
|
|
|
|
|
|
|
|
|
|
|
room_id = urllib.unquote(room_id) |
|
|
|
room_id = urllib.unquote(room_id) |
|
|
|
target_user = UserID.from_string(urllib.unquote(user_id)) |
|
|
|
target_user = UserID.from_string(urllib.unquote(user_id)) |
|
|
|