Move the supported versions API endpoint into an "unversioned" module.

This commit is contained in:
Jimmy Cuadra 2017-01-02 01:51:35 -08:00
parent b8bfa5ad4a
commit 1ca92148c5
3 changed files with 35 additions and 31 deletions

View File

@ -43,5 +43,4 @@ pub mod r0 {
pub mod voip;
}
/// [GET /_matrix/client/versions](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-versions)
pub mod supported_versions;
pub mod unversioned;

View File

@ -1,29 +0,0 @@
/// Details about this API endpoint.
#[derive(Clone, Copy, Debug)]
pub struct Endpoint;
/// This API endpoint's response.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response {
/// A list of Matrix client API protocol versions supported by the homeserver.
pub versions: Vec<String>,
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = ();
type QueryParams = ();
type Response = Response;
fn method() -> ::Method {
::Method::Get
}
fn request_path(_params: Self::PathParams) -> String {
Self::router_path()
}
fn router_path() -> String {
"/_matrix/client/versions".to_string()
}
}

34
src/unversioned.rs Normal file
View File

@ -0,0 +1,34 @@
//! Endpoints that cannot change with new versions of the Matrix specification.
/// [GET /_matrix/client/versions](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-versions)
pub mod get_supported_versions {
/// Details about this API endpoint.
#[derive(Clone, Copy, Debug)]
pub struct Endpoint;
/// This API endpoint's response.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Response {
/// A list of Matrix client API protocol versions supported by the homeserver.
pub versions: Vec<String>,
}
impl ::Endpoint for Endpoint {
type BodyParams = ();
type PathParams = ();
type QueryParams = ();
type Response = Response;
fn method() -> ::Method {
::Method::Get
}
fn request_path(_params: Self::PathParams) -> String {
Self::router_path()
}
fn router_path() -> String {
"/_matrix/client/versions".to_string()
}
}
}