Skip to content

Commit 70fddc0

Browse files
stefanceriupoljar
authored andcommitted
feat(ffi): expose method for reading the server name part of the current user's identifier.
1 parent 84796ab commit 70fddc0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

bindings/matrix-sdk-ffi/src/client.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ impl Client {
421421
})))
422422
}
423423

424+
/// Allows generic GET requests to be made through the SDKs internal HTTP client
424425
pub async fn get_url(&self, url: String) -> Result<String, ClientError> {
425426
let http_client = self.inner.http_client();
426427
Ok(http_client.get(url).send().await?.text().await?)
@@ -504,6 +505,12 @@ impl Client {
504505
Ok(user_id.to_string())
505506
}
506507

508+
/// The server name part of the current user ID
509+
pub fn user_id_server_name(&self) -> Result<String, ClientError> {
510+
let user_id = self.inner.user_id().context("No User ID found")?;
511+
Ok(user_id.server_name().to_string())
512+
}
513+
507514
pub async fn display_name(&self) -> Result<String, ClientError> {
508515
let display_name =
509516
self.inner.account().get_display_name().await?.context("No User ID found")?;

0 commit comments

Comments
 (0)