stripe_misc/identity_verification_report/
requests.rs

1use 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/// Only return VerificationReports of this type
40#[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/// List all verification reports.
96#[derive(Clone, Debug, serde::Serialize)]
97pub struct ListIdentityVerificationReport {
98    inner: ListIdentityVerificationReportBuilder,
99}
100impl ListIdentityVerificationReport {
101    /// Construct a new `ListIdentityVerificationReport`.
102    pub fn new() -> Self {
103        Self { inner: ListIdentityVerificationReportBuilder::new() }
104    }
105    /// A string to reference this user.
106    /// This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems.
107    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    /// Only return VerificationReports that were created during the given date interval.
112    pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
113        self.inner.created = Some(created.into());
114        self
115    }
116    /// A cursor for use in pagination.
117    /// `ending_before` is an object ID that defines your place in the list.
118    /// 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.
119    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    /// Specifies which fields in the response should be expanded.
124    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
125        self.inner.expand = Some(expand.into());
126        self
127    }
128    /// A limit on the number of objects to be returned.
129    /// Limit can range between 1 and 100, and the default is 10.
130    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
131        self.inner.limit = Some(limit.into());
132        self
133    }
134    /// A cursor for use in pagination.
135    /// `starting_after` is an object ID that defines your place in the list.
136    /// 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.
137    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    /// Only return VerificationReports of this type
142    pub fn type_(mut self, type_: impl Into<ListIdentityVerificationReportType>) -> Self {
143        self.inner.type_ = Some(type_.into());
144        self
145    }
146    /// Only return VerificationReports created by this VerificationSession ID.
147    /// It is allowed to provide a VerificationIntent ID.
148    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    /// Send the request and return the deserialized response.
160    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    /// Send the request and return the deserialized response, blocking until completion.
168    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/// Retrieves an existing VerificationReport
202#[derive(Clone, Debug, serde::Serialize)]
203pub struct RetrieveIdentityVerificationReport {
204    inner: RetrieveIdentityVerificationReportBuilder,
205    report: stripe_misc::IdentityVerificationReportId,
206}
207impl RetrieveIdentityVerificationReport {
208    /// Construct a new `RetrieveIdentityVerificationReport`.
209    pub fn new(report: impl Into<stripe_misc::IdentityVerificationReportId>) -> Self {
210        Self { report: report.into(), inner: RetrieveIdentityVerificationReportBuilder::new() }
211    }
212    /// Specifies which fields in the response should be expanded.
213    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    /// Send the request and return the deserialized response.
220    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    /// Send the request and return the deserialized response, blocking until completion.
228    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}