stripe_core/setup_attempt/
requests.rs1use stripe_client_core::{
2 RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Debug, serde::Serialize)]
6struct ListSetupAttemptBuilder {
7 #[serde(skip_serializing_if = "Option::is_none")]
8 created: Option<stripe_types::RangeQueryTs>,
9 #[serde(skip_serializing_if = "Option::is_none")]
10 ending_before: Option<String>,
11 #[serde(skip_serializing_if = "Option::is_none")]
12 expand: Option<Vec<String>>,
13 #[serde(skip_serializing_if = "Option::is_none")]
14 limit: Option<i64>,
15 setup_intent: String,
16 #[serde(skip_serializing_if = "Option::is_none")]
17 starting_after: Option<String>,
18}
19impl ListSetupAttemptBuilder {
20 fn new(setup_intent: impl Into<String>) -> Self {
21 Self {
22 created: None,
23 ending_before: None,
24 expand: None,
25 limit: None,
26 setup_intent: setup_intent.into(),
27 starting_after: None,
28 }
29 }
30}
31#[derive(Clone, Debug, serde::Serialize)]
33pub struct ListSetupAttempt {
34 inner: ListSetupAttemptBuilder,
35}
36impl ListSetupAttempt {
37 pub fn new(setup_intent: impl Into<String>) -> Self {
39 Self { inner: ListSetupAttemptBuilder::new(setup_intent.into()) }
40 }
41 pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
45 self.inner.created = Some(created.into());
46 self
47 }
48 pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
52 self.inner.ending_before = Some(ending_before.into());
53 self
54 }
55 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
57 self.inner.expand = Some(expand.into());
58 self
59 }
60 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
63 self.inner.limit = Some(limit.into());
64 self
65 }
66 pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
70 self.inner.starting_after = Some(starting_after.into());
71 self
72 }
73}
74impl ListSetupAttempt {
75 pub async fn send<C: StripeClient>(
77 &self,
78 client: &C,
79 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
80 self.customize().send(client).await
81 }
82
83 pub fn send_blocking<C: StripeBlockingClient>(
85 &self,
86 client: &C,
87 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
88 self.customize().send_blocking(client)
89 }
90
91 pub fn paginate(
92 &self,
93 ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::SetupAttempt>> {
94 stripe_client_core::ListPaginator::new_list("/setup_attempts", &self.inner)
95 }
96}
97
98impl StripeRequest for ListSetupAttempt {
99 type Output = stripe_types::List<stripe_shared::SetupAttempt>;
100
101 fn build(&self) -> RequestBuilder {
102 RequestBuilder::new(StripeMethod::Get, "/setup_attempts").query(&self.inner)
103 }
104}