ruma-api-macros
ruma-api-macros provides a procedural macro for easily generating ruma-api-compatible API endpoints.
You define the endpoint's metadata, request fields, and response fields, and the macro generates all the necessary types and implements all the necessary traits.
Usage
Here is an example that shows most of the macro's functionality.
pub mod some_endpoint {
use ruma_api_macros::ruma_api;
ruma_api! {
metadata {
description: "Does something.",
method: GET, name: "some_endpoint",
path: "/_matrix/some/endpoint/:baz", rate_limited: false,
requires_authentication: false,
}
request {
pub foo: String,
#[ruma_api(header = CONTENT_TYPE)]
pub content_type: String
#[ruma_api(query)]
pub bar: String,
#[ruma_api(path)]
pub baz: String,
}
response {
#[ruma_api(header = CONTENT_TYPE)]
pub content_type: String
pub value: String,
}
}
}
Documentation
ruma-api-macros has comprehensive documentation available on docs.rs.
License
MIT