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 ListFinancialConnectionsAccountBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
account_holder: Option<ListFinancialConnectionsAccountAccountHolder>,
#[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")]
session: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
starting_after: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListFinancialConnectionsAccountBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListFinancialConnectionsAccountBuilder").finish_non_exhaustive()
}
}
impl ListFinancialConnectionsAccountBuilder {
fn new() -> Self {
Self {
account_holder: None,
ending_before: None,
expand: None,
limit: None,
session: None,
starting_after: None,
}
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ListFinancialConnectionsAccountAccountHolder {
#[serde(skip_serializing_if = "Option::is_none")]
pub account: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub customer: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_account: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListFinancialConnectionsAccountAccountHolder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListFinancialConnectionsAccountAccountHolder").finish_non_exhaustive()
}
}
impl ListFinancialConnectionsAccountAccountHolder {
pub fn new() -> Self {
Self { account: None, customer: None, customer_account: None }
}
}
impl Default for ListFinancialConnectionsAccountAccountHolder {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ListFinancialConnectionsAccount {
inner: ListFinancialConnectionsAccountBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListFinancialConnectionsAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListFinancialConnectionsAccount").finish_non_exhaustive()
}
}
impl ListFinancialConnectionsAccount {
pub fn new() -> Self {
Self { inner: ListFinancialConnectionsAccountBuilder::new() }
}
pub fn account_holder(
mut self,
account_holder: impl Into<ListFinancialConnectionsAccountAccountHolder>,
) -> Self {
self.inner.account_holder = Some(account_holder.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 session(mut self, session: impl Into<String>) -> Self {
self.inner.session = Some(session.into());
self
}
pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
self.inner.starting_after = Some(starting_after.into());
self
}
}
impl Default for ListFinancialConnectionsAccount {
fn default() -> Self {
Self::new()
}
}
impl ListFinancialConnectionsAccount {
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::FinancialConnectionsAccount>,
> {
stripe_client_core::ListPaginator::new_list("/financial_connections/accounts", &self.inner)
}
}
impl StripeRequest for ListFinancialConnectionsAccount {
type Output = stripe_types::List<stripe_misc::FinancialConnectionsAccount>;
fn build(&self) -> RequestBuilder {
RequestBuilder::new(StripeMethod::Get, "/financial_connections/accounts").query(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct RetrieveFinancialConnectionsAccountBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveFinancialConnectionsAccountBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrieveFinancialConnectionsAccountBuilder").finish_non_exhaustive()
}
}
impl RetrieveFinancialConnectionsAccountBuilder {
fn new() -> Self {
Self { expand: None }
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct RetrieveFinancialConnectionsAccount {
inner: RetrieveFinancialConnectionsAccountBuilder,
account: stripe_misc::FinancialConnectionsAccountId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveFinancialConnectionsAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrieveFinancialConnectionsAccount").finish_non_exhaustive()
}
}
impl RetrieveFinancialConnectionsAccount {
pub fn new(account: impl Into<stripe_misc::FinancialConnectionsAccountId>) -> Self {
Self { account: account.into(), inner: RetrieveFinancialConnectionsAccountBuilder::new() }
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl RetrieveFinancialConnectionsAccount {
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 RetrieveFinancialConnectionsAccount {
type Output = stripe_misc::FinancialConnectionsAccount;
fn build(&self) -> RequestBuilder {
let account = &self.account;
RequestBuilder::new(StripeMethod::Get, format!("/financial_connections/accounts/{account}"))
.query(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct ListOwnersFinancialConnectionsAccountBuilder {
#[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>,
ownership: String,
#[serde(skip_serializing_if = "Option::is_none")]
starting_after: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListOwnersFinancialConnectionsAccountBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListOwnersFinancialConnectionsAccountBuilder").finish_non_exhaustive()
}
}
impl ListOwnersFinancialConnectionsAccountBuilder {
fn new(ownership: impl Into<String>) -> Self {
Self {
ending_before: None,
expand: None,
limit: None,
ownership: ownership.into(),
starting_after: None,
}
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ListOwnersFinancialConnectionsAccount {
inner: ListOwnersFinancialConnectionsAccountBuilder,
account: stripe_misc::FinancialConnectionsAccountId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListOwnersFinancialConnectionsAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListOwnersFinancialConnectionsAccount").finish_non_exhaustive()
}
}
impl ListOwnersFinancialConnectionsAccount {
pub fn new(
account: impl Into<stripe_misc::FinancialConnectionsAccountId>,
ownership: impl Into<String>,
) -> Self {
Self {
account: account.into(),
inner: ListOwnersFinancialConnectionsAccountBuilder::new(ownership.into()),
}
}
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
}
}
impl ListOwnersFinancialConnectionsAccount {
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::FinancialConnectionsAccountOwner>,
> {
let account = &self.account;
stripe_client_core::ListPaginator::new_list(
format!("/financial_connections/accounts/{account}/owners"),
&self.inner,
)
}
}
impl StripeRequest for ListOwnersFinancialConnectionsAccount {
type Output = stripe_types::List<stripe_misc::FinancialConnectionsAccountOwner>;
fn build(&self) -> RequestBuilder {
let account = &self.account;
RequestBuilder::new(
StripeMethod::Get,
format!("/financial_connections/accounts/{account}/owners"),
)
.query(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct DisconnectFinancialConnectionsAccountBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for DisconnectFinancialConnectionsAccountBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("DisconnectFinancialConnectionsAccountBuilder").finish_non_exhaustive()
}
}
impl DisconnectFinancialConnectionsAccountBuilder {
fn new() -> Self {
Self { expand: None }
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct DisconnectFinancialConnectionsAccount {
inner: DisconnectFinancialConnectionsAccountBuilder,
account: stripe_misc::FinancialConnectionsAccountId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for DisconnectFinancialConnectionsAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("DisconnectFinancialConnectionsAccount").finish_non_exhaustive()
}
}
impl DisconnectFinancialConnectionsAccount {
pub fn new(account: impl Into<stripe_misc::FinancialConnectionsAccountId>) -> Self {
Self { account: account.into(), inner: DisconnectFinancialConnectionsAccountBuilder::new() }
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl DisconnectFinancialConnectionsAccount {
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 DisconnectFinancialConnectionsAccount {
type Output = stripe_misc::FinancialConnectionsAccount;
fn build(&self) -> RequestBuilder {
let account = &self.account;
RequestBuilder::new(
StripeMethod::Post,
format!("/financial_connections/accounts/{account}/disconnect"),
)
.form(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct RefreshFinancialConnectionsAccountBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
features: Vec<RefreshFinancialConnectionsAccountFeatures>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RefreshFinancialConnectionsAccountBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RefreshFinancialConnectionsAccountBuilder").finish_non_exhaustive()
}
}
impl RefreshFinancialConnectionsAccountBuilder {
fn new(features: impl Into<Vec<RefreshFinancialConnectionsAccountFeatures>>) -> Self {
Self { expand: None, features: features.into() }
}
}
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum RefreshFinancialConnectionsAccountFeatures {
Balance,
Ownership,
Transactions,
Unknown(String),
}
impl RefreshFinancialConnectionsAccountFeatures {
pub fn as_str(&self) -> &str {
use RefreshFinancialConnectionsAccountFeatures::*;
match self {
Balance => "balance",
Ownership => "ownership",
Transactions => "transactions",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for RefreshFinancialConnectionsAccountFeatures {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use RefreshFinancialConnectionsAccountFeatures::*;
match s {
"balance" => Ok(Balance),
"ownership" => Ok(Ownership),
"transactions" => Ok(Transactions),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"RefreshFinancialConnectionsAccountFeatures"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for RefreshFinancialConnectionsAccountFeatures {
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 RefreshFinancialConnectionsAccountFeatures {
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 RefreshFinancialConnectionsAccountFeatures {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(RefreshFinancialConnectionsAccountFeatures))
.finish_non_exhaustive()
}
}
impl serde::Serialize for RefreshFinancialConnectionsAccountFeatures {
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 RefreshFinancialConnectionsAccountFeatures {
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 RefreshFinancialConnectionsAccount {
inner: RefreshFinancialConnectionsAccountBuilder,
account: stripe_misc::FinancialConnectionsAccountId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RefreshFinancialConnectionsAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RefreshFinancialConnectionsAccount").finish_non_exhaustive()
}
}
impl RefreshFinancialConnectionsAccount {
pub fn new(
account: impl Into<stripe_misc::FinancialConnectionsAccountId>,
features: impl Into<Vec<RefreshFinancialConnectionsAccountFeatures>>,
) -> Self {
Self {
account: account.into(),
inner: RefreshFinancialConnectionsAccountBuilder::new(features.into()),
}
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl RefreshFinancialConnectionsAccount {
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 RefreshFinancialConnectionsAccount {
type Output = stripe_misc::FinancialConnectionsAccount;
fn build(&self) -> RequestBuilder {
let account = &self.account;
RequestBuilder::new(
StripeMethod::Post,
format!("/financial_connections/accounts/{account}/refresh"),
)
.form(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct SubscribeFinancialConnectionsAccountBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
features: Vec<SubscribeFinancialConnectionsAccountFeatures>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for SubscribeFinancialConnectionsAccountBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("SubscribeFinancialConnectionsAccountBuilder").finish_non_exhaustive()
}
}
impl SubscribeFinancialConnectionsAccountBuilder {
fn new(features: impl Into<Vec<SubscribeFinancialConnectionsAccountFeatures>>) -> Self {
Self { expand: None, features: features.into() }
}
}
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum SubscribeFinancialConnectionsAccountFeatures {
Transactions,
Unknown(String),
}
impl SubscribeFinancialConnectionsAccountFeatures {
pub fn as_str(&self) -> &str {
use SubscribeFinancialConnectionsAccountFeatures::*;
match self {
Transactions => "transactions",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for SubscribeFinancialConnectionsAccountFeatures {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use SubscribeFinancialConnectionsAccountFeatures::*;
match s {
"transactions" => Ok(Transactions),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"SubscribeFinancialConnectionsAccountFeatures"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for SubscribeFinancialConnectionsAccountFeatures {
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 SubscribeFinancialConnectionsAccountFeatures {
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 SubscribeFinancialConnectionsAccountFeatures {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(SubscribeFinancialConnectionsAccountFeatures))
.finish_non_exhaustive()
}
}
impl serde::Serialize for SubscribeFinancialConnectionsAccountFeatures {
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 SubscribeFinancialConnectionsAccountFeatures {
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 SubscribeFinancialConnectionsAccount {
inner: SubscribeFinancialConnectionsAccountBuilder,
account: stripe_misc::FinancialConnectionsAccountId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for SubscribeFinancialConnectionsAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("SubscribeFinancialConnectionsAccount").finish_non_exhaustive()
}
}
impl SubscribeFinancialConnectionsAccount {
pub fn new(
account: impl Into<stripe_misc::FinancialConnectionsAccountId>,
features: impl Into<Vec<SubscribeFinancialConnectionsAccountFeatures>>,
) -> Self {
Self {
account: account.into(),
inner: SubscribeFinancialConnectionsAccountBuilder::new(features.into()),
}
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl SubscribeFinancialConnectionsAccount {
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 SubscribeFinancialConnectionsAccount {
type Output = stripe_misc::FinancialConnectionsAccount;
fn build(&self) -> RequestBuilder {
let account = &self.account;
RequestBuilder::new(
StripeMethod::Post,
format!("/financial_connections/accounts/{account}/subscribe"),
)
.form(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct UnsubscribeFinancialConnectionsAccountBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
features: Vec<UnsubscribeFinancialConnectionsAccountFeatures>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UnsubscribeFinancialConnectionsAccountBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UnsubscribeFinancialConnectionsAccountBuilder").finish_non_exhaustive()
}
}
impl UnsubscribeFinancialConnectionsAccountBuilder {
fn new(features: impl Into<Vec<UnsubscribeFinancialConnectionsAccountFeatures>>) -> Self {
Self { expand: None, features: features.into() }
}
}
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UnsubscribeFinancialConnectionsAccountFeatures {
Transactions,
Unknown(String),
}
impl UnsubscribeFinancialConnectionsAccountFeatures {
pub fn as_str(&self) -> &str {
use UnsubscribeFinancialConnectionsAccountFeatures::*;
match self {
Transactions => "transactions",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UnsubscribeFinancialConnectionsAccountFeatures {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UnsubscribeFinancialConnectionsAccountFeatures::*;
match s {
"transactions" => Ok(Transactions),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UnsubscribeFinancialConnectionsAccountFeatures"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UnsubscribeFinancialConnectionsAccountFeatures {
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 UnsubscribeFinancialConnectionsAccountFeatures {
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 UnsubscribeFinancialConnectionsAccountFeatures {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UnsubscribeFinancialConnectionsAccountFeatures))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UnsubscribeFinancialConnectionsAccountFeatures {
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 UnsubscribeFinancialConnectionsAccountFeatures {
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 UnsubscribeFinancialConnectionsAccount {
inner: UnsubscribeFinancialConnectionsAccountBuilder,
account: stripe_misc::FinancialConnectionsAccountId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UnsubscribeFinancialConnectionsAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UnsubscribeFinancialConnectionsAccount").finish_non_exhaustive()
}
}
impl UnsubscribeFinancialConnectionsAccount {
pub fn new(
account: impl Into<stripe_misc::FinancialConnectionsAccountId>,
features: impl Into<Vec<UnsubscribeFinancialConnectionsAccountFeatures>>,
) -> Self {
Self {
account: account.into(),
inner: UnsubscribeFinancialConnectionsAccountBuilder::new(features.into()),
}
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl UnsubscribeFinancialConnectionsAccount {
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 UnsubscribeFinancialConnectionsAccount {
type Output = stripe_misc::FinancialConnectionsAccount;
fn build(&self) -> RequestBuilder {
let account = &self.account;
RequestBuilder::new(
StripeMethod::Post,
format!("/financial_connections/accounts/{account}/unsubscribe"),
)
.form(&self.inner)
}
}