federation-api: Add versions endpoint (MSC3723)

This commit is contained in:
Jonathan de Jong 2022-03-14 12:03:27 +01:00 committed by GitHub
parent e336db767a
commit 1ffccaba18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 0 deletions

View File

@ -19,6 +19,7 @@ unstable-exhaustive-types = []
unstable-pre-spec = []
unstable-msc2448 = []
unstable-msc3618 = []
unstable-msc3723 = []
client = []
server = []

View File

@ -10,6 +10,8 @@ pub mod get_remote_server_keys;
pub mod get_remote_server_keys_batch;
pub mod get_server_keys;
pub mod get_server_version;
#[cfg(feature = "unstable-msc3723")]
pub mod get_server_versions;
/// Public key of the homeserver for verifying digital signatures.
#[derive(Clone, Debug, Deserialize, Serialize)]

View File

@ -0,0 +1,41 @@
//! Endpoint to receive metadata about implemented matrix versions.
pub mod msc3723 {
//! [GET /_matrix/federation/versions](https://github.com/matrix-org/matrix-doc/pull/3723)
use ruma_common::api::ruma_api;
ruma_api! {
metadata: {
description: "Get the supported matrix versions of this homeserver",
method: GET,
name: "get_server_versions",
unstable_path: "/_matrix/federation/unstable/org.matrix.msc3723/versions",
rate_limited: false,
authentication: None,
}
#[derive(Default)]
request: {}
#[derive(Default)]
response: {
/// A list of Matrix Server API protocol versions supported by the homeserver.
pub versions: Vec<String>,
}
}
impl Request {
/// Creates an empty `Request`.
pub fn new() -> Self {
Self {}
}
}
impl Response {
/// Creates an empty `Response`.
pub fn new() -> Self {
Default::default()
}
}
}

View File

@ -120,6 +120,7 @@ unstable-msc2677 = ["ruma-common/unstable-msc2677"]
unstable-msc3551 = ["ruma-common/unstable-msc3551"]
unstable-msc3552 = ["ruma-common/unstable-msc3552"]
unstable-msc3618 = ["ruma-federation-api/unstable-msc3618"]
unstable-msc3723 = ["ruma-federation-api/unstable-msc3723"]
# Private feature, only used in test / benchmarking code
__ci = [
@ -133,6 +134,7 @@ __ci = [
"unstable-msc3551",
"unstable-msc3552",
"unstable-msc3618",
"unstable-msc3723",
"ruma-state-res/__ci",
]