stripe_core/balance/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Debug, serde::Serialize)]
6struct RetrieveForMyAccountBalanceBuilder {
7    #[serde(skip_serializing_if = "Option::is_none")]
8    expand: Option<Vec<String>>,
9}
10impl RetrieveForMyAccountBalanceBuilder {
11    fn new() -> Self {
12        Self { expand: None }
13    }
14}
15/// Retrieves the current account balance, based on the authentication that was used to make the request.
16/// For a sample request, see [Accounting for negative balances](https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances).
17#[derive(Clone, Debug, serde::Serialize)]
18pub struct RetrieveForMyAccountBalance {
19    inner: RetrieveForMyAccountBalanceBuilder,
20}
21impl RetrieveForMyAccountBalance {
22    /// Construct a new `RetrieveForMyAccountBalance`.
23    pub fn new() -> Self {
24        Self { inner: RetrieveForMyAccountBalanceBuilder::new() }
25    }
26    /// Specifies which fields in the response should be expanded.
27    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
28        self.inner.expand = Some(expand.into());
29        self
30    }
31}
32impl Default for RetrieveForMyAccountBalance {
33    fn default() -> Self {
34        Self::new()
35    }
36}
37impl RetrieveForMyAccountBalance {
38    /// Send the request and return the deserialized response.
39    pub async fn send<C: StripeClient>(
40        &self,
41        client: &C,
42    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
43        self.customize().send(client).await
44    }
45
46    /// Send the request and return the deserialized response, blocking until completion.
47    pub fn send_blocking<C: StripeBlockingClient>(
48        &self,
49        client: &C,
50    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
51        self.customize().send_blocking(client)
52    }
53}
54
55impl StripeRequest for RetrieveForMyAccountBalance {
56    type Output = stripe_core::Balance;
57
58    fn build(&self) -> RequestBuilder {
59        RequestBuilder::new(StripeMethod::Get, "/balance").query(&self.inner)
60    }
61}