2022-01-13 12:06:20 +01:00
|
|
|
use std::{collections::BTreeMap, iter::FromIterator};
|
|
|
|
|
2024-05-02 09:26:43 +01:00
|
|
|
use ruma::api::client::discovery::get_supported_versions;
|
2022-04-06 21:31:29 +02:00
|
|
|
|
2024-05-02 09:26:43 +01:00
|
|
|
use crate::{Result, Ruma};
|
2020-07-30 18:14:47 +02:00
|
|
|
|
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
|
|
|
pub async fn get_supported_versions_route(
|
2022-12-14 13:09:10 +01:00
|
|
|
_body: Ruma<get_supported_versions::Request>,
|
2022-01-22 16:58:32 +01:00
|
|
|
) -> Result<get_supported_versions::Response> {
|
2022-01-13 11:48:18 +01:00
|
|
|
let resp = get_supported_versions::Response {
|
2022-05-30 12:58:43 +02:00
|
|
|
versions: vec![
|
|
|
|
"r0.5.0".to_owned(),
|
|
|
|
"r0.6.0".to_owned(),
|
|
|
|
"v1.1".to_owned(),
|
|
|
|
"v1.2".to_owned(),
|
2023-06-25 19:31:40 +02:00
|
|
|
"v1.3".to_owned(),
|
|
|
|
"v1.4".to_owned(),
|
2024-01-16 13:52:56 -08:00
|
|
|
"v1.5".to_owned(),
|
2022-05-30 12:58:43 +02:00
|
|
|
],
|
2024-09-21 10:53:57 +02:00
|
|
|
unstable_features: BTreeMap::from_iter([
|
|
|
|
("org.matrix.e2e_cross_signing".to_owned(), true),
|
|
|
|
("org.matrix.msc3916.stable".to_owned(), true),
|
|
|
|
]),
|
2022-01-13 11:48:18 +01:00
|
|
|
};
|
2020-07-30 18:14:47 +02:00
|
|
|
|
2022-01-22 16:58:32 +01:00
|
|
|
Ok(resp)
|
2020-07-30 18:14:47 +02:00
|
|
|
}
|