Add an API module to expose endpoints.

This commit is contained in:
Jimmy Cuadra 2017-07-07 23:20:42 -07:00
parent 86e837d26f
commit 60e4d9a86c
2 changed files with 21 additions and 0 deletions

19
src/api.rs Normal file
View File

@ -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<C>, request: Request)
-> impl Future<Item = Response, Error = Error> + 'a
where C: Connect {
client.request::<Endpoint>(request)
}
}
}

View File

@ -32,6 +32,8 @@ use url::Url;
pub use error::Error; pub use error::Error;
pub use session::Session; pub use session::Session;
/// Matrix client-server API endpoints.
pub mod api;
mod error; mod error;
mod session; mod session;