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:
2025-11-27 22:28:27 +01:00
parent 334f6ce277
commit ef0c483ee7
3 changed files with 73 additions and 1 deletions

View File

@@ -13,6 +13,42 @@ pub struct Account {
#[serde(rename = "type")] #[serde(rename = "type")]
pub account_type: String, pub account_type: String,
pub active: Option<bool>, pub active: Option<bool>,
pub order: Option<i32>,
pub created_at: Option<String>,
pub updated_at: Option<String>,
pub account_role: Option<String>,
pub object_group_id: Option<String>,
pub object_group_title: Option<String>,
pub object_group_order: Option<i32>,
pub currency_id: Option<String>,
pub currency_name: Option<String>,
pub currency_code: Option<String>,
pub currency_symbol: Option<String>,
pub currency_decimal_places: Option<i32>,
pub primary_currency_id: Option<String>,
pub primary_currency_name: Option<String>,
pub primary_currency_code: Option<String>,
pub primary_currency_symbol: Option<String>,
pub primary_currency_decimal_places: Option<i32>,
pub opening_balance: Option<String>,
pub pc_opening_balance: Option<String>,
pub debt_amount: Option<String>,
pub pc_debt_amount: Option<String>,
pub notes: Option<String>,
pub monthly_payment_date: Option<String>,
pub credit_card_type: Option<String>,
pub account_number: Option<String>,
pub bic: Option<String>,
pub opening_balance_date: Option<String>,
pub liability_type: Option<String>,
pub liability_direction: Option<String>,
pub interest: Option<String>,
pub interest_period: Option<String>,
pub include_net_worth: Option<bool>,
pub longitude: Option<f64>,
pub latitude: Option<f64>,
pub zoom_level: Option<i32>,
pub last_activity: Option<String>,
} }
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]

View File

@@ -1,5 +1,6 @@
use crate::models::{ use crate::models::{
Account, EndUserAgreement, PaginatedResponse, Requisition, TokenResponse, TransactionsResponse, Account, AccountDetail, EndUserAgreement, PaginatedResponse, Requisition, TokenResponse,
TransactionsResponse,
}; };
use reqwest::Url; use reqwest::Url;
use reqwest_middleware::ClientWithMiddleware; use reqwest_middleware::ClientWithMiddleware;
@@ -147,6 +148,14 @@ impl GoCardlessClient {
self.get_authenticated(url).await 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))] #[instrument(skip(self))]
pub async fn get_transactions( pub async fn get_transactions(
&self, &self,

View File

@@ -42,6 +42,33 @@ pub struct Account {
pub iban: Option<String>, pub iban: Option<String>,
pub institution_id: Option<String>, pub institution_id: Option<String>,
pub status: 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)] #[derive(Debug, Clone, Serialize, Deserialize)]