Struct ruma_common::api::Metadata
source · pub struct Metadata {
pub method: Method,
pub rate_limited: bool,
pub authentication: AuthScheme,
pub history: VersionHistory,
}
Available on crate feature
api
only.Expand description
Metadata about an API endpoint.
Fields§
§method: Method
The HTTP method used by this endpoint.
rate_limited: bool
Whether or not this endpoint is rate limited by the server.
authentication: AuthScheme
What authentication scheme the server uses for this endpoint.
history: VersionHistory
All info pertaining to an endpoint’s (historic) paths, deprecation version, and removal.
Implementations§
source§impl Metadata
impl Metadata
sourcepub fn empty_request_body<B>(&self) -> Bwhere
B: Default + BufMut,
pub fn empty_request_body<B>(&self) -> Bwhere B: Default + BufMut,
Returns an empty request body for this Matrix request.
For GET
requests, it returns an entirely empty buffer, for others it returns an empty JSON
object ({}
).
Transform the SendAccessToken
into an access token if the endpoint requires it, or if it
is SendAccessToken::Force
.
Fails if the endpoint requires an access token but the parameter is SendAccessToken::None
,
or if the access token can’t be converted to a HeaderValue
.
sourcepub fn make_endpoint_url(
&self,
versions: &[MatrixVersion],
base_url: &str,
path_args: &[&dyn Display],
query_string: &str
) -> Result<String, IntoHttpError>
pub fn make_endpoint_url( &self, versions: &[MatrixVersion], base_url: &str, path_args: &[&dyn Display], query_string: &str ) -> Result<String, IntoHttpError>
Generate the endpoint URL for this endpoint.