matrix-sdk: Add an example to the start verification method of the device.

master
Damir Jelić 2020-08-17 16:47:24 +02:00
parent 0f26e7e3bc
commit 8aedc3077d
1 changed files with 17 additions and 0 deletions

View File

@ -40,6 +40,23 @@ impl Device {
/// Start a interactive verification with this `Device`
///
/// Returns a `Sas` object that represents the interactive verification flow.
///
/// # Example
///
/// ```no_run
/// # use std::convert::TryFrom;
/// # use matrix_sdk::{Client, identifiers::UserId};
/// # use url::Url;
/// # use futures::executor::block_on;
/// # let alice = UserId::try_from("@alice:example.org").unwrap();
/// # let homeserver = Url::parse("http://example.com").unwrap();
/// # let client = Client::new(homeserver).unwrap();
/// # block_on(async {
/// let device = client.get_device(&alice, "DEVICEID".into()).await.unwrap();
///
/// let verification = device.start_verification().await.unwrap();
/// # });
/// ```
pub async fn start_verification(&self) -> Result<Sas> {
let (sas, request) = self.inner.start_verification();
let request = ToDeviceRequest {