Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(next): added serialize_extra and deserialize_extra feature flags #596

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion async-stripe-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ serde_json = { workspace = true, optional = true }

[features]
serialize = []
serialize_extra = ["serialize"]
deserialize = ["dep:serde_json"]
deserialize_extra = ["deserialize"]

[dev-dependencies]
serde_qs.workspace = true
serde_json.workspace = true
serde_json.workspace = true
2 changes: 2 additions & 0 deletions async-stripe-webhook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ serde_json.workspace = true

[features]
serialize = ["async-stripe-types/serialize", "async-stripe-shared/serialize"]
serialize_extra = ["serialize", "async-stripe-types/serialize_extra", "async-stripe-shared/serialize_extra"]
deserialize = ["async-stripe-types/deserialize", "async-stripe-shared/deserialize", "dep:serde_json"]
deserialize_extra = ["deserialize", "async-stripe-types/deserialize_extra", "async-stripe-shared/deserialize_extra", "dep:serde_json"]

full = [
"async-stripe-billing",
Expand Down
2 changes: 2 additions & 0 deletions generated/async-stripe-billing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ async-stripe-shared = {path = "../../generated/async-stripe-shared"}

[features]
serialize = ["async-stripe-types/serialize","async-stripe-shared/serialize"]
serialize_extra = ["serialize", "async-stripe-types/serialize_extra","async-stripe-shared/serialize_extra"]
deserialize = ["async-stripe-types/deserialize","async-stripe-shared/deserialize", "dep:serde_json"]
deserialize_extra = ["deserialize", "async-stripe-types/deserialize_extra","async-stripe-shared/deserialize_extra", "dep:serde_json"]
billing_meter = []
billing_meter_event = []
billing_meter_event_adjustment = []
Expand Down
15 changes: 15 additions & 0 deletions generated/async-stripe-billing/src/billing_meter/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use stripe_client_core::{
};

#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
struct ListBillingMeterBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
ending_before: Option<String>,
Expand All @@ -22,6 +23,7 @@ impl ListBillingMeterBuilder {
}
/// Retrieve a list of billing meters.
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct ListBillingMeter {
inner: ListBillingMeterBuilder,
}
Expand Down Expand Up @@ -98,6 +100,7 @@ impl StripeRequest for ListBillingMeter {
}
}
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
struct RetrieveBillingMeterBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
Expand All @@ -109,6 +112,7 @@ impl RetrieveBillingMeterBuilder {
}
/// Retrieves a billing meter given an ID
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct RetrieveBillingMeter {
inner: RetrieveBillingMeterBuilder,
id: stripe_billing::BillingMeterId,
Expand Down Expand Up @@ -151,6 +155,7 @@ impl StripeRequest for RetrieveBillingMeter {
}
}
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
struct CreateBillingMeterBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
customer_mapping: Option<CreateBillingMeterCustomerMapping>,
Expand Down Expand Up @@ -183,6 +188,7 @@ impl CreateBillingMeterBuilder {
}
/// Fields that specify how to map a meter event to a customer.
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct CreateBillingMeterCustomerMapping {
/// The key in the usage event payload to use for mapping the event to a customer.
pub event_payload_key: String,
Expand Down Expand Up @@ -253,6 +259,7 @@ impl<'de> serde::Deserialize<'de> for CreateBillingMeterCustomerMappingType {
}
/// The default settings to aggregate a meter's events with.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct CreateBillingMeterDefaultAggregation {
/// Specifies how events are aggregated.
/// Allowed values are `count` to count the number of events and `sum` to sum each event's value.
Expand Down Expand Up @@ -324,6 +331,7 @@ impl<'de> serde::Deserialize<'de> for CreateBillingMeterDefaultAggregationFormul
}
/// Fields that specify how to calculate a meter event's value.
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct CreateBillingMeterValueSettings {
/// The key in the usage event payload to use as the value for this meter.
/// For example, if the event payload contains usage on a `bytes_used` field, then set the event_payload_key to "bytes_used".
Expand All @@ -336,6 +344,7 @@ impl CreateBillingMeterValueSettings {
}
/// Creates a billing meter
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct CreateBillingMeter {
inner: CreateBillingMeterBuilder,
}
Expand Down Expand Up @@ -410,6 +419,7 @@ impl StripeRequest for CreateBillingMeter {
}
}
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
struct UpdateBillingMeterBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
display_name: Option<String>,
Expand All @@ -423,6 +433,7 @@ impl UpdateBillingMeterBuilder {
}
/// Updates a billing meter
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct UpdateBillingMeter {
inner: UpdateBillingMeterBuilder,
id: stripe_billing::BillingMeterId,
Expand Down Expand Up @@ -470,6 +481,7 @@ impl StripeRequest for UpdateBillingMeter {
}
}
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
struct DeactivateBillingMeterBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
Expand All @@ -481,6 +493,7 @@ impl DeactivateBillingMeterBuilder {
}
/// Deactivates a billing meter
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct DeactivateBillingMeter {
inner: DeactivateBillingMeterBuilder,
id: stripe_billing::BillingMeterId,
Expand Down Expand Up @@ -524,6 +537,7 @@ impl StripeRequest for DeactivateBillingMeter {
}
}
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
struct ReactivateBillingMeterBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
Expand All @@ -535,6 +549,7 @@ impl ReactivateBillingMeterBuilder {
}
/// Reactivates a billing meter
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct ReactivateBillingMeter {
inner: ReactivateBillingMeterBuilder,
id: stripe_billing::BillingMeterId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use stripe_client_core::{
};

#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
struct CreateBillingMeterEventBuilder {
event_name: String,
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -29,6 +30,7 @@ impl CreateBillingMeterEventBuilder {
}
/// Creates a billing meter event
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct CreateBillingMeterEvent {
inner: CreateBillingMeterEventBuilder,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use stripe_client_core::{
};

#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
struct CreateBillingMeterEventAdjustmentBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
cancel: Option<CreateBillingMeterEventAdjustmentCancel>,
Expand All @@ -22,6 +23,7 @@ impl CreateBillingMeterEventAdjustmentBuilder {
}
/// Specifies which event to cancel.
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct CreateBillingMeterEventAdjustmentCancel {
/// Unique identifier for the event.
/// You can only cancel events within 24 hours of Stripe receiving them.
Expand All @@ -40,6 +42,7 @@ impl Default for CreateBillingMeterEventAdjustmentCancel {
}
/// Creates a billing meter event adjustment
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct CreateBillingMeterEventAdjustment {
inner: CreateBillingMeterEventAdjustmentBuilder,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use stripe_client_core::{
};

#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
struct ListIdBillingMeterEventSummaryBuilder {
customer: String,
end_time: stripe_types::Timestamp,
Expand Down Expand Up @@ -94,6 +95,7 @@ impl<'de> serde::Deserialize<'de> for ListIdBillingMeterEventSummaryValueGroupin
}
/// Retrieve a list of billing meter event summaries.
#[derive(Clone, Debug, serde::Serialize)]
#[cfg_attr(feature = "deserialize_extra", derive(serde::Deserialize))]
pub struct ListIdBillingMeterEventSummary {
inner: ListIdBillingMeterEventSummaryBuilder,
id: stripe_billing::BillingMeterId,
Expand Down
Loading
Loading