prompts

package
v0.0.0-...-113aa42 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SelectTeamPrompt = "Select a team"

Functions

func AccessLabels

func AccessLabels(current types.Permission) ([]string, []types.Permission)

func AddAppCollaboratorsToNamedEntitiesPrompt

func AddAppCollaboratorsToNamedEntitiesPrompt(ctx context.Context, IO iostreams.IOStreamer) (bool, error)

AddAppCollaboratorsToNamedEntitiesPrompt displays a confirmation prompt for adding app collaborators to trigger access named entities list

func ChooseNamedEntityPrompt

func ChooseNamedEntityPrompt(ctx context.Context, clients *shared.ClientFactory) (string, string, error)

ChooseNamedEntityPrompt displays a selection prompt that lists available actions one can take to manage the list of users with access to the function. This function returns the chosen action and user(s) it should be applied to but does not execute the action.

func OrgSelectWorkspacePrompt

func OrgSelectWorkspacePrompt(ctx context.Context, clients *shared.ClientFactory, orgDomain, token string, topOptionAllWorkspaces bool) (string, error)

OrgSelectWorkspacePrompt prompts the user to select a single workspace to grant app access to, or grant all workspaces within the org.

func SortAlphaNumeric

func SortAlphaNumeric(teamDomains []string, labels []string, teamIDs []string) error

SortAlphaNumeric safely orders prompt domains, labels and team ids

func TriggerAccessLabels

func TriggerAccessLabels(current types.Permission) ([]string, []types.Permission)

func TriggerChooseNamedEntityActionPrompt

func TriggerChooseNamedEntityActionPrompt(ctx context.Context, clients *shared.ClientFactory) (string, error)

func TriggerChooseNamedEntityPrompt

func TriggerChooseNamedEntityPrompt(ctx context.Context, clients *shared.ClientFactory, accessAction string, currentAccessType types.Permission, hasIncludeAppCollabFlag bool) (string, string, bool, error)

TriggerChooseNamedEntityPrompt displays a selection prompt that lists available actions one can take to manage the list of users or channels with access to the trigger. This function returns the chosen action and user(s) or channel(s) it should be applied to but does not execute the action.

func ValidateGetOrgWorkspaceGrant

func ValidateGetOrgWorkspaceGrant(ctx context.Context, clients *shared.ClientFactory, selection *SelectedApp, orgGrantWorkspaceID string, promptOption bool) (string, error)

ValidateGetOrgWorkspaceGrant checks that the org-workspace-grant flag is being used appropriately. If org-workspace-grant should not be used, it will be reset to an empty string.

Types

type AppEnvironmentType

type AppEnvironmentType int
const (
	// ShowAllEnvironments does not filter apps by environment
	ShowAllEnvironments AppEnvironmentType = iota
	// ShowHostedOnly filters to show deployed apps only
	ShowHostedOnly
	// ShowLocalOnly filters to show locally run apps only
	//
	// Note: This check might not be correct when using the "app" and "token" flag
	// but without a saved apps.dev.json file. The ErrDeployedAppNotSupported error
	// will be returned with the selection in these cases.
	ShowLocalOnly
)

func (AppEnvironmentType) Equals

func (environment AppEnvironmentType) Equals(is AppEnvironmentType) bool

Equals returns true if the app environment type is equal

type AppInstallStatus

type AppInstallStatus int
const (
	// ShowAllApps shows all existing and potential apps; one can choose from installed apps, uninstalled apps, or create a new app
	ShowAllApps AppInstallStatus = iota
	// ShowInstalledAppsOnly filters to show installed apps only
	ShowInstalledAppsOnly
	// ShowInstalledAndUninstalledApps filters to show both installed and uninstalled apps
	ShowInstalledAndUninstalledApps
	// ShowInstalledAndNewApps shows installed apps and allows the user to create a new app
	ShowInstalledAndNewApps
)

type AppSelectMock

type AppSelectMock struct {
	mock.Mock
}

AppSelectMock implementation mocks the app environment prompts

func NewAppSelectMock

func NewAppSelectMock() *AppSelectMock

NewAppSelectMock returns a mock of the app environment prompts

func (*AppSelectMock) AppSelectPrompt

func (m *AppSelectMock) AppSelectPrompt(ctx context.Context, clients *shared.ClientFactory, env AppEnvironmentType, status AppInstallStatus) (SelectedApp, error)

AppSelectPrompt mocks the app selection prompt

type AppStatus

type AppStatus struct {
	AppID             string
	InstallationState types.AppInstallationStatus
	EnterpriseGrants  []types.EnterpriseGrant
}

type SelectedApp

type SelectedApp struct {
	// The workspace auth corresponding to the selected app
	Auth types.SlackAuth
	// The app that was chosen
	App types.App
}

SelectedApp contains information for the user chosen app

func AppSelectPrompt

func AppSelectPrompt(
	ctx context.Context,
	clients *shared.ClientFactory,
	environment AppEnvironmentType,
	status AppInstallStatus,
) (
	selected SelectedApp,
	err error,
)

AppSelectPrompt reveals options for apps that match the install status

type TeamApps

type TeamApps struct {
	Auth   types.SlackAuth
	Hosted SelectedApp
	Local  SelectedApp
}

TeamApps contains the apps (local and hosted), auth and information for a team

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL