Update to Rust 2018
This commit is contained in:
parent
f95b4b05bb
commit
bc968c8e14
@ -9,6 +9,7 @@ name = "ruma-client-api"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/ruma/ruma-client-api"
|
||||
version = "0.2.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
futures = "0.1.25"
|
||||
|
22
src/lib.rs
22
src/lib.rs
@ -5,20 +5,14 @@
|
||||
#![deny(missing_debug_implementations, missing_docs)]
|
||||
#![feature(try_from)]
|
||||
|
||||
extern crate futures;
|
||||
extern crate http;
|
||||
extern crate hyper;
|
||||
extern crate ruma_api;
|
||||
extern crate ruma_api_macros;
|
||||
extern crate ruma_events;
|
||||
extern crate ruma_identifiers;
|
||||
extern crate ruma_signatures;
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_urlencoded;
|
||||
extern crate url;
|
||||
use futures;
|
||||
use http;
|
||||
use hyper;
|
||||
use ruma_api;
|
||||
use serde;
|
||||
use serde_json;
|
||||
use serde_urlencoded;
|
||||
use url;
|
||||
|
||||
/// Endpoints for the r0.x.x versions of the client API specification.
|
||||
pub mod r0 {
|
||||
|
@ -4,6 +4,7 @@
|
||||
pub mod register {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -101,6 +102,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 {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -153,6 +155,7 @@ pub mod deactivate {
|
||||
/// [POST /_matrix/client/r0/account/password](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-account-password)
|
||||
pub mod change_password {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -177,6 +180,7 @@ pub mod change_password {
|
||||
/// [POST /_matrix/client/r0/register/email/requestToken](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-register-email-requesttoken)
|
||||
pub mod request_register_token {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -4,6 +4,7 @@
|
||||
pub mod create_alias {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomAliasId, RoomId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -31,6 +32,7 @@ pub mod create_alias {
|
||||
pub mod delete_alias {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::RoomAliasId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -56,6 +58,7 @@ pub mod delete_alias {
|
||||
pub mod get_alias {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomAliasId, RoomId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -4,6 +4,7 @@
|
||||
pub mod set_room_account_data {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
ruma_api! {
|
||||
@ -43,6 +44,7 @@ pub mod set_room_account_data {
|
||||
pub mod set_global_account_data {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
ruma_api! {
|
||||
|
@ -3,6 +3,7 @@
|
||||
/// [POST /_matrix/client/r0/account/3pid](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-account-3pid)
|
||||
pub mod create_contact {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -43,6 +44,7 @@ pub mod create_contact {
|
||||
/// [GET /_matrix/client/r0/account/3pid](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-account-3pid)
|
||||
pub mod get_contacts {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -84,6 +86,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 {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -5,6 +5,7 @@ pub mod get_context {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::collections::only;
|
||||
use ruma_identifiers::{EventId, RoomId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -4,6 +4,7 @@
|
||||
pub mod get_public_rooms {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomAliasId, RoomId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! Endpoints for event filters.
|
||||
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
/// Format to use for returned events
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
||||
@ -169,6 +170,7 @@ pub struct FilterDefinition {
|
||||
pub mod create_filter {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use super::FilterDefinition;
|
||||
|
||||
@ -204,6 +206,7 @@ pub mod create_filter {
|
||||
pub mod get_filter {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use super::FilterDefinition;
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
/// [GET /_matrix/media/r0/download/{serverName}/{mediaId}](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-media-r0-download-servername-mediaid)
|
||||
pub mod get_content {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -40,6 +41,7 @@ pub mod get_content {
|
||||
/// [POST /_matrix/media/r0/upload](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-media-r0-upload)
|
||||
pub mod create_content {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -67,6 +69,7 @@ pub mod create_content {
|
||||
/// [GET /_matrix/media/r0/thumbnail/{serverName}/{mediaId}](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-media-r0-thumbnail-servername-mediaid)
|
||||
pub mod get_content_thumbnail {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
/// The desired resizing method.
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||
|
@ -1,6 +1,7 @@
|
||||
//! Endpoints for room membership.
|
||||
|
||||
use ruma_signatures::Signatures;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
// TODO: spec requires a nesting ThirdPartySigned { signed: Signed { mxid: ..., ... } }
|
||||
// for join_room_by_id_or_alias but not for join_room_by_id, inconsistency?
|
||||
@ -23,6 +24,7 @@ pub struct ThirdPartySigned {
|
||||
pub mod invite_user {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -50,6 +52,7 @@ pub mod invite_user {
|
||||
pub mod join_room_by_id_or_alias {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomId, RoomIdOrAliasId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use super::ThirdPartySigned;
|
||||
|
||||
@ -84,6 +87,7 @@ pub mod join_room_by_id_or_alias {
|
||||
pub mod join_room_by_id {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use super::ThirdPartySigned;
|
||||
|
||||
@ -118,6 +122,7 @@ pub mod join_room_by_id {
|
||||
pub mod forget_room {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -143,6 +148,7 @@ pub mod forget_room {
|
||||
pub mod leave_room {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -168,6 +174,7 @@ pub mod leave_room {
|
||||
pub mod kick_user {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -198,6 +205,7 @@ pub mod kick_user {
|
||||
pub mod unban_user {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -225,6 +233,7 @@ pub mod unban_user {
|
||||
pub mod ban_user {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -5,6 +5,7 @@ pub mod set_presence {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::presence::PresenceState;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -36,6 +37,7 @@ pub mod get_presence {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::presence::PresenceState;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -73,6 +75,7 @@ pub mod get_presence {
|
||||
pub mod update_presence_subscriptions {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -107,6 +110,7 @@ pub mod get_subscribed_presences {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::presence::PresenceEvent;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -4,6 +4,7 @@
|
||||
pub mod get_display_name {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -33,6 +34,7 @@ pub mod get_display_name {
|
||||
pub mod set_display_name {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -61,6 +63,7 @@ pub mod set_display_name {
|
||||
pub mod get_avatar_url {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -90,6 +93,7 @@ pub mod get_avatar_url {
|
||||
pub mod set_avatar_url {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -117,6 +121,7 @@ pub mod set_avatar_url {
|
||||
pub mod get_profile {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -6,6 +6,7 @@ pub mod create_receipt {
|
||||
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{EventId, RoomId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -41,7 +42,7 @@ pub mod create_receipt {
|
||||
}
|
||||
|
||||
impl Display for ReceiptType {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
|
||||
match *self {
|
||||
ReceiptType::Read => write!(f, "m.read"),
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
pub mod redact_event {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{EventId, RoomId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -4,6 +4,7 @@
|
||||
pub mod create_room {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -7,8 +7,9 @@ pub mod search_events {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::collections::all::Event;
|
||||
use ruma_identifiers::{EventId, RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use r0::filter::RoomEventFilter;
|
||||
use crate::r0::filter::RoomEventFilter;
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -5,6 +5,7 @@ pub mod send_state_event_for_empty_key {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::EventType;
|
||||
use ruma_identifiers::{EventId, RoomId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
ruma_api! {
|
||||
@ -41,6 +42,7 @@ pub mod send_state_event_for_key {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::EventType;
|
||||
use ruma_identifiers::{EventId, RoomId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
ruma_api! {
|
||||
@ -80,6 +82,7 @@ pub mod send_message_event {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::{room::message::MessageEventContent, EventType};
|
||||
use ruma_identifiers::{EventId, RoomId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -6,6 +6,7 @@ pub mod get_user_info {
|
||||
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -4,6 +4,7 @@
|
||||
pub mod login {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::UserId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -5,6 +5,7 @@ pub mod get_state_events {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::collections::only;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -37,6 +38,7 @@ pub mod get_state_events_for_empty_key {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::EventType;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -70,6 +72,7 @@ pub mod get_state_events_for_key {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::EventType;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -106,6 +109,7 @@ pub mod get_member_events {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::room::member::MemberEvent;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -135,6 +139,7 @@ pub mod get_message_events {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::collections::only;
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -204,8 +209,9 @@ pub mod sync_events {
|
||||
stripped,
|
||||
};
|
||||
use ruma_identifiers::RoomId;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
use r0::filter::FilterDefinition;
|
||||
use crate::r0::filter::FilterDefinition;
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -5,6 +5,7 @@ pub mod create_tag {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::tag::TagInfo;
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -40,6 +41,7 @@ pub mod get_tags {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_events::tag::TagEventContent;
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -71,6 +73,7 @@ pub mod get_tags {
|
||||
pub mod delete_tag {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -4,6 +4,7 @@
|
||||
pub mod create_typing_event {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use ruma_identifiers::{RoomId, UserId};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -3,6 +3,7 @@
|
||||
/// [GET /_matrix/client/r0/voip/turnServer](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-voip-turnserver)
|
||||
pub mod get_turn_server_info {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
@ -3,6 +3,7 @@
|
||||
/// [GET /_matrix/client/versions](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-versions)
|
||||
pub mod get_supported_versions {
|
||||
use ruma_api_macros::ruma_api;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
|
Loading…
x
Reference in New Issue
Block a user