mercury-rust

Crates.iomercury-rust
lib.rsmercury-rust
version0.1.0
sourcesrc
created_at2021-06-15 19:05:35.369083
updated_at2021-06-15 19:05:35.369083
descriptionLibrary that interacts with Mercury Bank API.
homepage
repositoryhttps://github.com/nilbytes/mercury-rust
max_upload_size
id410578
size61,761
Darius Clark (dariusc93)

documentation

README

mercury-rust

Crate that interacts with Mercury Banking API to have access to accounts, transactional history, and perform other actions within your bank account through their API.

Example

use mercury_rust::client::Client;
use mercury_rust::resources::accounts::Account;
use mercury_rust::resources::ListData;
use std::env;

#[tokio::main]
async fn main() -> mercury_rust::Result<()> {

    let secret_key = env::var("API_KEY").expect("Missing 'API_KEY'.");
    let client = Client::new(secret_key);

    let accounts = Account::list(&client).await?;

    if let ListData::<Account>::Accounts( ref list ) = accounts.data {

        for account in list.iter() {
            println!("Account: {}", account.name);
            println!("Available Balance: {}", account.available_balance);
            println!("Current Balance: {}", account.current_balance);
            println!("Account Type: {:?}", account.kind);
            println!();
        }

    }

    Ok(())
}
Commit count: 2

cargo fmt