1#[cfg(feature = "decimal")]
2use rust_decimal::Decimal;
3
4use super::*;
5
6#[derive(Debug, Serialize)]
7pub struct GetAccountsRequest<'a, T: AsRef<str>> {
8 pub access_token: T,
9 #[serde(skip_serializing_if = "Option::is_none")]
10 pub options: Option<GetAccountsRequestFilter<'a, T>>,
11}
12
13#[derive(Debug, Serialize)]
14pub struct GetAccountsRequestFilter<'a, T: AsRef<str>> {
15 pub account_ids: &'a [T],
16}
17
18impl<T: AsRef<str> + HttpSerialize> Endpoint for GetAccountsRequest<'_, T> {
19 type Response = GetAccountsResponse;
20
21 fn path(&self) -> String {
22 "/accounts/get".into()
23 }
24}
25
26#[derive(Debug, Deserialize, Serialize)]
27pub struct GetAccountsResponse {
28 pub accounts: Vec<Account>,
29 pub item: Item,
30 pub request_id: String,
31}
32
33#[derive(Debug, Deserialize, Serialize)]
34pub struct Account {
35 pub account_id: String,
36 pub balances: Balance,
37 pub mask: Option<String>,
38 pub name: String,
39 pub official_name: Option<String>,
40 pub r#type: AccountType,
42 pub subtype: Option<String>,
43 #[serde(skip_serializing_if = "Option::is_none")]
47 pub verification_status: Option<String>,
48}
49
50#[derive(Debug, Deserialize, Serialize, Eq, PartialEq, Clone, Copy)]
51pub enum AccountType {
52 #[serde(rename = "investment")]
53 Investment,
54 #[serde(rename = "credit")]
55 Credit,
56 #[serde(rename = "depository")]
57 Depository,
58 #[serde(rename = "loan")]
59 Loan,
60 #[serde(rename = "brokerage")]
61 Brokerage,
62 #[serde(rename = "other")]
63 Other,
64}
65
66#[derive(Debug, Deserialize, Serialize)]
67pub struct Balance {
68 #[cfg(not(feature = "decimal"))]
69 pub available: Option<f64>,
70 #[cfg(not(feature = "decimal"))]
71 pub current: Option<f64>,
72 #[cfg(feature = "decimal")]
73 pub available: Option<Decimal>,
74 #[cfg(feature = "decimal")]
75 pub current: Option<Decimal>,
76 pub iso_currency_code: Option<String>,
77 #[cfg(feature = "decimal")]
78 pub limit: Option<Decimal>,
79 #[cfg(not(feature = "decimal"))]
80 pub limit: Option<f64>,
81 pub unofficial_currency_code: Option<String>,
82}