use stripe_client_core::{
RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
};
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct ListIdentityVerificationReportBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
client_reference_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
created: Option<stripe_types::RangeQueryTs>,
#[serde(skip_serializing_if = "Option::is_none")]
ending_before: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
starting_after: Option<String>,
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
type_: Option<ListIdentityVerificationReportType>,
#[serde(skip_serializing_if = "Option::is_none")]
verification_session: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListIdentityVerificationReportBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListIdentityVerificationReportBuilder").finish_non_exhaustive()
}
}
impl ListIdentityVerificationReportBuilder {
fn new() -> Self {
Self {
client_reference_id: None,
created: None,
ending_before: None,
expand: None,
limit: None,
starting_after: None,
type_: None,
verification_session: None,
}
}
}
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ListIdentityVerificationReportType {
Document,
IdNumber,
Unknown(String),
}
impl ListIdentityVerificationReportType {
pub fn as_str(&self) -> &str {
use ListIdentityVerificationReportType::*;
match self {
Document => "document",
IdNumber => "id_number",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ListIdentityVerificationReportType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ListIdentityVerificationReportType::*;
match s {
"document" => Ok(Document),
"id_number" => Ok(IdNumber),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ListIdentityVerificationReportType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ListIdentityVerificationReportType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ListIdentityVerificationReportType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListIdentityVerificationReportType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ListIdentityVerificationReportType)).finish_non_exhaustive()
}
}
impl serde::Serialize for ListIdentityVerificationReportType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ListIdentityVerificationReportType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ListIdentityVerificationReport {
inner: ListIdentityVerificationReportBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListIdentityVerificationReport {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListIdentityVerificationReport").finish_non_exhaustive()
}
}
impl ListIdentityVerificationReport {
pub fn new() -> Self {
Self { inner: ListIdentityVerificationReportBuilder::new() }
}
pub fn client_reference_id(mut self, client_reference_id: impl Into<String>) -> Self {
self.inner.client_reference_id = Some(client_reference_id.into());
self
}
pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
self.inner.created = Some(created.into());
self
}
pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
self.inner.ending_before = Some(ending_before.into());
self
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
pub fn limit(mut self, limit: impl Into<i64>) -> Self {
self.inner.limit = Some(limit.into());
self
}
pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
self.inner.starting_after = Some(starting_after.into());
self
}
pub fn type_(mut self, type_: impl Into<ListIdentityVerificationReportType>) -> Self {
self.inner.type_ = Some(type_.into());
self
}
pub fn verification_session(mut self, verification_session: impl Into<String>) -> Self {
self.inner.verification_session = Some(verification_session.into());
self
}
}
impl Default for ListIdentityVerificationReport {
fn default() -> Self {
Self::new()
}
}
impl ListIdentityVerificationReport {
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
pub fn paginate(
&self,
) -> stripe_client_core::ListPaginator<
stripe_types::List<stripe_misc::IdentityVerificationReport>,
> {
stripe_client_core::ListPaginator::new_list("/identity/verification_reports", &self.inner)
}
}
impl StripeRequest for ListIdentityVerificationReport {
type Output = stripe_types::List<stripe_misc::IdentityVerificationReport>;
fn build(&self) -> RequestBuilder {
RequestBuilder::new(StripeMethod::Get, "/identity/verification_reports").query(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct RetrieveIdentityVerificationReportBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveIdentityVerificationReportBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrieveIdentityVerificationReportBuilder").finish_non_exhaustive()
}
}
impl RetrieveIdentityVerificationReportBuilder {
fn new() -> Self {
Self { expand: None }
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct RetrieveIdentityVerificationReport {
inner: RetrieveIdentityVerificationReportBuilder,
report: stripe_misc::IdentityVerificationReportId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveIdentityVerificationReport {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrieveIdentityVerificationReport").finish_non_exhaustive()
}
}
impl RetrieveIdentityVerificationReport {
pub fn new(report: impl Into<stripe_misc::IdentityVerificationReportId>) -> Self {
Self { report: report.into(), inner: RetrieveIdentityVerificationReportBuilder::new() }
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl RetrieveIdentityVerificationReport {
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for RetrieveIdentityVerificationReport {
type Output = stripe_misc::IdentityVerificationReport;
fn build(&self) -> RequestBuilder {
let report = &self.report;
RequestBuilder::new(StripeMethod::Get, format!("/identity/verification_reports/{report}"))
.query(&self.inner)
}
}