update ruma
This commit is contained in:
parent
f3795846b5
commit
e9f87e1952
42 changed files with 514 additions and 500 deletions
|
@ -1,11 +1,11 @@
|
|||
use crate::{database::DatabaseGuard, Error, Result, Ruma};
|
||||
use ruma::{
|
||||
api::client::{
|
||||
error::ErrorKind,
|
||||
r0::config::{
|
||||
config::{
|
||||
get_global_account_data, get_room_account_data, set_global_account_data,
|
||||
set_room_account_data,
|
||||
},
|
||||
error::ErrorKind,
|
||||
},
|
||||
events::{AnyGlobalAccountDataEventContent, AnyRoomAccountDataEventContent},
|
||||
serde::Raw,
|
||||
|
@ -18,8 +18,8 @@ use serde_json::{json, value::RawValue as RawJsonValue};
|
|||
/// Sets some account data for the sender user.
|
||||
pub async fn set_global_account_data_route(
|
||||
db: DatabaseGuard,
|
||||
body: Ruma<set_global_account_data::Request<'_>>,
|
||||
) -> Result<set_global_account_data::Response> {
|
||||
body: Ruma<set_global_account_data::v3::Request<'_>>,
|
||||
) -> Result<set_global_account_data::v3::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
let data: serde_json::Value = serde_json::from_str(body.data.get())
|
||||
|
@ -40,7 +40,7 @@ pub async fn set_global_account_data_route(
|
|||
|
||||
db.flush()?;
|
||||
|
||||
Ok(set_global_account_data::Response {})
|
||||
Ok(set_global_account_data::v3::Response {})
|
||||
}
|
||||
|
||||
/// # `PUT /_matrix/client/r0/user/{userId}/rooms/{roomId}/account_data/{type}`
|
||||
|
@ -48,8 +48,8 @@ pub async fn set_global_account_data_route(
|
|||
/// Sets some room account data for the sender user.
|
||||
pub async fn set_room_account_data_route(
|
||||
db: DatabaseGuard,
|
||||
body: Ruma<set_room_account_data::Request<'_>>,
|
||||
) -> Result<set_room_account_data::Response> {
|
||||
body: Ruma<set_room_account_data::v3::Request<'_>>,
|
||||
) -> Result<set_room_account_data::v3::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
let data: serde_json::Value = serde_json::from_str(body.data.get())
|
||||
|
@ -70,7 +70,7 @@ pub async fn set_room_account_data_route(
|
|||
|
||||
db.flush()?;
|
||||
|
||||
Ok(set_room_account_data::Response {})
|
||||
Ok(set_room_account_data::v3::Response {})
|
||||
}
|
||||
|
||||
/// # `GET /_matrix/client/r0/user/{userId}/account_data/{type}`
|
||||
|
@ -78,8 +78,8 @@ pub async fn set_room_account_data_route(
|
|||
/// Gets some account data for the sender user.
|
||||
pub async fn get_global_account_data_route(
|
||||
db: DatabaseGuard,
|
||||
body: Ruma<get_global_account_data::Request<'_>>,
|
||||
) -> Result<get_global_account_data::Response> {
|
||||
body: Ruma<get_global_account_data::v3::Request<'_>>,
|
||||
) -> Result<get_global_account_data::v3::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
let event: Box<RawJsonValue> = db
|
||||
|
@ -91,7 +91,7 @@ pub async fn get_global_account_data_route(
|
|||
.map_err(|_| Error::bad_database("Invalid account data event in db."))?
|
||||
.content;
|
||||
|
||||
Ok(get_global_account_data::Response { account_data })
|
||||
Ok(get_global_account_data::v3::Response { account_data })
|
||||
}
|
||||
|
||||
/// # `GET /_matrix/client/r0/user/{userId}/rooms/{roomId}/account_data/{type}`
|
||||
|
@ -99,8 +99,8 @@ pub async fn get_global_account_data_route(
|
|||
/// Gets some room account data for the sender user.
|
||||
pub async fn get_room_account_data_route(
|
||||
db: DatabaseGuard,
|
||||
body: Ruma<get_room_account_data::Request<'_>>,
|
||||
) -> Result<get_room_account_data::Response> {
|
||||
body: Ruma<get_room_account_data::v3::Request<'_>>,
|
||||
) -> Result<get_room_account_data::v3::Response> {
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
let event: Box<RawJsonValue> = db
|
||||
|
@ -116,7 +116,7 @@ pub async fn get_room_account_data_route(
|
|||
.map_err(|_| Error::bad_database("Invalid account data event in db."))?
|
||||
.content;
|
||||
|
||||
Ok(get_room_account_data::Response { account_data })
|
||||
Ok(get_room_account_data::v3::Response { account_data })
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue