Use js_int types for numbers.
See https://github.com/ruma/ruma-events/issues/27 for rationale.
This commit is contained in:
parent
4a4c2dd025
commit
a16eb7cfe1
18
Cargo.toml
18
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]
|
||||
|
@ -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<String>,
|
||||
/// TODO: This parameter is not documented in the spec.
|
||||
pub send_attempt: u64,
|
||||
pub send_attempt: UInt,
|
||||
}
|
||||
|
||||
response {}
|
||||
|
@ -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<String>,
|
||||
/// Used to distinguish protocol level retries from requests to re-send the email.
|
||||
pub send_attempt: u64,
|
||||
pub send_attempt: UInt,
|
||||
}
|
||||
|
||||
response {}
|
||||
|
@ -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<String>,
|
||||
/// Used to distinguish protocol level retries from requests to re-send the email.
|
||||
pub send_attempt: u64,
|
||||
pub send_attempt: UInt,
|
||||
}
|
||||
|
||||
response {}
|
||||
|
@ -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<String>,
|
||||
/// 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.
|
||||
|
@ -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<String>,
|
||||
/// The maximum number of events to return.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub limit: Option<u64>,
|
||||
pub limit: Option<UInt>,
|
||||
/// 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<String>,
|
||||
/// The maximum number of events to return.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub limit: Option<u64>,
|
||||
pub limit: Option<UInt>,
|
||||
/// A list of senders IDs to include.
|
||||
///
|
||||
/// If this list is absent then all senders are included.
|
||||
|
@ -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<u64>,
|
||||
pub height: Option<UInt>,
|
||||
/// The desired resizing method.
|
||||
#[ruma_api(query)]
|
||||
pub method: Option<Method>,
|
||||
/// The *desired* width of the thumbnail. The actual thumbnail may not match the size
|
||||
/// specified.
|
||||
#[ruma_api(query)]
|
||||
pub width: Option<u64>,
|
||||
pub width: Option<UInt>,
|
||||
}
|
||||
|
||||
response {
|
||||
|
@ -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<bool>,
|
||||
/// 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<u64>,
|
||||
pub last_active_ago: Option<UInt>,
|
||||
/// The user's presence state.
|
||||
pub presence: PresenceState,
|
||||
}
|
||||
|
@ -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<GroupingKey, HashMap<RoomId, ResultGroup>>,
|
||||
@ -191,7 +192,7 @@ pub struct ResultGroup {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub next_batch: Option<String>,
|
||||
/// Key that can be used to order different groups.
|
||||
pub order: u64,
|
||||
pub order: UInt,
|
||||
/// Which results are in this group.
|
||||
pub results: Vec<EventId>,
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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<u64>,
|
||||
pub limit: Option<UInt>,
|
||||
}
|
||||
|
||||
response {
|
||||
|
@ -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<u64>,
|
||||
pub timeout: Option<UInt>,
|
||||
}
|
||||
|
||||
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<u64>,
|
||||
pub highlight_count: Option<UInt>,
|
||||
/// The total number of unread notifications for this room.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub notification_count: Option<u64>,
|
||||
pub notification_count: Option<UInt>,
|
||||
}
|
||||
|
||||
/// Events in the room.
|
||||
|
@ -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<u64>,
|
||||
pub timeout: Option<UInt>,
|
||||
/// 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.
|
||||
|
@ -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<String>,
|
||||
/// The username to use.
|
||||
|
Loading…
x
Reference in New Issue
Block a user