Documentation
¶
Index ¶
- Constants
- func AddCustomFieldsFlag(cmds ...*cobra.Command)
- func AddListFlags(cmd *cobra.Command)
- func CheckErr(httpResp *http.Response, body []byte) error
- func Ctx() context.Context
- func EnabledLanguages(defaultLang string, secondary []string) []string
- func IntPtr(i int) *int
- func NewClient() (*client.ClientWithResponses, config.Config, error)
- func NewClientWithAuth() (*client.ClientWithResponses, config.Config, error)
- func ParseCustomFields(cmd *cobra.Command) (*map[string]client.CustomFieldModel, error)
- func PromptExpiration(flag string) (*string, error)
- func PromptLanguages(defaultLang string, secondary []string) ([]string, error)
- func RefreshSession() error
- func ResolveOrgID(c *client.ClientWithResponses, explicit string) (string, error)
- func SelectProjectAllOrgs(c *client.ClientWithResponses) (string, error)
- func SelectProjectInActiveOrg(c *client.ClientWithResponses, activeID string) (*client.Tenant, error)
- func StringPtr(s string) *string
- func StringSlicePtr(s string) *[]string
Constants ¶
const DefaultLanguage = "en-US"
DefaultLanguage is the language a project falls back to when none is chosen.
Variables ¶
This section is empty.
Functions ¶
func AddCustomFieldsFlag ¶
AddCustomFieldsFlag registers the standard --custom-fields-json flag.
func AddListFlags ¶
AddListFlags adds common pagination/sorting flags to a command.
func EnabledLanguages ¶ added in v0.1.1
EnabledLanguages returns the default language first, followed by distinct secondary languages.
func NewClient ¶
func NewClient() (*client.ClientWithResponses, config.Config, error)
NewClient creates an API client from current config, validating that token is set.
func NewClientWithAuth ¶
func NewClientWithAuth() (*client.ClientWithResponses, config.Config, error)
NewClientWithAuth creates an API client and requires a token.
func ParseCustomFields ¶
func PromptExpiration ¶ added in v0.1.1
PromptExpiration resolves an API key expiry from a flag, or an interactive selector. Returns nil for no expiration.
func PromptLanguages ¶ added in v0.1.1
PromptLanguages resolves enabled languages from flags, or interactive selectors, falling back to DefaultLanguage.
func RefreshSession ¶ added in v0.1.1
func RefreshSession() error
RefreshSession re-mints the stored access token so newly created orgs and projects appear in its claims.
func ResolveOrgID ¶ added in v0.1.1
func ResolveOrgID(c *client.ClientWithResponses, explicit string) (string, error)
ResolveOrgID returns the organization to act on: the explicit id if given, the sole organization if there is exactly one, otherwise a prompt (TTY) or an error.
func SelectProjectAllOrgs ¶ added in v0.1.2
func SelectProjectAllOrgs(c *client.ClientWithResponses) (string, error)
SelectProjectAllOrgs opens a selector over every project in every organization the user belongs to, each labelled with its organization, and returns the chosen project id.
func SelectProjectInActiveOrg ¶ added in v0.1.2
func SelectProjectInActiveOrg(c *client.ClientWithResponses, activeID string) (*client.Tenant, error)
SelectProjectInActiveOrg opens a selector over the projects in the active project's organization, and returns the chosen project. When no project is active it falls back to selecting an organization first.
func StringSlicePtr ¶
StringSlicePtr returns a pointer to a string slice parsed from comma-separated input, or nil if empty.
Types ¶
This section is empty.