Skip to content

Commit

Permalink
feat: generate latest changes from OpenApi spec
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon authored Jan 12, 2024
1 parent 8d799cd commit d0cbc71
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 19 deletions.
2 changes: 1 addition & 1 deletion openapi/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "v751"
"version": "v755"
}
12 changes: 2 additions & 10 deletions src/resources/generated/balance_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub struct BalanceTransaction {
/// The transaction's net funds status in the Stripe balance, which are either `available` or `pending`.
pub status: BalanceTransactionStatus,

/// Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, `obligation_outbound`, `obligation_reversal_inbound`, `obligation_reversal_outbound`, `obligation_payout`, `obligation_payout_failure`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`.
/// Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`.
///
/// Learn more about [balance transaction types and what they represent](https://stripe.com/docs/reports/balance-transaction-types).
/// To classify transactions for accounting purposes, consider `reporting_category` instead.
Expand Down Expand Up @@ -183,7 +183,7 @@ pub struct ListBalanceTransactions<'a> {

/// Only returns transactions of the given type.
///
/// One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_inbound`, `obligation_outbound`, `obligation_reversal_inbound`, `obligation_reversal_outbound`, `obligation_payout`, `obligation_payout_failure`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`.
/// One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`.
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<&'a str>,
Expand Down Expand Up @@ -229,12 +229,8 @@ pub enum BalanceTransactionType {
IssuingAuthorizationRelease,
IssuingDispute,
IssuingTransaction,
ObligationInbound,
ObligationOutbound,
ObligationPayout,
ObligationPayoutFailure,
ObligationReversalInbound,
ObligationReversalOutbound,
Payment,
PaymentFailureRefund,
PaymentNetworkReserveHold,
Expand Down Expand Up @@ -278,12 +274,8 @@ impl BalanceTransactionType {
BalanceTransactionType::IssuingAuthorizationRelease => "issuing_authorization_release",
BalanceTransactionType::IssuingDispute => "issuing_dispute",
BalanceTransactionType::IssuingTransaction => "issuing_transaction",
BalanceTransactionType::ObligationInbound => "obligation_inbound",
BalanceTransactionType::ObligationOutbound => "obligation_outbound",
BalanceTransactionType::ObligationPayout => "obligation_payout",
BalanceTransactionType::ObligationPayoutFailure => "obligation_payout_failure",
BalanceTransactionType::ObligationReversalInbound => "obligation_reversal_inbound",
BalanceTransactionType::ObligationReversalOutbound => "obligation_reversal_outbound",
BalanceTransactionType::Payment => "payment",
BalanceTransactionType::PaymentFailureRefund => "payment_failure_refund",
BalanceTransactionType::PaymentNetworkReserveHold => "payment_network_reserve_hold",
Expand Down
131 changes: 131 additions & 0 deletions src/resources/generated/customer_session.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
// ======================================
// This file was automatically generated.
// ======================================

use crate::client::{Client, Response};
use crate::ids::{CustomerId};
use crate::params::{Expand, Expandable, Object, Timestamp};
use crate::resources::{Customer};
use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "CustomerSessionResourceCustomerSession".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CustomerSession {

/// The client secret of this customer session.
///
/// Used on the client to set up secure access to the given `customer`. The client secret can be used to provide access to `customer` from your frontend.
/// It should not be stored, logged, or exposed to anyone other than the relevant customer.
/// Make sure that you have TLS enabled on any page that includes the client secret.
pub client_secret: String,

#[serde(skip_serializing_if = "Option::is_none")]
pub components: Option<CustomerSessionResourceComponents>,

/// Time at which the object was created.
///
/// Measured in seconds since the Unix epoch.
pub created: Timestamp,

/// The customer the customer session was created for.
pub customer: Expandable<Customer>,

/// The timestamp at which this customer session will expire.
pub expires_at: Timestamp,

/// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
pub livemode: bool,
}

impl CustomerSession {

/// Creates a customer session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.
pub fn create(client: &Client, params: CreateCustomerSession<'_>) -> Response<CustomerSession> {
client.post_form("/customer_sessions", &params)
}
}

impl Object for CustomerSession {
type Id = ();
fn id(&self) -> Self::Id {}
fn object(&self) -> &'static str {
"customer_session"
}
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CustomerSessionResourceComponents {

#[serde(skip_serializing_if = "Option::is_none")]
pub buy_button: Option<CustomerSessionResourceComponentsResourceBuyButton>,

#[serde(skip_serializing_if = "Option::is_none")]
pub pricing_table: Option<CustomerSessionResourceComponentsResourcePricingTable>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CustomerSessionResourceComponentsResourceBuyButton {

/// Whether the buy button is enabled.
pub enabled: bool,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CustomerSessionResourceComponentsResourcePricingTable {

/// Whether the pricing table is enabled.
pub enabled: bool,
}

/// The parameters for `CustomerSession::create`.
#[derive(Clone, Debug, Serialize)]
pub struct CreateCustomerSession<'a> {

/// Configuration for each component.
///
/// 1 component must be enabled.
pub components: CreateCustomerSessionComponents,

/// The ID of an existing customer for which to create the customer session.
pub customer: CustomerId,

/// Specifies which fields in the response should be expanded.
#[serde(skip_serializing_if = "Expand::is_empty")]
pub expand: &'a [&'a str],
}

impl<'a> CreateCustomerSession<'a> {
pub fn new(components: CreateCustomerSessionComponents, customer: CustomerId) -> Self {
CreateCustomerSession {
components,
customer,
expand: Default::default(),
}
}
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCustomerSessionComponents {

/// Configuration for buy button.
#[serde(skip_serializing_if = "Option::is_none")]
pub buy_button: Option<CreateCustomerSessionComponentsBuyButton>,

/// Configuration for the pricing table.
#[serde(skip_serializing_if = "Option::is_none")]
pub pricing_table: Option<CreateCustomerSessionComponentsPricingTable>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCustomerSessionComponentsBuyButton {

/// Whether the buy button is enabled.
pub enabled: bool,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct CreateCustomerSessionComponentsPricingTable {

/// Whether the pricing table is enabled.
pub enabled: bool,
}
8 changes: 4 additions & 4 deletions src/resources/generated/payment_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2874,7 +2874,7 @@ pub struct CreatePaymentIntentPaymentMethodOptionsAcssDebit {
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage>,

/// Verification method for the intent.
/// Bank account verification method.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod>,
Expand Down Expand Up @@ -3479,7 +3479,7 @@ pub struct CreatePaymentIntentPaymentMethodOptionsUsBankAccount {
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage>,

/// Verification method for the intent.
/// Bank account verification method.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod>,
Expand Down Expand Up @@ -3761,7 +3761,7 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsAcssDebit {
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage>,

/// Verification method for the intent.
/// Bank account verification method.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod>,
Expand Down Expand Up @@ -4366,7 +4366,7 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccount {
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage>,

/// Verification method for the intent.
/// Bank account verification method.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod>,
Expand Down
8 changes: 4 additions & 4 deletions src/resources/generated/setup_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ pub struct CreateSetupIntentPaymentMethodOptionsAcssDebit {
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<CreateSetupIntentPaymentMethodOptionsAcssDebitMandateOptions>,

/// Verification method for the intent.
/// Bank account verification method.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<CreateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod>,
Expand Down Expand Up @@ -1396,7 +1396,7 @@ pub struct CreateSetupIntentPaymentMethodOptionsUsBankAccount {
#[serde(skip_serializing_if = "Option::is_none")]
pub networks: Option<CreateSetupIntentPaymentMethodOptionsUsBankAccountNetworks>,

/// Verification method for the intent.
/// Bank account verification method.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<CreateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod>,
Expand Down Expand Up @@ -1616,7 +1616,7 @@ pub struct UpdateSetupIntentPaymentMethodOptionsAcssDebit {
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<UpdateSetupIntentPaymentMethodOptionsAcssDebitMandateOptions>,

/// Verification method for the intent.
/// Bank account verification method.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<UpdateSetupIntentPaymentMethodOptionsAcssDebitVerificationMethod>,
Expand Down Expand Up @@ -1695,7 +1695,7 @@ pub struct UpdateSetupIntentPaymentMethodOptionsUsBankAccount {
#[serde(skip_serializing_if = "Option::is_none")]
pub networks: Option<UpdateSetupIntentPaymentMethodOptionsUsBankAccountNetworks>,

/// Verification method for the intent.
/// Bank account verification method.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<UpdateSetupIntentPaymentMethodOptionsUsBankAccountVerificationMethod>,
Expand Down

0 comments on commit d0cbc71

Please sign in to comment.