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 ListEntitlementsFeatureBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
archived: Option<bool>,
#[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")]
lookup_key: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
starting_after: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListEntitlementsFeatureBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListEntitlementsFeatureBuilder").finish_non_exhaustive()
}
}
impl ListEntitlementsFeatureBuilder {
fn new() -> Self {
Self {
archived: None,
ending_before: None,
expand: None,
limit: None,
lookup_key: None,
starting_after: None,
}
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ListEntitlementsFeature {
inner: ListEntitlementsFeatureBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListEntitlementsFeature {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListEntitlementsFeature").finish_non_exhaustive()
}
}
impl ListEntitlementsFeature {
pub fn new() -> Self {
Self { inner: ListEntitlementsFeatureBuilder::new() }
}
pub fn archived(mut self, archived: impl Into<bool>) -> Self {
self.inner.archived = Some(archived.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 lookup_key(mut self, lookup_key: impl Into<String>) -> Self {
self.inner.lookup_key = Some(lookup_key.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 ListEntitlementsFeature {
fn default() -> Self {
Self::new()
}
}
impl ListEntitlementsFeature {
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_shared::EntitlementsFeature>>
{
stripe_client_core::ListPaginator::new_list("/entitlements/features", &self.inner)
}
}
impl StripeRequest for ListEntitlementsFeature {
type Output = stripe_types::List<stripe_shared::EntitlementsFeature>;
fn build(&self) -> RequestBuilder {
RequestBuilder::new(StripeMethod::Get, "/entitlements/features").query(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct RetrieveEntitlementsFeatureBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveEntitlementsFeatureBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrieveEntitlementsFeatureBuilder").finish_non_exhaustive()
}
}
impl RetrieveEntitlementsFeatureBuilder {
fn new() -> Self {
Self { expand: None }
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct RetrieveEntitlementsFeature {
inner: RetrieveEntitlementsFeatureBuilder,
id: stripe_shared::EntitlementsFeatureId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrieveEntitlementsFeature {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrieveEntitlementsFeature").finish_non_exhaustive()
}
}
impl RetrieveEntitlementsFeature {
pub fn new(id: impl Into<stripe_shared::EntitlementsFeatureId>) -> Self {
Self { id: id.into(), inner: RetrieveEntitlementsFeatureBuilder::new() }
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl RetrieveEntitlementsFeature {
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 RetrieveEntitlementsFeature {
type Output = stripe_shared::EntitlementsFeature;
fn build(&self) -> RequestBuilder {
let id = &self.id;
RequestBuilder::new(StripeMethod::Get, format!("/entitlements/features/{id}"))
.query(&self.inner)
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct CreateEntitlementsFeatureBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
lookup_key: String,
#[serde(skip_serializing_if = "Option::is_none")]
metadata: Option<std::collections::HashMap<String, String>>,
name: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreateEntitlementsFeatureBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreateEntitlementsFeatureBuilder").finish_non_exhaustive()
}
}
impl CreateEntitlementsFeatureBuilder {
fn new(lookup_key: impl Into<String>, name: impl Into<String>) -> Self {
Self { expand: None, lookup_key: lookup_key.into(), metadata: None, name: name.into() }
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreateEntitlementsFeature {
inner: CreateEntitlementsFeatureBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreateEntitlementsFeature {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreateEntitlementsFeature").finish_non_exhaustive()
}
}
impl CreateEntitlementsFeature {
pub fn new(lookup_key: impl Into<String>, name: impl Into<String>) -> Self {
Self { inner: CreateEntitlementsFeatureBuilder::new(lookup_key.into(), name.into()) }
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
pub fn metadata(
mut self,
metadata: impl Into<std::collections::HashMap<String, String>>,
) -> Self {
self.inner.metadata = Some(metadata.into());
self
}
}
impl CreateEntitlementsFeature {
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 CreateEntitlementsFeature {
type Output = stripe_shared::EntitlementsFeature;
fn build(&self) -> RequestBuilder {
RequestBuilder::new(StripeMethod::Post, "/entitlements/features").form(&self.inner)
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct UpdateEntitlementsFeatureBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
active: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
metadata: Option<std::collections::HashMap<String, String>>,
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdateEntitlementsFeatureBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdateEntitlementsFeatureBuilder").finish_non_exhaustive()
}
}
impl UpdateEntitlementsFeatureBuilder {
fn new() -> Self {
Self { active: None, expand: None, metadata: None, name: None }
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdateEntitlementsFeature {
inner: UpdateEntitlementsFeatureBuilder,
id: stripe_shared::EntitlementsFeatureId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdateEntitlementsFeature {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdateEntitlementsFeature").finish_non_exhaustive()
}
}
impl UpdateEntitlementsFeature {
pub fn new(id: impl Into<stripe_shared::EntitlementsFeatureId>) -> Self {
Self { id: id.into(), inner: UpdateEntitlementsFeatureBuilder::new() }
}
pub fn active(mut self, active: impl Into<bool>) -> Self {
self.inner.active = Some(active.into());
self
}
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
pub fn metadata(
mut self,
metadata: impl Into<std::collections::HashMap<String, String>>,
) -> Self {
self.inner.metadata = Some(metadata.into());
self
}
pub fn name(mut self, name: impl Into<String>) -> Self {
self.inner.name = Some(name.into());
self
}
}
impl UpdateEntitlementsFeature {
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 UpdateEntitlementsFeature {
type Output = stripe_shared::EntitlementsFeature;
fn build(&self) -> RequestBuilder {
let id = &self.id;
RequestBuilder::new(StripeMethod::Post, format!("/entitlements/features/{id}"))
.form(&self.inner)
}
}