Documentation
¶
Overview ¶
Package useragent builds User-Agent strings for Stripe API requests.
Index ¶
- func DetectAIAgent(getEnv func(string) string) string
- func DetectInScreen(getEnv func(string) string) bool
- func DetectInTmux(getEnv func(string) string) bool
- func DetectInstallMethod(getEnv func(string) string, getExecutable func() (string, error), ...) string
- func DetectTerminalProgram(getEnv func(string) string) string
- func GetEncodedStripeUserAgent() string
- func GetEncodedUserAgent() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectAIAgent ¶ added in v1.37.2
DetectAIAgent detects if the CLI was invoked by a coding agent, based on well-known env vars. It accepts an environment getter function to allow testing without modifying the actual environment.
func DetectInScreen ¶ added in v1.42.3
DetectInScreen detects whether the CLI was invoked from within a GNU Screen session.
func DetectInTmux ¶ added in v1.42.3
DetectInTmux detects whether the CLI was invoked from within a tmux session.
func DetectInstallMethod ¶ added in v1.42.2
func DetectInstallMethod( getEnv func(string) string, getExecutable func() (string, error), statFile func(string) error, ) string
DetectInstallMethod detects how the CLI was installed. Returns one of: "npm_global", "npm_run", "npx", "homebrew", "scoop", "apt", or "unknown".
func DetectTerminalProgram ¶ added in v1.42.3
DetectTerminalProgram detects the terminal program the CLI was invoked from, when available.
func GetEncodedStripeUserAgent ¶
func GetEncodedStripeUserAgent() string
GetEncodedStripeUserAgent returns the string to be used as the value for the `X-Stripe-Client-User-Agent` HTTP header.
func GetEncodedUserAgent ¶
func GetEncodedUserAgent() string
GetEncodedUserAgent returns the string to be used as the value for the `User-Agent` HTTP header.
Types ¶
This section is empty.