galoy-cli 0.1.7

A CLI Client for interacting with Galoy Backend
Documentation
use anyhow::Context;

use crate::app::App;

impl App {
    pub async fn me(&self) -> anyhow::Result<()> {
        let result = self
            .client
            .me()
            .await
            .context("Error occurred while fetching 'me' data")?;

        println!(
            "{}",
            serde_json::to_string_pretty(&result).context("Failed to serialize JSON")?
        );

        Ok(())
    }

    pub async fn set_username(&self, username: String) -> anyhow::Result<()> {
        self.client
            .set_username(username)
            .await
            .context("Failed to set username")?;

        println!("Username has been successfully set!");

        Ok(())
    }
}