Trait ruma_api::Endpoint
[−]
[src]
pub trait Endpoint { type BodyParams: Deserialize + Serialize; type PathParams; type QueryParams: Deserialize + Serialize; type Response: Deserialize + Serialize; fn method() -> Method; fn request_path(params: Self::PathParams) -> String; fn router_path() -> &'static str; fn name() -> &'static str; fn description() -> &'static str; fn requires_authentication() -> bool; fn rate_limited() -> bool; }
An API endpoint.
Associated Types
type BodyParams: Deserialize + Serialize
Request parameters supplied via the body of the HTTP request.
type PathParams
Request parameters supplied via the URL's path.
type QueryParams: Deserialize + Serialize
Parameters supplied via the URL's query string.
type Response: Deserialize + Serialize
The body of the response.
Required Methods
fn method() -> Method
Returns the HTTP method used by this endpoint.
fn request_path(params: Self::PathParams) -> String
Generates the path component of the URL for this endpoint using the supplied parameters.
fn router_path() -> &'static str
Generates a generic path component of the URL for this endpoint, suitable for Router
from
the router crate.
fn name() -> &'static str
A unique identifier for this endpoint, suitable for Router
from the router crate.
fn description() -> &'static str
A human-readable description of the endpoint.
fn requires_authentication() -> bool
Whether or not this endpoint requires an authenticated user.
fn rate_limited() -> bool
Whether or not this endpoint is rate limited.