Skip to content

Commit ae9a554

Browse files
committed
Merge branch 'supported-versions'
2 parents dd29e20 + 5ecd74b commit ae9a554

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

crates/matrix-sdk/src/client.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,26 @@ impl Client {
317317
*homeserver = homeserver_url;
318318
}
319319

320-
async fn get_supported_versions(&self) -> HttpResult<get_supported_versions::Response> {
320+
/// Get the versions supported by the homeserver.
321+
///
322+
/// This method should be used to check that a server is a valid Matrix
323+
/// homeserver.
324+
///
325+
/// # Example
326+
/// ```no_run
327+
/// # use futures::executor::block_on;
328+
/// # block_on(async {
329+
/// use matrix_sdk::{Client};
330+
/// use url::Url;
331+
///
332+
/// let homeserver = Url::parse("http://example.com")?;
333+
/// let client = Client::new(homeserver)?;
334+
///
335+
/// // Check that it is a valid homeserver.
336+
/// client.get_supported_versions().await?;
337+
/// # Result::<_, anyhow::Error>::Ok(()) });
338+
/// ```
339+
pub async fn get_supported_versions(&self) -> HttpResult<get_supported_versions::Response> {
321340
self.send(
322341
get_supported_versions::Request::new(),
323342
Some(RequestConfig::new().disable_retry()),

0 commit comments

Comments
 (0)