mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-07 07:27:45 -04:00
sdk: Update argument order for send_state_event_raw
This commit is contained in:
committed by
Jonas Platte
parent
1609a73e99
commit
3fc1b3adb9
@@ -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()?;
|
||||
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user