use serde::{Serialize, Deserialize};
use super::{AccountBase, Item, Transaction};
///TransactionsGetResponse defines the response schema for `/transactions/get`
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TransactionsGetResponse {
///An array containing the `accounts` associated with the Item for which transactions are being returned. Each transaction can be mapped to its corresponding account via the `account_id` field.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub accounts: Vec<AccountBase>,
///Metadata about the Item.
pub item: Item,
///A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.
pub request_id: String,
///The total number of transactions available within the date range specified. If `total_transactions` is larger than the size of the `transactions` array, more transactions are available and can be fetched via manipulating the `offset` parameter.
pub total_transactions: i64,
///An array containing transactions from the account. Transactions are returned in reverse chronological order, with the most recent at the beginning of the array. The maximum number of transactions returned is determined by the `count` parameter.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub transactions: Vec<Transaction>,
}
impl std::fmt::Display for TransactionsGetResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(f, "{}", serde_json::to_string(self).unwrap())
}
}