Rename various modules.

This commit is contained in:
Jimmy Cuadra 2016-12-30 05:21:21 -08:00
parent 48727f1968
commit e7562be4db
13 changed files with 256 additions and 259 deletions

View File

@ -23,7 +23,6 @@ pub mod r0 {
pub mod contact;
pub mod context;
pub mod directory;
pub mod events;
pub mod filter;
pub mod media;
pub mod membership;

View File

@ -5,7 +5,7 @@ use ruma_identifiers::RoomAliasId;
/// PUT /_matrix/client/r0/directory/room/:room_alias
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-directory-room-roomalias)
pub mod create {
pub mod create_alias {
use ruma_identifiers::RoomId;
/// This API endpoint's body parameters.
@ -40,7 +40,7 @@ pub mod create {
/// DELETE /_matrix/client/r0/directory/room/:room_alias
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#delete-matrix-client-r0-directory-room-roomalias)
pub mod delete {
pub mod delete_alias {
/// Details about this API endpoint.
pub struct Endpoint;
@ -67,7 +67,7 @@ pub mod delete {
/// GET /_matrix/client/r0/directory/room/:room_alias
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-directory-room-roomalias)
pub mod get {
pub mod get_alias {
use ruma_identifiers::RoomId;
/// Details about this API endpoint.

View File

@ -3,7 +3,7 @@
/// POST /_matrix/client/r0/account/3pid
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-account-3pid)
pub mod add_contact {
pub mod create_contact {
/// This API endpoint's body parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BodyParams {

View File

@ -3,7 +3,7 @@
/// GET /_matrix/client/r0/publicRooms
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-publicrooms)
pub mod public_rooms {
pub mod get_public_rooms {
use ruma_identifiers::{RoomId, RoomAliasId};
/// A chunk of the response, describing one room

View File

@ -1,234 +0,0 @@
//! Endpoints for getting events
/// GET /_matrix/client/r0/rooms/{roomId}/state
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state)
pub mod get_full_state {
use ruma_identifiers::RoomId;
use ruma_events::collections::only;
/// Details about this API endpoint.
pub struct Endpoint;
/// This API endpoint's path parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PathParams {
pub room_id: RoomId
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = PathParams;
type QueryParams = ();
type Response = Vec<only::StateEvent>;
fn method() -> ::Method {
::Method::Get
}
fn request_path(params: Self::PathParams) -> String {
format!(
"/_matrix/client/r0/rooms/{}/state",
params.room_id
)
}
fn router_path() -> String {
"/_matrix/client/r0/rooms/:room_id/state".to_string()
}
}
}
/// GET /_matrix/client/r0/rooms/{roomId}/state/{eventType}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype)
pub mod get_state_for_empty_key {
use ruma_identifiers::RoomId;
/// Details about this API endpoint.
pub struct Endpoint;
/// This API endpoint's path parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PathParams {
pub room_id: RoomId,
pub event_type: String
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = PathParams;
type QueryParams = ();
type Response = ::serde_json::Value;
fn method() -> ::Method {
::Method::Get
}
fn request_path(params: Self::PathParams) -> String {
format!(
"/_matrix/client/r0/rooms/{}/state/{}",
params.room_id,
params.event_type
)
}
fn router_path() -> String {
"/_matrix/client/r0/rooms/:room_id/state/:event_type".to_string()
}
}
}
/// GET /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype-state-key)
pub mod get_state_for_key {
use ruma_identifiers::RoomId;
/// Details about this API endpoint.
pub struct Endpoint;
/// This API endpoint's path parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PathParams {
pub room_id: RoomId,
pub event_type: String,
pub state_key: String,
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = PathParams;
type QueryParams = ();
type Response = ::serde_json::Value;
fn method() -> ::Method {
::Method::Get
}
fn request_path(params: Self::PathParams) -> String {
format!(
"/_matrix/client/r0/rooms/{}/state/{}/{}",
params.room_id,
params.event_type,
params.state_key
)
}
fn router_path() -> String {
"/_matrix/client/r0/rooms/:room_id/state/:event_type/:state_key".to_string()
}
}
}
/// GET /_matrix/client/r0/rooms/{roomId}/members
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-members)
pub mod get_members {
use ruma_identifiers::RoomId;
use ruma_events::room::member::MemberEvent;
/// Details about this API endpoint.
pub struct Endpoint;
/// This API endpoint's path parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PathParams {
pub room_id: RoomId,
}
/// This API endpoint's reponse.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response {
pub chunks: Vec<MemberEvent>
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = PathParams;
type QueryParams = ();
type Response = Response;
fn method() -> ::Method {
::Method::Get
}
fn request_path(params: Self::PathParams) -> String {
format!(
"/_matrix/client/r0/rooms/{}/members",
params.room_id,
)
}
fn router_path() -> String {
"/_matrix/client/r0/rooms/:room_id/members".to_string()
}
}
}
/// GET /_matrix/client/r0/rooms/{roomId}/messages
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-messages)
pub mod get_messages {
use ruma_identifiers::RoomId;
use ruma_events::collections::only;
/// Details about this API endpoint.
pub struct Endpoint;
/// This API endpoint's path parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PathParams {
pub room_id: RoomId,
pub event_type: String
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum Direction {
#[serde(rename="b")]
Backward,
#[serde(rename="f")]
Forward
}
/// This API endpoint's query parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct QueryParams {
pub from: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub to: Option<String>,
pub dir: Direction,
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<u64>
}
/// This API endpoint's reponse.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response {
pub start: String,
pub chunks: Vec<only::RoomEvent>,
pub end: String
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = PathParams;
type QueryParams = QueryParams;
type Response = Response;
fn method() -> ::Method {
::Method::Get
}
fn request_path(params: Self::PathParams) -> String {
format!(
"/_matrix/client/r0/rooms/{}/messages",
params.room_id,
)
}
fn router_path() -> String {
"/_matrix/client/r0/rooms/:room_id/messages".to_string()
}
}
}

View File

@ -18,7 +18,7 @@ pub struct ThirdPartySigned {
/// POST /_matrix/client/r0/rooms/{roomId}/invite
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-invite)
pub mod invite {
pub mod invite_user {
use ruma_identifiers::RoomId;
/// The request type.
@ -62,7 +62,7 @@ pub mod invite {
/// POST /_matrix/client/r0/join/{roomIdOrAlias}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-join-roomidoralias)
pub mod join_by_room_id_or_alias {
pub mod join_room_by_id_or_alias {
use ruma_identifiers::{RoomId, RoomIdOrAliasId};
use super::ThirdPartySigned;
@ -124,7 +124,7 @@ pub mod join_by_room_id_or_alias {
/// POST /_matrix/client/r0/rooms/{roomId}/join
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-join)
pub mod join_by_room_id {
pub mod join_room_by_id {
use ruma_identifiers::RoomId;
use super::ThirdPartySigned;
@ -176,7 +176,7 @@ pub mod join_by_room_id {
/// POST /_matrix/client/r0/rooms/{roomId}/forget
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-forget)
pub mod forget {
pub mod forget_room {
use ruma_identifiers::RoomId;
/// Details about this API endpoint.
@ -214,7 +214,7 @@ pub mod forget {
/// POST /_matrix/client/r0/rooms/{roomId}/leave
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-leave)
pub mod leave {
pub mod leave_room {
use ruma_identifiers::RoomId;
/// Details about this API endpoint.
@ -252,7 +252,7 @@ pub mod leave {
/// POST /_matrix/client/r0/rooms/{roomId}/kick
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-kick)
pub mod kick {
pub mod kick_user {
use ruma_identifiers::RoomId;
/// The request type.
@ -298,7 +298,7 @@ pub mod kick {
/// POST /_matrix/client/r0/rooms/{roomId}/unban
///
/// [matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-unban)
pub mod unban {
pub mod unban_user {
use ruma_identifiers::RoomId;
/// The request type.
@ -342,7 +342,7 @@ pub mod unban {
/// POST /_matrix/client/r0/rooms/{roomId}/ban
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-ban)
pub mod ban {
pub mod ban_user {
use ruma_identifiers::RoomId;
/// The request type.

View File

@ -101,7 +101,7 @@ pub mod get_presence {
/// POST /_matrix/client/r0/presence/list/{userId}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-presence-list-userid)
pub mod update_presence_list {
pub mod update_presence_subscriptions {
use ruma_identifiers::UserId;
/// Details about this API endpoint.
@ -150,7 +150,7 @@ pub mod update_presence_list {
/// GET /_matrix/client/r0/presence/list/{userId}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-presence-list-userid)
pub mod get_presence_list_status {
pub mod get_subscribed_presences {
use ruma_identifiers::UserId;
use ruma_events::presence::PresenceEvent;

View File

@ -3,7 +3,7 @@
/// PUT /_matrix/client/r0/rooms/{roomId}/redact/{eventId}/{txnId}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-redact-eventid-txnid)
pub mod send_event {
pub mod redact_event {
use ruma_identifiers::{RoomId, EventId};
/// Details about this API endpoint.

View File

@ -3,7 +3,7 @@
/// PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-state-eventtype)
pub mod send_state {
pub mod send_state_event {
use ruma_identifiers::{RoomId, EventId};
use ruma_events::EventType;
@ -51,7 +51,7 @@ pub mod send_state {
/// PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-state-eventtype-statekey)
pub mod send_state_key {
pub mod send_state_event_by_state_key {
use ruma_identifiers::{RoomId, EventId};
use ruma_events::EventType;
@ -101,7 +101,7 @@ pub mod send_state_key {
/// PUT /_matrix/client/r0/rooms/{roomId}/send/{eventType}/{txnId}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-send-eventtype-txnid)
pub mod send_event {
pub mod send_message_event {
use ruma_identifiers::{RoomId, EventId};
use ruma_events::EventType;

View File

@ -1,9 +1,241 @@
//! Endpoints for getting and synchronizing events.
/// GET /_matrix/client/r0/rooms/{roomId}/state
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state)
pub mod get_state_events {
use ruma_identifiers::RoomId;
use ruma_events::collections::only;
/// Details about this API endpoint.
pub struct Endpoint;
/// This API endpoint's path parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PathParams {
pub room_id: RoomId
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = PathParams;
type QueryParams = ();
type Response = Vec<only::StateEvent>;
fn method() -> ::Method {
::Method::Get
}
fn request_path(params: Self::PathParams) -> String {
format!(
"/_matrix/client/r0/rooms/{}/state",
params.room_id
)
}
fn router_path() -> String {
"/_matrix/client/r0/rooms/:room_id/state".to_string()
}
}
}
/// GET /_matrix/client/r0/rooms/{roomId}/state/{eventType}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype)
pub mod get_state_event_by_event_type {
use ruma_identifiers::RoomId;
/// Details about this API endpoint.
pub struct Endpoint;
/// This API endpoint's path parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PathParams {
pub room_id: RoomId,
pub event_type: String
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = PathParams;
type QueryParams = ();
type Response = ::serde_json::Value;
fn method() -> ::Method {
::Method::Get
}
fn request_path(params: Self::PathParams) -> String {
format!(
"/_matrix/client/r0/rooms/{}/state/{}",
params.room_id,
params.event_type
)
}
fn router_path() -> String {
"/_matrix/client/r0/rooms/:room_id/state/:event_type".to_string()
}
}
}
/// GET /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype-state-key)
pub mod get_state_event_by_state_key {
use ruma_identifiers::RoomId;
/// Details about this API endpoint.
pub struct Endpoint;
/// This API endpoint's path parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PathParams {
pub room_id: RoomId,
pub event_type: String,
pub state_key: String,
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = PathParams;
type QueryParams = ();
type Response = ::serde_json::Value;
fn method() -> ::Method {
::Method::Get
}
fn request_path(params: Self::PathParams) -> String {
format!(
"/_matrix/client/r0/rooms/{}/state/{}/{}",
params.room_id,
params.event_type,
params.state_key
)
}
fn router_path() -> String {
"/_matrix/client/r0/rooms/:room_id/state/:event_type/:state_key".to_string()
}
}
}
/// GET /_matrix/client/r0/rooms/{roomId}/members
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-members)
pub mod get_member_events {
use ruma_identifiers::RoomId;
use ruma_events::room::member::MemberEvent;
/// Details about this API endpoint.
pub struct Endpoint;
/// This API endpoint's path parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PathParams {
pub room_id: RoomId,
}
/// This API endpoint's reponse.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response {
pub chunks: Vec<MemberEvent>
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = PathParams;
type QueryParams = ();
type Response = Response;
fn method() -> ::Method {
::Method::Get
}
fn request_path(params: Self::PathParams) -> String {
format!(
"/_matrix/client/r0/rooms/{}/members",
params.room_id,
)
}
fn router_path() -> String {
"/_matrix/client/r0/rooms/:room_id/members".to_string()
}
}
}
/// GET /_matrix/client/r0/rooms/{roomId}/messages
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-messages)
pub mod get_message_events {
use ruma_identifiers::RoomId;
use ruma_events::collections::only;
/// Details about this API endpoint.
pub struct Endpoint;
/// This API endpoint's path parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PathParams {
pub room_id: RoomId,
pub event_type: String
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum Direction {
#[serde(rename="b")]
Backward,
#[serde(rename="f")]
Forward
}
/// This API endpoint's query parameters.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct QueryParams {
pub from: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub to: Option<String>,
pub dir: Direction,
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<u64>
}
/// This API endpoint's reponse.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response {
pub start: String,
pub chunks: Vec<only::RoomEvent>,
pub end: String
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = PathParams;
type QueryParams = QueryParams;
type Response = Response;
fn method() -> ::Method {
::Method::Get
}
fn request_path(params: Self::PathParams) -> String {
format!(
"/_matrix/client/r0/rooms/{}/messages",
params.room_id,
)
}
fn router_path() -> String {
"/_matrix/client/r0/rooms/:room_id/messages".to_string()
}
}
}
/// GET /_matrix/client/r0/sync
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-sync)
pub mod sync {
pub mod sync_events {
use ruma_events::collections::only;
use ruma_identifiers::RoomId;

View File

@ -3,7 +3,7 @@
/// PUT /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-user-userid-rooms-roomid-tags-tag)
pub mod add_tag {
pub mod create_tag {
use ruma_identifiers::{UserId, RoomId};
use ruma_events::tag::TagInfo;
@ -93,7 +93,7 @@ pub mod get_tags {
/// DELETE /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#delete-matrix-client-r0-user-userid-rooms-roomid-tags-tag)
pub mod del_tag {
pub mod delete_tag {
use ruma_identifiers::{UserId, RoomId};
/// Details about this API endpoint.

View File

@ -3,7 +3,7 @@
/// PUT /_matrix/client/r0/rooms/{roomId}/typing/{userId}
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-typing-userid)
pub mod set_typing {
pub mod start_or_stop_typing {
use ruma_identifiers::{UserId, RoomId};
/// Details about this API endpoint.

View File

@ -3,7 +3,7 @@
/// GET /_matrix/client/r0/voip/turnServer
///
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-voip-turnserver)
pub mod turnserver {
pub mod get_turn_server_info {
/// Details about this API endpoint.
pub struct Endpoint;