akahu_client/lib.rs
1//! # akahu-client
2//!
3//! A non-official Rust client library for the [Akahu API](https://www.akahu.nz/),
4//! providing access to financial data aggregation services in New Zealand.
5//!
6//! ## Features
7//!
8//! - Fetch user accounts and account details
9//! - Retrieve transactions with pagination support
10//! - Access user identity and profile information
11//! - Type-safe API with strongly-typed models
12//! - Async/await support using tokio
13//! - Comprehensive error handling
14//!
15//! ## Quick Start
16//!
17//! ```no_run
18//! use akahu_client::{AkahuClient, UserToken};
19//!
20//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
21//! // Create a client with your app token
22//! let client = AkahuClient::new(
23//! reqwest::Client::new(),
24//! "app_token_...".to_string(),
25//! None
26//! );
27//!
28//! // Create a user token from OAuth flow
29//! let user_token = UserToken::new("user_token_...".to_string());
30//!
31//! // Fetch accounts
32//! let accounts = client.get_accounts(&user_token).await?;
33//!
34//! for account in accounts.items {
35//! println!("{}: {:?} - {:.2}",
36//! account.name,
37//! account.kind,
38//! account.balance.current
39//! );
40//! }
41//! # Ok(())
42//! # }
43//! ```
44//!
45//! ## Authentication
46//!
47//! The Akahu API requires two types of tokens:
48//! - **App Token**: Identifies your application (obtained from Akahu dashboard)
49//! - **User Token**: Identifies the user whose data you're accessing (obtained via OAuth flow)
50
51#![warn(missing_docs)]
52
53mod bank_account_number;
54mod client;
55mod error;
56mod models;
57mod serde;
58mod types;
59
60pub use bank_account_number::*;
61pub use client::AkahuClient;
62pub use error::AkahuError;
63pub use models::*;
64pub(crate) use serde::*;
65pub use types::*;