diff --git a/bindings/matrix-sdk-ffi/src/client.rs b/bindings/matrix-sdk-ffi/src/client.rs index 64e76d70b..983a8173d 100644 --- a/bindings/matrix-sdk-ffi/src/client.rs +++ b/bindings/matrix-sdk-ffi/src/client.rs @@ -33,6 +33,7 @@ use matrix_sdk::{ AuthApi, AuthSession, Client as MatrixClient, SessionChange, }; use matrix_sdk_ui::notification_client::NotificationProcessSetup as MatrixNotificationProcessSetup; +use mime::Mime; use ruma::{ api::client::discovery::discover_homeserver::AuthenticationServerInfo, push::{HttpPusherData as RumaHttpPusherData, PushFormat as RumaPushFormat}, @@ -458,6 +459,15 @@ impl Client { }) } + pub fn upload_avatar(&self, mime_type: String, data: Vec) -> Result<(), ClientError> { + let client = self.inner.clone(); + RUNTIME.block_on(async move { + let mime: Mime = mime_type.parse()?; + client.account().upload_avatar(&mime, data).await?; + Ok(()) + }) + } + pub fn avatar_url(&self) -> Result, ClientError> { let l = self.inner.clone(); RUNTIME.block_on(async move {