circle_api/models/
wallet_balance.rs1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4#[derive(Serialize, Debug, Default)]
5#[serde(rename_all = "camelCase")]
6pub struct WalletBalanceQueryParams {
7 include_all: Option<bool>,
8 name: Option<String>,
9 token_address: Option<String>,
10 standard: Option<String>,
11 from: Option<DateTime<Utc>>,
12 to: Option<DateTime<Utc>>,
13 page_before: Option<String>,
14 page_after: Option<String>,
15 page_size: Option<u64>,
16}
17
18pub type WalletBalanceQueryParamsBuilder = WalletBalanceQueryParams;
19
20impl WalletBalanceQueryParamsBuilder {
21 pub fn include_all(mut self, value: bool) -> Self {
22 self.include_all = Some(value);
23 self
24 }
25
26 pub fn name<S: Into<String>>(mut self, value: S) -> Self {
27 self.name = Some(value.into());
28 self
29 }
30
31 pub fn token_address<S: Into<String>>(mut self, value: S) -> Self {
32 self.token_address = Some(value.into());
33 self
34 }
35
36 pub fn standard<S: Into<String>>(mut self, value: S) -> Self {
37 self.standard = Some(value.into());
38 self
39 }
40
41 pub fn from(mut self, value: DateTime<Utc>) -> Self {
42 self.from = Some(value);
43 self
44 }
45
46 pub fn to(mut self, value: DateTime<Utc>) -> Self {
47 self.to = Some(value);
48 self
49 }
50
51 pub fn page_before<S: Into<String>>(mut self, value: S) -> Self {
52 self.page_before = Some(value.into());
53 self
54 }
55
56 pub fn page_after<S: Into<String>>(mut self, value: S) -> Self {
57 self.page_after = Some(value.into());
58 self
59 }
60
61 pub fn page_size(mut self, value: u64) -> Self {
62 self.page_size = Some(value);
63 self
64 }
65
66 pub fn build(self) -> WalletBalanceQueryParams {
67 WalletBalanceQueryParams {
68 include_all: self.include_all,
69 name: self.name,
70 token_address: self.token_address,
71 standard: self.standard,
72 from: self.from,
73 to: self.to,
74 page_before: self.page_before,
75 page_after: self.page_after,
76 page_size: self.page_size,
77 }
78 }
79}
80
81#[derive(Deserialize, Debug)]
82#[serde(rename_all = "camelCase")]
83pub struct TokenBalance {
84 pub amount: String,
85 pub token: TokenInfo,
86 pub update_date: DateTime<Utc>,
87}
88
89#[derive(Deserialize, Debug)]
90#[serde(rename_all = "camelCase")]
91pub struct TokenInfo {
92 pub id: String,
93 pub name: Option<String>,
94 pub standard: Option<String>,
95 pub blockchain: String,
96 pub decimals: Option<i32>,
97 pub is_native: bool,
98 pub symbol: Option<String>,
99 pub token_address: Option<String>,
100 pub create_date: DateTime<Utc>,
101 pub update_date: DateTime<Utc>,
102}
103
104#[derive(Deserialize, Debug)]
105#[serde(rename_all = "camelCase")]
106pub struct WalletBalanceResponse {
107 pub token_balances: Vec<TokenBalance>,
108}