Run cargo fmt for the get_profiles example
parent
7201749280
commit
1d00f79675
|
@ -4,10 +4,7 @@ use std::{env, process::exit};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use matrix_sdk::{
|
use matrix_sdk::{
|
||||||
self,
|
self, api::r0::profile, identifiers::UserId, Client, ClientConfig, Result as MatrixResult,
|
||||||
identifiers::UserId,
|
|
||||||
api::r0::profile,
|
|
||||||
Client, ClientConfig, Result as MatrixResult,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -20,11 +17,10 @@ struct UserProfile {
|
||||||
/// Spec: https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-profile-userid
|
/// Spec: https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-profile-userid
|
||||||
/// Ruma: https://docs.rs/ruma-client-api/0.9.0/ruma_client_api/r0/profile/get_profile/index.html
|
/// Ruma: https://docs.rs/ruma-client-api/0.9.0/ruma_client_api/r0/profile/get_profile/index.html
|
||||||
async fn get_profile(client: Client, mxid: UserId) -> MatrixResult<UserProfile> {
|
async fn get_profile(client: Client, mxid: UserId) -> MatrixResult<UserProfile> {
|
||||||
|
|
||||||
// First construct the request you want to make
|
// First construct the request you want to make
|
||||||
// See https://docs.rs/ruma-client-api/0.9.0/ruma_client_api/index.html for all available Endpoints
|
// See https://docs.rs/ruma-client-api/0.9.0/ruma_client_api/index.html for all available Endpoints
|
||||||
let request = profile::get_profile::Request {
|
let request = profile::get_profile::Request {
|
||||||
user_id: mxid.clone()
|
user_id: mxid.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Start the request using matrix_sdk::Client::send
|
// Start the request using matrix_sdk::Client::send
|
||||||
|
@ -33,7 +29,10 @@ async fn get_profile(client: Client, mxid: UserId) -> MatrixResult<UserProfile>
|
||||||
// Use the response and construct a UserProfile struct.
|
// Use the response and construct a UserProfile struct.
|
||||||
// See https://docs.rs/ruma-client-api/0.9.0/ruma_client_api/r0/profile/get_profile/struct.Response.html
|
// See https://docs.rs/ruma-client-api/0.9.0/ruma_client_api/r0/profile/get_profile/struct.Response.html
|
||||||
// for details on the Response for this Request
|
// for details on the Response for this Request
|
||||||
let user_profile = UserProfile{ avatar_url: resp.avatar_url, displayname: resp.displayname };
|
let user_profile = UserProfile {
|
||||||
|
avatar_url: resp.avatar_url,
|
||||||
|
displayname: resp.displayname,
|
||||||
|
};
|
||||||
Ok(user_profile)
|
Ok(user_profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue