Crate monzo

Source
Expand description

A Monzo client in pure rust.

It’s ergonomic, strongly-typed, and asynchronous.

In order to use this client, you will first need to get an access token and/or refresh token for the Monzo API (see the docs)

§Usage

use monzo::Client;

#[tokio::main]
async fn main() -> monzo::Result<()> {
    // You can create a simple monzo client using only an access token
    let quick_client = Client::new("ACCESS_TOKEN");

    // get a list of accounts
    let accounts = quick_client.accounts().await?;

    // get the id of one of the accounts
    let account_id = &accounts[0].id;

    // get the balance of that account
    let balance = quick_client.balance(account_id).await?;

    // If you have a refresh token and client credentials
    // you can create or upgrade a client which is capable
    // of refreshing its own access token.
    let mut refreshable_client =
        quick_client.with_refresh_tokens("CLIENT_ID", "CLIENT_SECRET", "REFRESH_TOKEN");

    refreshable_client.refresh_auth().await?;

    Ok(())
}

Modules§

accounts
Accounts API endpoint
feed_items
Create items in your account feed
inner_client
‘Inner’ clients that encapsulate the different authentication handling strategies that the Monzo API supports.
transactions
Retrieve and manipulate transactions

Structs§

Account
A struct representing a Monzo Account
Balance
The balance of a Monzo Account
Client
A Monzo API client
Owner
Struct representating an owner of a Monzo account
Pot
Representation of a Monzo pot
Transaction
A Monzo transaction
WhoAmI
The response returned by the Client::who_am_i method.

Enums§

Error
Common error type for anything that can go wrong with this crate

Type Aliases§

Result
Result type for all methods in this crate which can fail.