Change requires_authentication: bool to authentication: AuthScheme

This commit is contained in:
Vincent Lee 2020-09-18 09:28:51 -05:00 committed by GitHub
parent 906e50f9a8
commit d36d005b97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
178 changed files with 224 additions and 208 deletions

View File

@ -20,7 +20,7 @@ pub mod some_endpoint {
name: "some_endpoint",
path: "/_matrix/some/endpoint/:baz", // Variable path components start with a colon.
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -96,7 +96,7 @@ impl ToTokens for Api {
let name = &self.metadata.name.value();
let path = &self.metadata.path;
let rate_limited = &self.metadata.rate_limited;
let requires_authentication = &self.metadata.requires_authentication;
let authentication = &self.metadata.authentication;
let request_type = &self.request;
let response_type = &self.response;
@ -134,7 +134,7 @@ impl ToTokens for Api {
};
let mut header_kvs = self.request.append_header_kvs();
if requires_authentication.value {
if authentication == "AccessToken" {
header_kvs.extend(quote! {
req_builder = req_builder.header(
#ruma_api_import::exports::http::header::AUTHORIZATION,
@ -230,7 +230,7 @@ impl ToTokens for Api {
let request_lifetimes = self.request.combine_lifetimes();
let non_auth_endpoint_impls = if requires_authentication.value {
let non_auth_endpoint_impls = if authentication != "None" {
TokenStream::new()
} else {
quote! {
@ -321,7 +321,7 @@ impl ToTokens for Api {
name: #name,
path: #path,
rate_limited: #rate_limited,
requires_authentication: #requires_authentication,
authentication: #ruma_api_import::AuthScheme::#authentication,
};
impl #request_lifetimes #ruma_api_import::OutgoingRequest

View File

@ -18,8 +18,8 @@ pub struct Metadata {
pub path: LitStr,
/// The rate_limited field.
pub rate_limited: LitBool,
/// The description field.
pub requires_authentication: LitBool,
/// The authentication field.
pub authentication: Ident,
}
impl TryFrom<RawMetadata> for Metadata {
@ -31,7 +31,7 @@ impl TryFrom<RawMetadata> for Metadata {
let mut name = None;
let mut path = None;
let mut rate_limited = None;
let mut requires_authentication = None;
let mut authentication = None;
for field_value in raw.field_values {
let identifier = match field_value.member.clone() {
@ -78,11 +78,11 @@ impl TryFrom<RawMetadata> for Metadata {
}
_ => return Err(syn::Error::new_spanned(expr, "expected a bool literal")),
},
"requires_authentication" => match expr {
Expr::Lit(ExprLit { lit: Lit::Bool(literal), .. }) => {
requires_authentication = Some(literal);
"authentication" => match expr {
Expr::Path(ExprPath { ref path, .. }) if path.segments.len() == 1 => {
authentication = Some(path.segments[0].ident.clone());
}
_ => return Err(syn::Error::new_spanned(expr, "expected a bool literal")),
_ => return Err(syn::Error::new_spanned(expr, "expected an identifier")),
},
_ => return Err(syn::Error::new_spanned(field_value, "unexpected field")),
}
@ -98,8 +98,7 @@ impl TryFrom<RawMetadata> for Metadata {
name: name.ok_or_else(|| missing_field("name"))?,
path: path.ok_or_else(|| missing_field("path"))?,
rate_limited: rate_limited.ok_or_else(|| missing_field("rate_limited"))?,
requires_authentication: requires_authentication
.ok_or_else(|| missing_field("requires_authentication"))?,
authentication: authentication.ok_or_else(|| missing_field("authentication"))?,
})
}
}

View File

@ -8,6 +8,9 @@ Breaking changes:
* The `Endpoint` trait has been replaced by two new traits that each capture a subset of its
previous functionality: `OutgoingRequest` for sending requests and receiving responses and
`IncomingRequest` for receiving requests and sending responses.
* Endpoint authentication is now more granularly defined by an enum `AuthScheme`
instead of a boolean. The `ruma_api!` macro has been updated to require
`authentication` instead of `requires_authentication`.
Improvements:

View File

@ -30,7 +30,7 @@ use http::Method;
/// name: &'static str,
/// path: &'static str,
/// rate_limited: bool,
/// requires_authentication: bool,
/// authentication: ruma_api::AuthScheme,
/// }
///
/// request: {
@ -69,7 +69,7 @@ use http::Method;
/// A corresponding query string parameter will be expected in the request struct (see below
/// for details).
/// * `rate_limited`: Whether or not the endpoint enforces rate limiting on requests.
/// * `requires_authentication`: Whether or not the endpoint requires a valid access token.
/// * `authentication`: What authentication scheme the endpoint uses.
///
/// ## Request
///
@ -139,7 +139,7 @@ use http::Method;
/// name: "some_endpoint",
/// path: "/_matrix/some/endpoint/:baz",
/// rate_limited: false,
/// requires_authentication: false,
/// authentication: None,
/// }
///
/// request: {
@ -180,7 +180,7 @@ use http::Method;
/// name: "newtype_body_endpoint",
/// path: "/_matrix/some/newtype/body/endpoint",
/// rate_limited: false,
/// requires_authentication: false,
/// authentication: None,
/// }
///
/// request: {
@ -290,6 +290,20 @@ pub trait OutgoingNonAuthRequest: OutgoingRequest {}
/// Marker trait for requests that don't require authentication. (for the server side)
pub trait IncomingNonAuthRequest: IncomingRequest {}
/// Authentication scheme used by the endpoint.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum AuthScheme {
/// No authentication is performed.
None,
/// Authentication is performed by including an access token in the request headers.
AccessToken,
/// Authentication is performed by including X-Matrix signatures in the request headers,
/// as defined in the federation API.
ServerSignatures,
/// Authentication is performed by including an access token in the query parameters.
QueryOnlyAccessToken,
}
/// Metadata about an API endpoint.
#[derive(Clone, Debug)]
pub struct Metadata {
@ -309,8 +323,8 @@ pub struct Metadata {
/// Whether or not this endpoint is rate limited by the server.
pub rate_limited: bool,
/// Whether or not the server requires an authenticated user for this endpoint.
pub requires_authentication: bool,
/// What authentication scheme the server uses for this endpoint.
pub authentication: AuthScheme,
}
#[doc(hidden)]

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "my_endpoint",
path: "/_matrix/foo/:bar/:baz",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -11,7 +11,7 @@ use ruma_api::{
FromHttpRequestError, FromHttpResponseError, IntoHttpError, RequestDeserializationError,
ResponseDeserializationError, ServerError, Void,
},
IncomingRequest, Metadata, Outgoing, OutgoingRequest,
AuthScheme, IncomingRequest, Metadata, Outgoing, OutgoingRequest,
};
/// A request to create a new room alias.
@ -31,7 +31,7 @@ const METADATA: Metadata = Metadata {
name: "create_alias",
path: "/_matrix/client/r0/directory/room/:room_alias",
rate_limited: false,
requires_authentication: false,
authentication: AuthScheme::None,
};
impl OutgoingRequest for Request {

View File

@ -9,7 +9,7 @@ ruma_api! {
name: "no_fields",
path: "/_matrix/my/endpoint",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {}

View File

@ -7,7 +7,7 @@ ruma_api! {
name: "no_fields",
path: "/_matrix/my/endpoint",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -16,7 +16,7 @@ mod empty_response {
name: "create_alias",
path: "/_matrix/client/r0/directory/room/:room_alias",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {
@ -43,7 +43,7 @@ mod nested_types {
name: "create_alias",
path: "/_matrix/client/r0/directory/room/:room_alias",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {
@ -70,7 +70,7 @@ mod full_request_response {
name: "no_fields",
path: "/_matrix/my/endpoint/:thing",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {
@ -102,7 +102,7 @@ mod full_request_response_with_query_map {
name: "no_fields",
path: "/_matrix/my/endpoint/:thing",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {
@ -134,7 +134,7 @@ mod query_fields {
name: "get_public_rooms",
path: "/_matrix/client/r0/publicRooms",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -10,7 +10,7 @@ pub mod some_endpoint {
name: "some_endpoint",
path: "/_matrix/some/endpoint/:baz",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {
@ -67,7 +67,7 @@ pub mod newtype_body_endpoint {
name: "newtype_body_endpoint",
path: "/_matrix/some/newtype/body/endpoint",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {
@ -97,7 +97,7 @@ pub mod newtype_raw_body_endpoint {
name: "newtype_body_endpoint",
path: "/_matrix/some/newtype/body/endpoint",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {
@ -122,7 +122,7 @@ pub mod query_map_endpoint {
name: "newtype_body_endpoint",
path: "/_matrix/some/query/map/endpoint",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -9,7 +9,7 @@ ruma_api! {
name: "some_endpoint",
path: "/_matrix/some/endpoint/:baz",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -7,7 +7,7 @@ ruma_api! {
name: "invalid_path",
path: "µ/°/§/€",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {
@ -25,7 +25,7 @@ ruma_api! {
name: "invalid_path",
path: "path/to/invalid space/endpoint",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -15,7 +15,7 @@ mod newtype_body {
name: "my_endpoint",
path: "/_matrix/foo/:bar/",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {
@ -53,7 +53,7 @@ mod newtype_raw_body {
name: "my_endpoint",
path: "/_matrix/foo/:bar/",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {
@ -94,7 +94,7 @@ mod plain {
name: "my_endpoint",
path: "/_matrix/foo/:bar/",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -7,7 +7,7 @@ ruma_api! {
name: "some_endpoint",
path: "/_matrix/some/endpoint/:baz",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
#[not_a_real_attribute_should_fail]

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "push_events",
path: "/_matrix/app/v1/transactions/:txn_id",
rate_limited: false,
requires_authentication: true,
authentication: QueryOnlyAccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "query_room_alias",
path: "/_matrix/app/v1/rooms/:room_alias",
rate_limited: false,
requires_authentication: true,
authentication: QueryOnlyAccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "query_user_id",
path: "/_matrix/app/v1/users/:user_id",
rate_limited: false,
requires_authentication: true,
authentication: QueryOnlyAccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "get_location_for_protocol",
path: "/_matrix/app/v1/thirdparty/location/:protocol",
rate_limited: false,
requires_authentication: true,
authentication: QueryOnlyAccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "get_location_for_room_alias",
path: "/_matrix/app/v1/thirdparty/location",
rate_limited: false,
requires_authentication: true,
authentication: QueryOnlyAccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "get_protocol",
path: "/_matrix/app/v1/thirdparty/protocol/:protocol",
rate_limited: false,
requires_authentication: true,
authentication: QueryOnlyAccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "get_user_for_protocol",
path: "/_matrix/app/v1/thirdparty/user/:protocol",
rate_limited: false,
requires_authentication: true,
authentication: QueryOnlyAccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "get_user_for_user_id",
path: "/_matrix/app/v1/thirdparty/user",
rate_limited: false,
requires_authentication: true,
authentication: QueryOnlyAccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "add_3pid",
path: "/_matrix/client/r0/account/3pid/add",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "bind_3pid",
path: "/_matrix/client/r0/account/3pid/bind",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "change_password",
path: "/_matrix/client/r0/account/password",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -13,7 +13,7 @@ ruma_api! {
name: "deactivate",
path: "/_matrix/client/r0/account/deactivate",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
#[derive(Default)]

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "delete_3pid",
path: "/_matrix/client/r0/account/3pid/delete",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -9,7 +9,7 @@ ruma_api! {
name: "get_username_availability",
path: "/_matrix/client/r0/register/available",
rate_limited: true,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -13,7 +13,7 @@ ruma_api! {
name: "register",
path: "/_matrix/client/r0/register",
rate_limited: true,
requires_authentication: false,
authentication: None,
}
#[derive(Default)]

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "request_3pid_association_token_via_email",
path: "/_matrix/client/r0/account/3pid/email/requestToken",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "request_3pid_association_token_via_msisdn",
path: "/_matrix/client/r0/account/3pid/msisdn/requestToken",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -13,7 +13,7 @@ ruma_api! {
method: POST,
path: "/_matrix/client/r0/user/:user_id/openid/request_token",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "request_password_change_token_via_email",
path: "/_matrix/client/r0/account/password/email/requestToken",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "request_password_change_token_via_msisdn",
path: "/_matrix/client/r0/account/password/msisdn/requestToken",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "request_registration_token_via_email",
path: "/_matrix/client/r0/register/email/requestToken",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "request_registration_token_via_msisdn",
path: "/_matrix/client/r0/register/msisdn/requestToken",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "unbind_3pid",
path: "/_matrix/client/r0/account/3pid/unbind",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "whoami",
path: "/_matrix/client/r0/account/whoami",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
#[derive(Default)]

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "create_alias",
path: "/_matrix/client/r0/directory/room/:room_alias",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "delete_alias",
path: "/_matrix/client/r0/directory/room/:room_alias",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "get_alias",
path: "/_matrix/client/r0/directory/room/:room_alias",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "set_room_visibility",
path: "/_matrix/client/r0/directory/list/appservice/:network_id/:room_id",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "add_backup_keys",
path: "/_matrix/client/r0/room_keys/keys",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "create_backup",
path: "/_matrix/client/r0/room_keys/version",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "get_backup",
path: "/_matrix/client/r0/room_keys/version/:version",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "get_backup_keys",
path: "/_matrix/client/r0/room_keys/keys",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "get_latest_backup",
path: "/_matrix/client/r0/room_keys/version",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
#[derive(Default)]

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "update_backup",
path: "/_matrix/client/r0/room_keys/version/:version",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -13,7 +13,7 @@ ruma_api! {
name: "get_capabilities",
path: "/_matrix/client/r0/capabilities",
rate_limited: true,
requires_authentication: true
authentication: AccessToken
}
#[derive(Default)]

View File

@ -12,7 +12,7 @@ ruma_api! {
method: GET,
path: "/_matrix/client/r0/user/:user_id/account_data/:event_type",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
method: GET,
path: "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "set_global_account_data",
path: "/_matrix/client/r0/user/:user_id/account_data/:event_type",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "set_room_account_data",
path: "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -13,7 +13,7 @@ ruma_api! {
name: "get_contacts",
path: "/_matrix/client/r0/account/3pid",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
#[derive(Default)]

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "request_contact_verification_token",
path: "/_matrix/client/r0/account/3pid/email/requestToken",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -15,7 +15,7 @@ ruma_api! {
path: "/_matrix/client/r0/rooms/:room_id/context/:event_id",
name: "get_context",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "delete_device",
path: "/_matrix/client/r0/devices/:device_id",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
path: "/_matrix/client/r0/delete_devices",
name: "delete_devices",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "get_device",
path: "/_matrix/client/r0/devices/:device_id",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "get_devices",
path: "/_matrix/client/r0/devices",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
#[derive(Default)]

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "update_device",
path: "/_matrix/client/r0/devices/:device_id",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "get_public_rooms",
path: "/_matrix/client/r0/publicRooms",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
#[derive(Default)]

View File

@ -13,7 +13,7 @@ ruma_api! {
name: "get_public_rooms_filtered",
path: "/_matrix/client/r0/publicRooms",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
#[derive(Default)]

View File

@ -12,7 +12,7 @@ ruma_api! {
method: GET,
path: "/_matrix/client/r0/directory/list/room/:room_id",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
method: PUT,
path: "/_matrix/client/r0/directory/list/room/:room_id",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "create_filter",
path: "/_matrix/client/r0/user/:user_id/filter",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "get_filter",
path: "/_matrix/client/r0/user/:user_id/filter/:filter_id",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -17,7 +17,7 @@ ruma_api! {
name: "claim_keys",
path: "/_matrix/client/r0/keys/claim",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "get_key_changes",
path: "/_matrix/client/r0/keys/changes",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -17,7 +17,7 @@ ruma_api! {
name: "get_keys",
path: "/_matrix/client/r0/keys/query",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
#[derive(Default)]

View File

@ -16,7 +16,7 @@ ruma_api! {
name: "upload_keys",
path: "/_matrix/client/r0/keys/upload",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
#[derive(Default)]

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "upload_signatures",
path: "/_matrix/client/r0/keys/signatures/upload",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "upload_signing_keys",
path: "/_matrix/client/r0/keys/device_signing/upload",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
#[derive(Default)]

View File

@ -9,7 +9,7 @@ ruma_api! {
name: "create_media_content",
path: "/_matrix/media/r0/upload",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "get_media_content",
path: "/_matrix/media/r0/download/:server_name/:media_id",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "get_media_content_as_filename",
path: "/_matrix/media/r0/download/:server_name/:media_id/:filename",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -23,7 +23,7 @@ ruma_api! {
name: "get_content_thumbnail",
path: "/_matrix/media/r0/thumbnail/:server_name/:media_id",
rate_limited: true,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
path: "/_matrix/media/r0/config",
name: "get_media_config",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
#[derive(Default)]

View File

@ -13,7 +13,7 @@ ruma_api! {
method: GET,
path: "/_matrix/media/r0/preview_url",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "ban_user",
path: "/_matrix/client/r0/rooms/:room_id/ban",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "forget_room",
path: "/_matrix/client/r0/rooms/:room_id/forget",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -13,7 +13,7 @@ ruma_api! {
name: "get_member_events",
path: "/_matrix/client/r0/rooms/:room_id/members",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -20,7 +20,7 @@ ruma_api! {
name: "invite_user",
path: "/_matrix/client/r0/rooms/:room_id/invite",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "join_room_by_id",
path: "/_matrix/client/r0/rooms/:room_id/join",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -12,7 +12,7 @@ ruma_api! {
name: "join_room_by_id_or_alias",
path: "/_matrix/client/r0/join/:room_id_or_alias",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -13,7 +13,7 @@ ruma_api! {
name: "joined_members",
path: "/_matrix/client/r0/rooms/:room_id/joined_members",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "joined_rooms",
path: "/_matrix/client/r0/joined_rooms",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
#[derive(Default)]

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "kick_user",
path: "/_matrix/client/r0/rooms/:room_id/kick",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "leave_room",
path: "/_matrix/client/r0/rooms/:room_id/leave",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "unban_user",
path: "/_matrix/client/r0/rooms/:room_id/unban",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -16,7 +16,7 @@ ruma_api! {
name: "get_message_events",
path: "/_matrix/client/r0/rooms/:room_id/messages",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -7,7 +7,7 @@ use ruma_api::{
FromHttpRequestError, FromHttpResponseError, IntoHttpError, RequestDeserializationError,
ResponseDeserializationError, ServerError,
},
EndpointError, Metadata, Outgoing,
AuthScheme, EndpointError, Metadata, Outgoing,
};
use ruma_events::{AnyMessageEventContent, EventContent as _};
use ruma_identifiers::{EventId, RoomId};
@ -64,7 +64,7 @@ const METADATA: Metadata = Metadata {
name: "send_message_event",
path: "/_matrix/client/r0/rooms/:room_id/send/:event_type/:txn_id",
rate_limited: false,
requires_authentication: true,
authentication: AuthScheme::AccessToken,
};
impl TryFrom<http::Request<Vec<u8>>> for IncomingRequest {

View File

@ -13,7 +13,7 @@ ruma_api! {
name: "get_presence",
path: "/_matrix/client/r0/presence/:user_id/status",
rate_limited: false,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -11,7 +11,7 @@ ruma_api! {
name: "set_presence",
path: "/_matrix/client/r0/presence/:user_id/status",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "get_avatar_url",
path: "/_matrix/client/r0/profile/:user_id/avatar_url",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "get_display_name",
path: "/_matrix/client/r0/profile/:user_id/displayname",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "get_profile",
path: "/_matrix/client/r0/profile/:user_id",
rate_limited: false,
requires_authentication: false,
authentication: None,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "set_avatar_url",
path: "/_matrix/client/r0/profile/:user_id/avatar_url",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

View File

@ -10,7 +10,7 @@ ruma_api! {
name: "set_display_name",
path: "/_matrix/client/r0/profile/:user_id/displayname",
rate_limited: true,
requires_authentication: true,
authentication: AccessToken,
}
request: {

Some files were not shown because too many files have changed in this diff Show More