feat(ffi): expose latest json

Signed-off-by: Philippe Bertin <pbertin@teladochealth.com>
This commit is contained in:
Philippe Bertin
2026-04-08 09:23:44 -07:00
committed by Damir Jelić
parent 0233d03d4e
commit ba461598b2
2 changed files with 8 additions and 10 deletions
+3 -2
View File
@@ -47,10 +47,11 @@ All notable changes to this project will be documented in this file.
flags for selecting TLS backend, as `rustls` is the now the only supported
TLS backend.
([#6409](https://github.com/matrix-org/matrix-rust-sdk/pull/6409))
- Expose `event_type_raw` and `latest_content_raw()` on `EventTimelineItem`,
allowing clients to access the raw event type string and content JSON for
- Expose `event_type_raw` and `latest_json()` on `EventTimelineItem`,
allowing clients to access the raw event type string and full event JSON for
custom event handling without pattern-matching through nested enums.
([#6387](https://github.com/matrix-org/matrix-rust-sdk/pull/6387))
([#6424](https://github.com/matrix-org/matrix-rust-sdk/pull/6424))
- Expose sync v2 API through FFI via `Client.sync_v2()` and
`Client.sync_once_v2()`, enabling mobile clients to sync without
requiring Sliding Sync support on the homeserver. `Client.sync_v2()`
+5 -8
View File
@@ -1327,14 +1327,11 @@ impl LazyTimelineItemProvider {
self.0.contains_only_emojis()
}
/// Returns the JSON string of the event's `content` field from the latest
/// version (including edits). Returns `None` for local echoes that haven't
/// been echoed back by the server yet.
fn latest_content_raw(&self) -> Option<String> {
let raw = self.0.latest_json()?;
let value: serde_json::Value = serde_json::from_str(raw.json().get()).ok()?;
let content = value.get("content")?;
serde_json::to_string(content).ok()
/// Returns the full raw JSON string of the latest version of the event
/// (including edits). Returns `None` for local echoes that haven't been
/// echoed back by the server yet.
fn latest_json(&self) -> Option<String> {
Some(self.0.latest_json()?.json().get().to_owned())
}
}