Skip to content

Commit

Permalink
Merge pull request #605 from lasantosr/fix-enums
Browse files Browse the repository at this point in the history
fix(next): enum serialization
  • Loading branch information
mzeitlin11 authored Sep 3, 2024
2 parents d14a43b + 090006f commit 0306091
Show file tree
Hide file tree
Showing 17 changed files with 133 additions and 62 deletions.
75 changes: 47 additions & 28 deletions generated/async-stripe-billing/src/invoice/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1681,10 +1681,11 @@ impl<'de> serde::Deserialize<'de> for UpcomingInvoiceScheduleDetailsPhasesBillin
/// The date at which this phase of the subscription schedule ends.
/// If set, `iterations` must not be set.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingInvoiceScheduleDetailsPhasesEndDate {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// All invoices will be billed using the specified settings.
#[derive(Copy, Clone, Debug, serde::Serialize)]
Expand Down Expand Up @@ -2095,18 +2096,20 @@ impl<'de> serde::Deserialize<'de> for UpcomingInvoiceScheduleDetailsPhasesProrat
/// The date at which this phase of the subscription schedule starts or `now`.
/// Must be set on the first phase.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingInvoiceScheduleDetailsPhasesStartDate {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// Sets the phase to trialing from the start date to this date.
/// Must be before the phase end date, can not be combined with `trial`.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingInvoiceScheduleDetailsPhasesTrialEnd {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// In cases where the `schedule_details` params update the currently active phase, specifies if and how to prorate at the time of the request.
#[derive(Copy, Clone, Eq, PartialEq)]
Expand Down Expand Up @@ -2175,10 +2178,11 @@ impl<'de> serde::Deserialize<'de> for UpcomingInvoiceScheduleDetailsProrationBeh
/// This field has been deprecated and will be removed in a future API version.
/// Use `subscription_details.billing_cycle_anchor` instead.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingInvoiceSubscriptionBillingCycleAnchor {
Now,
Unchanged,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// The subscription creation or modification params to apply as a preview.
Expand Down Expand Up @@ -2255,10 +2259,11 @@ impl<'a> Default for UpcomingInvoiceSubscriptionDetails<'a> {
/// This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices.
/// For existing subscriptions, the value can only be set to `now` or `unchanged`.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingInvoiceSubscriptionDetailsBillingCycleAnchor {
Now,
Unchanged,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// A list of up to 20 subscription items, each with an attached price.
Expand Down Expand Up @@ -2630,9 +2635,10 @@ impl<'de> serde::Deserialize<'de> for UpcomingInvoiceSubscriptionDetailsResumeAt
/// If provided, the invoice returned will preview updating or creating a subscription with that trial end.
/// If set, one of `subscription_details.items` or `subscription` is required.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingInvoiceSubscriptionDetailsTrialEnd {
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// A list of up to 20 subscription items, each with an attached price.
Expand Down Expand Up @@ -3012,9 +3018,10 @@ impl<'de> serde::Deserialize<'de> for UpcomingInvoiceSubscriptionResumeAt {
/// This field has been deprecated and will be removed in a future API version.
/// Use `subscription_details.trial_end` instead.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingInvoiceSubscriptionTrialEnd {
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// At any time, you can preview the upcoming invoice for a customer.
Expand Down Expand Up @@ -4672,10 +4679,11 @@ impl<'de> serde::Deserialize<'de> for UpcomingLinesInvoiceScheduleDetailsPhasesB
/// The date at which this phase of the subscription schedule ends.
/// If set, `iterations` must not be set.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingLinesInvoiceScheduleDetailsPhasesEndDate {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// All invoices will be billed using the specified settings.
#[derive(Copy, Clone, Debug, serde::Serialize)]
Expand Down Expand Up @@ -5082,18 +5090,20 @@ impl<'de> serde::Deserialize<'de> for UpcomingLinesInvoiceScheduleDetailsPhasesP
/// The date at which this phase of the subscription schedule starts or `now`.
/// Must be set on the first phase.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingLinesInvoiceScheduleDetailsPhasesStartDate {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// Sets the phase to trialing from the start date to this date.
/// Must be before the phase end date, can not be combined with `trial`.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingLinesInvoiceScheduleDetailsPhasesTrialEnd {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// In cases where the `schedule_details` params update the currently active phase, specifies if and how to prorate at the time of the request.
#[derive(Copy, Clone, Eq, PartialEq)]
Expand Down Expand Up @@ -5162,10 +5172,11 @@ impl<'de> serde::Deserialize<'de> for UpcomingLinesInvoiceScheduleDetailsProrati
/// This field has been deprecated and will be removed in a future API version.
/// Use `subscription_details.billing_cycle_anchor` instead.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingLinesInvoiceSubscriptionBillingCycleAnchor {
Now,
Unchanged,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// The subscription creation or modification params to apply as a preview.
Expand Down Expand Up @@ -5242,10 +5253,11 @@ impl<'a> Default for UpcomingLinesInvoiceSubscriptionDetails<'a> {
/// This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices.
/// For existing subscriptions, the value can only be set to `now` or `unchanged`.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingLinesInvoiceSubscriptionDetailsBillingCycleAnchor {
Now,
Unchanged,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// A list of up to 20 subscription items, each with an attached price.
Expand Down Expand Up @@ -5617,9 +5629,10 @@ impl<'de> serde::Deserialize<'de> for UpcomingLinesInvoiceSubscriptionDetailsRes
/// If provided, the invoice returned will preview updating or creating a subscription with that trial end.
/// If set, one of `subscription_details.items` or `subscription` is required.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingLinesInvoiceSubscriptionDetailsTrialEnd {
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// A list of up to 20 subscription items, each with an attached price.
Expand Down Expand Up @@ -6001,9 +6014,10 @@ impl<'de> serde::Deserialize<'de> for UpcomingLinesInvoiceSubscriptionResumeAt {
/// This field has been deprecated and will be removed in a future API version.
/// Use `subscription_details.trial_end` instead.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpcomingLinesInvoiceSubscriptionTrialEnd {
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// When retrieving an upcoming invoice, you’ll get a **lines** property containing the total count of line items and the first handful of those items.
Expand Down Expand Up @@ -12328,10 +12342,11 @@ impl<'de> serde::Deserialize<'de> for CreatePreviewInvoiceScheduleDetailsPhasesB
/// The date at which this phase of the subscription schedule ends.
/// If set, `iterations` must not be set.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum CreatePreviewInvoiceScheduleDetailsPhasesEndDate {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// All invoices will be billed using the specified settings.
#[derive(Copy, Clone, Debug, serde::Serialize)]
Expand Down Expand Up @@ -12738,18 +12753,20 @@ impl<'de> serde::Deserialize<'de> for CreatePreviewInvoiceScheduleDetailsPhasesP
/// The date at which this phase of the subscription schedule starts or `now`.
/// Must be set on the first phase.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum CreatePreviewInvoiceScheduleDetailsPhasesStartDate {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// Sets the phase to trialing from the start date to this date.
/// Must be before the phase end date, can not be combined with `trial`.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum CreatePreviewInvoiceScheduleDetailsPhasesTrialEnd {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// In cases where the `schedule_details` params update the currently active phase, specifies if and how to prorate at the time of the request.
#[derive(Copy, Clone, Eq, PartialEq)]
Expand Down Expand Up @@ -12886,10 +12903,11 @@ impl<'a> Default for CreatePreviewInvoiceSubscriptionDetails<'a> {
/// This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices.
/// For existing subscriptions, the value can only be set to `now` or `unchanged`.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum CreatePreviewInvoiceSubscriptionDetailsBillingCycleAnchor {
Now,
Unchanged,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// A list of up to 20 subscription items, each with an attached price.
Expand Down Expand Up @@ -13261,9 +13279,10 @@ impl<'de> serde::Deserialize<'de> for CreatePreviewInvoiceSubscriptionDetailsRes
/// If provided, the invoice returned will preview updating or creating a subscription with that trial end.
/// If set, one of `subscription_details.items` or `subscription` is required.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum CreatePreviewInvoiceSubscriptionDetailsTrialEnd {
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// At any time, you can preview the upcoming invoice for a customer.
Expand Down
7 changes: 5 additions & 2 deletions generated/async-stripe-billing/src/plan/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,11 @@ impl<'a> CreatePlanBuilder<'a> {
}
}
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum CreatePlanProduct<'a> {
#[serde(untagged)]
InlineProductParams(CreatePlanInlineProductParams<'a>),
#[serde(untagged)]
Id(&'a str),
}
#[derive(Copy, Clone, Debug, serde::Serialize)]
Expand Down Expand Up @@ -366,9 +368,10 @@ impl<'a> CreatePlanTiers<'a> {
/// The lower bound of a tier is the upper bound of the previous tier adding one.
/// Use `inf` to define a fallback tier.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum CreatePlanTiersUpTo {
Inf,
#[serde(untagged)]
I64(i64),
}
/// Apply a transformation to the reported usage or set quantity before computing the billed price.
Expand Down
6 changes: 4 additions & 2 deletions generated/async-stripe-billing/src/quote/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,10 @@ impl<'a> Default for CreateQuoteSubscriptionData<'a> {
/// The special value `current_period_end` can be provided to update a subscription at the end of its current period.
/// The `effective_date` is ignored if it is in the past when the quote is accepted.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum CreateQuoteSubscriptionDataEffectiveDate {
CurrentPeriodEnd,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// A quote models prices and services for a customer.
Expand Down Expand Up @@ -1563,9 +1564,10 @@ impl<'a> Default for UpdateQuoteSubscriptionData<'a> {
/// The special value `current_period_end` can be provided to update a subscription at the end of its current period.
/// The `effective_date` is ignored if it is in the past when the quote is accepted.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpdateQuoteSubscriptionDataEffectiveDate {
CurrentPeriodEnd,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// A quote models prices and services for a customer.
Expand Down
6 changes: 4 additions & 2 deletions generated/async-stripe-billing/src/subscription/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2602,9 +2602,10 @@ impl<'de> serde::Deserialize<'de> for CreateSubscriptionProrationBehavior {
/// Can be at most two years from `billing_cycle_anchor`.
/// See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum CreateSubscriptionTrialEnd {
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// Settings related to subscription trials.
Expand Down Expand Up @@ -5380,9 +5381,10 @@ impl<'de> serde::Deserialize<'de> for UpdateSubscriptionProrationBehavior {
/// The special value `now` can be provided to end the customer's trial immediately.
/// Can be at most two years from `billing_cycle_anchor`.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpdateSubscriptionTrialEnd {
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// Settings related to subscription trials.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1474,10 +1474,11 @@ impl<'de> serde::Deserialize<'de> for CreateSubscriptionSchedulePhasesProrationB
/// We recommend using `now` so that it starts the subscription immediately.
/// You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum CreateSubscriptionScheduleStartDate {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// Creates a new subscription schedule object.
/// Each customer can have up to 500 active or scheduled subscriptions.
Expand Down Expand Up @@ -2450,10 +2451,11 @@ impl<'de> serde::Deserialize<'de> for UpdateSubscriptionSchedulePhasesCollection
/// The date at which this phase of the subscription schedule ends.
/// If set, `iterations` must not be set.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpdateSubscriptionSchedulePhasesEndDate {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// All invoices will be billed using the specified settings.
#[derive(Copy, Clone, Debug, serde::Serialize)]
Expand Down Expand Up @@ -2862,18 +2864,20 @@ impl<'de> serde::Deserialize<'de> for UpdateSubscriptionSchedulePhasesProrationB
/// The date at which this phase of the subscription schedule starts or `now`.
/// Must be set on the first phase.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpdateSubscriptionSchedulePhasesStartDate {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// Sets the phase to trialing from the start date to this date.
/// Must be before the phase end date, can not be combined with `trial`.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum UpdateSubscriptionSchedulePhasesTrialEnd {
Timestamp(stripe_types::Timestamp),
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// If the update changes the current phase, indicates whether the changes should be prorated.
/// The default value is `create_prorations`.
Expand Down
3 changes: 2 additions & 1 deletion generated/async-stripe-billing/src/usage_record/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ impl<'de> serde::Deserialize<'de> for CreateSubscriptionItemUsageRecordAction {
/// When passing `"now"`, Stripe records usage for the current time.
/// Default is `"now"` if a value is not provided.
#[derive(Copy, Clone, Debug, serde::Serialize)]
#[serde(untagged)]
#[serde(rename_all = "snake_case")]
pub enum CreateSubscriptionItemUsageRecordTimestamp {
Now,
#[serde(untagged)]
Timestamp(stripe_types::Timestamp),
}
/// Creates a usage record for a specified subscription item and date, and fills it with a quantity.
Expand Down
Loading

0 comments on commit 0306091

Please sign in to comment.