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 ListEntitlementsActiveEntitlementBuilder {
customer: String,
#[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>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListEntitlementsActiveEntitlementBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListEntitlementsActiveEntitlementBuilder").finish_non_exhaustive()
}
}
impl ListEntitlementsActiveEntitlementBuilder {
fn new(customer: impl Into<String>) -> Self {
Self {
customer: customer.into(),
ending_before: None,
expand: None,
limit: None,
starting_after: None,
}
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ListEntitlementsActiveEntitlement {
inner: ListEntitlementsActiveEntitlementBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListEntitlementsActiveEntitlement {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListEntitlementsActiveEntitlement").finish_non_exhaustive()
}
}
impl ListEntitlementsActiveEntitlement {
pub fn new(customer: impl Into<String>) -> Self {
Self { inner: ListEntitlementsActiveEntitlementBuilder::new(customer.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 ListEntitlementsActiveEntitlement {
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::EntitlementsActiveEntitlement>,
> {
stripe_client_core::ListPaginator::new_list(
"/entitlements/active_entitlements",
&self.inner,
)
}
}
impl StripeRequest for ListEntitlementsActiveEntitlement {
type Output = stripe_types::List<stripe_misc::EntitlementsActiveEntitlement>;
fn build(&self) -> RequestBuilder {
RequestBuilder::new(StripeMethod::Get, "/entitlements/active_entitlements")
.query(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct RetrieveEntitlementsActiveEntitlementBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveEntitlementsActiveEntitlementBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrieveEntitlementsActiveEntitlementBuilder").finish_non_exhaustive()
}
}
impl RetrieveEntitlementsActiveEntitlementBuilder {
fn new() -> Self {
Self { expand: None }
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct RetrieveEntitlementsActiveEntitlement {
inner: RetrieveEntitlementsActiveEntitlementBuilder,
id: stripe_misc::EntitlementsActiveEntitlementId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveEntitlementsActiveEntitlement {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrieveEntitlementsActiveEntitlement").finish_non_exhaustive()
}
}
impl RetrieveEntitlementsActiveEntitlement {
pub fn new(id: impl Into<stripe_misc::EntitlementsActiveEntitlementId>) -> Self {
Self { id: id.into(), inner: RetrieveEntitlementsActiveEntitlementBuilder::new() }
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl RetrieveEntitlementsActiveEntitlement {
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 RetrieveEntitlementsActiveEntitlement {
type Output = stripe_misc::EntitlementsActiveEntitlement;
fn build(&self) -> RequestBuilder {
let id = &self.id;
RequestBuilder::new(StripeMethod::Get, format!("/entitlements/active_entitlements/{id}"))
.query(&self.inner)
}
}