Skip to content

Commit

Permalink
feat(ffi): expose method for reading the server name part of the curr…
Browse files Browse the repository at this point in the history
…ent user's identifier.
  • Loading branch information
stefanceriu committed Jun 27, 2024
1 parent cb61073 commit f66b33a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bindings/matrix-sdk-ffi/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ impl Client {
})))
}

/// Allows generic GET requests to be made through the SDKs internal HTTP client
pub async fn get_url(&self, url: String) -> Result<String, ClientError> {
let http_client = self.inner.http_client();
Ok(http_client.get(url).send().await?.text().await?)
Expand Down Expand Up @@ -499,6 +500,12 @@ impl Client {
Ok(user_id.to_string())
}

/// The server name part of the current user ID
pub fn user_id_server_name(&self) -> Result<String, ClientError> {
let user_id = self.inner.user_id().context("No User ID found")?;
Ok(user_id.server_name().to_string())
}

pub async fn display_name(&self) -> Result<String, ClientError> {
let display_name =
self.inner.account().get_display_name().await?.context("No User ID found")?;
Expand Down

0 comments on commit f66b33a

Please sign in to comment.