ruma: Fix hello_isahc example

This commit is contained in:
Kévin Commaille 2022-03-04 13:00:42 +01:00 committed by Kévin Commaille
parent c3f9a3cb70
commit 9e736bec84
2 changed files with 4 additions and 5 deletions

View File

@ -166,7 +166,7 @@ required-features = ["client-api-c", "client-ext-client-api", "client-hyper-nati
[[example]] [[example]]
name = "hello_isahc" name = "hello_isahc"
required-features = ["client-api-c", "client-ext-client-api", "client-isahc"] required-features = ["client-api-c", "client-ext-client-api", "client-isahc", "rand"]
[[example]] [[example]]
name = "message_log" name = "message_log"

View File

@ -6,9 +6,8 @@ use std::{convert::TryFrom, env, process::exit};
use ruma::{ use ruma::{
api::client::{alias::get_alias, membership::join_room_by_id, message::send_message_event}, api::client::{alias::get_alias, membership::join_room_by_id, message::send_message_event},
events::room::message::RoomMessageEventContent, events::room::message::RoomMessageEventContent,
RoomAliasId, RoomAliasId, TransactionId,
}; };
use ruma_common::api::MatrixVersion;
async fn hello_world( async fn hello_world(
homeserver_url: String, homeserver_url: String,
@ -24,9 +23,9 @@ async fn hello_world(
let room_id = client.send_request(get_alias::v3::Request::new(room_alias)).await?.room_id; let room_id = client.send_request(get_alias::v3::Request::new(room_alias)).await?.room_id;
client.send_request(join_room_by_id::v3::Request::new(&room_id)).await?; client.send_request(join_room_by_id::v3::Request::new(&room_id)).await?;
client client
.send_request(send_message_event::Request::new( .send_request(send_message_event::v3::Request::new(
&room_id, &room_id,
"1", &TransactionId::new(),
&RoomMessageEventContent::text_plain("Hello World!"), &RoomMessageEventContent::text_plain("Hello World!"),
)?) )?)
.await?; .await?;