Add an API module to expose endpoints.
This commit is contained in:
parent
86e837d26f
commit
60e4d9a86c
19
src/api.rs
Normal file
19
src/api.rs
Normal 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)
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user