From 60e4d9a86c0c5b101448f73171196f048dd49ae8 Mon Sep 17 00:00:00 2001 From: Jimmy Cuadra Date: Fri, 7 Jul 2017 23:20:42 -0700 Subject: [PATCH] Add an API module to expose endpoints. --- src/api.rs | 19 +++++++++++++++++++ src/lib.rs | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 src/api.rs diff --git a/src/api.rs b/src/api.rs new file mode 100644 index 00000000..7568faaf --- /dev/null +++ b/src/api.rs @@ -0,0 +1,19 @@ +/// Endpoints that cannot change with new versions of the Matrix specification. +pub mod unversioned { + /// [GET /_matrix/client/versions](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-versions) + pub mod get_supported_versions { + use futures::Future; + use hyper::client::Connect; + use ruma_client_api::unversioned::get_supported_versions::Endpoint; + pub use ruma_client_api::unversioned::get_supported_versions::{Request, Response}; + + use {Client, Error}; + + /// Make a request to this API endpoint. + pub fn call<'a, C>(client: &'a Client, request: Request) + -> impl Future + 'a + where C: Connect { + client.request::(request) + } + } +} diff --git a/src/lib.rs b/src/lib.rs index d8450765..f171f476 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,6 +32,8 @@ use url::Url; pub use error::Error; pub use session::Session; +/// Matrix client-server API endpoints. +pub mod api; mod error; mod session;