update ruma

This commit is contained in:
Jonathan de Jong 2022-02-18 15:33:14 +01:00
parent f3795846b5
commit e9f87e1952
42 changed files with 514 additions and 500 deletions

View file

@ -1,7 +1,12 @@
use crate::{database::DatabaseGuard, Error, Result, Ruma};
use ruma::api::client::{error::ErrorKind, r0::search::search_events};
use ruma::api::client::{
error::ErrorKind,
search::search_events::v3::{
self as search_events_v3, EventContextResult, ResultCategories, ResultRoomEvents,
SearchResult,
},
};
use search_events::{EventContextResult, ResultCategories, ResultRoomEvents, SearchResult};
use std::collections::BTreeMap;
/// # `POST /_matrix/client/r0/search`
@ -11,8 +16,8 @@ use std::collections::BTreeMap;
/// - Only works if the user is currently joined to the room (TODO: Respect history visibility)
pub async fn search_events_route(
db: DatabaseGuard,
body: Ruma<search_events::Request<'_>>,
) -> Result<search_events::Response> {
body: Ruma<search_events_v3::Request<'_>>,
) -> Result<search_events_v3::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
let search_criteria = body.search_categories.room_events.as_ref().unwrap();
@ -97,7 +102,7 @@ pub async fn search_events_route(
Some((skip + limit).to_string())
};
Ok(search_events::Response::new(ResultCategories {
Ok(search_events_v3::Response::new(ResultCategories {
room_events: ResultRoomEvents {
count: Some((results.len() as u32).into()), // TODO: set this to none. Element shouldn't depend on it
groups: BTreeMap::new(), // TODO