Skip to content

Commit

Permalink
Merge pull request #453 from arlyon/feat/update-openapi
Browse files Browse the repository at this point in the history
Feat/update openapi
  • Loading branch information
arlyon committed Dec 1, 2023
2 parents 65dbec6 + a2df83c commit e79f6a9
Show file tree
Hide file tree
Showing 279 changed files with 9,817 additions and 2,416 deletions.
2 changes: 1 addition & 1 deletion examples/checkout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async fn main() {

// finally, create a checkout session for this product / price
let checkout_session = {
let mut params = CreateCheckoutSession::new("http://test.com/success");
let mut params = CreateCheckoutSession::new();
params.cancel_url = Some("http://test.com/cancel");
params.customer = Some(customer.id);
params.mode = Some(CheckoutSessionMode::Payment);
Expand Down
5 changes: 4 additions & 1 deletion openapi/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ pub fn gen_struct(
let struct_name = meta.schema_to_rust_type(object);
let schema = meta.spec.get_schema_unwrapped(object).as_item().expect("Expected item");
let obj = as_object_type(schema).expect("Expected object type");
let schema_title = schema.schema_data.title.as_ref().expect("No title found");
let schema_title = schema.schema_data.title.as_ref().unwrap_or_else(|| {
tracing::warn!("{} has no title", object);
&object
});

let deleted_schema = meta.spec.component_schemas().get(&format!("deleted_{}", object));
let deleted_properties =
Expand Down
2 changes: 1 addition & 1 deletion openapi/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "v545"
"version": "v692"
}
1 change: 1 addition & 0 deletions src/ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ def_id!(IssuingCardId, "ic_");
def_id!(IssuingCardholderId, "ich_");
def_id!(IssuingDisputeId, "idp_");
def_id!(IssuingTransactionId, "ipi_");
def_id!(IssuingTokenId: String);
def_id!(OrderId, "or_");
def_id!(OrderReturnId, "orret_");
def_id!(MandateId, "mandate_");
Expand Down
3 changes: 2 additions & 1 deletion src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ pub use {
generated::core::{
address::*,
balance::*,
balance_amount_by_source_type::*,
balance_transaction::*,
billing_details::*,
charge::*,
Expand All @@ -132,7 +133,6 @@ pub use {
payment_intent::*,
payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code::*,
linked_account_options_us_bank_account::*,
payment_method_details_card_checks::*,
payment_method_details_card_wallet_apple_pay::*,
payment_method_details_card_wallet_google_pay::*,
payment_method_options_customer_balance_eu_bank_account::*,
Expand Down Expand Up @@ -294,6 +294,7 @@ pub use {
generated::issuing::{
issuing_authorization::*,
issuing_card::*,
issuing_token::*,
issuing_cardholder::*,
issuing_dispute::*,
issuing_transaction::*,
Expand Down
3 changes: 2 additions & 1 deletion src/resources/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub mod core {
pub mod address;
pub mod api_errors;
pub mod balance;
pub mod balance_amount_by_source_type;
pub mod balance_transaction;
pub mod billing_details;
pub mod cash_balance;
Expand All @@ -30,7 +31,6 @@ pub mod core {
pub mod payment_intent;
pub mod payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code;
pub mod payment_method_config_biz_payment_method_configuration_details;
pub mod payment_method_details_card_checks;
pub mod payment_method_details_card_wallet_apple_pay;
pub mod payment_method_details_card_wallet_google_pay;
pub mod payment_method_options_customer_balance_eu_bank_account;
Expand Down Expand Up @@ -140,6 +140,7 @@ pub mod issuing {
pub mod issuing_card;
pub mod issuing_cardholder;
pub mod issuing_dispute;
pub mod issuing_token;
pub mod issuing_transaction;
}

Expand Down
175 changes: 169 additions & 6 deletions src/resources/generated/account.rs

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/resources/generated/account_application_authorized.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "account.application.authorized".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct AccountApplicationAuthorized {
}
10 changes: 10 additions & 0 deletions src/resources/generated/account_application_deauthorized.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "account.application.deauthorized".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct AccountApplicationDeauthorized {
}
10 changes: 10 additions & 0 deletions src/resources/generated/account_external_account_created.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "account.external_account.created".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct AccountExternalAccountCreated {
}
10 changes: 10 additions & 0 deletions src/resources/generated/account_external_account_deleted.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "account.external_account.deleted".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct AccountExternalAccountDeleted {
}
10 changes: 10 additions & 0 deletions src/resources/generated/account_external_account_updated.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "account.external_account.updated".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct AccountExternalAccountUpdated {
}
4 changes: 2 additions & 2 deletions src/resources/generated/account_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ impl Object for AccountSession {
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ConnectEmbeddedAccountSessionCreateComponents {

pub account_onboarding: ConnectEmbeddedBaseConfig,
pub account_onboarding: ConnectEmbeddedBaseConfigClaim,
}

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

/// Whether the embedded component is enabled.
pub enabled: bool,
Expand Down
10 changes: 10 additions & 0 deletions src/resources/generated/account_updated.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "account.updated".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct AccountUpdated {
}
10 changes: 10 additions & 0 deletions src/resources/generated/api_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub enum ApiErrorsCode {
ApplicationFeesNotAllowed,
AuthenticationRequired,
BalanceInsufficient,
BalanceInvalidParameter,
BankAccountBadRoutingNumbers,
BankAccountDeclined,
BankAccountExists,
Expand Down Expand Up @@ -114,6 +115,7 @@ pub enum ApiErrorsCode {
DebitNotAuthorized,
EmailInvalid,
ExpiredCard,
FinancialConnectionsAccountInactive,
IdempotencyKeyInUse,
IncorrectAddress,
IncorrectCvc,
Expand Down Expand Up @@ -218,11 +220,13 @@ pub enum ApiErrorsCode {
TaxesCalculationFailed,
TerminalLocationCountryUnsupported,
TerminalReaderBusy,
TerminalReaderHardwareFault,
TerminalReaderOffline,
TerminalReaderTimeout,
TestmodeChargesOnly,
TlsVersionUnsupported,
TokenAlreadyUsed,
TokenCardNetworkInvalid,
TokenInUse,
TransferSourceBalanceParametersMismatch,
TransfersNotAllowed,
Expand All @@ -248,6 +252,7 @@ impl ApiErrorsCode {
ApiErrorsCode::ApplicationFeesNotAllowed => "application_fees_not_allowed",
ApiErrorsCode::AuthenticationRequired => "authentication_required",
ApiErrorsCode::BalanceInsufficient => "balance_insufficient",
ApiErrorsCode::BalanceInvalidParameter => "balance_invalid_parameter",
ApiErrorsCode::BankAccountBadRoutingNumbers => "bank_account_bad_routing_numbers",
ApiErrorsCode::BankAccountDeclined => "bank_account_declined",
ApiErrorsCode::BankAccountExists => "bank_account_exists",
Expand Down Expand Up @@ -280,6 +285,9 @@ impl ApiErrorsCode {
ApiErrorsCode::DebitNotAuthorized => "debit_not_authorized",
ApiErrorsCode::EmailInvalid => "email_invalid",
ApiErrorsCode::ExpiredCard => "expired_card",
ApiErrorsCode::FinancialConnectionsAccountInactive => {
"financial_connections_account_inactive"
}
ApiErrorsCode::IdempotencyKeyInUse => "idempotency_key_in_use",
ApiErrorsCode::IncorrectAddress => "incorrect_address",
ApiErrorsCode::IncorrectCvc => "incorrect_cvc",
Expand Down Expand Up @@ -420,11 +428,13 @@ impl ApiErrorsCode {
"terminal_location_country_unsupported"
}
ApiErrorsCode::TerminalReaderBusy => "terminal_reader_busy",
ApiErrorsCode::TerminalReaderHardwareFault => "terminal_reader_hardware_fault",
ApiErrorsCode::TerminalReaderOffline => "terminal_reader_offline",
ApiErrorsCode::TerminalReaderTimeout => "terminal_reader_timeout",
ApiErrorsCode::TestmodeChargesOnly => "testmode_charges_only",
ApiErrorsCode::TlsVersionUnsupported => "tls_version_unsupported",
ApiErrorsCode::TokenAlreadyUsed => "token_already_used",
ApiErrorsCode::TokenCardNetworkInvalid => "token_card_network_invalid",
ApiErrorsCode::TokenInUse => "token_in_use",
ApiErrorsCode::TransferSourceBalanceParametersMismatch => {
"transfer_source_balance_parameters_mismatch"
Expand Down
10 changes: 10 additions & 0 deletions src/resources/generated/application_fee_created.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "application_fee.created".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ApplicationFeeCreated {
}
10 changes: 10 additions & 0 deletions src/resources/generated/application_fee_refund_updated.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "application_fee.refund.updated".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ApplicationFeeRefundUpdated {
}
10 changes: 10 additions & 0 deletions src/resources/generated/application_fee_refunded.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "application_fee.refunded".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ApplicationFeeRefunded {
}
21 changes: 10 additions & 11 deletions src/resources/generated/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use serde::{Deserialize, Serialize};

use crate::params::Object;
use crate::resources::Currency;
use crate::resources::{BalanceAmountBySourceType, Currency};

/// The resource representing a Stripe "Balance".
///
Expand All @@ -25,7 +25,7 @@ pub struct Balance {

/// Funds that you can pay out using Instant Payouts.
#[serde(skip_serializing_if = "Option::is_none")]
pub instant_available: Option<Vec<BalanceAmount>>,
pub instant_available: Option<Vec<BalanceAmountNet>>,

#[serde(skip_serializing_if = "Option::is_none")]
pub issuing: Option<BalanceDetail>,
Expand Down Expand Up @@ -62,18 +62,17 @@ pub struct BalanceAmount {
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct BalanceAmountBySourceType {
/// Amount for bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank_account: Option<i64>,
pub struct BalanceAmountNet {
/// Balance amount.
pub amount: i64,

/// Amount for card.
#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<i64>,
/// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
///
/// Must be a [supported currency](https://stripe.com/docs/currencies).
pub currency: Currency,

/// Amount for FPX.
#[serde(skip_serializing_if = "Option::is_none")]
pub fpx: Option<i64>,
pub source_types: Option<BalanceAmountBySourceType>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
Expand Down
21 changes: 21 additions & 0 deletions src/resources/generated/balance_amount_by_source_type.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "BalanceAmountBySourceType".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct BalanceAmountBySourceType {
/// Amount for bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank_account: Option<i64>,

/// Amount for card.
#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<i64>,

/// Amount for FPX.
#[serde(skip_serializing_if = "Option::is_none")]
pub fpx: Option<i64>,
}
10 changes: 10 additions & 0 deletions src/resources/generated/balance_available.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ======================================
// This file was automatically generated.
// ======================================

use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "balance.available".
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct BalanceAvailable {
}
Loading

0 comments on commit e79f6a9

Please sign in to comment.