add doc comment examples for whoami api
This commit is contained in:
@ -7,7 +7,23 @@
|
|||||||
use crate::{error::GolgiError, sbot::Sbot, utils};
|
use crate::{error::GolgiError, sbot::Sbot, utils};
|
||||||
|
|
||||||
impl Sbot {
|
impl Sbot {
|
||||||
/// Call the `whoami` RPC method and return an `id`.
|
/// Get the public key of the local identity.
|
||||||
|
///
|
||||||
|
/// # Example
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// use golgi::{Sbot, GolgiError};
|
||||||
|
///
|
||||||
|
/// async fn fetch_id() -> Result<(), GolgiError> {
|
||||||
|
/// let mut sbot_client = Sbot::init(None, None).await?;
|
||||||
|
///
|
||||||
|
/// let pub_key = sbot_client.whoami().await?;
|
||||||
|
///
|
||||||
|
/// println!("local ssb id: {}", pub_key);
|
||||||
|
///
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub async fn whoami(&mut self) -> Result<String, GolgiError> {
|
pub async fn whoami(&mut self) -> Result<String, GolgiError> {
|
||||||
let mut sbot_connection = self.get_sbot_connection().await?;
|
let mut sbot_connection = self.get_sbot_connection().await?;
|
||||||
let req_id = sbot_connection.client.whoami_req_send().await?;
|
let req_id = sbot_connection.client.whoami_req_send().await?;
|
||||||
|
Reference in New Issue
Block a user