Skip to content

Commit

Permalink
feat(ffi): add Element specific well known struct and a way to deseri…
Browse files Browse the repository at this point in the history
…alize it from external clients
  • Loading branch information
stefanceriu committed Jun 28, 2024
1 parent ffa306a commit 1b3be24
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bindings/matrix-sdk-ffi/src/element.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use crate::ClientError;
use serde::Deserialize;

/// Well-known settings specific to ElementCall
#[derive(Deserialize, uniffi::Record)]
pub struct ElementCallWellKnown {
widget_url: String,
}

/// Element specific well-known settings
#[derive(Deserialize, uniffi::Record)]
pub struct ElementWellKnown {
call: ElementCallWellKnown,
}

/// Helper function to parse a string into a ElementWellKnown struct
#[uniffi::export]
pub fn make_element_well_known(string: String) -> Result<ElementWellKnown, ClientError> {
serde_json::from_str(&string).map_err(ClientError::new)
}
1 change: 1 addition & 0 deletions bindings/matrix-sdk-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ mod authentication;
mod chunk_iterator;
mod client;
mod client_builder;
mod element;
mod encryption;
mod error;
mod event;
Expand Down

0 comments on commit 1b3be24

Please sign in to comment.