Make accidentally private things public

This commit is contained in:
Jonas Platte 2020-02-22 01:51:38 +01:00
parent 4939078954
commit 9665abbaf2
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
21 changed files with 81 additions and 70 deletions

View File

@ -24,9 +24,9 @@ use serde::{Deserialize, Serialize};
pub struct AuthenticationData { pub struct AuthenticationData {
/// The login type that the client is attempting to complete. /// The login type that the client is attempting to complete.
#[serde(rename = "type")] #[serde(rename = "type")]
kind: String, pub kind: String,
/// The value of the session key given by the homeserver. /// The value of the session key given by the homeserver.
session: Option<String>, pub session: Option<String>,
} }
/// Additional authentication information for requestToken endpoints. /// Additional authentication information for requestToken endpoints.
@ -42,7 +42,10 @@ pub struct IdentityServerInfo {
/// Possible values for deleting or unbinding 3PIDs /// Possible values for deleting or unbinding 3PIDs
#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[derive(Clone, Copy, Debug, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")] #[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, NoSupport,
/// Success.
Success, Success,
} }

View File

@ -18,16 +18,16 @@ ruma_api! {
request { request {
/// Identity server to delete from. /// Identity server to delete from.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
id_server: Option<String>, pub id_server: Option<String>,
/// Medium of the 3PID to be removed. /// Medium of the 3PID to be removed.
medium: Medium, pub medium: Medium,
/// Third-party address being removed. /// Third-party address being removed.
address: String, pub address: String,
} }
response { response {
/// Result of unbind operation. /// Result of unbind operation.
id_server_unbind_result: ThirdPartyIdRemovalStatus, pub id_server_unbind_result: ThirdPartyIdRemovalStatus,
} }
} }

View File

@ -18,18 +18,18 @@ ruma_api! {
request { request {
/// User ID of authenticated user. /// User ID of authenticated user.
#[ruma_api(path)] #[ruma_api(path)]
user_id: UserId, pub user_id: UserId,
} }
response { response {
/// Access token for verifying user's identity. /// Access token for verifying user's identity.
access_token: String, pub access_token: String,
/// Access token type. /// Access token type.
token_type: TokenType, pub token_type: TokenType,
/// Homeserver domain for verification of user's identity. /// Homeserver domain for verification of user's identity.
matrix_server_name: String, pub matrix_server_name: String,
/// Seconds until token expiration. /// Seconds until token expiration.
expires_in: UInt, pub expires_in: UInt,
} }
} }

View File

@ -18,16 +18,15 @@ ruma_api! {
request { request {
/// Identity server to unbind from. /// Identity server to unbind from.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
id_server: Option<String>, pub id_server: Option<String>,
/// Medium of the 3PID to be removed. /// Medium of the 3PID to be removed.
medium: Medium, pub medium: Medium,
/// Third-party address being removed. /// Third-party address being removed.
address: String, pub address: String,
} }
response { response {
/// Result of unbind operation. /// Result of unbind operation.
id_server_unbind_result: ThirdPartyIdRemovalStatus, pub id_server_unbind_result: ThirdPartyIdRemovalStatus,
} }
} }

View File

@ -21,15 +21,15 @@ ruma_api! {
request { request {
/// Type of event being sent to each device. /// Type of event being sent to each device.
#[ruma_api(path)] #[ruma_api(path)]
event_type: String, pub event_type: String,
/// A request identifier unique to the access token used to send the request. /// A request identifier unique to the access token used to send the request.
#[ruma_api(path)] #[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 /// 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 /// device. Individual message events can be sent to devices, but all
/// events must be of the same type. /// events must be of the same type.
#[wrap_incoming(all::Event with EventResult)] #[wrap_incoming(all::Event with EventResult)]
messages: HashMap<UserId, HashMap<DeviceIdOrAllDevices, all::Event>> pub messages: HashMap<UserId, HashMap<DeviceIdOrAllDevices, all::Event>>
} }
response {} response {}

View File

@ -17,16 +17,16 @@ ruma_api! {
request { request {
/// User ID of user for whom to retrieve data. /// User ID of user for whom to retrieve data.
#[ruma_api(path)] #[ruma_api(path)]
user_id: UserId, pub user_id: UserId,
/// Type of data to retrieve. /// Type of data to retrieve.
#[ruma_api(path)] #[ruma_api(path)]
event_type: String, pub event_type: String,
} }
response { response {
/// Account data content for the given type. /// Account data content for the given type.
#[ruma_api(body)] #[ruma_api(body)]
#[wrap_incoming(with EventResult)] #[wrap_incoming(with EventResult)]
account_data: only::Event, pub account_data: only::Event,
} }
} }

View File

@ -17,19 +17,19 @@ ruma_api! {
request { request {
/// User ID of user for whom to retrieve data. /// User ID of user for whom to retrieve data.
#[ruma_api(path)] #[ruma_api(path)]
user_id: UserId, pub user_id: UserId,
/// Room ID for which to retrieve data. /// Room ID for which to retrieve data.
#[ruma_api(path)] #[ruma_api(path)]
room_id: RoomId, pub room_id: RoomId,
/// Type of data to retrieve. /// Type of data to retrieve.
#[ruma_api(path)] #[ruma_api(path)]
event_type: String, pub event_type: String,
} }
response { response {
/// Account data content for the given type. /// Account data content for the given type.
#[ruma_api(body)] #[ruma_api(body)]
#[wrap_incoming(with EventResult)] #[wrap_incoming(with EventResult)]
account_data: only::Event, pub account_data: only::Event,
} }
} }

View File

@ -15,10 +15,12 @@ ruma_api! {
} }
request { request {
/// The device to delete.
#[ruma_api(path)] #[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")] #[serde(skip_serializing_if = "Option::is_none")]
auth: Option<AuthenticationData>, pub auth: Option<AuthenticationData>,
} }
response {} response {}

View File

@ -16,11 +16,11 @@ ruma_api! {
request { request {
/// List of devices to delete. /// List of devices to delete.
devices: Vec<DeviceId>, pub devices: Vec<DeviceId>,
/// Additional authentication information for the user-interactive authentication API. /// Additional authentication information for the user-interactive authentication API.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
auth: Option<AuthenticationData>, pub auth: Option<AuthenticationData>,
} }
response {} response {}

View File

@ -15,12 +15,14 @@ ruma_api! {
} }
request { request {
/// The device to retrieve.
#[ruma_api(path)] #[ruma_api(path)]
device_id: DeviceId, pub device_id: DeviceId,
} }
response { response {
/// Information about the device.
#[ruma_api(body)] #[ruma_api(body)]
device: Device, pub device: Device,
} }
} }

View File

@ -14,10 +14,13 @@ ruma_api! {
} }
request { request {
/// The device to update.
#[ruma_api(path)] #[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")] #[serde(skip_serializing_if = "Option::is_none")]
display_name: Option<String>, pub display_name: Option<String>,
} }
response {} response {}

View File

@ -19,17 +19,17 @@ ruma_api! {
/// Limit for the number of results to return. /// Limit for the number of results to return.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
#[ruma_api(query)] #[ruma_api(query)]
limit: Option<UInt>, pub limit: Option<UInt>,
/// Pagination token from a previous request. /// Pagination token from a previous request.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
#[ruma_api(query)] #[ruma_api(query)]
since: Option<String>, pub since: Option<String>,
/// The server to fetch the public room lists from. /// The server to fetch the public room lists from.
/// ///
/// `None` means the server this request is sent to. /// `None` means the server this request is sent to.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
#[ruma_api(query)] #[ruma_api(query)]
server: Option<String>, pub server: Option<String>,
} }
response { response {

View File

@ -22,16 +22,16 @@ ruma_api! {
/// `None` means the server this request is sent to. /// `None` means the server this request is sent to.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
#[ruma_api(query)] #[ruma_api(query)]
server: Option<String>, pub server: Option<String>,
/// Limit for the number of results to return. /// Limit for the number of results to return.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
limit: Option<UInt>, pub limit: Option<UInt>,
/// Pagination token from a previous request. /// Pagination token from a previous request.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
since: Option<String>, pub since: Option<String>,
/// Filter to apply to the results. /// Filter to apply to the results.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
filter: Option<Filter>, pub filter: Option<Filter>,
} }
response { response {
@ -51,5 +51,5 @@ ruma_api! {
pub struct Filter { pub struct Filter {
/// A string to search for in the room metadata, e.g. name, topic, canonical alias etc. /// A string to search for in the room metadata, e.g. name, topic, canonical alias etc.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
generic_search_term: Option<String>, pub generic_search_term: Option<String>,
} }

View File

@ -129,7 +129,7 @@ pub struct DeviceKeys {
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UnsignedDeviceInfo { pub struct UnsignedDeviceInfo {
/// The display name which the user set on the device. /// 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 /// A key for the SignedCurve25519 algorithm

View File

@ -18,6 +18,6 @@ ruma_api! {
response { response {
/// Maximum size of upload in bytes. /// Maximum size of upload in bytes.
#[serde(rename = "m.upload.size")] #[serde(rename = "m.upload.size")]
upload_size: UInt, pub upload_size: UInt,
} }
} }

View File

@ -17,10 +17,10 @@ ruma_api! {
request { request {
/// URL to get a preview of. /// URL to get a preview of.
#[ruma_api(query)] #[ruma_api(query)]
url: String, pub url: String,
/// Preferred point in time (in milliseconds) to return a preview for. /// Preferred point in time (in milliseconds) to return a preview for.
#[ruma_api(query)] #[ruma_api(query)]
ts: UInt, pub ts: UInt,
} }
response { response {
@ -29,6 +29,6 @@ ruma_api! {
/// Differences from OpenGraph: the image size in bytes is added to the `matrix:image:size` /// 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. /// field, and `og:image` returns the MXC URI to the image, if any.
#[ruma_api(body)] #[ruma_api(body)]
data: Option<Value>, pub data: Option<Value>,
} }
} }

View File

@ -47,7 +47,7 @@ ruma_api! {
/// Power level content to override in the default power level event. /// Power level content to override in the default power level event.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
#[wrap_incoming(PowerLevelsEventContent with EventResult)] #[wrap_incoming(PowerLevelsEventContent with EventResult)]
power_level_content_override: Option<PowerLevelsEventContent>, pub power_level_content_override: Option<PowerLevelsEventContent>,
/// Convenience parameter for setting various default state events based on a preset. /// Convenience parameter for setting various default state events based on a preset.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub preset: Option<RoomPreset>, pub preset: Option<RoomPreset>,
@ -100,13 +100,13 @@ pub enum RoomPreset {
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Invite3pid { pub struct Invite3pid {
/// Hostname and port of identity server to be used for account lookups. /// 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. /// An access token registered with the identity server.
id_access_token: String, pub id_access_token: String,
/// Type of third party ID. /// Type of third party ID.
medium: Medium, pub medium: Medium,
/// Third party identifier. /// Third party identifier.
address: String, pub address: String,
} }
/// Represents content of a state event to be used to initalize new room state. /// Represents content of a state event to be used to initalize new room state.
@ -114,9 +114,9 @@ pub struct Invite3pid {
pub struct InitialStateEvent { pub struct InitialStateEvent {
/// State event type. /// State event type.
#[serde(rename = "type")] #[serde(rename = "type")]
event_type: String, pub event_type: String,
/// `state_key` of the event to be sent. /// `state_key` of the event to be sent.
state_key: Option<String>, pub state_key: Option<String>,
/// JSON content of the state event. /// JSON content of the state event.
content: Value, pub content: Value,
} }

View File

@ -17,14 +17,14 @@ ruma_api! {
request { request {
/// Room in which the event to be reported is located. /// Room in which the event to be reported is located.
#[ruma_api(path)] #[ruma_api(path)]
room_id: RoomId, pub room_id: RoomId,
/// Event to report. /// Event to report.
#[ruma_api(path)] #[ruma_api(path)]
event_id: EventId, pub event_id: EventId,
/// Integer between -100 and 0 rating offensivness. /// Integer between -100 and 0 rating offensivness.
score: Int, pub score: Int,
/// Reason to report content. May be blank. /// Reason to report content. May be blank.
reason: String, pub reason: String,
} }
response {} response {}

View File

@ -16,13 +16,13 @@ ruma_api! {
request { request {
/// ID of the room to be upgraded. /// ID of the room to be upgraded.
#[ruma_api(path)] #[ruma_api(path)]
room_id: RoomId, pub room_id: RoomId,
/// New version for the room. /// New version for the room.
new_version: String, pub new_version: String,
} }
response { response {
/// ID of the new room. /// ID of the new room.
replacement_room: RoomId, pub replacement_room: RoomId,
} }
} }

View File

@ -99,24 +99,26 @@ pub enum LoginInfo {
/// Client configuration provided by the server. /// Client configuration provided by the server.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DiscoveryInfo { pub struct DiscoveryInfo {
/// Information about the homeserver to connect to.
#[serde(rename = "m.homeserver")] #[serde(rename = "m.homeserver")]
homeserver: HomeserverInfo, pub homeserver: HomeserverInfo,
/// Information about the identity server to connect to.
#[serde(rename = "m.identity_server")] #[serde(rename = "m.identity_server")]
identity_server: Option<IdentityServerInfo>, pub identity_server: Option<IdentityServerInfo>,
} }
/// Information about the homeserver to connect to. /// Information about the homeserver to connect to.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HomeserverInfo { pub struct HomeserverInfo {
/// The base URL for the homeserver for client-server connections. /// 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. /// Information about the identity server to connect to.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IdentityServerInfo { pub struct IdentityServerInfo {
/// The base URL for the identity server for client-server connections. /// The base URL for the identity server for client-server connections.
base_url: String, pub base_url: String,
} }
mod user_serde; mod user_serde;

View File

@ -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 // 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. // that one is arguably much easier to deal with.
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub struct UserInfo<'a> { pub(crate) struct UserInfo<'a> {
#[serde(borrow)] #[serde(borrow)]
identifier: UserIdentifier<'a>, pub identifier: UserIdentifier<'a>,
} }
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(tag = "type")] #[serde(tag = "type")]
pub enum UserIdentifier<'a> { pub(crate) enum UserIdentifier<'a> {
#[serde(rename = "m.id.user")] #[serde(rename = "m.id.user")]
MatrixId { user: &'a str }, MatrixId { user: &'a str },
#[serde(rename = "m.id.thirdparty")] #[serde(rename = "m.id.thirdparty")]