Merge pull request #11 from vberger/master

Point-out inconsistencies with spec
This commit is contained in:
Jimmy Cuadra 2016-12-31 11:36:37 -08:00 committed by GitHub
commit b8bfa5ad4a
8 changed files with 27 additions and 12 deletions

View File

@ -10,6 +10,7 @@ pub mod register {
pub password: String, pub password: String,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub username: Option<String>, pub username: Option<String>,
// TODO: `auth` field
} }
/// Details about this API endpoint. /// Details about this API endpoint.
@ -38,6 +39,7 @@ pub mod register {
pub access_token: String, pub access_token: String,
pub home_server: String, pub home_server: String,
pub user_id: String, pub user_id: String,
// TODO: `refresh_token` field? (more or less deprecated?)
} }
impl ::Endpoint for Endpoint { impl ::Endpoint for Endpoint {
@ -62,6 +64,7 @@ pub mod register {
/// [POST /_matrix/client/r0/account/password/email/requestToken](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-account-password-email-requesttoken) /// [POST /_matrix/client/r0/account/password/email/requestToken](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-account-password-email-requesttoken)
pub mod request_password_change_token { pub mod request_password_change_token {
// TODO: according to the spec, this does not has any params
/// This API endpoint's body parameters. /// This API endpoint's body parameters.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BodyParams { pub struct BodyParams {
@ -102,6 +105,8 @@ pub mod deactivate {
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub struct Endpoint; pub struct Endpoint;
// TODO: missing BodyParams
impl ::Endpoint for Endpoint { impl ::Endpoint for Endpoint {
type BodyParams = (); type BodyParams = ();
type PathParams = (); type PathParams = ();
@ -128,6 +133,7 @@ pub mod change_password {
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BodyParams { pub struct BodyParams {
pub new_password: String, pub new_password: String,
// TODO: missing `auth` field
} }
/// Details about this API endpoint. /// Details about this API endpoint.

View File

@ -17,9 +17,9 @@ pub mod create_contact {
/// The third party credentials to associate with the account. /// The third party credentials to associate with the account.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ThreePidCredentials { pub struct ThreePidCredentials {
client_secret: String, pub client_secret: String,
id_server: String, pub id_server: String,
sid: String, pub sid: String,
} }
impl ::Endpoint for Endpoint { impl ::Endpoint for Endpoint {
@ -90,6 +90,7 @@ pub mod get_contacts {
/// [POST /_matrix/client/r0/account/3pid/email/requestToken](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-account-3pid-email-requesttoken) /// [POST /_matrix/client/r0/account/3pid/email/requestToken](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-account-3pid-email-requesttoken)
pub mod request_contact_verification_token { pub mod request_contact_verification_token {
// TODO: according to the spec this takes no parameters
/// This API endpoint's body parameters. /// This API endpoint's body parameters.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BodyParams { pub struct BodyParams {

View File

@ -20,6 +20,7 @@ pub mod get_content {
type PathParams = PathParams; type PathParams = PathParams;
type QueryParams = (); type QueryParams = ();
type Response = (); // TODO: How should a file be represented as a response? type Response = (); // TODO: How should a file be represented as a response?
// must include HTTP headers Content-Type and Content-Disposition (filename)
fn method() -> ::Method { fn method() -> ::Method {
::Method::Get ::Method::Get

View File

@ -2,6 +2,9 @@
use ruma_signatures::Signatures; use ruma_signatures::Signatures;
// TODO: spec requires a nesting ThirdPartySigned { signed: Signed { mxid: ..., ... } }
// for join_room_by_id_or_alias but not for join_room_by_id, inconsistency?
/// A signature of an `m.third_party_invite` token to prove that this user owns a third party identity which has been invited to the room. /// A signature of an `m.third_party_invite` token to prove that this user owns a third party identity which has been invited to the room.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ThirdPartySigned { pub struct ThirdPartySigned {
@ -17,12 +20,12 @@ pub struct ThirdPartySigned {
/// [POST /_matrix/client/r0/rooms/{roomId}/invite](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-invite) /// [POST /_matrix/client/r0/rooms/{roomId}/invite](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-invite)
pub mod invite_user { pub mod invite_user {
use ruma_identifiers::RoomId; use ruma_identifiers::{UserId, RoomId};
/// The request type. /// The request type.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BodyParams { pub struct BodyParams {
pub user_id: String, pub user_id: UserId,
} }
/// Details about this API endpoint. /// Details about this API endpoint.

View File

@ -19,8 +19,8 @@ pub mod set_presence {
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BodyParams { pub struct BodyParams {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
status_msg: Option<String>, pub status_msg: Option<String>,
presence: PresenceState pub presence: PresenceState
} }
impl ::Endpoint for Endpoint { impl ::Endpoint for Endpoint {

View File

@ -2,7 +2,7 @@
/// [POST /_matrix/client/r0/createRoom](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom) /// [POST /_matrix/client/r0/createRoom](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom)
pub mod create_room { pub mod create_room {
use ruma_identifiers::RoomId; use ruma_identifiers::{RoomId, UserId};
/// The request type. /// The request type.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
@ -11,7 +11,7 @@ pub mod create_room {
pub creation_content: Option<CreationContent>, pub creation_content: Option<CreationContent>,
#[serde(skip_serializing_if = "Vec::is_empty")] #[serde(skip_serializing_if = "Vec::is_empty")]
#[serde(default)] #[serde(default)]
pub invite: Vec<String>, pub invite: Vec<UserId>,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>, pub name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -21,7 +21,8 @@ pub mod create_room {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub topic: Option<String>, pub topic: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub visibility: Option<String>, pub visibility: Option<String>, // TODO: should be an enum ["public", "private"]
// TODO: missing `invite_3pid`, `initial_state`
} }
/// Extra options to be added to the `m.room.create` event. /// Extra options to be added to the `m.room.create` event.

View File

@ -43,8 +43,9 @@ pub mod search_events {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub include_state: Option<bool>, pub include_state: Option<bool>,
/// The keys to search for. Defaults to all keys. /// The keys to search for. Defaults to all keys.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Vec::is_empty")]
pub keys: Option<Vec<SearchKeys>>, #[serde(default)]
pub keys: Vec<SearchKeys>,
/// The order in which to search for results. /// The order in which to search for results.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub order_by: Option<OrderBy>, pub order_by: Option<OrderBy>,

View File

@ -6,6 +6,8 @@ pub mod login {
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub struct Endpoint; pub struct Endpoint;
// TODO: missing BodyParams
/// This API endpoint's response. /// This API endpoint's response.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response { pub struct Response {