feat: Add full account representations
Having all details available is useful. For Firefly III some fields like current balance are left out, because they are not strictly account metadata, but are a result of the transactions in the account.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::models::{
|
||||
Account, EndUserAgreement, PaginatedResponse, Requisition, TokenResponse, TransactionsResponse,
|
||||
Account, AccountDetail, EndUserAgreement, PaginatedResponse, Requisition, TokenResponse,
|
||||
TransactionsResponse,
|
||||
};
|
||||
use reqwest::Url;
|
||||
use reqwest_middleware::ClientWithMiddleware;
|
||||
@@ -147,6 +148,14 @@ impl GoCardlessClient {
|
||||
self.get_authenticated(url).await
|
||||
}
|
||||
|
||||
#[instrument(skip(self))]
|
||||
pub async fn get_account_details(&self, id: &str) -> Result<AccountDetail, GoCardlessError> {
|
||||
let url = self
|
||||
.base_url
|
||||
.join(&format!("/api/v2/accounts/{}/details/", id))?;
|
||||
self.get_authenticated(url).await
|
||||
}
|
||||
|
||||
#[instrument(skip(self))]
|
||||
pub async fn get_transactions(
|
||||
&self,
|
||||
|
||||
@@ -42,6 +42,33 @@ pub struct Account {
|
||||
pub iban: Option<String>,
|
||||
pub institution_id: Option<String>,
|
||||
pub status: Option<String>,
|
||||
pub owner_name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AccountDetail {
|
||||
pub account: DetailSchema,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct DetailSchema {
|
||||
pub resource_id: Option<String>,
|
||||
pub iban: Option<String>,
|
||||
pub bban: Option<String>,
|
||||
pub pan: Option<String>,
|
||||
pub masked_pan: Option<String>,
|
||||
pub msisdn: Option<String>,
|
||||
pub currency: Option<String>,
|
||||
pub owner_name: Option<String>,
|
||||
pub name: Option<String>,
|
||||
pub display_name: Option<String>,
|
||||
pub product: Option<String>,
|
||||
pub cash_account_type: Option<String>,
|
||||
pub status: Option<String>,
|
||||
pub bic: Option<String>,
|
||||
pub linked_accounts: Option<String>,
|
||||
pub usage: Option<String>,
|
||||
pub details: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user