up_api/
lib.rs

1//! # Up API
2//!
3//! A convenient and easy to use wrapper for the [Up Bank API](https://developer.up.com.au).
4//! 
5//! ## Example
6//! 
7//! The following example shows the calculation of the sum of all transactions after a given date (up to the page limit).
8//! 
9//! ```
10//! use up_api::v1::Client;
11//! use up_api::v1::transactions::ListTransactionsOptions;
12//! 
13//! #[tokio::main]
14//! async fn main() {
15//!     let token = std::env::var("UP_ACCESS_TOKEN").unwrap();
16//! 
17//!     let client = Client::new(token.to_string());
18//! 
19//!     let mut options = ListTransactionsOptions::default();
20//!     options.filter_since("2020-01-01T01:02:03Z".to_string());
21//!     options.page_size(100);
22//! 
23//!     let transactions = client.list_transactions(&options).await.unwrap();
24//! 
25//!     let total : f32 =
26//!         transactions
27//!         .data
28//!         .into_iter()
29//!         .map(|t| t.attributes.amount.value)
30//!         .map(|v| v.parse::<f32>().unwrap())
31//!         .filter(|a| a > &0.0)
32//!         .sum();
33//! 
34//!     println!("{}", total);
35//! }
36//! ```
37
38/// Module for interacting with the v1 (beta) release of the Up API.
39pub mod v1;