Point-out inconsistencies with spec

This commit is contained in:
Victor Berger 2016-12-31 12:31:39 +01:00
parent 0535405ae6
commit 472ce01769
No known key found for this signature in database
GPG Key ID: 3638519DDEAAD525
8 changed files with 27 additions and 12 deletions

View File

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

View File

@ -17,9 +17,9 @@ pub mod create_contact {
/// The third party credentials to associate with the account.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ThreePidCredentials {
client_secret: String,
id_server: String,
sid: String,
pub client_secret: String,
pub id_server: String,
pub sid: String,
}
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)
pub mod request_contact_verification_token {
// TODO: according to the spec this takes no parameters
/// This API endpoint's body parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BodyParams {

View File

@ -20,6 +20,7 @@ pub mod get_content {
type PathParams = PathParams;
type QueryParams = ();
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 {
::Method::Get

View File

@ -2,6 +2,9 @@
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.
#[derive(Clone, Debug, Deserialize, Serialize)]
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)
pub mod invite_user {
use ruma_identifiers::RoomId;
use ruma_identifiers::{UserId, RoomId};
/// The request type.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BodyParams {
pub user_id: String,
pub user_id: UserId,
}
/// Details about this API endpoint.

View File

@ -19,8 +19,8 @@ pub mod set_presence {
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BodyParams {
#[serde(skip_serializing_if = "Option::is_none")]
status_msg: Option<String>,
presence: PresenceState
pub status_msg: Option<String>,
pub presence: PresenceState
}
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)
pub mod create_room {
use ruma_identifiers::RoomId;
use ruma_identifiers::{RoomId, UserId};
/// The request type.
#[derive(Clone, Debug, Deserialize, Serialize)]
@ -11,7 +11,7 @@ pub mod create_room {
pub creation_content: Option<CreationContent>,
#[serde(skip_serializing_if = "Vec::is_empty")]
#[serde(default)]
pub invite: Vec<String>,
pub invite: Vec<UserId>,
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
@ -21,7 +21,8 @@ pub mod create_room {
#[serde(skip_serializing_if = "Option::is_none")]
pub topic: Option<String>,
#[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.

View File

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

View File

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