client: Use http_client::Dummy for doctests
This commit is contained in:
parent
a2b64df5d3
commit
e3beb208e5
@ -83,14 +83,14 @@ impl<C: HttpClient> Client<C> {
|
|||||||
///
|
///
|
||||||
/// # Example:
|
/// # Example:
|
||||||
///
|
///
|
||||||
/// ```ignore
|
/// ```no_run
|
||||||
/// use std::time::Duration;
|
/// use std::time::Duration;
|
||||||
///
|
///
|
||||||
/// # use ruma_client::Client;
|
/// # type MatrixClient = ruma_client::Client<ruma_client::http_client::Dummy>;
|
||||||
/// # use ruma::presence::PresenceState;
|
/// # use ruma::presence::PresenceState;
|
||||||
/// # use tokio_stream::{StreamExt as _};
|
/// # use tokio_stream::{StreamExt as _};
|
||||||
/// # let homeserver_url = "https://example.com".parse().unwrap();
|
/// # let homeserver_url = "https://example.com".parse().unwrap();
|
||||||
/// # let client = Client::new(homeserver_url, None);
|
/// # let client = MatrixClient::new(homeserver_url, None);
|
||||||
/// # let next_batch_token = String::new();
|
/// # let next_batch_token = String::new();
|
||||||
/// # async {
|
/// # async {
|
||||||
/// let mut sync_stream = Box::pin(client.sync(
|
/// let mut sync_stream = Box::pin(client.sync(
|
||||||
|
@ -4,36 +4,37 @@
|
|||||||
//!
|
//!
|
||||||
//! # Usage
|
//! # Usage
|
||||||
//!
|
//!
|
||||||
//! Begin by creating a `Client` type, usually using the `https` method for a client that supports
|
//! Begin by creating a `Client`, selecting one of the type aliases from `ruma_client::http_client`
|
||||||
//! secure connections, and then logging in:
|
//! for the generic parameter. For the client API, there are login and registration methods
|
||||||
|
//! provided for the client (feature `client-api`):
|
||||||
//!
|
//!
|
||||||
//! ```ignore
|
//! ```ignore
|
||||||
//! use ruma_client::Client;
|
//! // type MatrixClient = ruma_client::Client<ruma_client::http_client::_>;
|
||||||
|
//! # type MatrixClient = ruma_client::Client<ruma_client::http_client::Dummy>;
|
||||||
|
//! # let work = async {
|
||||||
|
//! let homeserver_url = "https://example.com".parse().unwrap();
|
||||||
|
//! let client = MatrixClient::new(homeserver_url, None);
|
||||||
//!
|
//!
|
||||||
//! let work = async {
|
//! let session = client
|
||||||
//! let homeserver_url = "https://example.com".parse().unwrap();
|
//! .log_in("@alice:example.com", "secret", None, None)
|
||||||
//! let client = Client::new(homeserver_url, None);
|
//! .await?;
|
||||||
//!
|
//!
|
||||||
//! let session = client
|
//! // You're now logged in! Write the session to a file if you want to restore it later.
|
||||||
//! .log_in("@alice:example.com", "secret", None, None)
|
//! // Then start using the API!
|
||||||
//! .await?;
|
//! # Result::<(), ruma_client::Error<_, _>>::Ok(())
|
||||||
//!
|
//! # };
|
||||||
//! // You're now logged in! Write the session to a file if you want to restore it later.
|
|
||||||
//! // Then start using the API!
|
|
||||||
//! # Result::<(), ruma_client::Error<_>>::Ok(())
|
|
||||||
//! };
|
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! You can also pass an existing access token to the `Client` constructor to restore a previous
|
//! You can also pass an existing access token to the `Client` constructor to restore a previous
|
||||||
//! session rather than calling `log_in`. This can also be used to create a session for an
|
//! session rather than calling `log_in`. This can also be used to create a session for an
|
||||||
//! application service that does not need to log in, but uses the access_token directly:
|
//! application service that does not need to log in, but uses the access_token directly:
|
||||||
//!
|
//!
|
||||||
//! ```ignore
|
//! ```no_run
|
||||||
//! use ruma_client::Client;
|
//! # type MatrixClient = ruma_client::Client<ruma_client::http_client::Dummy>;
|
||||||
//!
|
//!
|
||||||
//! let work = async {
|
//! let work = async {
|
||||||
//! let homeserver_url = "https://example.com".parse().unwrap();
|
//! let homeserver_url = "https://example.com".parse().unwrap();
|
||||||
//! let client = Client::new(homeserver_url, Some("as_access_token".into()));
|
//! let client = MatrixClient::new(homeserver_url, Some("as_access_token".into()));
|
||||||
//!
|
//!
|
||||||
//! // make calls to the API
|
//! // make calls to the API
|
||||||
//! };
|
//! };
|
||||||
@ -48,10 +49,10 @@
|
|||||||
//!
|
//!
|
||||||
//! For example:
|
//! For example:
|
||||||
//!
|
//!
|
||||||
//! ```ignore
|
//! ```no_run
|
||||||
//! # use ruma_client::Client;
|
//! # type MatrixClient = ruma_client::Client<ruma_client::http_client::Dummy>;
|
||||||
//! # let homeserver_url = "https://example.com".parse().unwrap();
|
//! # let homeserver_url = "https://example.com".parse().unwrap();
|
||||||
//! # let client = Client::new(homeserver_url, None);
|
//! # let client = MatrixClient::new(homeserver_url, None);
|
||||||
//! use std::convert::TryFrom;
|
//! use std::convert::TryFrom;
|
||||||
//!
|
//!
|
||||||
//! use ruma::{
|
//! use ruma::{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user