resource

package
v1.40.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package resource provides auto-generated API resource commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddApprovalRequestsSubCmds added in v1.40.4

func AddApprovalRequestsSubCmds(rootCmd *cobra.Command, cfg *config.Config) error

AddApprovalRequestsSubCmds patches approval_requests commands into the auto-generated `core` namespace command tree.

func AddDatabasesCmd added in v1.40.1

func AddDatabasesCmd(rootCmd *cobra.Command, cfg *config.Config) error

AddDatabasesCmd registers the hand-written StripeDB command tree. If a generated command with the same name ever appears, prefer the manual version until the custom implementation is removed.

func AddEventsSubCmds added in v0.7.5

func AddEventsSubCmds(rootCmd *cobra.Command, cfg *config.Config) error

AddEventsSubCmds adds custom subcommands to the `events` command created automatically as a resource command.

func AddTerminalSubCmds added in v1.4.0

func AddTerminalSubCmds(rootCmd *cobra.Command, cfg *config.Config) error

AddTerminalSubCmds adds custom subcommands to the `terminal` command created automatically as a resource command.

func GetAliases added in v1.22.0

func GetAliases() map[string]string

GetAliases retrieves the entire alias map, useful for testing

func GetCmdAlias added in v1.22.0

func GetCmdAlias(principle string) string

GetCmdAlias retrieves the alias for a given resource, if one is present; otherwise returns ""

func GetResourceCmdName

func GetResourceCmdName(name string) string

GetResourceCmdName returns the name for the resource commands. This differs from the resource name because we want to use the pluralized name in most cases.

func HideAliasedCommands added in v1.22.0

func HideAliasedCommands(rootCmd *cobra.Command)

HideAliasedCommands performs the post-processing on the command tree to hide resources that have an alias

func NewQuickstartCmd added in v1.4.0

func NewQuickstartCmd(parentCmd *cobra.Command, config *config.Config)

NewQuickstartCmd returns a new terminal quickstart command

func NewUnsupportedV2BillingOperationCmd added in v1.21.6

func NewUnsupportedV2BillingOperationCmd(parentCmd *cobra.Command, name string, path string) *cobra.Command

NewUnsupportedV2BillingOperationCmd returns a new cobra command for an unsupported v2 billing command. This is temporary until resource commands support the /v2/billing namespace.

func PostProcessResourceCommands added in v1.12.0

func PostProcessResourceCommands(rootCmd *cobra.Command, cfg *config.Config) error

PostProcessResourceCommands patches up generated resource commands

func RemoveAppsCmd added in v1.10.3

func RemoveAppsCmd(rootCmd *cobra.Command) error

RemoveAppsCmd removes the autogenerated `apps` command as we need the plugin to have this namespace

Types

type EnumSpec added in v1.40.1

type EnumSpec struct {
	Value string
}

EnumSpec describes a single valid value for an enum parameter.

type EventsResendCmd added in v0.7.5

type EventsResendCmd struct {
	// contains filtered or unexported fields
}

EventsResendCmd represents the event resend API operation command. This command is manually defined because it has a custom behavior.

func NewEventsResendCmd added in v0.7.5

func NewEventsResendCmd(parentCmd *cobra.Command, cfg *config.Config) *EventsResendCmd

NewEventsResendCmd returns a new EventsResendCmd.

type NamespaceCmd

type NamespaceCmd struct {
	Cmd          *cobra.Command
	Name         string
	ResourceCmds map[string]*ResourceCmd
}

NamespaceCmd represents namespace commands. Namespace commands are top-level commands that are simply containers for resource commands.

Example of namespaces: `issuing`, `radar`, `terminal`.

func NewNamespaceCmd

func NewNamespaceCmd(rootCmd *cobra.Command, namespaceName string) *NamespaceCmd

NewNamespaceCmd returns a new NamespaceCmd.

type OperationCmd

type OperationCmd struct {
	*requests.Base

	Name      string
	HTTPVerb  string
	Path      string
	URLParams []string

	IsPreviewCommand bool
	// contains filtered or unexported fields
}

OperationCmd represents operation commands. Operation commands are nested under resource commands and represent a specific API operation for that resource.

Examples of operations: `create`, `retrieve` (standard CRUD methods), `capture` (custom method for the `charges` resource).

func NewOperationCmd

func NewOperationCmd(parentCmd *cobra.Command, opSpec *OperationSpec, cfg *config.Config) *OperationCmd

NewOperationCmd returns a new OperationCmd.

type OperationSpec added in v1.40.1

type OperationSpec struct {
	Name      string // cobra command name, e.g. "create"
	Path      string // e.g. "/v1/customers"
	Method    string // e.g. "POST"
	IsPreview bool
	ServerURL string // non-empty for operations that use a different server
	Params    map[string]*ParamSpec
}

OperationSpec is the self-describing definition of one API operation. Produced by codegen; consumed both by NewOperationCmd and future rich-output features.

type ParamSpec added in v1.40.1

type ParamSpec struct {
	Type             string // "string" | "integer" | "boolean" | "number" | "array"
	ShortDescription string

	// Required is true when the parameter is unconditionally required by the API —
	// the parameter itself and every ancestor object in its dot-path must all be required.
	// A field that is required within an optional parent is not Required here, because the
	// parent need not be provided.
	Required bool

	// MostCommon is true when the parameter is worth surfacing in CLI help and tooling
	// even if not strictly required. The generator sets this via two heuristics:
	//   - Depth-0 params (no dots) explicitly listed in x-stripeMostCommon on the request body.
	//   - Depth-1 params (one dot) that are locally required within a depth-0 MostCommon
	//     object — i.e., if you are going to provide the parent, these fields are needed.
	// Depth 2+ params are never marked.
	MostCommon bool

	Format string // e.g. "date-time", "unix-time"
	Enum   []EnumSpec
}

ParamSpec describes a single parameter of an API operation.

type QuickstartCmd added in v1.4.0

type QuickstartCmd struct {
	// contains filtered or unexported fields
}

QuickstartCmd starts a prompt flow for connecting a Terminal reader to their Stripe account

type ResourceCmd

type ResourceCmd struct {
	Cmd           *cobra.Command
	Name          string
	OperationCmds map[string]*OperationCmd
}

ResourceCmd represents resource commands. Resource commands can be either top-level commands or nested under namespace commands. Resource commands are containers for operation commands.

Example of resources: `customers`, `payment_intents` (top-level, not namespaced), `early_fraud_warnings` (namespaced under `radar`).

func NewResourceCmd

func NewResourceCmd(parentCmd *cobra.Command, resourceName string) *ResourceCmd

NewResourceCmd returns a new ResourceCmd.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL