Support v1/v2 conditions for join/leave, creation and other operations. (#12)

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-08-31 10:15:49 +00:00
parent 685946faed
commit 3a78ba2b16
6 changed files with 68 additions and 120 deletions

View File

@@ -103,6 +103,10 @@ impl Pdu {
let event_id = CanonicalJsonValue::String(event_id.into());
json.insert("event_id".into(), event_id);
Self::from_val(&json)
}
pub fn from_val(json: &CanonicalJsonObject) -> Result<Self> {
serde_json::to_value(json)
.and_then(serde_json::from_value)
.map_err(Into::into)