coinbase_advanced/models/
account.rs1use serde::{Deserialize, Serialize};
4
5use super::Balance;
6
7#[derive(Debug, Clone, Deserialize)]
9pub struct Account {
10 pub uuid: String,
12 pub name: String,
14 pub currency: String,
16 pub available_balance: Balance,
18 pub default: bool,
20 pub active: bool,
22 pub created_at: String,
24 pub updated_at: String,
26 pub deleted_at: Option<String>,
28 #[serde(rename = "type")]
30 pub account_type: String,
31 pub ready: bool,
33 pub hold: Balance,
35 pub retail_portfolio_id: Option<String>,
37}
38
39#[derive(Debug, Clone, Default, Serialize)]
41pub struct ListAccountsParams {
42 #[serde(skip_serializing_if = "Option::is_none")]
44 pub limit: Option<u32>,
45 #[serde(skip_serializing_if = "Option::is_none")]
47 pub cursor: Option<String>,
48 #[serde(skip_serializing_if = "Option::is_none")]
50 pub retail_portfolio_id: Option<String>,
51}
52
53impl ListAccountsParams {
54 pub fn new() -> Self {
56 Self::default()
57 }
58
59 pub fn limit(mut self, limit: u32) -> Self {
61 self.limit = Some(limit);
62 self
63 }
64
65 pub fn cursor(mut self, cursor: impl Into<String>) -> Self {
67 self.cursor = Some(cursor.into());
68 self
69 }
70
71 pub fn portfolio(mut self, portfolio_id: impl Into<String>) -> Self {
73 self.retail_portfolio_id = Some(portfolio_id.into());
74 self
75 }
76}
77
78#[derive(Debug, Clone, Deserialize)]
80pub struct ListAccountsResponse {
81 pub accounts: Vec<Account>,
83 pub has_next: bool,
85 pub cursor: Option<String>,
87 pub size: Option<u32>,
89}
90
91#[derive(Debug, Clone, Deserialize)]
93pub struct GetAccountResponse {
94 pub account: Account,
96}