Documentation
¶
Index ¶
- func DialogGoto(toName Name) func(*Flow, map[string]interface{}) (Name, State, map[string]string, error)
- func Goto(toName Name) func(*Flow) (Name, State, error)
- type Button
- type Color
- type Flow
- func (f *Flow) Finish() error
- func (f *Flow) ForUser(userID string) *Flow
- func (f *Flow) GetCurrentStep() (Name, error)
- func (f *Flow) GetState() State
- func (f *Flow) Go(toName Name) error
- func (f *Flow) InitHTTP(r *mux.Router) *Flow
- func (f *Flow) OnDone(done func(string, State) error) *Flow
- func (f *Flow) Start(appState State) error
- func (f *Flow) WithDebugLog() *Flow
- func (f *Flow) WithSteps(orderedSteps ...Step) *Flow
- type Name
- type State
- type Step
- func (s Step) Next(name Name) Step
- func (s Step) OnRender(f func(*Flow)) Step
- func (s Step) Terminal() Step
- func (s Step) WithButton(buttons ...Button) Step
- func (s Step) WithColor(color Color) Step
- func (s Step) WithField(title, value string) Step
- func (s Step) WithImage(imageURL string) Step
- func (s Step) WithPretext(text string) Step
- func (s Step) WithText(text string) Step
- func (s Step) WithTitle(text string) Step
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DialogGoto ¶ added in v0.0.25
Types ¶
type Button ¶ added in v0.0.25
type Button struct { Name string Disabled bool Color Color // OnClick is called when the button is clicked. It returns the next step's // name and the state updates to apply. // // If Dialog is also specified, OnClick is executed first. OnClick func(f *Flow) (Name, State, error) // Dialog is the interactive dialog to display if the button is clicked // (OnClick is executed first). OnDialogSubmit must be provided. Dialog *model.Dialog // Function that is called when the dialog box is submitted. It can return a // general error, or field-specific errors. On success it returns the name // of the next step, and the state updates to apply. OnDialogSubmit func(f *Flow, submitted map[string]interface{}) (Name, State, map[string]string, error) }
type Flow ¶
type Flow struct { UserID string // contains filtered or unexported fields }
func NewFlow ¶
NewFlow creates a new flow using direct messages with the user.
name must be a unique identifier for the flow within the plugin.
func (*Flow) ForUser ¶ added in v0.0.25
ForUser creates a new flow using direct messages with the user.
func (*Flow) GetCurrentStep ¶ added in v0.0.25
func (*Flow) WithDebugLog ¶ added in v0.0.25
type State ¶ added in v0.0.25
type State map[string]interface{}
State is the "app"'s state
func (State) GetBool ¶ added in v0.0.25
GetBool return the value to a given key as a bool. If the key is not found or isn't a bool, false is returned.
func (State) GetInt ¶ added in v0.0.25
GetInt return the value to a given key as a int. If the key is not found or isn't an int, zero is returned.
type Step ¶ added in v0.0.25
type Step struct {
// contains filtered or unexported fields
}
func (Step) WithButton ¶ added in v0.0.25
func (Step) WithPretext ¶ added in v0.0.25
Click to show internal directories.
Click to hide internal directories.