feat(client-api): Support bump_event_types in sync::sync_events::v4::Request.

This patch updates `sync::sync_events::v4::Request` to add the new
`bump_event_types` field, as described in [MSC3575] (more precisely in
this [diff]).

That's the first step to address https://github.com/matrix-org/matrix-rust-sdk/issues/1728.

[MSC3575]: https://github.com/matrix-org/matrix-spec-proposals/blob/kegan/sync-v3/proposals/3575-sync.md
[diff]: 35b79f6ebe...5bd13e66df (diff-1f7276cbbee4eeaaca06b07d2fe58312eab735259f2490e28e04710dde77fdccL78)
This commit is contained in:
Ivan Enderlin 2023-04-06 13:29:38 +02:00 committed by Kévin Commaille
parent e61e0ccf6b
commit fe3a8ff669

View File

@ -13,7 +13,7 @@ use ruma_common::{
events::{ events::{
receipt::SyncReceiptEvent, typing::SyncTypingEvent, AnyGlobalAccountDataEvent, receipt::SyncReceiptEvent, typing::SyncTypingEvent, AnyGlobalAccountDataEvent,
AnyRoomAccountDataEvent, AnyStrippedStateEvent, AnySyncStateEvent, AnySyncTimelineEvent, AnyRoomAccountDataEvent, AnyStrippedStateEvent, AnySyncStateEvent, AnySyncTimelineEvent,
AnyToDeviceEvent, StateEventType, AnyToDeviceEvent, StateEventType, TimelineEventType,
}, },
metadata, metadata,
serde::{duration::opt_ms, Raw}, serde::{duration::opt_ms, Raw},
@ -76,6 +76,16 @@ pub struct Request {
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub lists: BTreeMap<String, SyncRequestList>, pub lists: BTreeMap<String, SyncRequestList>,
/// An allow-list of event types which should be considered recent activity when sorting
/// `by_recency`. By omitting event types from this field, clients can ensure that
/// uninteresting events (e.g. a profil rename) do not cause a room to jump to the top of its
/// list(s). Empty or omitted `bump_event_types` have no effect; all events in a room will be
/// considered recent activity.
///
/// This is currently per-connection, not per-list. Sticky.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub bump_event_types: Vec<TimelineEventType>,
/// Specific rooms and event types that we want to receive events from. /// Specific rooms and event types that we want to receive events from.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub room_subscriptions: BTreeMap<OwnedRoomId, RoomSubscription>, pub room_subscriptions: BTreeMap<OwnedRoomId, RoomSubscription>,