From 9665abbaf243f659a2be83f4e3d84b975db5f520 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sat, 22 Feb 2020 01:51:38 +0100 Subject: [PATCH] Make accidentally private things public --- src/r0/account.rs | 9 ++++++--- src/r0/account/delete_3pid.rs | 8 ++++---- src/r0/account/request_openid_token.rs | 10 +++++----- src/r0/account/unbind_3pid.rs | 9 ++++----- src/r0/client_exchange/send_event_to_device.rs | 6 +++--- src/r0/config/get_global_account_data.rs | 6 +++--- src/r0/config/get_room_account_data.rs | 8 ++++---- src/r0/device/delete_device.rs | 6 ++++-- src/r0/device/delete_devices.rs | 4 ++-- src/r0/device/get_device.rs | 6 ++++-- src/r0/device/update_device.rs | 7 +++++-- src/r0/directory/get_public_rooms.rs | 6 +++--- src/r0/directory/get_public_rooms_filtered.rs | 10 +++++----- src/r0/keys.rs | 2 +- src/r0/media/get_media_config.rs | 2 +- src/r0/media/get_media_preview.rs | 6 +++--- src/r0/room/create_room.rs | 16 ++++++++-------- src/r0/room/report_content.rs | 8 ++++---- src/r0/room/upgrade_room.rs | 6 +++--- src/r0/session/login.rs | 10 ++++++---- src/r0/session/login/user_serde.rs | 6 +++--- 21 files changed, 81 insertions(+), 70 deletions(-) diff --git a/src/r0/account.rs b/src/r0/account.rs index bda1ecb0..4064aa37 100644 --- a/src/r0/account.rs +++ b/src/r0/account.rs @@ -24,9 +24,9 @@ use serde::{Deserialize, Serialize}; pub struct AuthenticationData { /// The login type that the client is attempting to complete. #[serde(rename = "type")] - kind: String, + pub kind: String, /// The value of the session key given by the homeserver. - session: Option, + pub session: Option, } /// Additional authentication information for requestToken endpoints. @@ -42,7 +42,10 @@ pub struct IdentityServerInfo { /// Possible values for deleting or unbinding 3PIDs #[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[serde(rename_all = "kebab-case")] -enum ThirdPartyIdRemovalStatus { +pub enum ThirdPartyIdRemovalStatus { + /// Either the homeserver couldn't determine the right identity server to contact, or the + /// identity server refused the operation. NoSupport, + /// Success. Success, } diff --git a/src/r0/account/delete_3pid.rs b/src/r0/account/delete_3pid.rs index b9109efe..4af420b6 100644 --- a/src/r0/account/delete_3pid.rs +++ b/src/r0/account/delete_3pid.rs @@ -18,16 +18,16 @@ ruma_api! { request { /// Identity server to delete from. #[serde(skip_serializing_if = "Option::is_none")] - id_server: Option, + pub id_server: Option, /// Medium of the 3PID to be removed. - medium: Medium, + pub medium: Medium, /// Third-party address being removed. - address: String, + pub address: String, } response { /// Result of unbind operation. - id_server_unbind_result: ThirdPartyIdRemovalStatus, + pub id_server_unbind_result: ThirdPartyIdRemovalStatus, } } diff --git a/src/r0/account/request_openid_token.rs b/src/r0/account/request_openid_token.rs index a62f7b09..e4ac9362 100644 --- a/src/r0/account/request_openid_token.rs +++ b/src/r0/account/request_openid_token.rs @@ -18,18 +18,18 @@ ruma_api! { request { /// User ID of authenticated user. #[ruma_api(path)] - user_id: UserId, + pub user_id: UserId, } response { /// Access token for verifying user's identity. - access_token: String, + pub access_token: String, /// Access token type. - token_type: TokenType, + pub token_type: TokenType, /// Homeserver domain for verification of user's identity. - matrix_server_name: String, + pub matrix_server_name: String, /// Seconds until token expiration. - expires_in: UInt, + pub expires_in: UInt, } } diff --git a/src/r0/account/unbind_3pid.rs b/src/r0/account/unbind_3pid.rs index 69f68f8e..d493a179 100644 --- a/src/r0/account/unbind_3pid.rs +++ b/src/r0/account/unbind_3pid.rs @@ -18,16 +18,15 @@ ruma_api! { request { /// Identity server to unbind from. #[serde(skip_serializing_if = "Option::is_none")] - id_server: Option, + pub id_server: Option, /// Medium of the 3PID to be removed. - medium: Medium, + pub medium: Medium, /// Third-party address being removed. - address: String, + pub address: String, } response { /// Result of unbind operation. - id_server_unbind_result: ThirdPartyIdRemovalStatus, + pub id_server_unbind_result: ThirdPartyIdRemovalStatus, } - } diff --git a/src/r0/client_exchange/send_event_to_device.rs b/src/r0/client_exchange/send_event_to_device.rs index 36aefd36..0813ab3b 100644 --- a/src/r0/client_exchange/send_event_to_device.rs +++ b/src/r0/client_exchange/send_event_to_device.rs @@ -21,15 +21,15 @@ ruma_api! { request { /// Type of event being sent to each device. #[ruma_api(path)] - event_type: String, + pub event_type: String, /// A request identifier unique to the access token used to send the request. #[ruma_api(path)] - txn_id: String, + pub txn_id: String, /// A map of users to devices to a message event to be sent to the user's /// device. Individual message events can be sent to devices, but all /// events must be of the same type. #[wrap_incoming(all::Event with EventResult)] - messages: HashMap> + pub messages: HashMap> } response {} diff --git a/src/r0/config/get_global_account_data.rs b/src/r0/config/get_global_account_data.rs index 342fa1c0..b5a01559 100644 --- a/src/r0/config/get_global_account_data.rs +++ b/src/r0/config/get_global_account_data.rs @@ -17,16 +17,16 @@ ruma_api! { request { /// User ID of user for whom to retrieve data. #[ruma_api(path)] - user_id: UserId, + pub user_id: UserId, /// Type of data to retrieve. #[ruma_api(path)] - event_type: String, + pub event_type: String, } response { /// Account data content for the given type. #[ruma_api(body)] #[wrap_incoming(with EventResult)] - account_data: only::Event, + pub account_data: only::Event, } } diff --git a/src/r0/config/get_room_account_data.rs b/src/r0/config/get_room_account_data.rs index f2ea38e9..dc76dd0e 100644 --- a/src/r0/config/get_room_account_data.rs +++ b/src/r0/config/get_room_account_data.rs @@ -17,19 +17,19 @@ ruma_api! { request { /// User ID of user for whom to retrieve data. #[ruma_api(path)] - user_id: UserId, + pub user_id: UserId, /// Room ID for which to retrieve data. #[ruma_api(path)] - room_id: RoomId, + pub room_id: RoomId, /// Type of data to retrieve. #[ruma_api(path)] - event_type: String, + pub event_type: String, } response { /// Account data content for the given type. #[ruma_api(body)] #[wrap_incoming(with EventResult)] - account_data: only::Event, + pub account_data: only::Event, } } diff --git a/src/r0/device/delete_device.rs b/src/r0/device/delete_device.rs index bea045e4..478a7064 100644 --- a/src/r0/device/delete_device.rs +++ b/src/r0/device/delete_device.rs @@ -15,10 +15,12 @@ ruma_api! { } request { + /// The device to delete. #[ruma_api(path)] - device_id: DeviceId, + pub device_id: DeviceId, + /// Additional authentication information for the user-interactive authentication API. #[serde(skip_serializing_if = "Option::is_none")] - auth: Option, + pub auth: Option, } response {} diff --git a/src/r0/device/delete_devices.rs b/src/r0/device/delete_devices.rs index 2adf8ea5..3ce01871 100644 --- a/src/r0/device/delete_devices.rs +++ b/src/r0/device/delete_devices.rs @@ -16,11 +16,11 @@ ruma_api! { request { /// List of devices to delete. - devices: Vec, + pub devices: Vec, /// Additional authentication information for the user-interactive authentication API. #[serde(skip_serializing_if = "Option::is_none")] - auth: Option, + pub auth: Option, } response {} diff --git a/src/r0/device/get_device.rs b/src/r0/device/get_device.rs index 98b88bd2..0b17c6b8 100644 --- a/src/r0/device/get_device.rs +++ b/src/r0/device/get_device.rs @@ -15,12 +15,14 @@ ruma_api! { } request { + /// The device to retrieve. #[ruma_api(path)] - device_id: DeviceId, + pub device_id: DeviceId, } response { + /// Information about the device. #[ruma_api(body)] - device: Device, + pub device: Device, } } diff --git a/src/r0/device/update_device.rs b/src/r0/device/update_device.rs index 2d3db701..9d4328ff 100644 --- a/src/r0/device/update_device.rs +++ b/src/r0/device/update_device.rs @@ -14,10 +14,13 @@ ruma_api! { } request { + /// The device to update. #[ruma_api(path)] - device_id: DeviceId, + pub device_id: DeviceId, + /// The new display name for this device. If this is `None`, the display name won't be + /// changed. #[serde(skip_serializing_if = "Option::is_none")] - display_name: Option, + pub display_name: Option, } response {} diff --git a/src/r0/directory/get_public_rooms.rs b/src/r0/directory/get_public_rooms.rs index dcf0cf98..2f565cda 100644 --- a/src/r0/directory/get_public_rooms.rs +++ b/src/r0/directory/get_public_rooms.rs @@ -19,17 +19,17 @@ ruma_api! { /// Limit for the number of results to return. #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] - limit: Option, + pub limit: Option, /// Pagination token from a previous request. #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] - since: Option, + pub since: Option, /// The server to fetch the public room lists from. /// /// `None` means the server this request is sent to. #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] - server: Option, + pub server: Option, } response { diff --git a/src/r0/directory/get_public_rooms_filtered.rs b/src/r0/directory/get_public_rooms_filtered.rs index f6b5ad6e..b63b0347 100644 --- a/src/r0/directory/get_public_rooms_filtered.rs +++ b/src/r0/directory/get_public_rooms_filtered.rs @@ -22,16 +22,16 @@ ruma_api! { /// `None` means the server this request is sent to. #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] - server: Option, + pub server: Option, /// Limit for the number of results to return. #[serde(skip_serializing_if = "Option::is_none")] - limit: Option, + pub limit: Option, /// Pagination token from a previous request. #[serde(skip_serializing_if = "Option::is_none")] - since: Option, + pub since: Option, /// Filter to apply to the results. #[serde(skip_serializing_if = "Option::is_none")] - filter: Option, + pub filter: Option, } response { @@ -51,5 +51,5 @@ ruma_api! { pub struct Filter { /// A string to search for in the room metadata, e.g. name, topic, canonical alias etc. #[serde(skip_serializing_if = "Option::is_none")] - generic_search_term: Option, + pub generic_search_term: Option, } diff --git a/src/r0/keys.rs b/src/r0/keys.rs index e307d3b6..1fc91089 100644 --- a/src/r0/keys.rs +++ b/src/r0/keys.rs @@ -129,7 +129,7 @@ pub struct DeviceKeys { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct UnsignedDeviceInfo { /// The display name which the user set on the device. - device_display_name: String, + pub device_display_name: String, } /// A key for the SignedCurve25519 algorithm diff --git a/src/r0/media/get_media_config.rs b/src/r0/media/get_media_config.rs index 2cc2f086..84008948 100644 --- a/src/r0/media/get_media_config.rs +++ b/src/r0/media/get_media_config.rs @@ -18,6 +18,6 @@ ruma_api! { response { /// Maximum size of upload in bytes. #[serde(rename = "m.upload.size")] - upload_size: UInt, + pub upload_size: UInt, } } diff --git a/src/r0/media/get_media_preview.rs b/src/r0/media/get_media_preview.rs index 126b7aba..c2fcdae8 100644 --- a/src/r0/media/get_media_preview.rs +++ b/src/r0/media/get_media_preview.rs @@ -17,10 +17,10 @@ ruma_api! { request { /// URL to get a preview of. #[ruma_api(query)] - url: String, + pub url: String, /// Preferred point in time (in milliseconds) to return a preview for. #[ruma_api(query)] - ts: UInt, + pub ts: UInt, } response { @@ -29,6 +29,6 @@ ruma_api! { /// Differences from OpenGraph: the image size in bytes is added to the `matrix:image:size` /// field, and `og:image` returns the MXC URI to the image, if any. #[ruma_api(body)] - data: Option, + pub data: Option, } } diff --git a/src/r0/room/create_room.rs b/src/r0/room/create_room.rs index 0335921e..53d077f6 100644 --- a/src/r0/room/create_room.rs +++ b/src/r0/room/create_room.rs @@ -47,7 +47,7 @@ ruma_api! { /// Power level content to override in the default power level event. #[serde(skip_serializing_if = "Option::is_none")] #[wrap_incoming(PowerLevelsEventContent with EventResult)] - power_level_content_override: Option, + pub power_level_content_override: Option, /// Convenience parameter for setting various default state events based on a preset. #[serde(skip_serializing_if = "Option::is_none")] pub preset: Option, @@ -100,13 +100,13 @@ pub enum RoomPreset { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Invite3pid { /// Hostname and port of identity server to be used for account lookups. - id_server: String, + pub id_server: String, /// An access token registered with the identity server. - id_access_token: String, + pub id_access_token: String, /// Type of third party ID. - medium: Medium, + pub medium: Medium, /// Third party identifier. - address: String, + pub address: String, } /// Represents content of a state event to be used to initalize new room state. @@ -114,9 +114,9 @@ pub struct Invite3pid { pub struct InitialStateEvent { /// State event type. #[serde(rename = "type")] - event_type: String, + pub event_type: String, /// `state_key` of the event to be sent. - state_key: Option, + pub state_key: Option, /// JSON content of the state event. - content: Value, + pub content: Value, } diff --git a/src/r0/room/report_content.rs b/src/r0/room/report_content.rs index 43713bea..ecb07ec6 100644 --- a/src/r0/room/report_content.rs +++ b/src/r0/room/report_content.rs @@ -17,14 +17,14 @@ ruma_api! { request { /// Room in which the event to be reported is located. #[ruma_api(path)] - room_id: RoomId, + pub room_id: RoomId, /// Event to report. #[ruma_api(path)] - event_id: EventId, + pub event_id: EventId, /// Integer between -100 and 0 rating offensivness. - score: Int, + pub score: Int, /// Reason to report content. May be blank. - reason: String, + pub reason: String, } response {} diff --git a/src/r0/room/upgrade_room.rs b/src/r0/room/upgrade_room.rs index 85ab9ee3..91b60b01 100644 --- a/src/r0/room/upgrade_room.rs +++ b/src/r0/room/upgrade_room.rs @@ -16,13 +16,13 @@ ruma_api! { request { /// ID of the room to be upgraded. #[ruma_api(path)] - room_id: RoomId, + pub room_id: RoomId, /// New version for the room. - new_version: String, + pub new_version: String, } response { /// ID of the new room. - replacement_room: RoomId, + pub replacement_room: RoomId, } } diff --git a/src/r0/session/login.rs b/src/r0/session/login.rs index a6b53d6e..d69fbe42 100644 --- a/src/r0/session/login.rs +++ b/src/r0/session/login.rs @@ -99,24 +99,26 @@ pub enum LoginInfo { /// Client configuration provided by the server. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DiscoveryInfo { + /// Information about the homeserver to connect to. #[serde(rename = "m.homeserver")] - homeserver: HomeserverInfo, + pub homeserver: HomeserverInfo, + /// Information about the identity server to connect to. #[serde(rename = "m.identity_server")] - identity_server: Option, + pub identity_server: Option, } /// Information about the homeserver to connect to. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct HomeserverInfo { /// The base URL for the homeserver for client-server connections. - base_url: String, + pub base_url: String, } /// Information about the identity server to connect to. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct IdentityServerInfo { /// The base URL for the identity server for client-server connections. - base_url: String, + pub base_url: String, } mod user_serde; diff --git a/src/r0/session/login/user_serde.rs b/src/r0/session/login/user_serde.rs index 17202ce8..f7568789 100644 --- a/src/r0/session/login/user_serde.rs +++ b/src/r0/session/login/user_serde.rs @@ -8,14 +8,14 @@ use super::Medium; // The following three structs could just be used in place of the one in the parent module, but // that one is arguably much easier to deal with. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct UserInfo<'a> { +pub(crate) struct UserInfo<'a> { #[serde(borrow)] - identifier: UserIdentifier<'a>, + pub identifier: UserIdentifier<'a>, } #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[serde(tag = "type")] -pub enum UserIdentifier<'a> { +pub(crate) enum UserIdentifier<'a> { #[serde(rename = "m.id.user")] MatrixId { user: &'a str }, #[serde(rename = "m.id.thirdparty")]