pub struct EventBuilder<C: EventContent> { /* private fields */ }Implementations§
Source§impl<E: EventContent> EventBuilder<E>
impl<E: EventContent> 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 bundled_relations(
self,
relations: BundledMessageLikeRelations<Raw<AnySyncTimelineEvent>>,
) -> Self
pub fn bundled_relations( self, relations: BundledMessageLikeRelations<Raw<AnySyncTimelineEvent>>, ) -> Self
Adds bundled relations to this event.
Ideally, we’d type-check that an event passed as a relation is the same type as this one, but it’s not trivial to do so because this builder is only generic on the event’s content, not the event type itself; doing so would require many changes, and this is testing code after all.
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.
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_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 latest thread event id too.
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<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).