From af52cdab16bcfc7fee581f8e9edef301b324150d Mon Sep 17 00:00:00 2001 From: Graham Scott Date: Mon, 25 May 2026 11:10:07 -0400 Subject: [PATCH 1/2] Fix incorrect help text in resources command hint The root help template suggested running `stripe resources help` but that produces an error since the command doesn't accept positional arguments. Updated to `stripe resources --help`. Co-Authored-By: Claude Opus 4.6 Committed-By-Agent: claude --- pkg/cmd/templates.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/templates.go b/pkg/cmd/templates.go index 61737643..a95062af 100644 --- a/pkg/cmd/templates.go +++ b/pkg/cmd/templates.go @@ -394,7 +394,7 @@ Use "{{.CommandPath}} [command] --help" for more information about a command.{{e ansi.Bold("Webhook commands:"), ansi.Bold("Stripe commands:"), ansi.Bold("Resource commands:"), - ansi.Italic("To see more resource commands, run `stripe resources help`"), + ansi.Italic("To see more resource commands, run `stripe resources --help`"), ansi.Italic("To see only v2 resource commands, run `stripe v2 help`"), ansi.Bold("API commands:"), ansi.Bold("Other commands:"), From fcfacfb625da0be1c1da368ccee9e8988ba77924 Mon Sep 17 00:00:00 2001 From: Graham Scott Date: Mon, 25 May 2026 11:10:38 -0400 Subject: [PATCH 2/2] Add descriptions to resource commands from OpenAPI spec Wire schema descriptions from the OpenAPI spec through the code generator so that `stripe resources` and per-resource `--help` output show a short description for each resource command. The generator extracts the first sentence of each schema's description, then cleans it for terminal display (collapses newlines, strips Markdown links and backticks). Resources without descriptions in the spec are left blank. Co-Authored-By: Claude Opus 4.6 Committed-By-Agent: claude --- pkg/cmd/resource/resource.go | 8 +- pkg/cmd/resources/resources_gen.go | 354 ++++++++++++++--------------- pkg/cmd/resources_test.go | 4 +- pkg/gen/gen_resources_cmds.go | 11 +- pkg/gen/resource_utils.go | 17 ++ pkg/gen/resources_cmds.go.tpl | 4 +- 6 files changed, 211 insertions(+), 187 deletions(-) diff --git a/pkg/cmd/resource/resource.go b/pkg/cmd/resource/resource.go index 57eb9d2d..81b6e965 100644 --- a/pkg/cmd/resource/resource.go +++ b/pkg/cmd/resource/resource.go @@ -64,12 +64,16 @@ func GetResourceCmdName(name string) string { } } -// NewResourceCmd returns a new ResourceCmd. -func NewResourceCmd(parentCmd *cobra.Command, resourceName string) *ResourceCmd { +// NewResourceCmd returns a new ResourceCmd. An optional description can be +// passed to set the Short help text for the command. +func NewResourceCmd(parentCmd *cobra.Command, resourceName string, description ...string) *ResourceCmd { cmd := &cobra.Command{ Use: resourceName, Annotations: make(map[string]string), } + if len(description) > 0 && description[0] != "" { + cmd.Short = description[0] + } cmd.SetUsageTemplate(resourceUsageTemplate()) parentCmd.AddCommand(cmd) diff --git a/pkg/cmd/resources/resources_gen.go b/pkg/cmd/resources/resources_gen.go index 8b10be15..654afa32 100644 --- a/pkg/cmd/resources/resources_gen.go +++ b/pkg/cmd/resources/resources_gen.go @@ -42,133 +42,133 @@ func addV1ResourcesCmds(rootCmd *cobra.Command, cfg *config.Config) { nsTreasuryCmd := resource.NewNamespaceCmd(rootCmd, "treasury") // Resource commands - rAccountLinksCmd := resource.NewResourceCmd(rootCmd, "account_links") - rAccountSessionsCmd := resource.NewResourceCmd(rootCmd, "account_sessions") - rAccountsCmd := resource.NewResourceCmd(rootCmd, "accounts") + rAccountLinksCmd := resource.NewResourceCmd(rootCmd, "account_links", "Account Links are the means by which a Connect platform grants a connected account permission to access Stripe-hosted applications, such as Connect Onboarding") + rAccountSessionsCmd := resource.NewResourceCmd(rootCmd, "account_sessions", "An AccountSession allows a Connect platform to grant access to a connected account in Connect embedded components") + rAccountsCmd := resource.NewResourceCmd(rootCmd, "accounts", "For new integrations, we recommend using the Accounts v2 API, in place of /v1/accounts and /v1/customers to represent a user") rApplePayDomainsCmd := resource.NewResourceCmd(rootCmd, "apple_pay_domains") rApplicationFeesCmd := resource.NewResourceCmd(rootCmd, "application_fees") - rBalanceCmd := resource.NewResourceCmd(rootCmd, "balance") - rBalanceSettingsCmd := resource.NewResourceCmd(rootCmd, "balance_settings") - rBalanceTransactionsCmd := resource.NewResourceCmd(rootCmd, "balance_transactions") - rBankAccountsCmd := resource.NewResourceCmd(rootCmd, "bank_accounts") - rCapabilitiesCmd := resource.NewResourceCmd(rootCmd, "capabilities") - rCardsCmd := resource.NewResourceCmd(rootCmd, "cards") - rCashBalancesCmd := resource.NewResourceCmd(rootCmd, "cash_balances") - rChargesCmd := resource.NewResourceCmd(rootCmd, "charges") - rConfirmationTokensCmd := resource.NewResourceCmd(rootCmd, "confirmation_tokens") + rBalanceCmd := resource.NewResourceCmd(rootCmd, "balance", "This is an object representing your Stripe balance") + rBalanceSettingsCmd := resource.NewResourceCmd(rootCmd, "balance_settings", "Options for customizing account balances and payout settings for a Stripe platform’s connected accounts") + rBalanceTransactionsCmd := resource.NewResourceCmd(rootCmd, "balance_transactions", "Balance transactions represent funds moving through your Stripe account") + rBankAccountsCmd := resource.NewResourceCmd(rootCmd, "bank_accounts", "These bank accounts are payment methods on Customer objects") + rCapabilitiesCmd := resource.NewResourceCmd(rootCmd, "capabilities", "This is an object representing a capability for a Stripe account") + rCardsCmd := resource.NewResourceCmd(rootCmd, "cards", "You can store multiple cards on a customer in order to charge the customer later") + rCashBalancesCmd := resource.NewResourceCmd(rootCmd, "cash_balances", "A customer's Cash balance represents real funds") + rChargesCmd := resource.NewResourceCmd(rootCmd, "charges", "The Charge object represents a single attempt to move money into your Stripe account") + rConfirmationTokensCmd := resource.NewResourceCmd(rootCmd, "confirmation_tokens", "ConfirmationTokens help transport client side data collected by Stripe JS over to your server for confirming a PaymentIntent or SetupIntent") rConfirmationTokensTestHelpersCmd := resource.NewResourceCmd(rConfirmationTokensCmd.Cmd, "test_helpers") - rCountrySpecsCmd := resource.NewResourceCmd(rootCmd, "country_specs") - rCouponsCmd := resource.NewResourceCmd(rootCmd, "coupons") - rCreditNoteLineItemsCmd := resource.NewResourceCmd(rootCmd, "credit_note_line_items") - rCreditNotesCmd := resource.NewResourceCmd(rootCmd, "credit_notes") - rCustomerBalanceTransactionsCmd := resource.NewResourceCmd(rootCmd, "customer_balance_transactions") - rCustomerCashBalanceTransactionsCmd := resource.NewResourceCmd(rootCmd, "customer_cash_balance_transactions") - rCustomerSessionsCmd := resource.NewResourceCmd(rootCmd, "customer_sessions") - rCustomersCmd := resource.NewResourceCmd(rootCmd, "customers") + rCountrySpecsCmd := resource.NewResourceCmd(rootCmd, "country_specs", "Stripe needs to collect certain pieces of information about each account created") + rCouponsCmd := resource.NewResourceCmd(rootCmd, "coupons", "A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer") + rCreditNoteLineItemsCmd := resource.NewResourceCmd(rootCmd, "credit_note_line_items", "The credit note line item object") + rCreditNotesCmd := resource.NewResourceCmd(rootCmd, "credit_notes", "Issue a credit note to adjust an invoice's amount after the invoice is finalized") + rCustomerBalanceTransactionsCmd := resource.NewResourceCmd(rootCmd, "customer_balance_transactions", "Each customer has a Balance value, which denotes a debit or credit that's automatically applied to their next invoice upon finalization") + rCustomerCashBalanceTransactionsCmd := resource.NewResourceCmd(rootCmd, "customer_cash_balance_transactions", "Customers with certain payments enabled have a cash balance, representing funds that were paid by the customer to a merchant, but have not yet been allocated to a payment") + rCustomerSessionsCmd := resource.NewResourceCmd(rootCmd, "customer_sessions", "A Customer Session allows you to grant Stripe's frontend SDKs (like Stripe.js) client-side access control over a Customer") + rCustomersCmd := resource.NewResourceCmd(rootCmd, "customers", "This object represents a customer of your business") rCustomersTestHelpersCmd := resource.NewResourceCmd(rCustomersCmd.Cmd, "test_helpers") - rDisputesCmd := resource.NewResourceCmd(rootCmd, "disputes") + rDisputesCmd := resource.NewResourceCmd(rootCmd, "disputes", "A dispute occurs when a customer questions your charge with their card issuer") rEphemeralKeysCmd := resource.NewResourceCmd(rootCmd, "ephemeral_keys") - rEventsCmd := resource.NewResourceCmd(rootCmd, "events") - rExchangeRatesCmd := resource.NewResourceCmd(rootCmd, "exchange_rates") + rEventsCmd := resource.NewResourceCmd(rootCmd, "events", "Snapshot events allow you to track and react to activity in your Stripe integration") + rExchangeRatesCmd := resource.NewResourceCmd(rootCmd, "exchange_rates", "[Deprecated] The ExchangeRate APIs are deprecated") rExternalAccountsCmd := resource.NewResourceCmd(rootCmd, "external_accounts") - rFeeRefundsCmd := resource.NewResourceCmd(rootCmd, "fee_refunds") - rFileLinksCmd := resource.NewResourceCmd(rootCmd, "file_links") - rFilesCmd := resource.NewResourceCmd(rootCmd, "files") - rInvoiceLineItemsCmd := resource.NewResourceCmd(rootCmd, "invoice_line_items") - rInvoicePaymentsCmd := resource.NewResourceCmd(rootCmd, "invoice_payments") - rInvoiceRenderingTemplatesCmd := resource.NewResourceCmd(rootCmd, "invoice_rendering_templates") - rInvoiceitemsCmd := resource.NewResourceCmd(rootCmd, "invoiceitems") - rInvoicesCmd := resource.NewResourceCmd(rootCmd, "invoices") - rLineItemsCmd := resource.NewResourceCmd(rootCmd, "line_items") - rLoginLinksCmd := resource.NewResourceCmd(rootCmd, "login_links") - rMandatesCmd := resource.NewResourceCmd(rootCmd, "mandates") - rPaymentAttemptRecordsCmd := resource.NewResourceCmd(rootCmd, "payment_attempt_records") + rFeeRefundsCmd := resource.NewResourceCmd(rootCmd, "fee_refunds", "Application Fee Refund objects allow you to refund an application fee that has previously been created but not yet refunded") + rFileLinksCmd := resource.NewResourceCmd(rootCmd, "file_links", "To share the contents of a File object with non-Stripe users, you can create a FileLink") + rFilesCmd := resource.NewResourceCmd(rootCmd, "files", "This object represents files hosted on Stripe's servers") + rInvoiceLineItemsCmd := resource.NewResourceCmd(rootCmd, "invoice_line_items", "Invoice Line Items represent the individual lines within an invoice and only exist within the context of an invoice") + rInvoicePaymentsCmd := resource.NewResourceCmd(rootCmd, "invoice_payments", "Invoice Payments represent payments made against invoices") + rInvoiceRenderingTemplatesCmd := resource.NewResourceCmd(rootCmd, "invoice_rendering_templates", "Invoice Rendering Templates are used to configure how invoices are rendered on surfaces like the PDF") + rInvoiceitemsCmd := resource.NewResourceCmd(rootCmd, "invoiceitems", "Invoice Items represent the component lines of an invoice") + rInvoicesCmd := resource.NewResourceCmd(rootCmd, "invoices", "Invoices are statements of amounts owed by a customer, and are either generated one-off, or generated periodically from a subscription") + rLineItemsCmd := resource.NewResourceCmd(rootCmd, "line_items", "Invoice Line Items represent the individual lines within an invoice and only exist within the context of an invoice") + rLoginLinksCmd := resource.NewResourceCmd(rootCmd, "login_links", "Login Links are single-use URLs that takes an Express account to the login page for their Stripe dashboard") + rMandatesCmd := resource.NewResourceCmd(rootCmd, "mandates", "A Mandate is a record of the permission that your customer gives you to debit their payment method") + rPaymentAttemptRecordsCmd := resource.NewResourceCmd(rootCmd, "payment_attempt_records", "A Payment Attempt Record represents an individual attempt at making a payment, on or off Stripe") rPaymentIntentAmountDetailsLineItemsCmd := resource.NewResourceCmd(rootCmd, "payment_intent_amount_details_line_items") - rPaymentIntentsCmd := resource.NewResourceCmd(rootCmd, "payment_intents") - rPaymentLinksCmd := resource.NewResourceCmd(rootCmd, "payment_links") - rPaymentMethodConfigurationsCmd := resource.NewResourceCmd(rootCmd, "payment_method_configurations") - rPaymentMethodDomainsCmd := resource.NewResourceCmd(rootCmd, "payment_method_domains") - rPaymentMethodsCmd := resource.NewResourceCmd(rootCmd, "payment_methods") - rPaymentRecordsCmd := resource.NewResourceCmd(rootCmd, "payment_records") + rPaymentIntentsCmd := resource.NewResourceCmd(rootCmd, "payment_intents", "A PaymentIntent guides you through the process of collecting a payment from your customer") + rPaymentLinksCmd := resource.NewResourceCmd(rootCmd, "payment_links", "A payment link is a shareable URL that will take your customers to a hosted payment page") + rPaymentMethodConfigurationsCmd := resource.NewResourceCmd(rootCmd, "payment_method_configurations", "PaymentMethodConfigurations control which payment methods are displayed to your customers when you don't explicitly specify payment method types") + rPaymentMethodDomainsCmd := resource.NewResourceCmd(rootCmd, "payment_method_domains", "A payment method domain represents a web domain that you have registered with Stripe") + rPaymentMethodsCmd := resource.NewResourceCmd(rootCmd, "payment_methods", "PaymentMethod objects represent your customer's payment instruments") + rPaymentRecordsCmd := resource.NewResourceCmd(rootCmd, "payment_records", "A Payment Record is a resource that allows you to represent payments that occur on- or off-Stripe") rPaymentSourcesCmd := resource.NewResourceCmd(rootCmd, "payment_sources") - rPayoutsCmd := resource.NewResourceCmd(rootCmd, "payouts") - rPersonsCmd := resource.NewResourceCmd(rootCmd, "persons") - rPlansCmd := resource.NewResourceCmd(rootCmd, "plans") - rPricesCmd := resource.NewResourceCmd(rootCmd, "prices") - rProductFeaturesCmd := resource.NewResourceCmd(rootCmd, "product_features") - rProductsCmd := resource.NewResourceCmd(rootCmd, "products") - rPromotionCodesCmd := resource.NewResourceCmd(rootCmd, "promotion_codes") - rQuotesCmd := resource.NewResourceCmd(rootCmd, "quotes") - rRefundsCmd := resource.NewResourceCmd(rootCmd, "refunds") + rPayoutsCmd := resource.NewResourceCmd(rootCmd, "payouts", "A Payout object is created when you receive funds from Stripe, or when you initiate a payout to either a bank account or debit card of a connected Stripe account") + rPersonsCmd := resource.NewResourceCmd(rootCmd, "persons", "This is an object representing a person associated with a Stripe account") + rPlansCmd := resource.NewResourceCmd(rootCmd, "plans", "You can now model subscriptions more flexibly using the Prices API") + rPricesCmd := resource.NewResourceCmd(rootCmd, "prices", "Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products") + rProductFeaturesCmd := resource.NewResourceCmd(rootCmd, "product_features", "A product_feature represents an attachment between a feature and a product") + rProductsCmd := resource.NewResourceCmd(rootCmd, "products", "Products describe the specific goods or services you offer to your customers") + rPromotionCodesCmd := resource.NewResourceCmd(rootCmd, "promotion_codes", "A Promotion Code represents a customer-redeemable code for an underlying promotion") + rQuotesCmd := resource.NewResourceCmd(rootCmd, "quotes", "A Quote is a way to model prices that you'd like to provide to a customer") + rRefundsCmd := resource.NewResourceCmd(rootCmd, "refunds", "Refund objects allow you to refund a previously created charge that isn't refunded yet") rRefundsTestHelpersCmd := resource.NewResourceCmd(rRefundsCmd.Cmd, "test_helpers") - rReviewsCmd := resource.NewResourceCmd(rootCmd, "reviews") - rScheduledQueryRunsCmd := resource.NewResourceCmd(rootCmd, "scheduled_query_runs") - rSetupAttemptsCmd := resource.NewResourceCmd(rootCmd, "setup_attempts") - rSetupIntentsCmd := resource.NewResourceCmd(rootCmd, "setup_intents") - rShippingRatesCmd := resource.NewResourceCmd(rootCmd, "shipping_rates") - rSourcesCmd := resource.NewResourceCmd(rootCmd, "sources") - rSubscriptionItemsCmd := resource.NewResourceCmd(rootCmd, "subscription_items") - rSubscriptionSchedulesCmd := resource.NewResourceCmd(rootCmd, "subscription_schedules") - rSubscriptionsCmd := resource.NewResourceCmd(rootCmd, "subscriptions") - rTaxCodesCmd := resource.NewResourceCmd(rootCmd, "tax_codes") - rTaxIdsCmd := resource.NewResourceCmd(rootCmd, "tax_ids") - rTaxRatesCmd := resource.NewResourceCmd(rootCmd, "tax_rates") - rTokensCmd := resource.NewResourceCmd(rootCmd, "tokens") - rTopupsCmd := resource.NewResourceCmd(rootCmd, "topups") - rTransferReversalsCmd := resource.NewResourceCmd(rootCmd, "transfer_reversals") - rTransfersCmd := resource.NewResourceCmd(rootCmd, "transfers") - rWebhookEndpointsCmd := resource.NewResourceCmd(rootCmd, "webhook_endpoints") - rAppsSecretsCmd := resource.NewResourceCmd(nsAppsCmd.Cmd, "secrets") - rBillingAlertsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "alerts") - rBillingCreditBalanceSummariesCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "credit_balance_summaries") - rBillingCreditBalanceTransactionsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "credit_balance_transactions") - rBillingCreditGrantsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "credit_grants") - rBillingMeterEventAdjustmentsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_adjustments") - rBillingMeterEventSummariesCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_summaries") - rBillingMeterEventsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_events") - rBillingMetersCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meters") - rBillingPortalConfigurationsCmd := resource.NewResourceCmd(nsBillingPortalCmd.Cmd, "configurations") - rBillingPortalSessionsCmd := resource.NewResourceCmd(nsBillingPortalCmd.Cmd, "sessions") - rCheckoutSessionsCmd := resource.NewResourceCmd(nsCheckoutCmd.Cmd, "sessions") - rClimateOrdersCmd := resource.NewResourceCmd(nsClimateCmd.Cmd, "orders") - rClimateProductsCmd := resource.NewResourceCmd(nsClimateCmd.Cmd, "products") - rClimateSuppliersCmd := resource.NewResourceCmd(nsClimateCmd.Cmd, "suppliers") - rEntitlementsActiveEntitlementsCmd := resource.NewResourceCmd(nsEntitlementsCmd.Cmd, "active_entitlements") - rEntitlementsFeaturesCmd := resource.NewResourceCmd(nsEntitlementsCmd.Cmd, "features") - rFinancialConnectionsAccountsCmd := resource.NewResourceCmd(nsFinancialConnectionsCmd.Cmd, "accounts") - rFinancialConnectionsSessionsCmd := resource.NewResourceCmd(nsFinancialConnectionsCmd.Cmd, "sessions") - rFinancialConnectionsTransactionsCmd := resource.NewResourceCmd(nsFinancialConnectionsCmd.Cmd, "transactions") - rForwardingRequestsCmd := resource.NewResourceCmd(nsForwardingCmd.Cmd, "requests") - rIdentityVerificationReportsCmd := resource.NewResourceCmd(nsIdentityCmd.Cmd, "verification_reports") - rIdentityVerificationSessionsCmd := resource.NewResourceCmd(nsIdentityCmd.Cmd, "verification_sessions") - rIssuingAuthorizationsCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "authorizations") + rReviewsCmd := resource.NewResourceCmd(rootCmd, "reviews", "Reviews can be used to supplement automated fraud detection with human expertise") + rScheduledQueryRunsCmd := resource.NewResourceCmd(rootCmd, "scheduled_query_runs", "If you have scheduled a Sigma query, you'll receive a sigma.scheduled_query_run.created webhook each time the query runs") + rSetupAttemptsCmd := resource.NewResourceCmd(rootCmd, "setup_attempts", "A SetupAttempt describes one attempted confirmation of a SetupIntent, whether that confirmation is successful or unsuccessful") + rSetupIntentsCmd := resource.NewResourceCmd(rootCmd, "setup_intents", "A SetupIntent guides you through the process of setting up and saving a customer's payment credentials for future payments") + rShippingRatesCmd := resource.NewResourceCmd(rootCmd, "shipping_rates", "Shipping rates describe the price of shipping presented to your customers and applied to a purchase") + rSourcesCmd := resource.NewResourceCmd(rootCmd, "sources", "Source objects allow you to accept a variety of payment methods") + rSubscriptionItemsCmd := resource.NewResourceCmd(rootCmd, "subscription_items", "Subscription items allow you to create customer subscriptions with more than one plan, making it easy to represent complex billing relationships") + rSubscriptionSchedulesCmd := resource.NewResourceCmd(rootCmd, "subscription_schedules", "A subscription schedule allows you to create and manage the lifecycle of a subscription by predefining expected changes") + rSubscriptionsCmd := resource.NewResourceCmd(rootCmd, "subscriptions", "Subscriptions allow you to charge a customer on a recurring basis") + rTaxCodesCmd := resource.NewResourceCmd(rootCmd, "tax_codes", "Tax codes classify goods and services for tax purposes") + rTaxIdsCmd := resource.NewResourceCmd(rootCmd, "tax_ids", "You can add one or multiple tax IDs to a customer or account") + rTaxRatesCmd := resource.NewResourceCmd(rootCmd, "tax_rates", "Tax rates can be applied to invoices, subscriptions and Checkout Sessions to collect tax") + rTokensCmd := resource.NewResourceCmd(rootCmd, "tokens", "Tokenization is the process Stripe uses to collect sensitive card or bank account details, or personally identifiable information (PII), directly from your customers in a secure manner") + rTopupsCmd := resource.NewResourceCmd(rootCmd, "topups", "To top up your Stripe balance, you create a top-up object") + rTransferReversalsCmd := resource.NewResourceCmd(rootCmd, "transfer_reversals", "Stripe Connect platforms can reverse transfers made to a connected account, either entirely or partially, and can also specify whether to refund any related application fees") + rTransfersCmd := resource.NewResourceCmd(rootCmd, "transfers", "A Transfer object is created when you move funds between Stripe accounts as part of Connect") + rWebhookEndpointsCmd := resource.NewResourceCmd(rootCmd, "webhook_endpoints", "You can configure webhook endpoints via the API to be notified about events that happen in your Stripe account or connected accounts") + rAppsSecretsCmd := resource.NewResourceCmd(nsAppsCmd.Cmd, "secrets", "Secret Store is an API that allows Stripe Apps developers to securely persist secrets for use by UI Extensions and app backends") + rBillingAlertsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "alerts", "A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed") + rBillingCreditBalanceSummariesCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "credit_balance_summaries", "Indicates the billing credit balance for billing credits granted to a customer") + rBillingCreditBalanceTransactionsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "credit_balance_transactions", "A credit balance transaction is a resource representing a transaction (either a credit or a debit) against an existing credit grant") + rBillingCreditGrantsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "credit_grants", "A credit grant is an API resource that documents the allocation of some billing credits to a customer") + rBillingMeterEventAdjustmentsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_adjustments", "A billing meter event adjustment is a resource that allows you to cancel a meter event") + rBillingMeterEventSummariesCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_summaries", "A billing meter event summary represents an aggregated view of a customer's billing meter events within a specified timeframe") + rBillingMeterEventsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_events", "Meter events represent actions that customers take in your system") + rBillingMetersCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meters", "Meters specify how to aggregate meter events over a billing period") + rBillingPortalConfigurationsCmd := resource.NewResourceCmd(nsBillingPortalCmd.Cmd, "configurations", "A portal configuration describes the functionality and behavior you embed in a portal session") + rBillingPortalSessionsCmd := resource.NewResourceCmd(nsBillingPortalCmd.Cmd, "sessions", "The Billing customer portal is a Stripe-hosted UI for subscription and billing management") + rCheckoutSessionsCmd := resource.NewResourceCmd(nsCheckoutCmd.Cmd, "sessions", "A Checkout Session represents your customer's session as they pay for one-time purchases or subscriptions through Checkout or Payment Links") + rClimateOrdersCmd := resource.NewResourceCmd(nsClimateCmd.Cmd, "orders", "Orders represent your intent to purchase a particular Climate product") + rClimateProductsCmd := resource.NewResourceCmd(nsClimateCmd.Cmd, "products", "A Climate product represents a type of carbon removal unit available for reservation") + rClimateSuppliersCmd := resource.NewResourceCmd(nsClimateCmd.Cmd, "suppliers", "A supplier of carbon removal") + rEntitlementsActiveEntitlementsCmd := resource.NewResourceCmd(nsEntitlementsCmd.Cmd, "active_entitlements", "An active entitlement describes access to a feature for a customer") + rEntitlementsFeaturesCmd := resource.NewResourceCmd(nsEntitlementsCmd.Cmd, "features", "A feature represents a monetizable ability or functionality in your system") + rFinancialConnectionsAccountsCmd := resource.NewResourceCmd(nsFinancialConnectionsCmd.Cmd, "accounts", "A Financial Connections Account represents an account that exists outside of Stripe, to which you have been granted some degree of access") + rFinancialConnectionsSessionsCmd := resource.NewResourceCmd(nsFinancialConnectionsCmd.Cmd, "sessions", "A Financial Connections Session is the secure way to programmatically launch the client-side Stripe.js modal that lets your users link their accounts") + rFinancialConnectionsTransactionsCmd := resource.NewResourceCmd(nsFinancialConnectionsCmd.Cmd, "transactions", "A Transaction represents a real transaction that affects a Financial Connections Account balance") + rForwardingRequestsCmd := resource.NewResourceCmd(nsForwardingCmd.Cmd, "requests", "Instructs Stripe to make a request on your behalf using the destination URL") + rIdentityVerificationReportsCmd := resource.NewResourceCmd(nsIdentityCmd.Cmd, "verification_reports", "A VerificationReport is the result of an attempt to collect and verify data from a user") + rIdentityVerificationSessionsCmd := resource.NewResourceCmd(nsIdentityCmd.Cmd, "verification_sessions", "A VerificationSession guides you through the process of collecting and verifying the identities of your users") + rIssuingAuthorizationsCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "authorizations", "When an issued card is used to make a purchase, an Issuing Authorization object is created") rIssuingAuthorizationsTestHelpersCmd := resource.NewResourceCmd(rIssuingAuthorizationsCmd.Cmd, "test_helpers") - rIssuingCardholdersCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "cardholders") - rIssuingCardsCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "cards") + rIssuingCardholdersCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "cardholders", "An Issuing Cardholder object represents an individual or business entity who is issued cards") + rIssuingCardsCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "cards", "You can create physical or virtual cards that are issued to cardholders") rIssuingCardsTestHelpersCmd := resource.NewResourceCmd(rIssuingCardsCmd.Cmd, "test_helpers") - rIssuingDisputesCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "disputes") - rIssuingPersonalizationDesignsCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "personalization_designs") + rIssuingDisputesCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "disputes", "As a card issuer, you can dispute transactions that the cardholder does not recognize, suspects to be fraudulent, or has other issues with") + rIssuingPersonalizationDesignsCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "personalization_designs", "A Personalization Design is a logical grouping of a Physical Bundle, card logo, and carrier text that represents a product line") rIssuingPersonalizationDesignsTestHelpersCmd := resource.NewResourceCmd(rIssuingPersonalizationDesignsCmd.Cmd, "test_helpers") - rIssuingPhysicalBundlesCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "physical_bundles") - rIssuingTokensCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "tokens") - rIssuingTransactionsCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "transactions") + rIssuingPhysicalBundlesCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "physical_bundles", "A Physical Bundle represents the bundle of physical items - card stock, carrier letter, and envelope - that is shipped to a cardholder when you create a physical card") + rIssuingTokensCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "tokens", "An issuing token object is created when an issued card is added to a digital wallet") + rIssuingTransactionsCmd := resource.NewResourceCmd(nsIssuingCmd.Cmd, "transactions", "Any use of an issued card that results in funds entering or leaving your Stripe account, such as a completed purchase or refund, is represented by an Issuing Transaction object") rIssuingTransactionsTestHelpersCmd := resource.NewResourceCmd(rIssuingTransactionsCmd.Cmd, "test_helpers") - rRadarEarlyFraudWarningsCmd := resource.NewResourceCmd(nsRadarCmd.Cmd, "early_fraud_warnings") - rRadarPaymentEvaluationsCmd := resource.NewResourceCmd(nsRadarCmd.Cmd, "payment_evaluations") - rRadarValueListItemsCmd := resource.NewResourceCmd(nsRadarCmd.Cmd, "value_list_items") - rRadarValueListsCmd := resource.NewResourceCmd(nsRadarCmd.Cmd, "value_lists") - rReportingReportRunsCmd := resource.NewResourceCmd(nsReportingCmd.Cmd, "report_runs") - rReportingReportTypesCmd := resource.NewResourceCmd(nsReportingCmd.Cmd, "report_types") - rTaxAssociationsCmd := resource.NewResourceCmd(nsTaxCmd.Cmd, "associations") - rTaxCalculationsCmd := resource.NewResourceCmd(nsTaxCmd.Cmd, "calculations") - rTaxRegistrationsCmd := resource.NewResourceCmd(nsTaxCmd.Cmd, "registrations") - rTaxSettingsCmd := resource.NewResourceCmd(nsTaxCmd.Cmd, "settings") - rTaxTransactionsCmd := resource.NewResourceCmd(nsTaxCmd.Cmd, "transactions") - rTerminalConfigurationsCmd := resource.NewResourceCmd(nsTerminalCmd.Cmd, "configurations") - rTerminalConnectionTokensCmd := resource.NewResourceCmd(nsTerminalCmd.Cmd, "connection_tokens") - rTerminalLocationsCmd := resource.NewResourceCmd(nsTerminalCmd.Cmd, "locations") - rTerminalOnboardingLinksCmd := resource.NewResourceCmd(nsTerminalCmd.Cmd, "onboarding_links") - rTerminalReadersCmd := resource.NewResourceCmd(nsTerminalCmd.Cmd, "readers") + rRadarEarlyFraudWarningsCmd := resource.NewResourceCmd(nsRadarCmd.Cmd, "early_fraud_warnings", "An early fraud warning indicates that the card issuer has notified us that a charge may be fraudulent") + rRadarPaymentEvaluationsCmd := resource.NewResourceCmd(nsRadarCmd.Cmd, "payment_evaluations", "Payment Evaluations represent the risk lifecycle of an externally processed payment") + rRadarValueListItemsCmd := resource.NewResourceCmd(nsRadarCmd.Cmd, "value_list_items", "Value list items allow you to add specific values to a given Radar value list, which can then be used in rules") + rRadarValueListsCmd := resource.NewResourceCmd(nsRadarCmd.Cmd, "value_lists", "Value lists allow you to group values together which can then be referenced in rules") + rReportingReportRunsCmd := resource.NewResourceCmd(nsReportingCmd.Cmd, "report_runs", "The Report Run object represents an instance of a report type generated with specific run parameters") + rReportingReportTypesCmd := resource.NewResourceCmd(nsReportingCmd.Cmd, "report_types", "The Report Type resource corresponds to a particular type of report, such as the \"Activity summary\" or \"Itemized payouts\" reports") + rTaxAssociationsCmd := resource.NewResourceCmd(nsTaxCmd.Cmd, "associations", "A Tax Association exposes the Tax Transactions that Stripe attempted to create on your behalf based on the PaymentIntent input") + rTaxCalculationsCmd := resource.NewResourceCmd(nsTaxCmd.Cmd, "calculations", "A Tax Calculation allows you to calculate the tax to collect from your customer") + rTaxRegistrationsCmd := resource.NewResourceCmd(nsTaxCmd.Cmd, "registrations", "A Tax Registration lets us know that your business is registered to collect tax on payments within a region, enabling you to automatically collect tax") + rTaxSettingsCmd := resource.NewResourceCmd(nsTaxCmd.Cmd, "settings", "You can use Tax Settings to manage configurations used by Stripe Tax calculations") + rTaxTransactionsCmd := resource.NewResourceCmd(nsTaxCmd.Cmd, "transactions", "A Tax Transaction records the tax collected from or refunded to your customer") + rTerminalConfigurationsCmd := resource.NewResourceCmd(nsTerminalCmd.Cmd, "configurations", "A Configurations object represents how features should be configured for terminal readers") + rTerminalConnectionTokensCmd := resource.NewResourceCmd(nsTerminalCmd.Cmd, "connection_tokens", "A Connection Token is used by the Stripe Terminal SDK to connect to a reader") + rTerminalLocationsCmd := resource.NewResourceCmd(nsTerminalCmd.Cmd, "locations", "A Location represents a grouping of readers") + rTerminalOnboardingLinksCmd := resource.NewResourceCmd(nsTerminalCmd.Cmd, "onboarding_links", "Returns redirect links used for onboarding onto Tap to Pay on iPhone") + rTerminalReadersCmd := resource.NewResourceCmd(nsTerminalCmd.Cmd, "readers", "A Reader represents a physical device for accepting payment details") rTerminalReadersTestHelpersCmd := resource.NewResourceCmd(rTerminalReadersCmd.Cmd, "test_helpers") rTestHelpersConfirmationTokensCmd := resource.NewResourceCmd(nsTestHelpersCmd.Cmd, "confirmation_tokens") rTestHelpersCustomersCmd := resource.NewResourceCmd(nsTestHelpersCmd.Cmd, "customers") @@ -180,28 +180,28 @@ func addV1ResourcesCmds(rootCmd *cobra.Command, cfg *config.Config) { rTestHelpersRefundsCmd := resource.NewResourceCmd(nsTestHelpersCmd.Cmd, "refunds") rTestHelpersTerminalCmd := resource.NewResourceCmd(nsTestHelpersCmd.Cmd, "terminal") rTestHelpersTerminalReadersCmd := resource.NewResourceCmd(rTestHelpersTerminalCmd.Cmd, "readers") - rTestHelpersTestClocksCmd := resource.NewResourceCmd(nsTestHelpersCmd.Cmd, "test_clocks") + rTestHelpersTestClocksCmd := resource.NewResourceCmd(nsTestHelpersCmd.Cmd, "test_clocks", "A test clock enables deterministic control over objects in testmode") rTestHelpersTreasuryCmd := resource.NewResourceCmd(nsTestHelpersCmd.Cmd, "treasury") rTestHelpersTreasuryInboundTransfersCmd := resource.NewResourceCmd(rTestHelpersTreasuryCmd.Cmd, "inbound_transfers") rTestHelpersTreasuryOutboundPaymentsCmd := resource.NewResourceCmd(rTestHelpersTreasuryCmd.Cmd, "outbound_payments") rTestHelpersTreasuryOutboundTransfersCmd := resource.NewResourceCmd(rTestHelpersTreasuryCmd.Cmd, "outbound_transfers") rTestHelpersTreasuryReceivedCreditsCmd := resource.NewResourceCmd(rTestHelpersTreasuryCmd.Cmd, "received_credits") rTestHelpersTreasuryReceivedDebitsCmd := resource.NewResourceCmd(rTestHelpersTreasuryCmd.Cmd, "received_debits") - rTreasuryCreditReversalsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "credit_reversals") - rTreasuryDebitReversalsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "debit_reversals") - rTreasuryFinancialAccountsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "financial_accounts") - rTreasuryInboundTransfersCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "inbound_transfers") + rTreasuryCreditReversalsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "credit_reversals", "You can reverse some ReceivedCredits depending on their network and source flow") + rTreasuryDebitReversalsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "debit_reversals", "You can reverse some ReceivedDebits depending on their network and source flow") + rTreasuryFinancialAccountsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "financial_accounts", "Stripe Treasury provides users with a container for money called a FinancialAccount that is separate from their Payments balance") + rTreasuryInboundTransfersCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "inbound_transfers", "Use InboundTransfers to add funds to your FinancialAccount via a PaymentMethod that is owned by you") rTreasuryInboundTransfersTestHelpersCmd := resource.NewResourceCmd(rTreasuryInboundTransfersCmd.Cmd, "test_helpers") - rTreasuryOutboundPaymentsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "outbound_payments") + rTreasuryOutboundPaymentsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "outbound_payments", "Use OutboundPayments to send funds to another party's external bank account or FinancialAccount") rTreasuryOutboundPaymentsTestHelpersCmd := resource.NewResourceCmd(rTreasuryOutboundPaymentsCmd.Cmd, "test_helpers") - rTreasuryOutboundTransfersCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "outbound_transfers") + rTreasuryOutboundTransfersCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "outbound_transfers", "Use OutboundTransfers to transfer funds from a FinancialAccount to a PaymentMethod belonging to the same entity") rTreasuryOutboundTransfersTestHelpersCmd := resource.NewResourceCmd(rTreasuryOutboundTransfersCmd.Cmd, "test_helpers") - rTreasuryReceivedCreditsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "received_credits") + rTreasuryReceivedCreditsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "received_credits", "ReceivedCredits represent funds sent to a FinancialAccount (for example, via ACH or wire)") rTreasuryReceivedCreditsTestHelpersCmd := resource.NewResourceCmd(rTreasuryReceivedCreditsCmd.Cmd, "test_helpers") - rTreasuryReceivedDebitsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "received_debits") + rTreasuryReceivedDebitsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "received_debits", "ReceivedDebits represent funds pulled from a FinancialAccount") rTreasuryReceivedDebitsTestHelpersCmd := resource.NewResourceCmd(rTreasuryReceivedDebitsCmd.Cmd, "test_helpers") - rTreasuryTransactionEntrysCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "transaction_entrys") - rTreasuryTransactionsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "transactions") + rTreasuryTransactionEntrysCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "transaction_entrys", "TransactionEntries represent individual units of money movements within a single Transaction") + rTreasuryTransactionsCmd := resource.NewResourceCmd(nsTreasuryCmd.Cmd, "transactions", "Transactions represent changes to a FinancialAccount's balance") // Operation commands resource.NewOperationCmd(rAccountLinksCmd.Cmd, &V1AccountLinksCreate, cfg) @@ -784,17 +784,17 @@ func addV2ResourcesCmds(rootCmd *cobra.Command, cfg *config.Config) { nsCoreCmd := resource.NewNamespaceCmd(rootCmd, "core") // Resource commands - rBillingMeterEventAdjustmentsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_adjustments") - rBillingMeterEventSessionsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_sessions") - rBillingMeterEventsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_events") - rCommerceProductCatalogImportsCmd := resource.NewResourceCmd(nsCommerceCmd.Cmd, "product_catalog_imports") - rCoreAccountLinksCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_links") - rCoreAccountPersonTokensCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_person_tokens") - rCoreAccountPersonsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_persons") - rCoreAccountTokensCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_tokens") - rCoreAccountsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "accounts") - rCoreEventDestinationsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "event_destinations") - rCoreEventsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "events") + rBillingMeterEventAdjustmentsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_adjustments", "A Meter Event Adjustment is used to cancel or modify previously recorded meter events") + rBillingMeterEventSessionsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_sessions", "A Meter Event Session is an authentication session for the high-throughput meter event API") + rBillingMeterEventsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_events", "A Meter Event is a usage record that captures billable activity for usage-based billing") + rCommerceProductCatalogImportsCmd := resource.NewResourceCmd(nsCommerceCmd.Cmd, "product_catalog_imports", "The product catalog import object tracks the long-running background process that handles uploading, processing and validation") + rCoreAccountLinksCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_links", "Account Links let a platform create a temporary, single-use URL that an account can use to access a Stripe-hosted flow for collecting or updating required information") + rCoreAccountPersonTokensCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_person_tokens", "Person Tokens are single-use tokens which tokenize person information, and are used for creating or updating a Person") + rCoreAccountPersonsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_persons", "A Person represents an individual associated with an Account's identity (for example, an owner, director, executive, or representative)") + rCoreAccountTokensCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_tokens", "Account tokens are single-use tokens which tokenize company/individual/business information, and are used for creating or updating an Account") + rCoreAccountsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "accounts", "An Account v2 object represents a company, individual, or other entity that interacts with a platform on Stripe") + rCoreEventDestinationsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "event_destinations", "Set up an event destination to receive events from Stripe across multiple destination types, including webhook endpoints and Amazon EventBridge") + rCoreEventsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "events", "Events are generated to keep you informed of activity in your business account") // Operation commands resource.NewOperationCmd(rBillingMeterEventAdjustmentsCmd.Cmd, &V2BillingMeterEventAdjustmentsCreate, cfg) @@ -845,52 +845,52 @@ func addV2PreviewResourcesCmds(rootCmd *cobra.Command, cfg *config.Config) { nsTestHelpersCmd := resource.NewNamespaceCmd(rootCmd, "test_helpers") // Resource commands - rFinancialAddressCreditSimulationsCmd := resource.NewResourceCmd(rootCmd, "financial_address_credit_simulations") + rFinancialAddressCreditSimulationsCmd := resource.NewResourceCmd(rootCmd, "financial_address_credit_simulations", "Credit Simulations represent simulated credit transactions applied to financial addresses for testing purposes") rFinancialAddressCreditSimulationsTestHelpersCmd := resource.NewResourceCmd(rFinancialAddressCreditSimulationsCmd.Cmd, "test_helpers") - rFinancialAddressGeneratedMicrodepositssCmd := resource.NewResourceCmd(rootCmd, "financial_address_generated_microdepositss") + rFinancialAddressGeneratedMicrodepositssCmd := resource.NewResourceCmd(rootCmd, "financial_address_generated_microdepositss", "Generated Microdeposits represent verification deposits sent to a financial address for ownership verification, containing the deposited amounts and status") rFinancialAddressGeneratedMicrodepositssTestHelpersCmd := resource.NewResourceCmd(rFinancialAddressGeneratedMicrodepositssCmd.Cmd, "test_helpers") - rBillingBillSettingVersionsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "bill_setting_versions") - rBillingBillSettingsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "bill_settings") - rBillingCadencesCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "cadences") - rBillingCollectionSettingVersionsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "collection_setting_versions") - rBillingCollectionSettingsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "collection_settings") - rBillingMeterEventAdjustmentsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_adjustments") - rBillingMeterEventSessionsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_sessions") - rBillingMeterEventsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_events") - rBillingProfilesCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "profiles") - rCommerceProductCatalogImportsCmd := resource.NewResourceCmd(nsCommerceCmd.Cmd, "product_catalog_imports") - rCoreAccountLinksCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_links") - rCoreAccountPersonTokensCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_person_tokens") - rCoreAccountPersonsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_persons") - rCoreAccountTokensCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_tokens") - rCoreAccountsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "accounts") - rCoreBatchJobsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "batch_jobs") - rCoreEventDestinationsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "event_destinations") - rCoreEventsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "events") - rCoreVaultsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "vaults") + rBillingBillSettingVersionsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "bill_setting_versions", "A Bill Setting Version is a specific configuration of a BillSetting at a point in time") + rBillingBillSettingsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "bill_settings", "BillSetting is responsible for settings which dictate generating bills, which include settings for calculating totals on bills, tax on bill items, as well as how to generate and present invoices") + rBillingCadencesCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "cadences", "A Cadence represents a billing schedule applied to a customer, defining when and how often to generate invoices, such as on monthly or annual billing cycle") + rBillingCollectionSettingVersionsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "collection_setting_versions", "A Collection Setting Version is a specific configuration of a CollectionSetting at a point in time") + rBillingCollectionSettingsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "collection_settings", "Settings that configure and manage the behavior of collecting payments") + rBillingMeterEventAdjustmentsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_adjustments", "A Meter Event Adjustment is used to cancel or modify previously recorded meter events") + rBillingMeterEventSessionsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_event_sessions", "A Meter Event Session is an authentication session for the high-throughput meter event API") + rBillingMeterEventsCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "meter_events", "A Meter Event is a usage record that captures billable activity for usage-based billing") + rBillingProfilesCmd := resource.NewResourceCmd(nsBillingCmd.Cmd, "profiles", "A Billing Profile is a representation of how a bill is paid, separating payment behavior from customer identity") + rCommerceProductCatalogImportsCmd := resource.NewResourceCmd(nsCommerceCmd.Cmd, "product_catalog_imports", "The product catalog import object tracks the long-running background process that handles uploading, processing and validation") + rCoreAccountLinksCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_links", "Account Links let a platform create a temporary, single-use URL that an account can use to access a Stripe-hosted flow for collecting or updating required information") + rCoreAccountPersonTokensCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_person_tokens", "Person Tokens are single-use tokens which tokenize person information, and are used for creating or updating a Person") + rCoreAccountPersonsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_persons", "A Person represents an individual associated with an Account's identity (for example, an owner, director, executive, or representative)") + rCoreAccountTokensCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "account_tokens", "Account tokens are single-use tokens which tokenize company/individual/business information, and are used for creating or updating an Account") + rCoreAccountsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "accounts", "An Account v2 object represents a company, individual, or other entity that interacts with a platform on Stripe") + rCoreBatchJobsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "batch_jobs", "A batch job allows you to perform an API operation on a large set of records asynchronously") + rCoreEventDestinationsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "event_destinations", "Set up an event destination to receive events from Stripe across multiple destination types, including webhook endpoints and Amazon EventBridge") + rCoreEventsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "events", "Events are generated to keep you informed of activity in your business account") + rCoreVaultsCmd := resource.NewResourceCmd(nsCoreCmd.Cmd, "vaults", "Use the USBankAccounts API to create and manage US bank accounts objects that you can use to receive funds") rCoreVaultsGbBankAccountsCmd := resource.NewResourceCmd(rCoreVaultsCmd.Cmd, "gb_bank_accounts") rCoreVaultsUsBankAccountsCmd := resource.NewResourceCmd(rCoreVaultsCmd.Cmd, "us_bank_accounts") - rDataReportingsCmd := resource.NewResourceCmd(nsDataCmd.Cmd, "reportings") + rDataReportingsCmd := resource.NewResourceCmd(nsDataCmd.Cmd, "reportings", "The QueryRun object represents an ad-hoc SQL execution") rDataReportingsQueryRunsCmd := resource.NewResourceCmd(rDataReportingsCmd.Cmd, "query_runs") - rExtendWorkflowRunsCmd := resource.NewResourceCmd(nsExtendCmd.Cmd, "workflow_runs") - rExtendWorkflowsCmd := resource.NewResourceCmd(nsExtendCmd.Cmd, "workflows") - rIamActivityLogsCmd := resource.NewResourceCmd(nsIamCmd.Cmd, "activity_logs") - rMoneyManagementAdjustmentsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "adjustments") - rMoneyManagementFinancialAccountsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "financial_accounts") - rMoneyManagementFinancialAddresssCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "financial_addresss") - rMoneyManagementInboundTransfersCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "inbound_transfers") - rMoneyManagementOutboundPaymentQuotesCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "outbound_payment_quotes") - rMoneyManagementOutboundPaymentsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "outbound_payments") - rMoneyManagementOutboundSetupIntentsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "outbound_setup_intents") - rMoneyManagementOutboundTransfersCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "outbound_transfers") - rMoneyManagementPayoutMethodsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "payout_methods") - rMoneyManagementPayoutMethodsBankAccountSpecsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "payout_methods_bank_account_specs") - rMoneyManagementReceivedCreditsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "received_credits") - rMoneyManagementReceivedDebitsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "received_debits") - rMoneyManagementTransactionEntrysCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "transaction_entrys") - rMoneyManagementTransactionsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "transactions") - rNetworkBusinessProfilesCmd := resource.NewResourceCmd(nsNetworkCmd.Cmd, "business_profiles") - rOrchestratedCommerceAgreementsCmd := resource.NewResourceCmd(nsOrchestratedCommerceCmd.Cmd, "agreements") + rExtendWorkflowRunsCmd := resource.NewResourceCmd(nsExtendCmd.Cmd, "workflow_runs", "An execution of a Workflow in response to a triggering event") + rExtendWorkflowsCmd := resource.NewResourceCmd(nsExtendCmd.Cmd, "workflows", "A Stripe Workflow is a sequence of actions, like Stripe API calls, that are taken in response to an initiating trigger") + rIamActivityLogsCmd := resource.NewResourceCmd(nsIamCmd.Cmd, "activity_logs", "An activity log records a single action performed on an account") + rMoneyManagementAdjustmentsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "adjustments", "Adjustments represent Stripe-initiated credits or debits to a user balance") + rMoneyManagementFinancialAccountsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "financial_accounts", "A FinancialAccount represents a balance and can be used as the source or destination for the money management (/v2/money_management) APIs") + rMoneyManagementFinancialAddresssCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "financial_addresss", "A Financial Address contains information needed to transfer money to a Financial Account") + rMoneyManagementInboundTransfersCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "inbound_transfers", "An InboundTransfer object, representing a money movement from a user owned PaymentMethod to a FinancialAccount belonging to the same user") + rMoneyManagementOutboundPaymentQuotesCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "outbound_payment_quotes", "OutboundPaymentQuote represents a quote that provides fee and amount estimates for OutboundPayment") + rMoneyManagementOutboundPaymentsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "outbound_payments", "OutboundPayment represents a single money movement from one FinancialAccount you own to a payout method someone else owns") + rMoneyManagementOutboundSetupIntentsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "outbound_setup_intents", "Use the OutboundSetupIntent API to create and setup usable payout methods") + rMoneyManagementOutboundTransfersCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "outbound_transfers", "OutboundTransfer represents a single money movement from one FinancialAccount you own to a payout method you also own") + rMoneyManagementPayoutMethodsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "payout_methods", "Use the PayoutMethods API to list and interact with PayoutMethod objects") + rMoneyManagementPayoutMethodsBankAccountSpecsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "payout_methods_bank_account_specs", "The PayoutMethodsBankAccountSpec object") + rMoneyManagementReceivedCreditsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "received_credits", "Use ReceivedCredits API to retrieve information on when, where, and how funds are sent into your FinancialAccount") + rMoneyManagementReceivedDebitsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "received_debits", "ReceivedDebit resource") + rMoneyManagementTransactionEntrysCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "transaction_entrys", "TransactionEntries represent individual money movements across different states within a Transaction") + rMoneyManagementTransactionsCmd := resource.NewResourceCmd(nsMoneyManagementCmd.Cmd, "transactions", "Use Transactions to view changes to your FinancialAccount balance over time") + rNetworkBusinessProfilesCmd := resource.NewResourceCmd(nsNetworkCmd.Cmd, "business_profiles", "The Stripe business profile represents a business' public identity on the Stripe network") + rOrchestratedCommerceAgreementsCmd := resource.NewResourceCmd(nsOrchestratedCommerceCmd.Cmd, "agreements", "An Orchestrated Commerce Agreement represents a mutual agreement between a seller and an orchestrator/agent on the Stripe network") rTestHelpersFinancialAddressCreditSimulationsCmd := resource.NewResourceCmd(nsTestHelpersCmd.Cmd, "financial_address_credit_simulations") rTestHelpersFinancialAddressGeneratedMicrodepositssCmd := resource.NewResourceCmd(nsTestHelpersCmd.Cmd, "financial_address_generated_microdepositss") diff --git a/pkg/cmd/resources_test.go b/pkg/cmd/resources_test.go index 2ffd96e7..5e47b1f2 100644 --- a/pkg/cmd/resources_test.go +++ b/pkg/cmd/resources_test.go @@ -63,8 +63,8 @@ func TestResourcesListAliasedName(t *testing.T) { aliases := resource.GetAliases() for principle, alias := range aliases { - aliasRegexp := fmt.Sprintf("\n\\s+%s(s?)\\s+\n", resource.GetResourceCmdName(alias)) - principleRegexp := fmt.Sprintf("\n\\s+%s(s?)\\s+\n", resource.GetResourceCmdName(principle)) + aliasRegexp := fmt.Sprintf(`\n\s+%s(s?)\s+[^\n]*\n`, resource.GetResourceCmdName(alias)) + principleRegexp := fmt.Sprintf(`\n\s+%s(s?)\s+[^\n]*\n`, resource.GetResourceCmdName(principle)) assert.Regexp(t, regexp.MustCompile(aliasRegexp), output) assert.NotRegexp(t, regexp.MustCompile(principleRegexp), output) } diff --git a/pkg/gen/gen_resources_cmds.go b/pkg/gen/gen_resources_cmds.go index 39d9a564..6565b2dd 100644 --- a/pkg/gen/gen_resources_cmds.go +++ b/pkg/gen/gen_resources_cmds.go @@ -45,6 +45,7 @@ type NamespaceData struct { type ResourceData struct { Operations map[string]*OperationData SubResources map[string]*ResourceData + Description string } type OperationData struct { @@ -260,6 +261,7 @@ func getApiNamespaceFromOperations(ops *[]spec.StripeOperation, isPreview bool) func genCmdTemplate(apiNamespace ApiNamespace, schemaName string, cmdName string, data *TemplateData, stripeAPI *spec.Spec) error { origNsName, origResName := parseSchemaName(cmdName) schema := stripeAPI.Components.Schemas[schemaName] + resDescription := gen.CleanDescription(gen.FirstSentence(schema.Description)) for _, op := range *schema.XStripeOperations { if op.MethodOn != "service" { @@ -276,12 +278,12 @@ func genCmdTemplate(apiNamespace ApiNamespace, schemaName string, cmdName string subResName = components[1] } else if strings.Contains(op.Path, test_helpers_path) && test_helpers_path != nsName { if nsName != "" { - err := addToTemplateData(data, apiNamespace, test_helpers_path, nsName, resName, stripeAPI, op) + err := addToTemplateData(data, apiNamespace, test_helpers_path, nsName, resName, stripeAPI, op, "") if err != nil { return err } } else { - err := addToTemplateData(data, apiNamespace, test_helpers_path, resName, "", stripeAPI, op) + err := addToTemplateData(data, apiNamespace, test_helpers_path, resName, "", stripeAPI, op, "") if err != nil { return err } @@ -290,7 +292,7 @@ func genCmdTemplate(apiNamespace ApiNamespace, schemaName string, cmdName string subResName = test_helpers_path } - err := addToTemplateData(data, apiNamespace, nsName, resName, subResName, stripeAPI, op) + err := addToTemplateData(data, apiNamespace, nsName, resName, subResName, stripeAPI, op, resDescription) if err != nil { return err } @@ -299,7 +301,7 @@ func genCmdTemplate(apiNamespace ApiNamespace, schemaName string, cmdName string return nil } -func addToTemplateData(data *TemplateData, apiNamespace ApiNamespace, nsName, resName, subResName string, stripeAPI *spec.Spec, op spec.StripeOperation) error { +func addToTemplateData(data *TemplateData, apiNamespace ApiNamespace, nsName, resName, subResName string, stripeAPI *spec.Spec, op spec.StripeOperation, resDescription string) error { hasSubResources := subResName != "" if _, ok := data.ApiNamespaces[apiNamespace]; !ok { @@ -319,6 +321,7 @@ func addToTemplateData(data *TemplateData, apiNamespace ApiNamespace, nsName, re data.ApiNamespaces[apiNamespace].Namespaces[nsName].Resources[resCmdName] = &ResourceData{ Operations: make(map[string]*OperationData), SubResources: make(map[string]*ResourceData), + Description: resDescription, } } diff --git a/pkg/gen/resource_utils.go b/pkg/gen/resource_utils.go index 400eca38..136c3c49 100644 --- a/pkg/gen/resource_utils.go +++ b/pkg/gen/resource_utils.go @@ -1,6 +1,7 @@ package gen import ( + "regexp" "strings" "github.com/stripe/stripe-cli/pkg/spec" @@ -50,6 +51,22 @@ func FirstSentence(s string) string { return s } +// mdLinkRe matches Markdown links like [text](url) and captures the text. +var mdLinkRe = regexp.MustCompile(`\[([^\]]+)\]\([^)]+\)`) + +// CleanDescription prepares a description string for use as a CLI Short field: +// collapses internal newlines to spaces, strips Markdown links (keeping text), +// and removes backticks. +func CleanDescription(s string) string { + s = strings.ReplaceAll(s, "\n", " ") + s = mdLinkRe.ReplaceAllString(s, "$1") + s = strings.ReplaceAll(s, "`", "") + for strings.Contains(s, " ") { + s = strings.ReplaceAll(s, " ", " ") + } + return strings.TrimSpace(s) +} + // ResolveObjectSchema returns s if it is a plain object schema (type "object" or has // Properties), or the first anyOf/oneOf branch that is an object schema. Returns nil if // no object branch is found. diff --git a/pkg/gen/resources_cmds.go.tpl b/pkg/gen/resources_cmds.go.tpl index e7cdaa70..a829dbd0 100644 --- a/pkg/gen/resources_cmds.go.tpl +++ b/pkg/gen/resources_cmds.go.tpl @@ -32,8 +32,8 @@ func add{{ $apiNamespace | ToCamel }}ResourcesCmds(rootCmd *cobra.Command, cfg * ns{{ $nsName | ToCamel }}Cmd := resource.NewNamespaceCmd(rootCmd, "{{ $nsName }}"){{ end }}{{ end }}{{ end }} // Resource commands{{ range $nsName, $nsData := $vData.Namespaces }}{{ range $resName, $resData := $nsData.Resources }}{{ if eq $resData.SubResources nil }} - r{{ (printf "%s_%s" $nsName $resName) | ToCamel }}Cmd := resource.NewResourceCmd({{ if ne $nsName "" }}ns{{ $nsName | ToCamel }}Cmd.Cmd{{ else }}rootCmd{{ end }}, "{{ $resName }}"){{ else }} - r{{ (printf "%s_%s" $nsName $resName) | ToCamel }}Cmd := resource.NewResourceCmd({{ if ne $nsName "" }}ns{{ $nsName | ToCamel }}Cmd.Cmd{{ else }}rootCmd{{ end }}, "{{ $resName }}"){{ range $subResName, $subResData := $resData.SubResources }}{{ if $subResData.Operations }} + r{{ (printf "%s_%s" $nsName $resName) | ToCamel }}Cmd := resource.NewResourceCmd({{ if ne $nsName "" }}ns{{ $nsName | ToCamel }}Cmd.Cmd{{ else }}rootCmd{{ end }}, "{{ $resName }}"{{ if $resData.Description }}, {{ $resData.Description | quote }}{{ end }}){{ else }} + r{{ (printf "%s_%s" $nsName $resName) | ToCamel }}Cmd := resource.NewResourceCmd({{ if ne $nsName "" }}ns{{ $nsName | ToCamel }}Cmd.Cmd{{ else }}rootCmd{{ end }}, "{{ $resName }}"{{ if $resData.Description }}, {{ $resData.Description | quote }}{{ end }}){{ range $subResName, $subResData := $resData.SubResources }}{{ if $subResData.Operations }} r{{ (printf "%s_%s_%s" $nsName $resName $subResName) | ToCamel }}Cmd := resource.NewResourceCmd(r{{ (printf "%s_%s" $nsName $resName) | ToCamel }}Cmd.Cmd, "{{ $subResName }}"){{ end }}{{ end }}{{ end }}{{ end }}{{ end }} // Operation commands{{ range $nsName, $nsData := $vData.Namespaces }}{{ range $resName, $resData := $nsData.Resources }}{{ range $opName, $opData := $resData.Operations }}