use stripe_client_core::{
RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
};
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct ListSetupAttemptBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
created: Option<stripe_types::RangeQueryTs>,
#[serde(skip_serializing_if = "Option::is_none")]
ending_before: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
setup_intent: String,
#[serde(skip_serializing_if = "Option::is_none")]
starting_after: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListSetupAttemptBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListSetupAttemptBuilder").finish_non_exhaustive()
}
}
impl ListSetupAttemptBuilder {
fn new(setup_intent: impl Into<String>) -> Self {
Self {
created: None,
ending_before: None,
expand: None,
limit: None,
setup_intent: setup_intent.into(),
starting_after: None,
}
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ListSetupAttempt {
inner: ListSetupAttemptBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListSetupAttempt {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListSetupAttempt").finish_non_exhaustive()
}
}
impl ListSetupAttempt {
pub fn new(setup_intent: impl Into<String>) -> Self {
Self { inner: ListSetupAttemptBuilder::new(setup_intent.into()) }
}
pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
self.inner.created = Some(created.into());
self
}
pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
self.inner.ending_before = Some(ending_before.into());
self
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
pub fn limit(mut self, limit: impl Into<i64>) -> Self {
self.inner.limit = Some(limit.into());
self
}
pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
self.inner.starting_after = Some(starting_after.into());
self
}
}
impl ListSetupAttempt {
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
pub fn paginate(
&self,
) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::SetupAttempt>> {
stripe_client_core::ListPaginator::new_list("/setup_attempts", &self.inner)
}
}
impl StripeRequest for ListSetupAttempt {
type Output = stripe_types::List<stripe_shared::SetupAttempt>;
fn build(&self) -> RequestBuilder {
RequestBuilder::new(StripeMethod::Get, "/setup_attempts").query(&self.inner)
}
}