pub struct EventBuilder<C: StaticEventContent<IsPrefix = False>> { /* private fields */ }
Implementations§
Source§impl<E: StaticEventContent<IsPrefix = False>> EventBuilder<E>
impl<E: StaticEventContent<IsPrefix = False>> EventBuilder<E>
pub fn room(self, room_id: &RoomId) -> Self
pub fn sender(self, sender: &UserId) -> Self
pub fn event_id(self, event_id: &EventId) -> Self
pub fn no_event_id(self) -> Self
pub fn server_ts(self, ts: impl TimestampArg) -> Self
pub fn unsigned_transaction_id(self, transaction_id: &TransactionId) -> Self
Sourcepub fn with_bundled_thread_summary(
self,
latest_event: Raw<AnySyncMessageLikeEvent>,
count: usize,
current_user_participated: bool,
) -> Self
pub fn with_bundled_thread_summary( self, latest_event: Raw<AnySyncMessageLikeEvent>, count: usize, current_user_participated: bool, ) -> Self
Create a bundled thread summary in the unsigned bundled relations of this event.
Sourcepub fn with_bundled_edit(
self,
replacement: impl Into<Raw<AnySyncTimelineEvent>>,
) -> Self
pub fn with_bundled_edit( self, replacement: impl Into<Raw<AnySyncTimelineEvent>>, ) -> Self
Create a bundled edit in the unsigned bundled relations of this event.
Sourcepub fn state_key(self, state_key: impl Into<String>) -> Self
pub fn state_key(self, state_key: impl Into<String>) -> Self
For state events manually created, define the state key.
For other state events created in the EventFactory
, this is
automatically filled upon creation or update of the events.
Source§impl<E> EventBuilder<E>
impl<E> EventBuilder<E>
Sourcepub fn into_raw<T>(self) -> Raw<T>
pub fn into_raw<T>(self) -> Raw<T>
Build an event from the EventBuilder
and convert it into a
serialized and Raw
event.
The generic argument T
allows you to automatically cast the Raw
event into any desired type.
pub fn into_raw_timeline(self) -> Raw<AnyTimelineEvent>
pub fn into_any_sync_message_like_event(self) -> AnySyncMessageLikeEvent
pub fn into_original_sync_room_message_event( self, ) -> OriginalSyncRoomMessageEvent
pub fn into_raw_sync(self) -> Raw<AnySyncTimelineEvent>
pub fn into_event(self) -> TimelineEvent
Source§impl EventBuilder<RoomEncryptedEventContent>
impl EventBuilder<RoomEncryptedEventContent>
Sourcepub fn into_utd_sync_timeline_event(self) -> TimelineEvent
pub fn into_utd_sync_timeline_event(self) -> TimelineEvent
Turn this event into a TimelineEvent
representing a decryption
failure
Source§impl EventBuilder<RoomMessageEventContent>
impl EventBuilder<RoomMessageEventContent>
Sourcepub fn in_thread(self, root: &EventId, latest_thread_event: &EventId) -> Self
pub fn in_thread(self, root: &EventId, latest_thread_event: &EventId) -> Self
Adds a thread relation to the root event, setting the reply fallback to the latest in-thread event.
Sourcepub fn in_thread_reply(self, root: &EventId, replied_to: &EventId) -> Self
pub fn in_thread_reply(self, root: &EventId, replied_to: &EventId) -> Self
Adds a thread relation to the root event, that’s a non-fallback reply to another thread event.
Sourcepub fn mentions(self, mentions: Mentions) -> Self
pub fn mentions(self, mentions: Mentions) -> Self
Adds the given mentions to the current event.
Sourcepub fn edit(
self,
edited_event_id: &EventId,
new_content: RoomMessageEventContentWithoutRelation,
) -> Self
pub fn edit( self, edited_event_id: &EventId, new_content: RoomMessageEventContentWithoutRelation, ) -> Self
Adds a replacement relation to the current event, with the new content passed.
Source§impl EventBuilder<RoomCreateEventContent>
impl EventBuilder<RoomCreateEventContent>
Sourcepub fn predecessor(self, room_id: &RoomId) -> Self
pub fn predecessor(self, room_id: &RoomId) -> Self
Define the predecessor fields.
Sourcepub fn no_predecessor(self) -> Self
pub fn no_predecessor(self) -> Self
Erase the predecessor if any.
Sourcepub fn with_space_type(self) -> Self
pub fn with_space_type(self) -> Self
Sets the m.room.create
type
field to m.space
.
Source§impl EventBuilder<StickerEventContent>
impl EventBuilder<StickerEventContent>
Sourcepub fn reply_thread(self, root: &EventId, reply_to_event: &EventId) -> Self
pub fn reply_thread(self, root: &EventId, reply_to_event: &EventId) -> Self
Add reply Thread
relation to root event and set replied-to event id.
Source§impl EventBuilder<DirectEventContent>
impl EventBuilder<DirectEventContent>
Sourcepub fn add_user(
self,
user_id: OwnedDirectUserIdentifier,
room_id: &RoomId,
) -> Self
pub fn add_user( self, user_id: OwnedDirectUserIdentifier, room_id: &RoomId, ) -> Self
Add a user/room pair to the m.direct
event.
Source§impl EventBuilder<RoomMemberEventContent>
impl EventBuilder<RoomMemberEventContent>
Sourcepub fn membership(self, state: MembershipState) -> Self
pub fn membership(self, state: MembershipState) -> Self
Set the membership
of the m.room.member
event to the given
MembershipState
.
The default is MembershipState::Join
.
Sourcepub fn invited(self, invited_user: &UserId) -> Self
pub fn invited(self, invited_user: &UserId) -> Self
Set that the sender of this event invited the user passed as a parameter here.
Sourcepub fn kicked(self, kicked_user: &UserId) -> Self
pub fn kicked(self, kicked_user: &UserId) -> Self
Set that the sender of this event kicked the user passed as a parameter here.
Sourcepub fn banned(self, banned_user: &UserId) -> Self
pub fn banned(self, banned_user: &UserId) -> Self
Set that the sender of this event banned the user passed as a parameter here.
Sourcepub fn display_name(self, display_name: impl Into<String>) -> Self
pub fn display_name(self, display_name: impl Into<String>) -> Self
Set the display name of the m.room.member
event.
Sourcepub fn avatar_url(self, url: &MxcUri) -> Self
pub fn avatar_url(self, url: &MxcUri) -> Self
Set the avatar URL of the m.room.member
event.
Sourcepub fn reason(self, reason: impl Into<String>) -> Self
pub fn reason(self, reason: impl Into<String>) -> Self
Set the reason field of the m.room.member
event.
Sourcepub fn previous(self, previous: impl Into<PreviousMembership>) -> Self
pub fn previous(self, previous: impl Into<PreviousMembership>) -> Self
Set the previous membership state (in the unsigned section).