diff --git a/crates/ruma-client-api/Cargo.toml b/crates/ruma-client-api/Cargo.toml index 0924db7f..28727702 100644 --- a/crates/ruma-client-api/Cargo.toml +++ b/crates/ruma-client-api/Cargo.toml @@ -18,6 +18,7 @@ rustdoc-args = ["--cfg", "docsrs"] compat = [] unstable-exhaustive-types = [] unstable-msc2448 = [] +unstable-msc3488 = [] client = [] server = [] diff --git a/crates/ruma-client-api/src/discovery/discover_homeserver.rs b/crates/ruma-client-api/src/discovery/discover_homeserver.rs index d639719e..dd00f6eb 100644 --- a/crates/ruma-client-api/src/discovery/discover_homeserver.rs +++ b/crates/ruma-client-api/src/discovery/discover_homeserver.rs @@ -27,6 +27,11 @@ ruma_api! { /// Information about the identity server to connect to. #[serde(rename = "m.identity_server")] pub identity_server: Option, + + /// 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, } 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 } + } +} diff --git a/crates/ruma/Cargo.toml b/crates/ruma/Cargo.toml index 3bf8b192..db30612f 100644 --- a/crates/ruma/Cargo.toml +++ b/crates/ruma/Cargo.toml @@ -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"]