monzo/endpoints/
balance.rs1use serde::Deserialize;
4
5#[derive(Deserialize, Debug)]
7#[must_use]
8pub struct Balance {
9 pub balance: i64,
12
13 pub total_balance: i64,
16
17 pub currency: String,
19
20 pub spend_today: i64,
22}
23
24pub use get::Request as Get;
25mod get {
26 use serde::Serialize;
27
28 use crate::endpoints::Endpoint;
29
30 pub struct Request<'a> {
32 query: Query<'a>,
33 }
34
35 impl<'a> Request<'a> {
36 pub(crate) const fn new(account_id: &'a str) -> Self {
37 let query = Query { account_id };
38 Self { query }
39 }
40 }
41
42 impl Endpoint for Request<'_> {
43 const METHOD: reqwest::Method = reqwest::Method::GET;
44
45 fn endpoint(&self) -> &'static str {
46 "/balance"
47 }
48
49 fn query(&self) -> Option<&dyn erased_serde::Serialize> {
50 Some(&self.query)
51 }
52 }
53
54 #[derive(Debug, Serialize)]
55 struct Query<'a> {
56 account_id: &'a str,
57 }
58}