Documentation
¶
Index ¶
- Variables
- func CheckInteractiveAndInitWorkspace(cmd *cli.Command, projectName string)
- func ConfigDir() (string, error)
- func GetProjectName(cmd *cli.Command, flagName string) string
- func GetProjectNameFromConfig() string
- func InitWorkspaceConfig(projectName, openAPISpec, stainlessConfig string) error
- func SaveAuthConfig(config *AuthConfig) error
- func SaveWorkspaceConfig(configPath string, config *WorkspaceConfig) error
- type AuthConfig
- type WorkspaceConfig
Constants ¶
This section is empty.
Variables ¶
var Command = cli.Command{ Name: "stl", Usage: "CLI for the stainless API", Commands: []*cli.Command{ { Name: "projects", Commands: []*cli.Command{ &projectsRetrieve, &projectsUpdate, &projectsList, }, }, { Name: "projects:branches", Commands: []*cli.Command{ &projectsBranchesCreate, &projectsBranchesRetrieve, }, }, { Name: "projects:configs", Commands: []*cli.Command{ &projectsConfigsRetrieve, &projectsConfigsGuess, }, }, { Name: "projects:snippets", Commands: []*cli.Command{ &projectsSnippetsCreateRequest, }, }, { Name: "builds", Commands: []*cli.Command{ &buildsCreate, &buildsRetrieve, &buildsList, &buildsCompare, }, }, { Name: "build_target_outputs", Commands: []*cli.Command{ &buildTargetOutputsRetrieve, }, }, { Name: "orgs", Commands: []*cli.Command{ &orgsRetrieve, &orgsList, }, }, }, EnableShellCompletion: true, HideHelpCommand: true, }
Functions ¶
func CheckInteractiveAndInitWorkspace ¶
CheckInteractiveAndInitWorkspace checks if running in interactive mode and prompts to init workspace if needed
func GetProjectName ¶
GetProjectName returns the project name from the command line flag or workspace config
func GetProjectNameFromConfig ¶
func GetProjectNameFromConfig() string
GetProjectNameFromConfig returns the project name from workspace config if available
func InitWorkspaceConfig ¶
InitWorkspaceConfig initializes a new workspace config in the current directory
func SaveAuthConfig ¶
func SaveAuthConfig(config *AuthConfig) error
SaveAuthConfig saves the auth config to disk
func SaveWorkspaceConfig ¶
func SaveWorkspaceConfig(configPath string, config *WorkspaceConfig) error
SaveWorkspaceConfig saves the workspace config to the specified path
Types ¶
type AuthConfig ¶
type AuthConfig struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token,omitempty"`
TokenType string `json:"token_type"`
}
AuthConfig stores the OAuth credentials
func LoadAuthConfig ¶
func LoadAuthConfig() (*AuthConfig, error)
LoadAuthConfig loads the auth config from disk
func StartDeviceFlow ¶
func StartDeviceFlow(clientID, scope string) (*AuthConfig, error)
StartDeviceFlow initiates the OAuth 2.0 device flow
type WorkspaceConfig ¶
type WorkspaceConfig struct {
Project string `json:"project"`
OpenAPISpec string `json:"openapi_spec,omitempty"`
StainlessConfig string `json:"stainless_config,omitempty"`
}
WorkspaceConfig stores workspace-level configuration
func FindWorkspaceConfig ¶
func FindWorkspaceConfig() (*WorkspaceConfig, string, error)
FindWorkspaceConfig searches for a stainless-workspace.json file starting from the current directory and moving up to parent directories until found or root is reached
func LoadWorkspaceConfig ¶
func LoadWorkspaceConfig(configPath string) (*WorkspaceConfig, error)
LoadWorkspaceConfig loads the workspace config from the specified path