Add room information query endpoint.
This commit is contained in:
parent
e4c7a81a7c
commit
4cf4aa6ef7
@ -14,6 +14,7 @@ Improvements:
|
|||||||
create_join_event::v1,
|
create_join_event::v1,
|
||||||
create_join_event_template::v1
|
create_join_event_template::v1
|
||||||
},
|
},
|
||||||
|
query::get_room_information::v1,
|
||||||
version::get_server_version::v1
|
version::get_server_version::v1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ mod serde;
|
|||||||
pub mod directory;
|
pub mod directory;
|
||||||
pub mod discovery;
|
pub mod discovery;
|
||||||
pub mod membership;
|
pub mod membership;
|
||||||
|
pub mod query;
|
||||||
|
|
||||||
/// A 'persistent data unit' (event) for room versions 3 and beyond.
|
/// A 'persistent data unit' (event) for room versions 3 and beyond.
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
|
3
src/query.rs
Normal file
3
src/query.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
//! Endpoints to retrieve information from a homeserver about a resource.
|
||||||
|
|
||||||
|
pub mod get_room_information;
|
2
src/query/get_room_information/mod.rs
Normal file
2
src/query/get_room_information/mod.rs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
//! Endpoint to query room information with a room alias.
|
||||||
|
pub mod v1;
|
28
src/query/get_room_information/v1.rs
Normal file
28
src/query/get_room_information/v1.rs
Normal 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>,
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user