diff --git a/crates/ruma-common/src/api/metadata.rs b/crates/ruma-common/src/api/metadata.rs index 736a6b0e..756e0904 100644 --- a/crates/ruma-common/src/api/metadata.rs +++ b/crates/ruma-common/src/api/metadata.rs @@ -385,6 +385,16 @@ impl VersionHistory { self.stable_paths.first().map(|(v, _)| *v) } + /// Returns the Matrix version that deprecated this endpoint, if any. + pub fn deprecated_in(&self) -> Option { + self.deprecated + } + + /// Returns the Matrix version that removed this endpoint, if any. + pub fn removed_in(&self) -> Option { + self.removed + } + /// Picks the last unstable path, if it exists. pub fn unstable(&self) -> Option<&'static str> { self.unstable_paths.last().copied() diff --git a/crates/ruma-common/tests/api/ui/01-api-sanity-check.rs b/crates/ruma-common/tests/api/ui/01-api-sanity-check.rs index 6e0cc2d6..0758fb8b 100644 --- a/crates/ruma-common/tests/api/ui/01-api-sanity-check.rs +++ b/crates/ruma-common/tests/api/ui/01-api-sanity-check.rs @@ -74,6 +74,6 @@ fn main() { ); assert_eq!(METADATA.history.added_in(), Some(MatrixVersion::V1_0)); - assert_eq!(METADATA.history.deprecated, Some(MatrixVersion::V1_2)); - assert_eq!(METADATA.history.removed, Some(MatrixVersion::V1_3)); + assert_eq!(METADATA.history.deprecated_in(), Some(MatrixVersion::V1_2)); + assert_eq!(METADATA.history.removed_in(), Some(MatrixVersion::V1_3)); }