Skip to content

Commit 4a8cbfe

Browse files
committed
feat(sdk): Use SendStateEvent future in Room send_state methods
Signed-off-by: Skye Elliot <[email protected]>
1 parent ef185e1 commit 4a8cbfe

File tree

1 file changed

+9
-13
lines changed
  • crates/matrix-sdk/src/room

1 file changed

+9
-13
lines changed

crates/matrix-sdk/src/room/mod.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ use crate::{
153153
media::{MediaFormat, MediaRequestParameters},
154154
notification_settings::{IsEncrypted, IsOneToOne, RoomNotificationMode},
155155
room::{
156-
futures::SendStateEventRaw,
156+
futures::{SendStateEvent, SendStateEventRaw},
157157
knock_requests::{KnockRequest, KnockRequestMemberInfo},
158158
power_levels::{RoomPowerLevelChanges, RoomPowerLevelsExt},
159159
privacy_settings::RoomPrivacySettings,
@@ -2647,11 +2647,11 @@ impl Room {
26472647
/// # anyhow::Ok(()) };
26482648
/// ```
26492649
#[instrument(skip_all)]
2650-
pub async fn send_state_event(
2651-
&self,
2650+
pub fn send_state_event<'a>(
2651+
&'a self,
26522652
content: impl StateEventContent<StateKey = EmptyStateKey>,
2653-
) -> Result<send_state_event::v3::Response> {
2654-
self.send_state_event_for_key(&EmptyStateKey, content).await
2653+
) -> SendStateEvent<'a> {
2654+
self.send_state_event_for_key(&EmptyStateKey, content)
26552655
}
26562656

26572657
/// Send a state event to the homeserver.
@@ -2694,21 +2694,17 @@ impl Room {
26942694
/// joined_room.send_state_event_for_key("foo", content).await?;
26952695
/// # anyhow::Ok(()) };
26962696
/// ```
2697-
pub async fn send_state_event_for_key<C, K>(
2698-
&self,
2697+
pub fn send_state_event_for_key<'a, C, K>(
2698+
&'a self,
26992699
state_key: &K,
27002700
content: C,
2701-
) -> Result<send_state_event::v3::Response>
2701+
) -> SendStateEvent<'a>
27022702
where
27032703
C: StateEventContent,
27042704
C::StateKey: Borrow<K>,
27052705
K: AsRef<str> + ?Sized,
27062706
{
2707-
self.ensure_room_joined()?;
2708-
let request =
2709-
send_state_event::v3::Request::new(self.room_id().to_owned(), state_key, &content)?;
2710-
let response = self.client.send(request).await?;
2711-
Ok(response)
2707+
SendStateEvent::new(self, state_key, content)
27122708
}
27132709

27142710
/// Send a raw room state event to the homeserver.

0 commit comments

Comments
 (0)