stripe_product/tax_code/
requests.rs1use 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 ListTaxCodeBuilder {
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}
18#[cfg(feature = "redact-generated-debug")]
19impl std::fmt::Debug for ListTaxCodeBuilder {
20 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
21 f.debug_struct("ListTaxCodeBuilder").finish_non_exhaustive()
22 }
23}
24impl ListTaxCodeBuilder {
25 fn new() -> Self {
26 Self { ending_before: None, expand: None, limit: None, starting_after: None }
27 }
28}
29#[derive(Clone)]
31#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
32#[derive(serde::Serialize)]
33pub struct ListTaxCode {
34 inner: ListTaxCodeBuilder,
35}
36#[cfg(feature = "redact-generated-debug")]
37impl std::fmt::Debug for ListTaxCode {
38 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
39 f.debug_struct("ListTaxCode").finish_non_exhaustive()
40 }
41}
42impl ListTaxCode {
43 pub fn new() -> Self {
45 Self { inner: ListTaxCodeBuilder::new() }
46 }
47 pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
51 self.inner.ending_before = Some(ending_before.into());
52 self
53 }
54 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
56 self.inner.expand = Some(expand.into());
57 self
58 }
59 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
62 self.inner.limit = Some(limit.into());
63 self
64 }
65 pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
69 self.inner.starting_after = Some(starting_after.into());
70 self
71 }
72}
73impl Default for ListTaxCode {
74 fn default() -> Self {
75 Self::new()
76 }
77}
78impl ListTaxCode {
79 pub async fn send<C: StripeClient>(
81 &self,
82 client: &C,
83 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
84 self.customize().send(client).await
85 }
86
87 pub fn send_blocking<C: StripeBlockingClient>(
89 &self,
90 client: &C,
91 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
92 self.customize().send_blocking(client)
93 }
94
95 pub fn paginate(
96 &self,
97 ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::TaxCode>> {
98 stripe_client_core::ListPaginator::new_list("/tax_codes", &self.inner)
99 }
100}
101
102impl StripeRequest for ListTaxCode {
103 type Output = stripe_types::List<stripe_shared::TaxCode>;
104
105 fn build(&self) -> RequestBuilder {
106 RequestBuilder::new(StripeMethod::Get, "/tax_codes").query(&self.inner)
107 }
108}
109#[derive(Clone, Eq, PartialEq)]
110#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
111#[derive(serde::Serialize)]
112struct RetrieveTaxCodeBuilder {
113 #[serde(skip_serializing_if = "Option::is_none")]
114 expand: Option<Vec<String>>,
115}
116#[cfg(feature = "redact-generated-debug")]
117impl std::fmt::Debug for RetrieveTaxCodeBuilder {
118 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
119 f.debug_struct("RetrieveTaxCodeBuilder").finish_non_exhaustive()
120 }
121}
122impl RetrieveTaxCodeBuilder {
123 fn new() -> Self {
124 Self { expand: None }
125 }
126}
127#[derive(Clone)]
130#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
131#[derive(serde::Serialize)]
132pub struct RetrieveTaxCode {
133 inner: RetrieveTaxCodeBuilder,
134 id: stripe_shared::TaxCodeId,
135}
136#[cfg(feature = "redact-generated-debug")]
137impl std::fmt::Debug for RetrieveTaxCode {
138 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
139 f.debug_struct("RetrieveTaxCode").finish_non_exhaustive()
140 }
141}
142impl RetrieveTaxCode {
143 pub fn new(id: impl Into<stripe_shared::TaxCodeId>) -> Self {
145 Self { id: id.into(), inner: RetrieveTaxCodeBuilder::new() }
146 }
147 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
149 self.inner.expand = Some(expand.into());
150 self
151 }
152}
153impl RetrieveTaxCode {
154 pub async fn send<C: StripeClient>(
156 &self,
157 client: &C,
158 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
159 self.customize().send(client).await
160 }
161
162 pub fn send_blocking<C: StripeBlockingClient>(
164 &self,
165 client: &C,
166 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
167 self.customize().send_blocking(client)
168 }
169}
170
171impl StripeRequest for RetrieveTaxCode {
172 type Output = stripe_shared::TaxCode;
173
174 fn build(&self) -> RequestBuilder {
175 let id = &self.id;
176 RequestBuilder::new(StripeMethod::Get, format!("/tax_codes/{id}")).query(&self.inner)
177 }
178}