diff --git a/Cargo.toml b/Cargo.toml index ee1a425d..20166ba6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,20 +12,24 @@ version = "0.3.0" edition = "2018" [dependencies] -futures = "0.1.26" +futures = "0.1.27" http = "0.1.17" -hyper = "0.12.27" -ruma-api = "0.7.0" -ruma-api-macros = "0.4.0" +hyper = "0.12.29" +ruma-api = "0.8.0" +ruma-api-macros = "0.5.0" ruma-events = "0.12.0" -ruma-identifiers = "0.12.0" +ruma-identifiers = "0.13.0" ruma-signatures = "0.4.2" serde_json = "1.0.39" -serde_urlencoded = "0.5.4" +serde_urlencoded = "0.5.5" url_serde = "0.2.0" +[dependencies.js_int] +version = "0.1.0" +features = ["serde"] + [dependencies.serde] -version = "1.0.90" +version = "1.0.92" features = ["derive"] [dependencies.url] diff --git a/src/r0/account/request_password_change_token.rs b/src/r0/account/request_password_change_token.rs index 53a207e0..56394bfa 100644 --- a/src/r0/account/request_password_change_token.rs +++ b/src/r0/account/request_password_change_token.rs @@ -1,5 +1,6 @@ //! [POST /_matrix/client/r0/account/password/email/requestToken](https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-account-password-email-requesttoken) +use js_int::UInt; use ruma_api_macros::ruma_api; use serde::{Deserialize, Serialize}; @@ -22,7 +23,7 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub id_server: Option, /// TODO: This parameter is not documented in the spec. - pub send_attempt: u64, + pub send_attempt: UInt, } response {} diff --git a/src/r0/account/request_register_token.rs b/src/r0/account/request_register_token.rs index cd391063..628ffc4d 100644 --- a/src/r0/account/request_register_token.rs +++ b/src/r0/account/request_register_token.rs @@ -1,5 +1,6 @@ //! [POST /_matrix/client/r0/register/email/requestToken](https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-register-email-requesttoken) +use js_int::UInt; use ruma_api_macros::ruma_api; use serde::{Deserialize, Serialize}; @@ -22,7 +23,7 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub id_server: Option, /// Used to distinguish protocol level retries from requests to re-send the email. - pub send_attempt: u64, + pub send_attempt: UInt, } response {} diff --git a/src/r0/contact/request_contact_verification_token.rs b/src/r0/contact/request_contact_verification_token.rs index d6bf95a6..3eade882 100644 --- a/src/r0/contact/request_contact_verification_token.rs +++ b/src/r0/contact/request_contact_verification_token.rs @@ -1,5 +1,6 @@ //! [POST /_matrix/client/r0/account/3pid/email/requestToken](https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-account-3pid-email-requesttoken) +use js_int::UInt; use ruma_api_macros::ruma_api; use serde::{Deserialize, Serialize}; @@ -22,7 +23,7 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub id_server: Option, /// Used to distinguish protocol level retries from requests to re-send the email. - pub send_attempt: u64, + pub send_attempt: UInt, } response {} diff --git a/src/r0/directory/get_public_rooms.rs b/src/r0/directory/get_public_rooms.rs index 1eb1c28d..6a70fd83 100644 --- a/src/r0/directory/get_public_rooms.rs +++ b/src/r0/directory/get_public_rooms.rs @@ -1,5 +1,6 @@ //! [GET /_matrix/client/r0/publicRooms](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-publicrooms) +use js_int::UInt; use ruma_api_macros::ruma_api; use ruma_identifiers::{RoomAliasId, RoomId}; use serde::{Deserialize, Serialize}; @@ -43,7 +44,7 @@ pub struct PublicRoomsChunk { #[serde(skip_serializing_if = "Option::is_none")] pub name: Option, /// The number of members joined to the room. - pub num_joined_members: u64, + pub num_joined_members: UInt, /// The ID of the room. pub room_id: RoomId, /// The topic of the room, if any. diff --git a/src/r0/filter.rs b/src/r0/filter.rs index 3be8cd30..95304bdf 100644 --- a/src/r0/filter.rs +++ b/src/r0/filter.rs @@ -3,6 +3,7 @@ pub mod create_filter; pub mod get_filter; +use js_int::UInt; use ruma_identifiers::{RoomId, UserId}; use serde::{Deserialize, Serialize}; @@ -37,7 +38,7 @@ pub struct RoomEventFilter { pub not_rooms: Vec, /// The maximum number of events to return. #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, + pub limit: Option, /// A list of room IDs to include. /// /// If this list is absent then all rooms are included. @@ -117,7 +118,7 @@ pub struct Filter { pub not_types: Vec, /// The maximum number of events to return. #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, + pub limit: Option, /// A list of senders IDs to include. /// /// If this list is absent then all senders are included. diff --git a/src/r0/media/get_content_thumbnail.rs b/src/r0/media/get_content_thumbnail.rs index e13e340f..033864f2 100644 --- a/src/r0/media/get_content_thumbnail.rs +++ b/src/r0/media/get_content_thumbnail.rs @@ -1,5 +1,6 @@ //! [GET /_matrix/media/r0/thumbnail/{serverName}/{mediaId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-media-r0-thumbnail-servername-mediaid) +use js_int::UInt; use ruma_api_macros::ruma_api; use serde::{Deserialize, Serialize}; @@ -34,14 +35,14 @@ ruma_api! { /// The *desired* height of the thumbnail. The actual thumbnail may not match the size /// specified. #[ruma_api(query)] - pub height: Option, + pub height: Option, /// The desired resizing method. #[ruma_api(query)] pub method: Option, /// The *desired* width of the thumbnail. The actual thumbnail may not match the size /// specified. #[ruma_api(query)] - pub width: Option, + pub width: Option, } response { diff --git a/src/r0/presence/get_presence.rs b/src/r0/presence/get_presence.rs index f1e8ea86..010894af 100644 --- a/src/r0/presence/get_presence.rs +++ b/src/r0/presence/get_presence.rs @@ -1,5 +1,6 @@ //! [GET /_matrix/client/r0/presence/{userId}/status](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-presence-userid-status) +use js_int::UInt; use ruma_api_macros::ruma_api; use ruma_events::presence::PresenceState; use ruma_identifiers::UserId; @@ -30,7 +31,7 @@ ruma_api! { pub currently_active: Option, /// The length of time in milliseconds since an action was performed by the user. #[serde(skip_serializing_if = "Option::is_none")] - pub last_active_ago: Option, + pub last_active_ago: Option, /// The user's presence state. pub presence: PresenceState, } diff --git a/src/r0/search/search_events.rs b/src/r0/search/search_events.rs index 36814128..368d1113 100644 --- a/src/r0/search/search_events.rs +++ b/src/r0/search/search_events.rs @@ -2,6 +2,7 @@ use std::collections::HashMap; +use js_int::UInt; use ruma_api_macros::ruma_api; use ruma_events::collections::all::Event; use ruma_identifiers::{EventId, RoomId, UserId}; @@ -75,9 +76,9 @@ pub struct Criteria { #[derive(Clone, Copy, Debug, Deserialize, Serialize)] pub struct EventContext { /// How many events after the result are returned. - pub after_limit: u64, + pub after_limit: UInt, /// How many events before the result are returned. - pub before_limit: u64, + pub before_limit: UInt, /// Requests that the server returns the historic profile information for the users that /// sent the events that were returned. pub include_profile: bool, @@ -165,7 +166,7 @@ pub struct ResultCategories { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct RoomEventResults { /// An approximate count of the total number of results found. - pub count: u64, + pub count: UInt, /// Any groups that were requested. // TODO: Not sure this is right. https://github.com/matrix-org/matrix-doc/issues/773 pub groups: HashMap>, @@ -191,7 +192,7 @@ pub struct ResultGroup { #[serde(skip_serializing_if = "Option::is_none")] pub next_batch: Option, /// Key that can be used to order different groups. - pub order: u64, + pub order: UInt, /// Which results are in this group. pub results: Vec, } diff --git a/src/r0/server/get_user_info.rs b/src/r0/server/get_user_info.rs index e45e385f..1c16795f 100644 --- a/src/r0/server/get_user_info.rs +++ b/src/r0/server/get_user_info.rs @@ -2,6 +2,7 @@ use std::collections::HashMap; +use js_int::UInt; use ruma_api_macros::ruma_api; use ruma_identifiers::UserId; use serde::{Deserialize, Serialize}; @@ -36,7 +37,7 @@ pub struct ConnectionInfo { /// Most recently seen IP address of the session. pub ip: String, /// Unix timestamp that the session was last active. - pub last_seen: u64, + pub last_seen: UInt, /// User agent string last seen in the session. pub user_agent: String, } diff --git a/src/r0/sync/get_message_events.rs b/src/r0/sync/get_message_events.rs index 1078972b..4498bcdf 100644 --- a/src/r0/sync/get_message_events.rs +++ b/src/r0/sync/get_message_events.rs @@ -1,5 +1,6 @@ //! [GET /_matrix/client/r0/rooms/{roomId}/messages](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-rooms-roomid-messages) +use js_int::UInt; use ruma_api_macros::ruma_api; use ruma_events::collections::only; use ruma_identifiers::RoomId; @@ -38,7 +39,7 @@ ruma_api! { /// /// Default: 10. #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, + pub limit: Option, } response { diff --git a/src/r0/sync/sync_events.rs b/src/r0/sync/sync_events.rs index f152ca04..5bdc1048 100644 --- a/src/r0/sync/sync_events.rs +++ b/src/r0/sync/sync_events.rs @@ -2,6 +2,7 @@ use std::collections::HashMap; +use js_int::UInt; use ruma_api_macros::ruma_api; use ruma_events::{ collections::{all, only}, @@ -42,7 +43,7 @@ ruma_api! { /// The maximum time to poll in milliseconds before returning this request. #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] - pub timeout: Option, + pub timeout: Option, } response { @@ -156,10 +157,10 @@ pub struct JoinedRoom { pub struct UnreadNotificationsCount { /// The number of unread notifications for this room with the highlight flag set. #[serde(skip_serializing_if = "Option::is_none")] - pub highlight_count: Option, + pub highlight_count: Option, /// The total number of unread notifications for this room. #[serde(skip_serializing_if = "Option::is_none")] - pub notification_count: Option, + pub notification_count: Option, } /// Events in the room. diff --git a/src/r0/typing/create_typing_event.rs b/src/r0/typing/create_typing_event.rs index e928c4ef..d1178596 100644 --- a/src/r0/typing/create_typing_event.rs +++ b/src/r0/typing/create_typing_event.rs @@ -1,5 +1,6 @@ //! [PUT /_matrix/client/r0/rooms/{roomId}/typing/{userId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#put-matrix-client-r0-rooms-roomid-typing-userid) +use js_int::UInt; use ruma_api_macros::ruma_api; use ruma_identifiers::{RoomId, UserId}; use serde::{Deserialize, Serialize}; @@ -20,7 +21,7 @@ ruma_api! { pub room_id: RoomId, /// The length of time in milliseconds to mark this user as typing. #[serde(skip_serializing_if = "Option::is_none")] - pub timeout: Option, + pub timeout: Option, /// Whether the user is typing or not. If `false`, the `timeout` key can be omitted. pub typing: bool, /// The user who has started to type. diff --git a/src/r0/voip/get_turn_server_info.rs b/src/r0/voip/get_turn_server_info.rs index 52260261..03fce2c3 100644 --- a/src/r0/voip/get_turn_server_info.rs +++ b/src/r0/voip/get_turn_server_info.rs @@ -1,5 +1,6 @@ //! [GET /_matrix/client/r0/voip/turnServer](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-voip-turnserver) +use js_int::UInt; use ruma_api_macros::ruma_api; use serde::{Deserialize, Serialize}; @@ -19,7 +20,7 @@ ruma_api! { /// The password to use. pub password: String, /// The time-to-live in seconds. - pub ttl: u64, + pub ttl: UInt, /// A list of TURN URIs. pub uris: Vec, /// The username to use.