stripe_misc/identity_verification_report/
requests.rs1use stripe_client_core::{
2 RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Debug, serde::Serialize)]
6struct ListIdentityVerificationReportBuilder {
7 #[serde(skip_serializing_if = "Option::is_none")]
8 client_reference_id: Option<String>,
9 #[serde(skip_serializing_if = "Option::is_none")]
10 created: Option<stripe_types::RangeQueryTs>,
11 #[serde(skip_serializing_if = "Option::is_none")]
12 ending_before: Option<String>,
13 #[serde(skip_serializing_if = "Option::is_none")]
14 expand: Option<Vec<String>>,
15 #[serde(skip_serializing_if = "Option::is_none")]
16 limit: Option<i64>,
17 #[serde(skip_serializing_if = "Option::is_none")]
18 starting_after: Option<String>,
19 #[serde(rename = "type")]
20 #[serde(skip_serializing_if = "Option::is_none")]
21 type_: Option<ListIdentityVerificationReportType>,
22 #[serde(skip_serializing_if = "Option::is_none")]
23 verification_session: Option<String>,
24}
25impl ListIdentityVerificationReportBuilder {
26 fn new() -> Self {
27 Self {
28 client_reference_id: None,
29 created: None,
30 ending_before: None,
31 expand: None,
32 limit: None,
33 starting_after: None,
34 type_: None,
35 verification_session: None,
36 }
37 }
38}
39#[derive(Clone, Eq, PartialEq)]
41#[non_exhaustive]
42pub enum ListIdentityVerificationReportType {
43 Document,
44 IdNumber,
45 Unknown(String),
47}
48impl ListIdentityVerificationReportType {
49 pub fn as_str(&self) -> &str {
50 use ListIdentityVerificationReportType::*;
51 match self {
52 Document => "document",
53 IdNumber => "id_number",
54 Unknown(v) => v,
55 }
56 }
57}
58
59impl std::str::FromStr for ListIdentityVerificationReportType {
60 type Err = std::convert::Infallible;
61 fn from_str(s: &str) -> Result<Self, Self::Err> {
62 use ListIdentityVerificationReportType::*;
63 match s {
64 "document" => Ok(Document),
65 "id_number" => Ok(IdNumber),
66 v => {
67 tracing::warn!(
68 "Unknown value '{}' for enum '{}'",
69 v,
70 "ListIdentityVerificationReportType"
71 );
72 Ok(Unknown(v.to_owned()))
73 }
74 }
75 }
76}
77impl std::fmt::Display for ListIdentityVerificationReportType {
78 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
79 f.write_str(self.as_str())
80 }
81}
82
83impl std::fmt::Debug for ListIdentityVerificationReportType {
84 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
85 f.write_str(self.as_str())
86 }
87}
88impl serde::Serialize for ListIdentityVerificationReportType {
89 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
90 where
91 S: serde::Serializer,
92 {
93 serializer.serialize_str(self.as_str())
94 }
95}
96#[cfg(feature = "deserialize")]
97impl<'de> serde::Deserialize<'de> for ListIdentityVerificationReportType {
98 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
99 use std::str::FromStr;
100 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
101 Ok(Self::from_str(&s).expect("infallible"))
102 }
103}
104#[derive(Clone, Debug, serde::Serialize)]
106pub struct ListIdentityVerificationReport {
107 inner: ListIdentityVerificationReportBuilder,
108}
109impl ListIdentityVerificationReport {
110 pub fn new() -> Self {
112 Self { inner: ListIdentityVerificationReportBuilder::new() }
113 }
114 pub fn client_reference_id(mut self, client_reference_id: impl Into<String>) -> Self {
117 self.inner.client_reference_id = Some(client_reference_id.into());
118 self
119 }
120 pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
122 self.inner.created = Some(created.into());
123 self
124 }
125 pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
129 self.inner.ending_before = Some(ending_before.into());
130 self
131 }
132 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
134 self.inner.expand = Some(expand.into());
135 self
136 }
137 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
140 self.inner.limit = Some(limit.into());
141 self
142 }
143 pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
147 self.inner.starting_after = Some(starting_after.into());
148 self
149 }
150 pub fn type_(mut self, type_: impl Into<ListIdentityVerificationReportType>) -> Self {
152 self.inner.type_ = Some(type_.into());
153 self
154 }
155 pub fn verification_session(mut self, verification_session: impl Into<String>) -> Self {
158 self.inner.verification_session = Some(verification_session.into());
159 self
160 }
161}
162impl Default for ListIdentityVerificationReport {
163 fn default() -> Self {
164 Self::new()
165 }
166}
167impl ListIdentityVerificationReport {
168 pub async fn send<C: StripeClient>(
170 &self,
171 client: &C,
172 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
173 self.customize().send(client).await
174 }
175
176 pub fn send_blocking<C: StripeBlockingClient>(
178 &self,
179 client: &C,
180 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
181 self.customize().send_blocking(client)
182 }
183
184 pub fn paginate(
185 &self,
186 ) -> stripe_client_core::ListPaginator<
187 stripe_types::List<stripe_misc::IdentityVerificationReport>,
188 > {
189 stripe_client_core::ListPaginator::new_list("/identity/verification_reports", &self.inner)
190 }
191}
192
193impl StripeRequest for ListIdentityVerificationReport {
194 type Output = stripe_types::List<stripe_misc::IdentityVerificationReport>;
195
196 fn build(&self) -> RequestBuilder {
197 RequestBuilder::new(StripeMethod::Get, "/identity/verification_reports").query(&self.inner)
198 }
199}
200#[derive(Clone, Debug, serde::Serialize)]
201struct RetrieveIdentityVerificationReportBuilder {
202 #[serde(skip_serializing_if = "Option::is_none")]
203 expand: Option<Vec<String>>,
204}
205impl RetrieveIdentityVerificationReportBuilder {
206 fn new() -> Self {
207 Self { expand: None }
208 }
209}
210#[derive(Clone, Debug, serde::Serialize)]
212pub struct RetrieveIdentityVerificationReport {
213 inner: RetrieveIdentityVerificationReportBuilder,
214 report: stripe_misc::IdentityVerificationReportId,
215}
216impl RetrieveIdentityVerificationReport {
217 pub fn new(report: impl Into<stripe_misc::IdentityVerificationReportId>) -> Self {
219 Self { report: report.into(), inner: RetrieveIdentityVerificationReportBuilder::new() }
220 }
221 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
223 self.inner.expand = Some(expand.into());
224 self
225 }
226}
227impl RetrieveIdentityVerificationReport {
228 pub async fn send<C: StripeClient>(
230 &self,
231 client: &C,
232 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
233 self.customize().send(client).await
234 }
235
236 pub fn send_blocking<C: StripeBlockingClient>(
238 &self,
239 client: &C,
240 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
241 self.customize().send_blocking(client)
242 }
243}
244
245impl StripeRequest for RetrieveIdentityVerificationReport {
246 type Output = stripe_misc::IdentityVerificationReport;
247
248 fn build(&self) -> RequestBuilder {
249 let report = &self.report;
250 RequestBuilder::new(StripeMethod::Get, format!("/identity/verification_reports/{report}"))
251 .query(&self.inner)
252 }
253}