Documentation ¶
Index ¶
- Variables
- func APIKey(input string) error
- func APIKeyNotRestricted(input string) error
- func Account(account string) error
- func CallNonEmpty(validator ArgValidator, value string) error
- func CallNonEmptyArray(validator ArgValidator, values []string) error
- func ExactArgs(num int) cobra.PositionalArgs
- func HTTPMethod(method string) error
- func MaximumNArgs(num int) cobra.PositionalArgs
- func NoArgs(cmd *cobra.Command, args []string) error
- func OneDollar(number string) error
- func RequestSource(source string) error
- func RequestStatus(status string) error
- func StatusCode(code string) error
- func StatusCodeType(code string) error
- type ArgValidator
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAPIKeyNotConfigured is the error returned when the loaded profile is missing the api key property ErrAPIKeyNotConfigured = errors.New("you have not configured API keys yet") // ErrPubKeyNotConfigured is the error returned when the loaded profile is missing the publishable key property ErrPubKeyNotConfigured = errors.New("you have not configured publishable keys yet") // ErrDeviceNameNotConfigured is the error returned when the loaded profile is missing the device name property ErrDeviceNameNotConfigured = errors.New("you have not configured your device name yet") // ErrAccountIDNotConfigured is the error returned when the loaded profile is missing the account_id property ErrAccountIDNotConfigured = errors.New("you have not configured your accountID yet") )
Functions ¶
func APIKeyNotRestricted ¶ added in v1.4.0
APIKeyNotRestricted validates that a string looks like a secret API key and is not a restricted key.
func CallNonEmpty ¶ added in v0.4.0
func CallNonEmpty(validator ArgValidator, value string) error
CallNonEmpty calls an argument validator on a string if the string is not empty.
func CallNonEmptyArray ¶ added in v0.4.0
func CallNonEmptyArray(validator ArgValidator, values []string) error
CallNonEmptyArray calls an argument validator on all non-empty elements of a string array.
func ExactArgs ¶
func ExactArgs(num int) cobra.PositionalArgs
ExactArgs is a validator for commands to print an error when the number provided is different than the arguments passed in
func HTTPMethod ¶ added in v0.4.0
HTTPMethod validates that a string is an acceptable HTTP method.
func MaximumNArgs ¶ added in v0.6.7
func MaximumNArgs(num int) cobra.PositionalArgs
MaximumNArgs is a validator for commands to print an error when the provided args are greater than the maximum amount
func OneDollar ¶ added in v1.4.0
OneDollar validates that a provided number is at least 100 (ie. 1 dollar)
func RequestSource ¶ added in v0.4.0
RequestSource validates that a string is an acceptable request source.
func RequestStatus ¶ added in v0.4.0
RequestStatus validates that a string is an acceptable request status.
func StatusCode ¶ added in v0.4.0
StatusCode validates that a provided status code is within the range of those used in the Stripe API.
func StatusCodeType ¶ added in v0.4.0
StatusCodeType validates that a provided status code type is one of those used in the Stripe API.
Types ¶
type ArgValidator ¶ added in v0.4.0
ArgValidator is an argument validator. It accepts a string and returns an error if the string is invalid, or nil otherwise.