stripe_misc/apple_pay_domain/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5/// Delete an apple pay domain.
6#[derive(Clone, Debug, serde::Serialize)]
7pub struct DeleteApplePayDomain {
8    domain: String,
9}
10impl DeleteApplePayDomain {
11    /// Construct a new `DeleteApplePayDomain`.
12    pub fn new(domain: impl Into<String>) -> Self {
13        Self { domain: domain.into() }
14    }
15}
16impl DeleteApplePayDomain {
17    /// Send the request and return the deserialized response.
18    pub async fn send<C: StripeClient>(
19        &self,
20        client: &C,
21    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
22        self.customize().send(client).await
23    }
24
25    /// Send the request and return the deserialized response, blocking until completion.
26    pub fn send_blocking<C: StripeBlockingClient>(
27        &self,
28        client: &C,
29    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
30        self.customize().send_blocking(client)
31    }
32}
33
34impl StripeRequest for DeleteApplePayDomain {
35    type Output = stripe_misc::DeletedApplePayDomain;
36
37    fn build(&self) -> RequestBuilder {
38        let domain = &self.domain;
39        RequestBuilder::new(StripeMethod::Delete, format!("/apple_pay/domains/{domain}"))
40    }
41}
42#[derive(Clone, Debug, serde::Serialize)]
43struct ListApplePayDomainBuilder {
44    #[serde(skip_serializing_if = "Option::is_none")]
45    domain_name: Option<String>,
46    #[serde(skip_serializing_if = "Option::is_none")]
47    ending_before: Option<String>,
48    #[serde(skip_serializing_if = "Option::is_none")]
49    expand: Option<Vec<String>>,
50    #[serde(skip_serializing_if = "Option::is_none")]
51    limit: Option<i64>,
52    #[serde(skip_serializing_if = "Option::is_none")]
53    starting_after: Option<String>,
54}
55impl ListApplePayDomainBuilder {
56    fn new() -> Self {
57        Self {
58            domain_name: None,
59            ending_before: None,
60            expand: None,
61            limit: None,
62            starting_after: None,
63        }
64    }
65}
66/// List apple pay domains.
67#[derive(Clone, Debug, serde::Serialize)]
68pub struct ListApplePayDomain {
69    inner: ListApplePayDomainBuilder,
70}
71impl ListApplePayDomain {
72    /// Construct a new `ListApplePayDomain`.
73    pub fn new() -> Self {
74        Self { inner: ListApplePayDomainBuilder::new() }
75    }
76    pub fn domain_name(mut self, domain_name: impl Into<String>) -> Self {
77        self.inner.domain_name = Some(domain_name.into());
78        self
79    }
80    /// A cursor for use in pagination.
81    /// `ending_before` is an object ID that defines your place in the list.
82    /// 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.
83    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
84        self.inner.ending_before = Some(ending_before.into());
85        self
86    }
87    /// Specifies which fields in the response should be expanded.
88    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
89        self.inner.expand = Some(expand.into());
90        self
91    }
92    /// A limit on the number of objects to be returned.
93    /// Limit can range between 1 and 100, and the default is 10.
94    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
95        self.inner.limit = Some(limit.into());
96        self
97    }
98    /// A cursor for use in pagination.
99    /// `starting_after` is an object ID that defines your place in the list.
100    /// 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.
101    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
102        self.inner.starting_after = Some(starting_after.into());
103        self
104    }
105}
106impl Default for ListApplePayDomain {
107    fn default() -> Self {
108        Self::new()
109    }
110}
111impl ListApplePayDomain {
112    /// Send the request and return the deserialized response.
113    pub async fn send<C: StripeClient>(
114        &self,
115        client: &C,
116    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
117        self.customize().send(client).await
118    }
119
120    /// Send the request and return the deserialized response, blocking until completion.
121    pub fn send_blocking<C: StripeBlockingClient>(
122        &self,
123        client: &C,
124    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
125        self.customize().send_blocking(client)
126    }
127
128    pub fn paginate(
129        &self,
130    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_misc::ApplePayDomain>> {
131        stripe_client_core::ListPaginator::new_list("/apple_pay/domains", &self.inner)
132    }
133}
134
135impl StripeRequest for ListApplePayDomain {
136    type Output = stripe_types::List<stripe_misc::ApplePayDomain>;
137
138    fn build(&self) -> RequestBuilder {
139        RequestBuilder::new(StripeMethod::Get, "/apple_pay/domains").query(&self.inner)
140    }
141}
142#[derive(Clone, Debug, serde::Serialize)]
143struct RetrieveApplePayDomainBuilder {
144    #[serde(skip_serializing_if = "Option::is_none")]
145    expand: Option<Vec<String>>,
146}
147impl RetrieveApplePayDomainBuilder {
148    fn new() -> Self {
149        Self { expand: None }
150    }
151}
152/// Retrieve an apple pay domain.
153#[derive(Clone, Debug, serde::Serialize)]
154pub struct RetrieveApplePayDomain {
155    inner: RetrieveApplePayDomainBuilder,
156    domain: String,
157}
158impl RetrieveApplePayDomain {
159    /// Construct a new `RetrieveApplePayDomain`.
160    pub fn new(domain: impl Into<String>) -> Self {
161        Self { domain: domain.into(), inner: RetrieveApplePayDomainBuilder::new() }
162    }
163    /// Specifies which fields in the response should be expanded.
164    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
165        self.inner.expand = Some(expand.into());
166        self
167    }
168}
169impl RetrieveApplePayDomain {
170    /// Send the request and return the deserialized response.
171    pub async fn send<C: StripeClient>(
172        &self,
173        client: &C,
174    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
175        self.customize().send(client).await
176    }
177
178    /// Send the request and return the deserialized response, blocking until completion.
179    pub fn send_blocking<C: StripeBlockingClient>(
180        &self,
181        client: &C,
182    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
183        self.customize().send_blocking(client)
184    }
185}
186
187impl StripeRequest for RetrieveApplePayDomain {
188    type Output = stripe_misc::ApplePayDomain;
189
190    fn build(&self) -> RequestBuilder {
191        let domain = &self.domain;
192        RequestBuilder::new(StripeMethod::Get, format!("/apple_pay/domains/{domain}"))
193            .query(&self.inner)
194    }
195}
196#[derive(Clone, Debug, serde::Serialize)]
197struct CreateApplePayDomainBuilder {
198    domain_name: String,
199    #[serde(skip_serializing_if = "Option::is_none")]
200    expand: Option<Vec<String>>,
201}
202impl CreateApplePayDomainBuilder {
203    fn new(domain_name: impl Into<String>) -> Self {
204        Self { domain_name: domain_name.into(), expand: None }
205    }
206}
207/// Create an apple pay domain.
208#[derive(Clone, Debug, serde::Serialize)]
209pub struct CreateApplePayDomain {
210    inner: CreateApplePayDomainBuilder,
211}
212impl CreateApplePayDomain {
213    /// Construct a new `CreateApplePayDomain`.
214    pub fn new(domain_name: impl Into<String>) -> Self {
215        Self { inner: CreateApplePayDomainBuilder::new(domain_name.into()) }
216    }
217    /// Specifies which fields in the response should be expanded.
218    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
219        self.inner.expand = Some(expand.into());
220        self
221    }
222}
223impl CreateApplePayDomain {
224    /// Send the request and return the deserialized response.
225    pub async fn send<C: StripeClient>(
226        &self,
227        client: &C,
228    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
229        self.customize().send(client).await
230    }
231
232    /// Send the request and return the deserialized response, blocking until completion.
233    pub fn send_blocking<C: StripeBlockingClient>(
234        &self,
235        client: &C,
236    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
237        self.customize().send_blocking(client)
238    }
239}
240
241impl StripeRequest for CreateApplePayDomain {
242    type Output = stripe_misc::ApplePayDomain;
243
244    fn build(&self) -> RequestBuilder {
245        RequestBuilder::new(StripeMethod::Post, "/apple_pay/domains").form(&self.inner)
246    }
247}