Add PDU type for v3 rooms and above
This commit is contained in:
parent
2877fde4ad
commit
dbc8312730
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
authors = ["Jimmy Cuadra <jimmy@jimmycuadra.com>"]
|
||||
authors = ["Jonas Platte <jplatte+git@posteo.de>"]
|
||||
categories = ["api-bindings", "web-programming"]
|
||||
description = "Types for the endpoints in the Matrix server-server API."
|
||||
documentation = "https://docs.rs/ruma-federation-api"
|
||||
@ -13,3 +13,8 @@ repository = "https://github.com/ruma/ruma-federation-api"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
js_int = "0.1.3"
|
||||
ruma-events = "0.18.0"
|
||||
ruma-identifiers = "0.14.1"
|
||||
serde = { version = "1.0.105", features = ["derive"] }
|
||||
serde_json = "1.0.50"
|
||||
|
39
src/lib.rs
39
src/lib.rs
@ -1 +1,40 @@
|
||||
// TODO
|
||||
//!#[warn(missing_docs)]
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_events::EventType;
|
||||
use ruma_identifiers::{EventId, RoomId, UserId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value as JsonValue;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct RoomV3Pdu {
|
||||
pub room_id: RoomId,
|
||||
pub sender: UserId,
|
||||
pub origin: String,
|
||||
pub origin_server_ts: UInt,
|
||||
|
||||
// TODO: Replace with event content collection from ruma-events once that exists
|
||||
#[serde(rename = "type")]
|
||||
pub kind: EventType,
|
||||
pub content: JsonValue,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub state_key: Option<String>,
|
||||
pub prev_events: Vec<EventId>,
|
||||
pub depth: UInt,
|
||||
pub auth_events: Vec<EventId>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub redacts: Option<EventId>,
|
||||
#[serde(default, skip_serializing_if = "serde_json::Map::is_empty")]
|
||||
pub unsigned: serde_json::Map<String, JsonValue>,
|
||||
pub hashes: EventHash,
|
||||
pub signatures: HashMap<String, HashMap<String, String>>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct EventHash {
|
||||
pub sha256: String,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user