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() -> String; }
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() -> String
Generates a generic path component of the URL for this endpoint, suitable for Router
from
the router crate.