[−][src]Struct monzo::client::QuickClient
A quick and dirty Monzo API client.
This client is easy to construct, because all you need is an access token. This client is not capable of refreshing the access token, hence this must be managed externally.
For a full list of client functionality, see the [MonzoClient] trait
Implementations
impl Client
[src]
pub fn new(access_token: impl Into<String>) -> Self
[src]
Create a new Monzo Client.
This Client
needs only an access token to authenticate against
the Monzo API, but is incapable of refreshing its access if the
token expires.
pub fn from_http_client(
http_client: Client,
access_token: impl Into<String>
) -> Self
[src]
http_client: Client,
access_token: impl Into<String>
) -> Self
BYO HTTP client.
The Monzo client uses a reqwest http client under the hood. If you wish, you may use your own reqwest client with whatever configuration you see fit.
pub fn with_refresh_tokens(
self,
client_id: impl Into<String>,
client_secret: impl Into<String>,
refresh_token: impl Into<String>
) -> RefreshableClient
[src]
self,
client_id: impl Into<String>,
client_secret: impl Into<String>,
refresh_token: impl Into<String>
) -> RefreshableClient
Upgrade a Client by adding refresh tokens.
A client that has refresh tokens is able to refresh it's authentication when the access token expires.
#[must_use]pub fn access_token(&self) -> &String
[src]
Return a reference to the current access token
pub async fn accounts<'_>(&'_ self) -> Result<Vec<Account>>
[src]
pub async fn balance<'_, '_>(&'_ self, account_id: &'_ str) -> Result<Balance>
[src]
pub async fn pots<'_>(&'_ self) -> Result<Vec<Pot>>
[src]
#[must_use]pub fn basic_feed_item<'a>(
&self,
account_id: &'a str,
title: &'a str,
image_url: &'a str
) -> Basic<'a>
[src]
&self,
account_id: &'a str,
title: &'a str,
image_url: &'a str
) -> Basic<'a>
Post a basic item on the account feed.
Example
use monzo::Client; let account_id = "ACCOUNT_ID"; let title = "Feed Item Title"; let image_url = "http://www.nyan.cat/cats/original.gif"; client.basic_feed_item( account_id, title, image_url, ).body("i figured out how to send messages to monzo from my computer...") .send().await?;
Note
At the time of writing the feed item API doesn't appear to quite match the documentation. 'image url' doesn't appear to do anything
#[must_use]pub fn deposit_into_pot(
&self,
pot_id: &str,
source_account_id: &str,
amount: i64
) -> Deposit
[src]
&self,
pot_id: &str,
source_account_id: &str,
amount: i64
) -> Deposit
Deposit money into a pot
#[must_use]pub fn transactions<'a>(&self, account_id: &'a str) -> List<'a>
[src]
Get a list of transactions
The only required field is the account id, however optional pagination parameters can be supplied.
Example
use monzo::Client; use chrono::{Duration, Utc}; let account_id = "ACCOUNT_ID"; let transactions = client.transactions(account_id) .since(Utc::now() - Duration::days(10)) .limit(10) .send() .await?;
Note
The Monzo API will only return transactions from more than 90 days ago in the first 5 minutes after authorising the Client. You can avoid this by using the 'since' method.
#[must_use]pub fn transaction(&self, transaction_id: &str) -> Get
[src]
Retrieve a transaction by transaction id
Example
use monzo::Client; let transaction_id = "TRANSACTION_ID"; let transactions = client.transaction(transaction_id) .send() .await?;
Note
*The Monzo API will only return transactions from more than 90 days ago in the first 5 minutes after authorising the Client.
pub fn set_access_token(&mut self, access_token: impl Into<String>)
[src]
Manually update the access token
pub fn with_access_token(self, access_token: impl Into<String>) -> Self
[src]
Builder-style method for setting the access token
#[must_use]pub fn http_client(&self) -> &Client
[src]
Return a reference to the internal http client
pub fn set_http_client(&mut self, http_client: Client)
[src]
Swap out the internal http client for your own one.
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,