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_raw
This commit is contained in:
committed by
Jonas Platte
parent
8f108d4064
commit
1609a73e99
@@ -1240,7 +1240,7 @@ mod tests {
|
||||
let reaction = ReactionEventContent::new(Annotation::new(event_id.into(), "🐈".to_owned()));
|
||||
room.send(reaction).await.expect("Sending the reaction should not fail");
|
||||
|
||||
room.send_raw(json!({}), "m.reaction").await.expect("Sending the reaction should not fail");
|
||||
room.send_raw("m.reaction", json!({})).await.expect("Sending the reaction should not fail");
|
||||
}
|
||||
|
||||
#[async_test]
|
||||
|
||||
@@ -86,7 +86,7 @@ impl<'a> IntoFuture for SendMessageLikeEvent<'a> {
|
||||
let Self { room, event_type, content, transaction_id } = self;
|
||||
Box::pin(async move {
|
||||
let content = content?;
|
||||
assign!(room.send_raw(content, &event_type), { transaction_id }).await
|
||||
assign!(room.send_raw(&event_type, content), { transaction_id }).await
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1404,10 +1404,10 @@ impl Room {
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `content` - The content of the event as a json `Value`.
|
||||
///
|
||||
/// * `event_type` - The type of the event.
|
||||
///
|
||||
/// * `content` - The content of the event as a json `Value`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
@@ -1421,20 +1421,16 @@ impl Room {
|
||||
/// # let room_id = room_id!("!test:localhost");
|
||||
/// use serde_json::json;
|
||||
///
|
||||
/// let content = json!({
|
||||
/// "body": "Hello world",
|
||||
/// });
|
||||
///
|
||||
/// if let Some(room) = client.get_room(&room_id) {
|
||||
/// room.send_raw(content, "m.room.message").await?;
|
||||
/// room.send_raw("m.room.message", json!({ "body": "Hello world" })).await?;
|
||||
/// }
|
||||
/// # anyhow::Ok(()) };
|
||||
/// ```
|
||||
#[instrument(skip_all, fields(event_type, room_id = ?self.room_id(), transaction_id, encrypted))]
|
||||
pub fn send_raw<'a>(
|
||||
&'a self,
|
||||
content: serde_json::Value,
|
||||
event_type: &'a str,
|
||||
content: serde_json::Value,
|
||||
) -> SendRawMessageLikeEvent<'a> {
|
||||
SendRawMessageLikeEvent::new(self, event_type, content)
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ impl MatrixDriver {
|
||||
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,
|
||||
None => self.room.send_raw(content, &type_str).await?.event_id,
|
||||
None => self.room.send_raw(&type_str, content).await?.event_id,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user