2022-01-13 12:06:20 +01:00
|
|
|
use std::{collections::BTreeMap, iter::FromIterator};
|
|
|
|
|
2022-01-20 11:51:31 +01:00
|
|
|
use crate::{ConduitResult, Ruma};
|
2020-07-30 18:14:47 +02:00
|
|
|
use ruma::api::client::unversioned::get_supported_versions;
|
|
|
|
|
2020-07-31 14:40:28 +02:00
|
|
|
/// # `GET /_matrix/client/versions`
|
|
|
|
///
|
|
|
|
/// Get the versions of the specification and unstable features supported by this server.
|
|
|
|
///
|
|
|
|
/// - Versions take the form MAJOR.MINOR.PATCH
|
|
|
|
/// - Only the latest PATCH release will be reported for each MAJOR.MINOR value
|
2021-08-31 19:14:37 +02:00
|
|
|
/// - Unstable features are namespaced and may include version information in their name
|
2020-07-31 14:40:28 +02:00
|
|
|
///
|
|
|
|
/// Note: Unstable features are used while developing new features. Clients should avoid using
|
|
|
|
/// unstable features in their stable releases
|
2022-01-20 11:51:31 +01:00
|
|
|
#[tracing::instrument(skip(_body))]
|
|
|
|
pub async fn get_supported_versions_route(
|
|
|
|
_body: Ruma<get_supported_versions::Request>,
|
|
|
|
) -> ConduitResult<get_supported_versions::Response> {
|
2022-01-13 11:48:18 +01:00
|
|
|
let resp = get_supported_versions::Response {
|
|
|
|
versions: vec!["r0.5.0".to_owned(), "r0.6.0".to_owned()],
|
2022-01-13 12:06:20 +01:00
|
|
|
unstable_features: BTreeMap::from_iter([("org.matrix.e2e_cross_signing".to_owned(), true)]),
|
2022-01-13 11:48:18 +01:00
|
|
|
};
|
2020-07-30 18:14:47 +02:00
|
|
|
|
2020-08-06 08:29:59 -04:00
|
|
|
Ok(resp.into())
|
2020-07-30 18:14:47 +02:00
|
|
|
}
|