api: Remove support for path metadata field
This commit is contained in:
parent
ea8d8fa981
commit
aed0988694
@ -74,7 +74,6 @@ impl Api {
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
let path = util::map_option_literal(&metadata.path);
|
||||
let added = util::map_option_literal(&metadata.added);
|
||||
let deprecated = util::map_option_literal(&metadata.deprecated);
|
||||
let removed = util::map_option_literal(&metadata.removed);
|
||||
@ -94,7 +93,6 @@ impl Api {
|
||||
description: #description,
|
||||
method: #http::Method::#method,
|
||||
name: #name,
|
||||
path: #path,
|
||||
unstable_path: #unstable_path,
|
||||
r0_path: #r0_path,
|
||||
stable_path: #stable_path,
|
||||
|
@ -14,7 +14,6 @@ mod kw {
|
||||
syn::custom_keyword!(description);
|
||||
syn::custom_keyword!(method);
|
||||
syn::custom_keyword!(name);
|
||||
syn::custom_keyword!(path);
|
||||
syn::custom_keyword!(unstable_path);
|
||||
syn::custom_keyword!(r0_path);
|
||||
syn::custom_keyword!(stable_path);
|
||||
@ -45,9 +44,6 @@ pub struct Metadata {
|
||||
/// The name field.
|
||||
pub name: LitStr,
|
||||
|
||||
/// The path field. (deprecated)
|
||||
pub path: Option<EndpointPath>,
|
||||
|
||||
/// The unstable path field.
|
||||
pub unstable_path: Option<EndpointPath>,
|
||||
|
||||
@ -101,7 +97,6 @@ impl Parse for Metadata {
|
||||
let mut description = None;
|
||||
let mut method = None;
|
||||
let mut name = None;
|
||||
let mut path = None;
|
||||
let mut unstable_path = None;
|
||||
let mut r0_path = None;
|
||||
let mut stable_path = None;
|
||||
@ -116,7 +111,6 @@ impl Parse for Metadata {
|
||||
FieldValue::Description(d) => set_field(&mut description, d)?,
|
||||
FieldValue::Method(m) => set_field(&mut method, m)?,
|
||||
FieldValue::Name(n) => set_field(&mut name, n)?,
|
||||
FieldValue::Path(p) => set_field(&mut path, p)?,
|
||||
FieldValue::UnstablePath(p) => set_field(&mut unstable_path, p)?,
|
||||
FieldValue::R0Path(p) => set_field(&mut r0_path, p)?,
|
||||
FieldValue::StablePath(p) => set_field(&mut stable_path, p)?,
|
||||
@ -135,6 +129,17 @@ impl Parse for Metadata {
|
||||
let missing_field =
|
||||
|name| syn::Error::new_spanned(metadata_kw, format!("missing field `{}`", name));
|
||||
|
||||
let stable_or_r0 = stable_path.as_ref().or(r0_path.as_ref());
|
||||
|
||||
if let Some(path) = stable_or_r0 {
|
||||
if added.is_none() {
|
||||
return Err(syn::Error::new_spanned(
|
||||
path,
|
||||
"stable path was defined, while `added` version was not defined",
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(deprecated) = &deprecated {
|
||||
if added.is_none() {
|
||||
return Err(syn::Error::new_spanned(
|
||||
@ -160,26 +165,53 @@ impl Parse for Metadata {
|
||||
}
|
||||
|
||||
if let Some(added) = &added {
|
||||
if stable_path.is_none() {
|
||||
if stable_or_r0.is_none() {
|
||||
return Err(syn::Error::new_spanned(
|
||||
added,
|
||||
"added version is defined, but no stable path exists",
|
||||
"added version is defined, but no stable or r0 path exists",
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(r0) = &r0_path {
|
||||
let added = added.as_ref().expect("we error if r0 or stable is defined without added");
|
||||
|
||||
if added.major.get() == 1 && added.minor > 0 {
|
||||
return Err(syn::Error::new_spanned(
|
||||
r0,
|
||||
"r0 defined while added version is newer than v1.0",
|
||||
));
|
||||
}
|
||||
|
||||
if stable_path.is_none() {
|
||||
return Err(syn::Error::new_spanned(r0, "r0 defined without stable path"));
|
||||
}
|
||||
|
||||
if !r0.value().contains("/r0/") {
|
||||
return Err(syn::Error::new_spanned(r0, "r0 endpoint does not contain /r0/"));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(stable) = &stable_path {
|
||||
if stable.value().contains("/r0/") {
|
||||
return Err(syn::Error::new_spanned(
|
||||
stable,
|
||||
"stable endpoint contains /r0/ (did you make a copy-paste error?)",
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if unstable_path.is_none() && r0_path.is_none() && stable_path.is_none() {
|
||||
// TODO replace with error
|
||||
// return Err(syn::Error::new_spanned(metadata_kw, "no path is defined"));
|
||||
r0_path = path.clone();
|
||||
unstable_path = path.clone();
|
||||
return Err(syn::Error::new_spanned(
|
||||
metadata_kw,
|
||||
"need to define one of [r0_path, stable_path, unstable_path]",
|
||||
));
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
description: description.ok_or_else(|| missing_field("description"))?,
|
||||
method: method.ok_or_else(|| missing_field("method"))?,
|
||||
name: name.ok_or_else(|| missing_field("name"))?,
|
||||
path,
|
||||
unstable_path,
|
||||
r0_path,
|
||||
stable_path,
|
||||
@ -204,7 +236,6 @@ enum Field {
|
||||
Description,
|
||||
Method,
|
||||
Name,
|
||||
Path,
|
||||
UnstablePath,
|
||||
R0Path,
|
||||
StablePath,
|
||||
@ -228,9 +259,6 @@ impl Parse for Field {
|
||||
} else if lookahead.peek(kw::name) {
|
||||
let _: kw::name = input.parse()?;
|
||||
Ok(Self::Name)
|
||||
} else if lookahead.peek(kw::path) {
|
||||
let _: kw::path = input.parse()?;
|
||||
Ok(Self::Path)
|
||||
} else if lookahead.peek(kw::unstable_path) {
|
||||
let _: kw::unstable_path = input.parse()?;
|
||||
Ok(Self::UnstablePath)
|
||||
@ -265,7 +293,6 @@ enum FieldValue {
|
||||
Description(LitStr),
|
||||
Method(Ident),
|
||||
Name(LitStr),
|
||||
Path(EndpointPath),
|
||||
UnstablePath(EndpointPath),
|
||||
R0Path(EndpointPath),
|
||||
StablePath(EndpointPath),
|
||||
@ -294,7 +321,6 @@ impl Parse for FieldValue {
|
||||
Field::Description => Self::Description(input.parse()?),
|
||||
Field::Method => Self::Method(input.parse()?),
|
||||
Field::Name => Self::Name(input.parse()?),
|
||||
Field::Path => Self::Path(input.parse()?),
|
||||
Field::UnstablePath => Self::UnstablePath(input.parse()?),
|
||||
Field::R0Path => Self::R0Path(input.parse()?),
|
||||
Field::StablePath => Self::StablePath(input.parse()?),
|
||||
@ -310,6 +336,12 @@ impl Parse for FieldValue {
|
||||
#[derive(Clone)]
|
||||
pub struct EndpointPath(LitStr);
|
||||
|
||||
impl EndpointPath {
|
||||
pub fn value(&self) -> String {
|
||||
self.0.value()
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for EndpointPath {
|
||||
fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
|
||||
let path: LitStr = input.parse()?;
|
||||
|
@ -6,8 +6,8 @@ use syn::{parse::Parse, Error, LitFloat};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct MatrixVersionLiteral {
|
||||
major: NonZeroU8,
|
||||
minor: u8,
|
||||
pub(crate) major: NonZeroU8,
|
||||
pub(crate) minor: u8,
|
||||
}
|
||||
|
||||
impl Parse for MatrixVersionLiteral {
|
||||
|
@ -135,9 +135,10 @@ use ruma_identifiers::UserId;
|
||||
/// description: "Does something.",
|
||||
/// method: POST,
|
||||
/// name: "some_endpoint",
|
||||
/// path: "/_matrix/some/endpoint/:baz",
|
||||
/// stable_path: "/_matrix/some/endpoint/:baz",
|
||||
/// rate_limited: false,
|
||||
/// authentication: None,
|
||||
/// added: 1.1,
|
||||
/// }
|
||||
///
|
||||
/// request: {
|
||||
@ -176,9 +177,10 @@ use ruma_identifiers::UserId;
|
||||
/// description: "Does something.",
|
||||
/// method: PUT,
|
||||
/// name: "newtype_body_endpoint",
|
||||
/// path: "/_matrix/some/newtype/body/endpoint",
|
||||
/// stable_path: "/_matrix/some/newtype/body/endpoint",
|
||||
/// rate_limited: false,
|
||||
/// authentication: None,
|
||||
/// added: 1.1,
|
||||
/// }
|
||||
///
|
||||
/// request: {
|
||||
|
@ -21,9 +21,6 @@ pub struct Metadata {
|
||||
/// A unique identifier for this endpoint.
|
||||
pub name: &'static str,
|
||||
|
||||
/// (DEPRECATED)
|
||||
pub path: Option<&'static str>,
|
||||
|
||||
/// The unstable path of this endpoint's URL, often `None`, used for developmental
|
||||
/// purposes.
|
||||
pub unstable_path: Option<&'static str>,
|
||||
|
@ -11,7 +11,7 @@ ruma_api! {
|
||||
description: "Does something.",
|
||||
method: POST,
|
||||
name: "my_endpoint",
|
||||
path: "/_matrix/foo/:bar/:user",
|
||||
unstable_path: "/_matrix/foo/:bar/:user",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -55,7 +55,7 @@ fn request_serde() {
|
||||
.try_into_http_request::<Vec<u8>>(
|
||||
"https://homeserver.tld",
|
||||
SendAccessToken::None,
|
||||
&[MatrixVersion::V1_0],
|
||||
&[MatrixVersion::V1_1],
|
||||
)
|
||||
.unwrap();
|
||||
let req2 = Request::try_from_http_request(http_req, &["barVal", "@bazme:ruma.io"]).unwrap();
|
||||
@ -82,7 +82,7 @@ fn invalid_uri_should_not_panic() {
|
||||
let result = req.try_into_http_request::<Vec<u8>>(
|
||||
"invalid uri",
|
||||
SendAccessToken::None,
|
||||
&[MatrixVersion::V1_0],
|
||||
&[MatrixVersion::V1_1],
|
||||
);
|
||||
assert!(result.is_err());
|
||||
}
|
||||
@ -104,7 +104,7 @@ fn request_with_user_id_serde() {
|
||||
"https://homeserver.tld",
|
||||
SendAccessToken::None,
|
||||
user_id,
|
||||
&[MatrixVersion::V1_0],
|
||||
&[MatrixVersion::V1_1],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@ -126,7 +126,7 @@ mod without_query {
|
||||
description: "Does something without query.",
|
||||
method: POST,
|
||||
name: "my_endpoint",
|
||||
path: "/_matrix/foo/:bar/:user",
|
||||
unstable_path: "/_matrix/foo/:bar/:user",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -165,7 +165,7 @@ mod without_query {
|
||||
"https://homeserver.tld",
|
||||
SendAccessToken::None,
|
||||
user_id,
|
||||
&[MatrixVersion::V1_0],
|
||||
&[MatrixVersion::V1_1],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
@ -10,7 +10,7 @@ ruma_api! {
|
||||
description: "Does something.",
|
||||
method: GET,
|
||||
name: "no_fields",
|
||||
path: "/_matrix/my/endpoint",
|
||||
unstable_path: "/_matrix/my/endpoint",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -53,7 +53,7 @@ fn request_content_type_override() {
|
||||
.try_into_http_request::<Vec<u8>>(
|
||||
"https://homeserver.tld",
|
||||
SendAccessToken::None,
|
||||
&[MatrixVersion::V1_0],
|
||||
&[MatrixVersion::V1_1],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
@ -28,15 +28,14 @@ const METADATA: Metadata = Metadata {
|
||||
description: "Add an alias to a room.",
|
||||
method: Method::PUT,
|
||||
name: "create_alias",
|
||||
path: Some("/_matrix/client/r0/directory/room/:room_alias"),
|
||||
unstable_path: None,
|
||||
r0_path: None,
|
||||
stable_path: None,
|
||||
unstable_path: Some("/_matrix/client/unstable/directory/room/:room_alias"),
|
||||
r0_path: Some("/_matrix/client/r0/directory/room/:room_alias"),
|
||||
stable_path: Some("/_matrix/client/v3/directory/room/:room_alias"),
|
||||
rate_limited: false,
|
||||
authentication: AuthScheme::None,
|
||||
added: None,
|
||||
deprecated: None,
|
||||
removed: None,
|
||||
added: Some(MatrixVersion::V1_0),
|
||||
deprecated: Some(MatrixVersion::V1_1),
|
||||
removed: Some(MatrixVersion::V1_2),
|
||||
};
|
||||
|
||||
impl OutgoingRequest for Request {
|
||||
@ -49,11 +48,19 @@ impl OutgoingRequest for Request {
|
||||
self,
|
||||
base_url: &str,
|
||||
_access_token: SendAccessToken<'_>,
|
||||
// FIXME: properly integrate
|
||||
_considering_versions: &'_ [MatrixVersion],
|
||||
considering_versions: &'_ [MatrixVersion],
|
||||
) -> Result<http::Request<T>, IntoHttpError> {
|
||||
let url = (base_url.to_owned() + METADATA.path.unwrap())
|
||||
.replace(":room_alias", &self.room_alias.to_string());
|
||||
let url = format!(
|
||||
"{}{}",
|
||||
base_url,
|
||||
ruma_api::select_path(
|
||||
considering_versions,
|
||||
&METADATA,
|
||||
Some(format_args!("/_matrix/client/unstable/directory/room/{}", self.room_alias)),
|
||||
Some(format_args!("/_matrix/client/r0/directory/room/{}", self.room_alias)),
|
||||
Some(format_args!("/_matrix/client/v3/directory/room/{}", self.room_alias)),
|
||||
)?
|
||||
);
|
||||
|
||||
let request_body = RequestBody { room_id: self.room_id };
|
||||
|
||||
|
@ -6,7 +6,7 @@ mod get {
|
||||
description: "Does something.",
|
||||
method: GET,
|
||||
name: "no_fields",
|
||||
path: "/_matrix/my/endpoint",
|
||||
unstable_path: "/_matrix/my/endpoint",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -22,7 +22,7 @@ mod post {
|
||||
description: "Does something.",
|
||||
method: POST,
|
||||
name: "no_fields",
|
||||
path: "/_matrix/my/endpoint",
|
||||
unstable_path: "/_matrix/my/endpoint",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -39,7 +39,7 @@ fn empty_post_request_http_repr() {
|
||||
.try_into_http_request::<Vec<u8>>(
|
||||
"https://homeserver.tld",
|
||||
SendAccessToken::None,
|
||||
&[MatrixVersion::V1_0],
|
||||
&[MatrixVersion::V1_1],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@ -53,7 +53,7 @@ fn empty_get_request_http_repr() {
|
||||
.try_into_http_request::<Vec<u8>>(
|
||||
"https://homeserver.tld",
|
||||
SendAccessToken::None,
|
||||
&[MatrixVersion::V1_0],
|
||||
&[MatrixVersion::V1_1],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
@ -5,7 +5,7 @@ ruma_api! {
|
||||
description: "Does something.",
|
||||
method: GET,
|
||||
name: "no_fields",
|
||||
path: "/_matrix/my/endpoint",
|
||||
unstable_path: "/_matrix/my/endpoint",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ ruma_api! {
|
||||
description: "Does something.",
|
||||
method: GET,
|
||||
name: "some_path_args",
|
||||
path: "/_matrix/:one/a/:two/b/:three/c",
|
||||
unstable_path: "/_matrix/:one/a/:two/b/:three/c",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ mod empty_response {
|
||||
description: "Add an alias to a room.",
|
||||
method: PUT,
|
||||
name: "create_alias",
|
||||
path: "/_matrix/client/r0/directory/room/:room_alias",
|
||||
unstable_path: "/_matrix/client/r0/directory/room/:room_alias",
|
||||
rate_limited: false,
|
||||
authentication: AccessToken,
|
||||
}
|
||||
@ -42,7 +42,7 @@ mod nested_types {
|
||||
description: "Add an alias to a room.",
|
||||
method: PUT,
|
||||
name: "create_alias",
|
||||
path: "/_matrix/client/r0/directory/room",
|
||||
unstable_path: "/_matrix/client/r0/directory/room",
|
||||
rate_limited: false,
|
||||
authentication: AccessToken,
|
||||
}
|
||||
@ -69,7 +69,7 @@ mod full_request_response {
|
||||
description: "Does something.",
|
||||
method: POST,
|
||||
name: "no_fields",
|
||||
path: "/_matrix/my/endpoint/:thing",
|
||||
unstable_path: "/_matrix/my/endpoint/:thing",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -101,7 +101,7 @@ mod full_request_response_with_query_map {
|
||||
description: "Does something.",
|
||||
method: GET,
|
||||
name: "no_fields",
|
||||
path: "/_matrix/my/endpoint/:thing",
|
||||
unstable_path: "/_matrix/my/endpoint/:thing",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -133,7 +133,7 @@ mod query_fields {
|
||||
description: "Get the list of rooms in this homeserver's public directory.",
|
||||
method: GET,
|
||||
name: "get_public_rooms",
|
||||
path: "/_matrix/client/r0/publicRooms",
|
||||
unstable_path: "/_matrix/client/r0/publicRooms",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ pub mod some_endpoint {
|
||||
description: "Does something.",
|
||||
method: POST, // An `http::Method` constant. No imports required.
|
||||
name: "some_endpoint",
|
||||
path: "/_matrix/some/endpoint/:user",
|
||||
unstable_path: "/_matrix/some/endpoint/:user",
|
||||
|
||||
#[cfg(all())]
|
||||
rate_limited: true,
|
||||
@ -76,7 +76,7 @@ pub mod newtype_body_endpoint {
|
||||
description: "Does something.",
|
||||
method: PUT,
|
||||
name: "newtype_body_endpoint",
|
||||
path: "/_matrix/some/newtype/body/endpoint",
|
||||
unstable_path: "/_matrix/some/newtype/body/endpoint",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -106,7 +106,7 @@ pub mod raw_body_endpoint {
|
||||
description: "Does something.",
|
||||
method: PUT,
|
||||
name: "newtype_body_endpoint",
|
||||
path: "/_matrix/some/newtype/body/endpoint",
|
||||
unstable_path: "/_matrix/some/newtype/body/endpoint",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -131,7 +131,7 @@ pub mod query_map_endpoint {
|
||||
description: "Does something.",
|
||||
method: GET,
|
||||
name: "newtype_body_endpoint",
|
||||
path: "/_matrix/some/query/map/endpoint",
|
||||
unstable_path: "/_matrix/some/query/map/endpoint",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ const BASE: Metadata = Metadata {
|
||||
description: "",
|
||||
method: Method::GET,
|
||||
name: "test_endpoint",
|
||||
path: Some("/depr/path"),
|
||||
unstable_path: Some("/unstable/path"),
|
||||
r0_path: Some("/r0/path"),
|
||||
stable_path: Some("/stable/path"),
|
||||
|
@ -7,7 +7,6 @@ ruma_api! {
|
||||
description: "Does something.",
|
||||
method: POST, // An `http::Method` constant. No imports required.
|
||||
name: "some_endpoint",
|
||||
path: "/_matrix/some/endpoint/:baz",
|
||||
unstable_path: "/_matrix/some/msc1234/endpoint/:baz",
|
||||
r0_path: "/_matrix/some/r0/endpoint/:baz",
|
||||
stable_path: "/_matrix/some/v1/endpoint/:baz",
|
||||
|
@ -5,7 +5,7 @@ ruma_api! {
|
||||
description: "This will fail.",
|
||||
method: GET,
|
||||
name: "invalid_path",
|
||||
path: "µ/°/§/€",
|
||||
unstable_path: "µ/°/§/€",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -23,7 +23,7 @@ ruma_api! {
|
||||
description: "This will fail.",
|
||||
method: GET,
|
||||
name: "invalid_path",
|
||||
path: "path/to/invalid space/endpoint",
|
||||
unstable_path: "path/to/invalid space/endpoint",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
error: path may only contain printable ASCII characters with no spaces
|
||||
--> $DIR/02-invalid-path.rs:8:15
|
||||
--> tests/ui/02-invalid-path.rs:8:24
|
||||
|
|
||||
8 | path: "µ/°/§/€",
|
||||
| ^^^^^^^^^
|
||||
8 | unstable_path: "µ/°/§/€",
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: path may only contain printable ASCII characters with no spaces
|
||||
--> $DIR/02-invalid-path.rs:26:15
|
||||
--> tests/ui/02-invalid-path.rs:26:24
|
||||
|
|
||||
26 | path: "path/to/invalid space/endpoint",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
26 | unstable_path: "path/to/invalid space/endpoint",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -13,7 +13,7 @@ mod newtype_body {
|
||||
description: "Does something.",
|
||||
method: POST,
|
||||
name: "my_endpoint",
|
||||
path: "/_matrix/foo/:bar/",
|
||||
unstable_path: "/_matrix/foo/:bar/",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -51,7 +51,7 @@ mod raw_body {
|
||||
description: "Does something.",
|
||||
method: POST,
|
||||
name: "my_endpoint",
|
||||
path: "/_matrix/foo/:bar/",
|
||||
unstable_path: "/_matrix/foo/:bar/",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -92,7 +92,7 @@ mod plain {
|
||||
description: "Does something.",
|
||||
method: POST,
|
||||
name: "my_endpoint",
|
||||
path: "/_matrix/foo/:bar/",
|
||||
unstable_path: "/_matrix/foo/:bar/",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ ruma_api! {
|
||||
description: "Does something.",
|
||||
method: POST, // An `http::Method` constant. No imports required.
|
||||
name: "some_endpoint",
|
||||
path: "/_matrix/some/endpoint/:baz",
|
||||
unstable_path: "/_matrix/some/endpoint/:baz",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ ruma_api! {
|
||||
description: "Does something.",
|
||||
method: POST, // An `http::Method` constant. No imports required.
|
||||
name: "some_endpoint",
|
||||
path: "/_matrix/some/endpoint",
|
||||
unstable_path: "/_matrix/some/endpoint/:foo",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
@ -18,6 +18,7 @@ ruma_api! {
|
||||
#[derive(PartialEq)] // Make sure attributes work
|
||||
request: {
|
||||
// With no attribute on the field, it will be put into the body of the request.
|
||||
#[ruma_api(path)]
|
||||
pub foo: String,
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ ruma_api! {
|
||||
description: "Does something.",
|
||||
method: POST, // An `http::Method` constant. No imports required.
|
||||
name: "some_endpoint",
|
||||
path: "/_matrix/some/endpoint/:baz",
|
||||
unstable_path: "/_matrix/some/endpoint/:baz",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ ruma_api! {
|
||||
description: "Does something.",
|
||||
method: POST, // An `http::Method` constant. No imports required.
|
||||
name: "some_endpoint",
|
||||
path: "/_matrix/some/endpoint/:baz",
|
||||
unstable_path: "/_matrix/some/endpoint/:baz",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ ruma_api! {
|
||||
description: "This will fail.",
|
||||
method: GET,
|
||||
name: "invalid_versions",
|
||||
path: "/a/path",
|
||||
unstable_path: "/a/path",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
|
||||
|
@ -5,7 +5,7 @@ ruma_api! {
|
||||
description: "This will fail.",
|
||||
method: GET,
|
||||
name: "invalid_versions",
|
||||
path: "/a/path",
|
||||
unstable_path: "/a/path",
|
||||
rate_limited: false,
|
||||
authentication: None,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user