stripe2 32.0.0

Stripe client, generated from the OpenAPI spec.
Documentation
use serde_json::json;
use crate::model::*;
use crate::FluentRequest;
use serde::{Serialize, Deserialize};
use httpclient::InMemoryResponseExt;
use crate::StripeClient;
/**You should use this struct via [`StripeClient::get_balance_transactions`].

On request success, this will return a [`GetBalanceTransactionsResponse`].*/
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetBalanceTransactionsRequest {
    pub created: Option<serde_json::Value>,
    pub currency: Option<String>,
    pub ending_before: Option<String>,
    pub expand: Option<Vec<String>>,
    pub limit: Option<i64>,
    pub payout: Option<String>,
    pub source: Option<String>,
    pub starting_after: Option<String>,
    pub type_: Option<String>,
}
impl GetBalanceTransactionsRequest {}
impl FluentRequest<'_, GetBalanceTransactionsRequest> {
    pub fn created(mut self, created: serde_json::Value) -> Self {
        self.params.created = Some(created);
        self
    }
    pub fn currency(mut self, currency: &str) -> Self {
        self.params.currency = Some(currency.to_owned());
        self
    }
    pub fn ending_before(mut self, ending_before: &str) -> Self {
        self.params.ending_before = Some(ending_before.to_owned());
        self
    }
    pub fn expand(mut self, expand: impl IntoIterator<Item = impl AsRef<str>>) -> Self {
        self
            .params
            .expand = Some(expand.into_iter().map(|s| s.as_ref().to_owned()).collect());
        self
    }
    pub fn limit(mut self, limit: i64) -> Self {
        self.params.limit = Some(limit);
        self
    }
    pub fn payout(mut self, payout: &str) -> Self {
        self.params.payout = Some(payout.to_owned());
        self
    }
    pub fn source(mut self, source: &str) -> Self {
        self.params.source = Some(source.to_owned());
        self
    }
    pub fn starting_after(mut self, starting_after: &str) -> Self {
        self.params.starting_after = Some(starting_after.to_owned());
        self
    }
    pub fn type_(mut self, type_: &str) -> Self {
        self.params.type_ = Some(type_.to_owned());
        self
    }
}
impl<'a> ::std::future::IntoFuture for FluentRequest<'a, GetBalanceTransactionsRequest> {
    type Output = httpclient::InMemoryResult<GetBalanceTransactionsResponse>;
    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
    fn into_future(self) -> Self::IntoFuture {
        Box::pin(async move {
            let url = "/v1/balance_transactions";
            let mut r = self.client.client.get(url);
            r = r.set_query(self.params);
            r = self.client.authenticate(r);
            let res = r.await?;
            res.json().map_err(Into::into)
        })
    }
}