Skip to main content

stripe_issuing/issuing_physical_bundle/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Eq, PartialEq)]
6#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
7#[derive(serde::Serialize)]
8struct ListIssuingPhysicalBundleBuilder {
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    #[serde(skip_serializing_if = "Option::is_none")]
16    starting_after: Option<String>,
17    #[serde(skip_serializing_if = "Option::is_none")]
18    status: Option<stripe_shared::IssuingPhysicalBundleStatus>,
19    #[serde(rename = "type")]
20    #[serde(skip_serializing_if = "Option::is_none")]
21    type_: Option<stripe_shared::IssuingPhysicalBundleType>,
22}
23#[cfg(feature = "redact-generated-debug")]
24impl std::fmt::Debug for ListIssuingPhysicalBundleBuilder {
25    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
26        f.debug_struct("ListIssuingPhysicalBundleBuilder").finish_non_exhaustive()
27    }
28}
29impl ListIssuingPhysicalBundleBuilder {
30    fn new() -> Self {
31        Self {
32            ending_before: None,
33            expand: None,
34            limit: None,
35            starting_after: None,
36            status: None,
37            type_: None,
38        }
39    }
40}
41/// Returns a list of physical bundle objects.
42/// The objects are sorted in descending order by creation date, with the most recently created object appearing first.
43#[derive(Clone)]
44#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
45#[derive(serde::Serialize)]
46pub struct ListIssuingPhysicalBundle {
47    inner: ListIssuingPhysicalBundleBuilder,
48}
49#[cfg(feature = "redact-generated-debug")]
50impl std::fmt::Debug for ListIssuingPhysicalBundle {
51    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
52        f.debug_struct("ListIssuingPhysicalBundle").finish_non_exhaustive()
53    }
54}
55impl ListIssuingPhysicalBundle {
56    /// Construct a new `ListIssuingPhysicalBundle`.
57    pub fn new() -> Self {
58        Self { inner: ListIssuingPhysicalBundleBuilder::new() }
59    }
60    /// A cursor for use in pagination.
61    /// `ending_before` is an object ID that defines your place in the list.
62    /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
63    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
64        self.inner.ending_before = Some(ending_before.into());
65        self
66    }
67    /// Specifies which fields in the response should be expanded.
68    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
69        self.inner.expand = Some(expand.into());
70        self
71    }
72    /// A limit on the number of objects to be returned.
73    /// Limit can range between 1 and 100, and the default is 10.
74    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
75        self.inner.limit = Some(limit.into());
76        self
77    }
78    /// A cursor for use in pagination.
79    /// `starting_after` is an object ID that defines your place in the list.
80    /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
81    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
82        self.inner.starting_after = Some(starting_after.into());
83        self
84    }
85    /// Only return physical bundles with the given status.
86    pub fn status(mut self, status: impl Into<stripe_shared::IssuingPhysicalBundleStatus>) -> Self {
87        self.inner.status = Some(status.into());
88        self
89    }
90    /// Only return physical bundles with the given type.
91    pub fn type_(mut self, type_: impl Into<stripe_shared::IssuingPhysicalBundleType>) -> Self {
92        self.inner.type_ = Some(type_.into());
93        self
94    }
95}
96impl Default for ListIssuingPhysicalBundle {
97    fn default() -> Self {
98        Self::new()
99    }
100}
101impl ListIssuingPhysicalBundle {
102    /// Send the request and return the deserialized response.
103    pub async fn send<C: StripeClient>(
104        &self,
105        client: &C,
106    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
107        self.customize().send(client).await
108    }
109
110    /// Send the request and return the deserialized response, blocking until completion.
111    pub fn send_blocking<C: StripeBlockingClient>(
112        &self,
113        client: &C,
114    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
115        self.customize().send_blocking(client)
116    }
117
118    pub fn paginate(
119        &self,
120    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::IssuingPhysicalBundle>>
121    {
122        stripe_client_core::ListPaginator::new_list("/issuing/physical_bundles", &self.inner)
123    }
124}
125
126impl StripeRequest for ListIssuingPhysicalBundle {
127    type Output = stripe_types::List<stripe_shared::IssuingPhysicalBundle>;
128
129    fn build(&self) -> RequestBuilder {
130        RequestBuilder::new(StripeMethod::Get, "/issuing/physical_bundles").query(&self.inner)
131    }
132}
133#[derive(Clone, Eq, PartialEq)]
134#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
135#[derive(serde::Serialize)]
136struct RetrieveIssuingPhysicalBundleBuilder {
137    #[serde(skip_serializing_if = "Option::is_none")]
138    expand: Option<Vec<String>>,
139}
140#[cfg(feature = "redact-generated-debug")]
141impl std::fmt::Debug for RetrieveIssuingPhysicalBundleBuilder {
142    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
143        f.debug_struct("RetrieveIssuingPhysicalBundleBuilder").finish_non_exhaustive()
144    }
145}
146impl RetrieveIssuingPhysicalBundleBuilder {
147    fn new() -> Self {
148        Self { expand: None }
149    }
150}
151/// Retrieves a physical bundle object.
152#[derive(Clone)]
153#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
154#[derive(serde::Serialize)]
155pub struct RetrieveIssuingPhysicalBundle {
156    inner: RetrieveIssuingPhysicalBundleBuilder,
157    physical_bundle: stripe_shared::IssuingPhysicalBundleId,
158}
159#[cfg(feature = "redact-generated-debug")]
160impl std::fmt::Debug for RetrieveIssuingPhysicalBundle {
161    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
162        f.debug_struct("RetrieveIssuingPhysicalBundle").finish_non_exhaustive()
163    }
164}
165impl RetrieveIssuingPhysicalBundle {
166    /// Construct a new `RetrieveIssuingPhysicalBundle`.
167    pub fn new(physical_bundle: impl Into<stripe_shared::IssuingPhysicalBundleId>) -> Self {
168        Self {
169            physical_bundle: physical_bundle.into(),
170            inner: RetrieveIssuingPhysicalBundleBuilder::new(),
171        }
172    }
173    /// Specifies which fields in the response should be expanded.
174    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
175        self.inner.expand = Some(expand.into());
176        self
177    }
178}
179impl RetrieveIssuingPhysicalBundle {
180    /// Send the request and return the deserialized response.
181    pub async fn send<C: StripeClient>(
182        &self,
183        client: &C,
184    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
185        self.customize().send(client).await
186    }
187
188    /// Send the request and return the deserialized response, blocking until completion.
189    pub fn send_blocking<C: StripeBlockingClient>(
190        &self,
191        client: &C,
192    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
193        self.customize().send_blocking(client)
194    }
195}
196
197impl StripeRequest for RetrieveIssuingPhysicalBundle {
198    type Output = stripe_shared::IssuingPhysicalBundle;
199
200    fn build(&self) -> RequestBuilder {
201        let physical_bundle = &self.physical_bundle;
202        RequestBuilder::new(
203            StripeMethod::Get,
204            format!("/issuing/physical_bundles/{physical_bundle}"),
205        )
206        .query(&self.inner)
207    }
208}