From 5ecd74b2e4008f75321185555b598442f3bed67b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Fri, 31 Dec 2021 13:02:15 +0100 Subject: [PATCH] feat(sdk): Make get_supported_versions public --- crates/matrix-sdk/src/client.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/crates/matrix-sdk/src/client.rs b/crates/matrix-sdk/src/client.rs index 43e90a919..d5e037dd5 100644 --- a/crates/matrix-sdk/src/client.rs +++ b/crates/matrix-sdk/src/client.rs @@ -317,7 +317,26 @@ impl Client { *homeserver = homeserver_url; } - async fn get_supported_versions(&self) -> HttpResult { + /// Get the versions supported by the homeserver. + /// + /// This method should be used to check that a server is a valid Matrix + /// homeserver. + /// + /// # Example + /// ```no_run + /// # use futures::executor::block_on; + /// # block_on(async { + /// use matrix_sdk::{Client}; + /// use url::Url; + /// + /// let homeserver = Url::parse("http://example.com")?; + /// let client = Client::new(homeserver)?; + /// + /// // Check that it is a valid homeserver. + /// client.get_supported_versions().await?; + /// # Result::<_, anyhow::Error>::Ok(()) }); + /// ``` + pub async fn get_supported_versions(&self) -> HttpResult { self.send( get_supported_versions::Request::new(), Some(RequestConfig::new().disable_retry()),