extern crate tokio;
use exante::{AccountType, Client};
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), String> {
let client = Client::new(AccountType::Demo, "api-key", "secret-key");
let account_id = client
.get_user_accounts()
.send()
.await
.map_err(|e| format!("Failed to get user accounts: {e}"))?
.first()
.ok_or_else(|| String::from("No account found"))?
.account_id
.to_owned();
let transactions = client
.get_transactions()
.filter_account_id(account_id)
.limit(10)
.send()
.await
.map_err(|e| format!("Failed to get transactions: {e}"))?;
transactions.iter().for_each(|t| println!("{t:?}"));
Ok(())
}