Add room information query endpoint.

This commit is contained in:
Isaiah Inuwa 2020-05-24 22:40:33 -05:00
parent e4c7a81a7c
commit 4cf4aa6ef7
5 changed files with 35 additions and 0 deletions

View File

@ -14,6 +14,7 @@ Improvements:
create_join_event::v1,
create_join_event_template::v1
},
query::get_room_information::v1,
version::get_server_version::v1
```

View File

@ -15,6 +15,7 @@ mod serde;
pub mod directory;
pub mod discovery;
pub mod membership;
pub mod query;
/// A 'persistent data unit' (event) for room versions 3 and beyond.
#[derive(Deserialize, Serialize)]

3
src/query.rs Normal file
View File

@ -0,0 +1,3 @@
//! Endpoints to retrieve information from a homeserver about a resource.
pub mod get_room_information;

View File

@ -0,0 +1,2 @@
//! Endpoint to query room information with a room alias.
pub mod v1;

View File

@ -0,0 +1,28 @@
//! [GET /_matrix/federation/v1/query/directory](https://matrix.org/docs/spec/server_server/r0.1.3#get-matrix-federation-v1-query-directory)
use ruma_api::ruma_api;
use ruma_identifiers::RoomId;
ruma_api! {
metadata {
description: "Get mapped room ID and resident homeservers for a given room alias.",
name: "get_room_information",
method: GET,
path: "/_matrix/federation/v1/query/directory",
rate_limited: false,
requires_authentication: true,
}
request {
/// Room alias to query.
#[ruma_api(query)]
pub room_alias: String,
}
response {
/// Room ID mapped to queried alias.
pub room_id: RoomId,
/// An array of server names that are likely to hold the given room.
pub servers: Vec<String>,
}
}