Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assume event_id and room_id from context for spec elision optimization. #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mautrix/client/api/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ async def get_event(self, room_id: RoomID, event_id: EventID) -> Event:
https://matrix.org/docs/spec/client_server/r0.5.0#get-matrix-client-r0-rooms-roomid-event-eventid
"""
content = await self.api.request(Method.GET, Path.rooms[room_id].event[event_id])
if "event_id" not in content:
content["event_id"] = event_id
if "room_id" not in content:
content["room_id"] = room_id
try:
return Event.deserialize(content)
except SerializerError as e:
Expand Down