sdk: Update argument order for send_state_event_raw

This commit is contained in:
Jonas Platte
2023-10-30 18:00:57 +01:00
committed by Jonas Platte
parent 1609a73e99
commit 3fc1b3adb9
2 changed files with 9 additions and 10 deletions

View File

@@ -1778,13 +1778,13 @@ impl Room {
///
/// # Arguments
///
/// * `content` - The raw content of the state event.
///
/// * `event_type` - The type of the event that we're sending out.
///
/// * `state_key` - A unique key which defines the overwriting semantics for
/// this piece of room state. This value is often a zero-length string.
///
/// * `content` - The raw content of the state event.
///
/// # Examples
///
/// ```no_run
@@ -1794,23 +1794,22 @@ impl Room {
/// # let homeserver = url::Url::parse("http://localhost:8080")?;
/// # let mut client = matrix_sdk::Client::new(homeserver).await?;
/// # let room_id = matrix_sdk::ruma::room_id!("!test:localhost");
/// let content = json!({
/// "avatar_url": "mxc://example.org/SEsfnsuifSDFSSEF",
/// "displayname": "Alice Margatroid",
/// "membership": "join"
/// });
///
/// if let Some(room) = client.get_room(&room_id) {
/// room.send_state_event_raw(content, "m.room.member", "").await?;
/// room.send_state_event_raw("m.room.member", "", json!({
/// "avatar_url": "mxc://example.org/SEsfnsuifSDFSSEF",
/// "displayname": "Alice Margatroid",
/// "membership": "join",
/// })).await?;
/// }
/// # anyhow::Ok(()) };
/// ```
#[instrument(skip_all)]
pub async fn send_state_event_raw(
&self,
content: serde_json::Value,
event_type: &str,
state_key: &str,
content: serde_json::Value,
) -> Result<send_state_event::v3::Response> {
self.ensure_room_joined()?;

View File

@@ -115,7 +115,7 @@ impl MatrixDriver {
) -> Result<OwnedEventId> {
let type_str = event_type.to_string();
Ok(match state_key {
Some(key) => self.room.send_state_event_raw(content, &type_str, &key).await?.event_id,
Some(key) => self.room.send_state_event_raw(&type_str, &key, content).await?.event_id,
None => self.room.send_raw(&type_str, content).await?.event_id,
})
}