resource

package
v0.6.12 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

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
}

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, name, path, httpVerb string, cfg *config.Config) *OperationCmd

NewOperationCmd returns a new OperationCmd.

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
JackTT - Gopher 🇻🇳