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(Copy, Clone, Eq, PartialEq)]
41pub enum ListIdentityVerificationReportType {
42 Document,
43 IdNumber,
44}
45impl ListIdentityVerificationReportType {
46 pub fn as_str(self) -> &'static str {
47 use ListIdentityVerificationReportType::*;
48 match self {
49 Document => "document",
50 IdNumber => "id_number",
51 }
52 }
53}
54
55impl std::str::FromStr for ListIdentityVerificationReportType {
56 type Err = stripe_types::StripeParseError;
57 fn from_str(s: &str) -> Result<Self, Self::Err> {
58 use ListIdentityVerificationReportType::*;
59 match s {
60 "document" => Ok(Document),
61 "id_number" => Ok(IdNumber),
62 _ => Err(stripe_types::StripeParseError),
63 }
64 }
65}
66impl std::fmt::Display for ListIdentityVerificationReportType {
67 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
68 f.write_str(self.as_str())
69 }
70}
71
72impl std::fmt::Debug for ListIdentityVerificationReportType {
73 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
74 f.write_str(self.as_str())
75 }
76}
77impl serde::Serialize for ListIdentityVerificationReportType {
78 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
79 where
80 S: serde::Serializer,
81 {
82 serializer.serialize_str(self.as_str())
83 }
84}
85#[cfg(feature = "deserialize")]
86impl<'de> serde::Deserialize<'de> for ListIdentityVerificationReportType {
87 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
88 use std::str::FromStr;
89 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
90 Self::from_str(&s).map_err(|_| {
91 serde::de::Error::custom("Unknown value for ListIdentityVerificationReportType")
92 })
93 }
94}
95#[derive(Clone, Debug, serde::Serialize)]
97pub struct ListIdentityVerificationReport {
98 inner: ListIdentityVerificationReportBuilder,
99}
100impl ListIdentityVerificationReport {
101 pub fn new() -> Self {
103 Self { inner: ListIdentityVerificationReportBuilder::new() }
104 }
105 pub fn client_reference_id(mut self, client_reference_id: impl Into<String>) -> Self {
108 self.inner.client_reference_id = Some(client_reference_id.into());
109 self
110 }
111 pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
113 self.inner.created = Some(created.into());
114 self
115 }
116 pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
120 self.inner.ending_before = Some(ending_before.into());
121 self
122 }
123 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
125 self.inner.expand = Some(expand.into());
126 self
127 }
128 pub fn limit(mut self, limit: impl Into<i64>) -> Self {
131 self.inner.limit = Some(limit.into());
132 self
133 }
134 pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
138 self.inner.starting_after = Some(starting_after.into());
139 self
140 }
141 pub fn type_(mut self, type_: impl Into<ListIdentityVerificationReportType>) -> Self {
143 self.inner.type_ = Some(type_.into());
144 self
145 }
146 pub fn verification_session(mut self, verification_session: impl Into<String>) -> Self {
149 self.inner.verification_session = Some(verification_session.into());
150 self
151 }
152}
153impl Default for ListIdentityVerificationReport {
154 fn default() -> Self {
155 Self::new()
156 }
157}
158impl ListIdentityVerificationReport {
159 pub async fn send<C: StripeClient>(
161 &self,
162 client: &C,
163 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
164 self.customize().send(client).await
165 }
166
167 pub fn send_blocking<C: StripeBlockingClient>(
169 &self,
170 client: &C,
171 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
172 self.customize().send_blocking(client)
173 }
174
175 pub fn paginate(
176 &self,
177 ) -> stripe_client_core::ListPaginator<
178 stripe_types::List<stripe_misc::IdentityVerificationReport>,
179 > {
180 stripe_client_core::ListPaginator::new_list("/identity/verification_reports", &self.inner)
181 }
182}
183
184impl StripeRequest for ListIdentityVerificationReport {
185 type Output = stripe_types::List<stripe_misc::IdentityVerificationReport>;
186
187 fn build(&self) -> RequestBuilder {
188 RequestBuilder::new(StripeMethod::Get, "/identity/verification_reports").query(&self.inner)
189 }
190}
191#[derive(Clone, Debug, serde::Serialize)]
192struct RetrieveIdentityVerificationReportBuilder {
193 #[serde(skip_serializing_if = "Option::is_none")]
194 expand: Option<Vec<String>>,
195}
196impl RetrieveIdentityVerificationReportBuilder {
197 fn new() -> Self {
198 Self { expand: None }
199 }
200}
201#[derive(Clone, Debug, serde::Serialize)]
203pub struct RetrieveIdentityVerificationReport {
204 inner: RetrieveIdentityVerificationReportBuilder,
205 report: stripe_misc::IdentityVerificationReportId,
206}
207impl RetrieveIdentityVerificationReport {
208 pub fn new(report: impl Into<stripe_misc::IdentityVerificationReportId>) -> Self {
210 Self { report: report.into(), inner: RetrieveIdentityVerificationReportBuilder::new() }
211 }
212 pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
214 self.inner.expand = Some(expand.into());
215 self
216 }
217}
218impl RetrieveIdentityVerificationReport {
219 pub async fn send<C: StripeClient>(
221 &self,
222 client: &C,
223 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
224 self.customize().send(client).await
225 }
226
227 pub fn send_blocking<C: StripeBlockingClient>(
229 &self,
230 client: &C,
231 ) -> Result<<Self as StripeRequest>::Output, C::Err> {
232 self.customize().send_blocking(client)
233 }
234}
235
236impl StripeRequest for RetrieveIdentityVerificationReport {
237 type Output = stripe_misc::IdentityVerificationReport;
238
239 fn build(&self) -> RequestBuilder {
240 let report = &self.report;
241 RequestBuilder::new(StripeMethod::Get, format!("/identity/verification_reports/{report}"))
242 .query(&self.inner)
243 }
244}