api: Add support for Matrix 1.8

This commit is contained in:
Kévin Commaille 2023-08-24 11:43:00 +02:00 committed by Kévin Commaille
parent ea41901211
commit 7f0ca5eaa8

View File

@ -516,6 +516,11 @@ pub enum MatrixVersion {
/// ///
/// See <https://spec.matrix.org/v1.7/>. /// See <https://spec.matrix.org/v1.7/>.
V1_7, V1_7,
/// Version 1.8 of the Matrix specification, released in Q3 2023.
///
/// See <https://spec.matrix.org/v1.8/>.
V1_8,
} }
impl TryFrom<&str> for MatrixVersion { impl TryFrom<&str> for MatrixVersion {
@ -536,6 +541,7 @@ impl TryFrom<&str> for MatrixVersion {
"v1.5" => V1_5, "v1.5" => V1_5,
"v1.6" => V1_6, "v1.6" => V1_6,
"v1.7" => V1_7, "v1.7" => V1_7,
"v1.8" => V1_8,
_ => return Err(UnknownVersionError), _ => return Err(UnknownVersionError),
}) })
} }
@ -582,6 +588,7 @@ impl MatrixVersion {
MatrixVersion::V1_5 => (1, 5), MatrixVersion::V1_5 => (1, 5),
MatrixVersion::V1_6 => (1, 6), MatrixVersion::V1_6 => (1, 6),
MatrixVersion::V1_7 => (1, 7), MatrixVersion::V1_7 => (1, 7),
MatrixVersion::V1_8 => (1, 8),
} }
} }
@ -596,6 +603,7 @@ impl MatrixVersion {
(1, 5) => Ok(MatrixVersion::V1_5), (1, 5) => Ok(MatrixVersion::V1_5),
(1, 6) => Ok(MatrixVersion::V1_6), (1, 6) => Ok(MatrixVersion::V1_6),
(1, 7) => Ok(MatrixVersion::V1_7), (1, 7) => Ok(MatrixVersion::V1_7),
(1, 8) => Ok(MatrixVersion::V1_8),
_ => Err(UnknownVersionError), _ => Err(UnknownVersionError),
} }
} }
@ -684,7 +692,9 @@ impl MatrixVersion {
// <https://spec.matrix.org/v1.6/rooms/#complete-list-of-room-versions> // <https://spec.matrix.org/v1.6/rooms/#complete-list-of-room-versions>
MatrixVersion::V1_6 MatrixVersion::V1_6
// <https://spec.matrix.org/v1.7/rooms/#complete-list-of-room-versions> // <https://spec.matrix.org/v1.7/rooms/#complete-list-of-room-versions>
| MatrixVersion::V1_7 => RoomVersionId::V10, | MatrixVersion::V1_7
// <https://spec.matrix.org/v1.8/rooms/#complete-list-of-room-versions>
| MatrixVersion::V1_8 => RoomVersionId::V10,
} }
} }
} }