Use ruma-events collection types to fix the event context API.

This commit is contained in:
Jimmy Cuadra 2016-12-15 00:58:49 -08:00
parent 15b01204cc
commit 5868783cd3
2 changed files with 9 additions and 10 deletions

View File

@ -11,10 +11,8 @@ repository = "https://github.com/ruma/ruma-client-api"
version = "0.1.0" version = "0.1.0"
[dependencies] [dependencies]
ruma-identifiers = "0.4.3" ruma-events = "0.1.0"
ruma-identifiers = "0.5.0"
serde = "0.8.19" serde = "0.8.19"
serde_derive = "0.8.19" serde_derive = "0.8.19"
serde_json = "0.8.3" serde_json = "0.8.4"
[dependencies.ruma-events]
git = "https://github.com/ruma/ruma-events"

View File

@ -3,7 +3,8 @@
/// GET /_matrix/client/r0/rooms/:room_id/context/:event_id /// GET /_matrix/client/r0/rooms/:room_id/context/:event_id
pub mod get_context { pub mod get_context {
use ruma_identifiers::{EventId, RoomId}; use ruma_identifiers::{EventId, RoomId};
use ruma_events::{RoomEvent, StateEvent}; use ruma_events::collections::only;
/// Details about this API endpoint. /// Details about this API endpoint.
pub struct Endpoint; pub struct Endpoint;
@ -25,11 +26,11 @@ pub mod get_context {
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response { pub struct Response {
pub end: String, pub end: String,
pub event: Box<RoomEvent>, pub event: only::RoomEvent,
pub events_after: Vec<Box<RoomEvent>>, pub events_after: Vec<only::RoomEvent>,
pub events_before: Vec<Box<RoomEvent>>, pub events_before: Vec<only::RoomEvent>,
pub start: String, pub start: String,
pub state: Vec<Box<StateEvent>>, pub state: Vec<only::StateEvent>,
} }
impl ::Endpoint for Endpoint { impl ::Endpoint for Endpoint {