client-api: Add tile server to well-known

According to MSC3488
This commit is contained in:
Kévin Commaille 2022-03-15 18:37:54 +01:00
parent 195ddf8112
commit bb26f159e3
No known key found for this signature in database
GPG Key ID: DD507DAE96E8245C
3 changed files with 35 additions and 2 deletions

View File

@ -18,6 +18,7 @@ rustdoc-args = ["--cfg", "docsrs"]
compat = []
unstable-exhaustive-types = []
unstable-msc2448 = []
unstable-msc3488 = []
client = []
server = []

View File

@ -27,6 +27,11 @@ ruma_api! {
/// Information about the identity server to connect to.
#[serde(rename = "m.identity_server")]
pub identity_server: Option<IdentityServerInfo>,
/// Information about the tile server to use to display location data.
#[cfg(feature = "unstable-msc3488")]
#[serde(rename = "org.matrix.msc3488.tile_server")]
pub tile_server: Option<TileServerInfo>,
}
error: crate::Error
@ -42,7 +47,12 @@ impl Request {
impl Response {
/// Creates a new `Response` with the given `HomeserverInfo`.
pub fn new(homeserver: HomeserverInfo) -> Self {
Self { homeserver, identity_server: None }
Self {
homeserver,
identity_server: None,
#[cfg(feature = "unstable-msc3488")]
tile_server: None,
}
}
}
@ -75,3 +85,22 @@ impl IdentityServerInfo {
Self { base_url }
}
}
/// Information about a discovered map tile server.
#[cfg(feature = "unstable-msc3488")]
#[derive(Clone, Debug, Deserialize, Hash, PartialEq, PartialOrd, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct TileServerInfo {
/// The URL of a map tile server's `style.json` file.
///
/// See the [Mapbox Style Specification](https://docs.mapbox.com/mapbox-gl-js/style-spec/) for more details.
pub map_style_url: String,
}
#[cfg(feature = "unstable-msc3488")]
impl TileServerInfo {
/// Creates a `TileServerInfo` with the given map style URL.
pub fn new(map_style_url: String) -> Self {
Self { map_style_url }
}
}

View File

@ -118,7 +118,10 @@ unstable-msc2675 = ["ruma-common/unstable-msc2675"]
unstable-msc2676 = ["ruma-common/unstable-msc2676"]
unstable-msc2677 = ["ruma-common/unstable-msc2677"]
unstable-msc3246 = ["ruma-common/unstable-msc3246"]
unstable-msc3488 = ["ruma-common/unstable-msc3488"]
unstable-msc3488 = [
"ruma-client-api/unstable-msc3488",
"ruma-common/unstable-msc3488",
]
unstable-msc3551 = ["ruma-common/unstable-msc3551"]
unstable-msc3552 = ["ruma-common/unstable-msc3552"]
unstable-msc3553 = ["ruma-common/unstable-msc3553"]