Squash a bunch of bugs

This commit is contained in:
Ross Schulman 2017-07-01 15:57:21 -04:00 committed by Jonas Platte
parent 3a854bf64a
commit a1a9064d28
2 changed files with 61 additions and 61 deletions

View File

@ -7,7 +7,7 @@ pub mod login {
ruma_api! { ruma_api! {
metadata { metadata {
description: "Login to the homeserver.", description: "Login to the homeserver.",
method: ::Method::Post, method: Method::Post,
name: "login", name: "login",
path: "/_matrix/client/r0/login", path: "/_matrix/client/r0/login",
rate_limited: true, rate_limited: true,
@ -35,19 +35,20 @@ pub mod login {
pub refresh_token: Option<String>, pub refresh_token: Option<String>,
pub user_id: String, pub user_id: String,
} }
}
/// Possible login mediums for 3rd party ID /// Possible login mediums for 3rd party ID
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub enum LoginMedium { pub enum LoginMedium {
#[serde(rename = "email")] #[serde(rename = "email")]
Email Email,
} }
/// Possible kinds of login /// Possible kinds of login
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub enum LoginKind { pub enum LoginKind {
#[serde(rename = "m.login.password")] #[serde(rename = "m.login.password")]
Password Password,
} }
} }
@ -58,7 +59,7 @@ pub mod logout {
ruma_api! { ruma_api! {
metadata { metadata {
description: "Log out of the homeserver.", description: "Log out of the homeserver.",
method: ::Method::Post, method: Method::Post,
name: "logout", name: "logout",
path: "/_matrix/client/r0/logout", path: "/_matrix/client/r0/logout",
rate_limited: false, rate_limited: false,
@ -66,4 +67,5 @@ pub mod logout {
} }
request {} request {}
response {} response {}
}
} }

View File

@ -20,7 +20,7 @@ pub mod get_state_events {
pub room_id: RoomId, pub room_id: RoomId,
} }
response { response {
pub Vec<only::StateEvent>, pub room_state: Vec<only::StateEvent>,
} }
} }
} }
@ -28,12 +28,13 @@ pub mod get_state_events {
/// [GET /_matrix/client/r0/rooms/{roomId}/state/{eventType}](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype) /// [GET /_matrix/client/r0/rooms/{roomId}/state/{eventType}](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype)
pub mod get_state_events_for_empty_key { pub mod get_state_events_for_empty_key {
use ruma_api_macros::ruma_api; use ruma_api_macros::ruma_api;
use ruma_identifiers::{RoomId, EventType}; use ruma_identifiers::RoomId;
use ruma_events::EventType;
ruma_api! { ruma_api! {
metadata { metadata {
description: "Get state events of a given type associated with the empty key.", description: "Get state events of a given type associated with the empty key.",
method: ::Method::Get, method: Method::Get,
name: "get_state_events_for_empty_key", name: "get_state_events_for_empty_key",
path: "/_matrix/client/r0/rooms/:room_id/state/:event_type", path: "/_matrix/client/r0/rooms/:room_id/state/:event_type",
rate_limited: false, rate_limited: false,
@ -61,7 +62,7 @@ pub mod get_state_events_for_key {
ruma_api! { ruma_api! {
metadata { metadata {
description: "Get state events associated with a given key.", description: "Get state events associated with a given key.",
method: ::Method::Get, method: Method::Get,
name: "get_state_events_for_key", name: "get_state_events_for_key",
path: "/_matrix/client/r0/rooms/:room_id/state/:event_type/:state_key", path: "/_matrix/client/r0/rooms/:room_id/state/:event_type/:state_key",
rate_limited: false, rate_limited: false,
@ -70,7 +71,7 @@ pub mod get_state_events_for_key {
request { request {
/// The room to look up the state in. /// The room to look up the state in.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomID, pub room_id: RoomId,
/// The type of state to look up. /// The type of state to look up.
#[ruma_api(path)] #[ruma_api(path)]
pub event_type: String, pub event_type: String,
@ -93,7 +94,7 @@ pub mod get_member_events {
ruma_api! { ruma_api! {
metadata { metadata {
description: "Get membership events for a room.", description: "Get membership events for a room.",
method: ::Method::Get, method: Method::Get,
name: "get_member_events", name: "get_member_events",
path: "/_matrix/client/r0/rooms/:room_id/members", path: "/_matrix/client/r0/rooms/:room_id/members",
rate_limited: false, rate_limited: false,
@ -105,7 +106,7 @@ pub mod get_member_events {
request { request {
/// The room to look up the state in. /// The room to look up the state in.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomID, pub room_id: RoomId,
} }
response { response {
pub chunk: Vec<MemberEvent> pub chunk: Vec<MemberEvent>
@ -122,7 +123,7 @@ pub mod get_message_events {
ruma_api! { ruma_api! {
metadata { metadata {
description: "Get message events for a room.", description: "Get message events for a room.",
method: ::Method::Get, method: Method::Get,
name: "get_message_events", name: "get_message_events",
path: "/_matrix/client/r0/rooms/:room_id/messages", path: "/_matrix/client/r0/rooms/:room_id/messages",
rate_limited: false, rate_limited: false,
@ -133,7 +134,7 @@ pub mod get_message_events {
// has one, room_id. I've followed the spec here. -- rschulman 6/30/2017 // has one, room_id. I've followed the spec here. -- rschulman 6/30/2017
/// The room to look up the state in. /// The room to look up the state in.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomID, pub room_id: RoomId,
/// Required. The token to start returning events from. This token can be obtained from a /// Required. The token to start returning events from. This token can be obtained from a
/// prev_batch token returned for each room by the sync API, or from a start or end token /// prev_batch token returned for each room by the sync API, or from a start or end token
/// returned by a previous request to this endpoint. /// returned by a previous request to this endpoint.
@ -155,6 +156,14 @@ pub mod get_message_events {
pub end: String, pub end: String,
} }
} }
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum Direction {
#[serde(rename="b")]
Backward,
#[serde(rename="f")]
Forward,
}
} }
/// [GET /_matrix/client/r0/sync](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-sync) /// [GET /_matrix/client/r0/sync](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-sync)
@ -170,7 +179,7 @@ pub mod sync_events {
ruma_api! { ruma_api! {
metadata { metadata {
description: "Get all new events from all rooms since the last sync or a given point of time.", description: "Get all new events from all rooms since the last sync or a given point of time.",
method: ::Method::Get, method: Method::Get,
name: "sync", name: "sync",
path: "/_matrix/client/r0/sync", path: "/_matrix/client/r0/sync",
rate_limited: false, rate_limited: false,
@ -195,9 +204,6 @@ pub mod sync_events {
} }
} }
/// Details about this API endpoint.
#[derive(Clone, Copy, Debug)]
pub struct Endpoint;
/// Whether to set presence or not during sync. /// Whether to set presence or not during sync.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
@ -290,12 +296,4 @@ pub mod sync_events {
pub struct Presence { pub struct Presence {
pub events: only::Event, pub events: only::Event,
} }
/// This API endpoint's reponse.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response {
pub next_batch: String,
pub rooms: Rooms,
pub presence: Presence,
}
} }