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

batch send: use classes without unnecessary/unknown fields #100

Merged
merged 1 commit into from
May 23, 2022

Conversation

sumnerevans
Copy link
Member

The batch send endpoint now accepts events and state events that don't
have room_id, event_id, etc. All batch send classes allow for the
specification of the timestamp.

@tulir
Copy link
Member

tulir commented May 2, 2022

Seems unnecessarily duplicating, and event type specific classes are only useful for deserialization. Something like this should be enough classes:

@dataclass
class BatchSendEvent(BaseEvent, SerializableAttrs):
    sender: UserID
    timestamp: int = attr.ib(metadata={"json": "origin_server_ts"})
    content: Any

@dataclass
class BatchSendStateEvent(BatchSendEvent, SerializableAttrs):
    state_key: str

The batch send endpoint now accepts events and state events that don't
have room_id, event_id, etc. All batch send classes allow for the
specification of the timestamp.
@sumnerevans sumnerevans requested a review from tulir May 23, 2022 17:24
@sumnerevans sumnerevans marked this pull request as ready for review May 23, 2022 18:00
@sumnerevans sumnerevans merged commit a842f0c into master May 23, 2022
@sumnerevans sumnerevans deleted the sumner/bri-2378 branch May 23, 2022 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants