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

Initting objects does not have nil defaults. #239

Open
Steven4294 opened this issue Oct 29, 2023 · 1 comment
Open

Initting objects does not have nil defaults. #239

Steven4294 opened this issue Oct 29, 2023 · 1 comment

Comments

@Steven4294
Copy link

See below:

     let response = try await stripe.invoices.
                        .update(invoice: invoice.id ?? "",
                                      autoAdvance:nil,
                                      collectionMethod:  nil,
                                      description:  nil,
                                      metadata: nil,
                                      accountTaxIds:  nil,
                                      applicationFeeAmount: nil,
                                      automaticTax: nil,
                                      customFields: nil,
                                      daysUntilDue: nil,
                                      defaultPaymentMethod: nil,
                                      defaultSource: nil,
                                      defaultTaxRates:nil,
                                      discounts:  nil,
                                      dueDate: nil,
                                      footer: nil,
                                      onBehalfOf:  nil,
                                      paymentSettings: nil,
                                      renderingOptions:nil,
                                      shippingCost:  nil,
                                      shippingDetails:  nil,
                                      statementDescriptor: nil,
                                      transferData: nil,
                                      expand:  nil)

Codebase gets bloated as a result

@coenttb
Copy link

coenttb commented Sep 16, 2024

It's not immediately clear how to fix this. I note that the Stripe* conformances do have nil parameters:

public struct StripeSubscriptionRoutes: SubscriptionRoutes {
   
    public func create(customer: String,
                       items: [[String: Any]],
                       cancelAtPeriodEnd: Bool? = nil,
                       currency: Currency? = nil,
                       defaultPaymentMethod: String? = nil,
                       description: String? = nil,
                       metadata: [String: String]? = nil,
                       paymentBehavior: SubscriptionPaymentBehavior? = nil,
                       addInvoiceItems: [[String: Any]]? = nil,
                       applicationFeePercent: Decimal? = nil,
                       automaticTax: [String: Any]? = nil,
                       backdateStartDate: Date? = nil,
                       billingCycleAnchor: Date? = nil,
                       billingThresholds: [String: Any]? = nil,
                       cancelAt: Date? = nil,
                       collectionMethod: SubscriptionCollectionMethod? = nil,
                       coupon: String? = nil,
                       daysUntilDue: Int? = nil,
                       defaultSource: String? = nil,
                       defaultTaxRates: [String]? = nil,
                       offSession: Bool? = nil,
                       onBehalfOf: String? = nil,
                       paymentSettings: [String: Any]? = nil,
                       pendingInvoiceItemInterval: [String: Any]? = nil,
                       promotionCode: String? = nil,
                       prorationBehavior: SubscriptionProrationBehavior? = nil,
                       transferData: [String: Any]? = nil,
                       trialEnd: Any? = nil,
                       trialFromPlan: Bool? = nil,
                       trialPeriodDays: Int? = nil,
                       trialSettings: [String: Any]? = nil,
                       expand: [String]? = nil) async throws -> Subscription {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants