#![allow(unexpected_cfgs)]
use ruma_common::{
api::{Metadata, auth_scheme::AccessToken, path_builder::PathBuilder, request, response},
metadata,
};
metadata! {
method: PUT,
rate_limited: true,
authentication: AccessToken,
path: "/_matrix/other/v1/endpoint/{baz}",
}
#[request]
pub struct Request {
#[ruma_api(path)]
pub baz: String,
#[ruma_api(query_all)]
pub bar: Query,
#[ruma_api(raw_body)]
pub body: Vec<u8>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct Query {
pub foo: String,
}
#[response]
pub struct Response {
#[ruma_api(raw_body)]
pub body: Vec<u8>,
}
fn main() {
assert_eq!(
Request::PATH_BUILDER.all_paths().collect::<Vec<_>>(),
&["/_matrix/other/v1/endpoint/{baz}"],
);
let path = Request::PATH_BUILDER.select_path(()).unwrap();
assert_eq!(path, "/_matrix/other/v1/endpoint/{baz}");
}