Documentation
¶
Overview ¶
goapp is an EXPERIMENTAL package to make simple Mattermost apps written in go.
Index ¶
- func AppendBindings(orig []apps.Binding, extra ...*apps.Binding) []apps.Binding
- func MakeBindings(creq CallRequest, bindables []Bindable) []apps.Binding
- func OAuth2Logger(l utils.Logger, a *apps.OAuth2App, u *User) utils.Logger
- type App
- func (app *App) Bindings(creq CallRequest) []apps.Binding
- func (app *App) HandleCall(p string, h HandlerFunc)
- func (app *App) NewTestServer(t testing.TB) *httptest.Server
- func (app *App) RemoveConnectedUser(creq CallRequest) error
- func (app *App) RunHTTP()
- func (app *App) StoreConnectedUser(creq CallRequest, user *User) error
- type AppOption
- func TestWithBindingsHandler(h HandlerFunc) AppOption
- func WithBindingsExpand(e *apps.Expand) AppOption
- func WithBindingsPath(path string) AppOption
- func WithChannelHeader(items ...Bindable) AppOption
- func WithCommand(subcommands ...Bindable) AppOption
- func WithLog(log utils.Logger) AppOption
- func WithPostMenu(items ...Bindable) AppOption
- func WithStatic(staticFS fs.FS) AppOption
- type Bindable
- type BindableAction
- type BindableForm
- type BindableMulti
- type BindableOption
- func WithChildren(children ...Bindable) BindableOption
- func WithDescription(description string) BindableOption
- func WithExpand(expand apps.Expand) BindableOption
- func WithHint(hint string) BindableOption
- func WithIcon(icon string) BindableOption
- func WithState(state interface{}) BindableOption
- func WithSubmit(submit *apps.Call) BindableOption
- type CallRequest
- func (creq *CallRequest) ActingUserID() string
- func (creq CallRequest) AppProxyURL(paths ...string) string
- func (creq CallRequest) AsActingUser() *appclient.Client
- func (creq CallRequest) AsBot() *appclient.Client
- func (creq CallRequest) BoolValue(name string) (value, found bool)
- func (creq CallRequest) GetValue(name, defaultValue string) string
- func (creq CallRequest) IsConnectedUser() bool
- func (creq CallRequest) IsSystemAdmin() bool
- func (creq CallRequest) OAuth2User() *User
- func (creq CallRequest) StringValue(name string) (string, bool)
- type HandlerFunc
- type Initializer
- type Requirer
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendBindings ¶
func MakeBindings ¶
func MakeBindings(creq CallRequest, bindables []Bindable) []apps.Binding
Types ¶
type App ¶
type App struct { Manifest apps.Manifest Mode apps.DeployType Router *mux.Router // contains filtered or unexported fields }
func (*App) HandleCall ¶
func (app *App) HandleCall(p string, h HandlerFunc)
func (*App) RemoveConnectedUser ¶
func (app *App) RemoveConnectedUser(creq CallRequest) error
func (*App) StoreConnectedUser ¶
func (app *App) StoreConnectedUser(creq CallRequest, user *User) error
type AppOption ¶
func TestWithBindingsHandler ¶ added in v1.2.0
func TestWithBindingsHandler(h HandlerFunc) AppOption
func WithBindingsExpand ¶ added in v1.2.0
func WithBindingsPath ¶ added in v1.2.0
func WithChannelHeader ¶
func WithCommand ¶
func WithPostMenu ¶
func WithStatic ¶
type Bindable ¶
type Bindable interface {
Binding(CallRequest) *apps.Binding
}
type BindableAction ¶
type BindableAction struct {
// contains filtered or unexported fields
}
func MakeBindableAction ¶
func MakeBindableAction(name string, submitHandler HandlerFunc, opts ...BindableOption) (*BindableAction, error)
func MakeBindableActionOrPanic ¶
func MakeBindableActionOrPanic(name string, submitHandler HandlerFunc, opts ...BindableOption) *BindableAction
func (BindableAction) Binding ¶
func (b BindableAction) Binding(creq CallRequest) *apps.Binding
func (BindableAction) Init ¶
func (b BindableAction) Init(app *App) error
func (BindableAction) RequireConnectedUser ¶
func (b BindableAction) RequireConnectedUser() bool
func (BindableAction) RequireSystemAdmin ¶
func (b BindableAction) RequireSystemAdmin() bool
type BindableForm ¶
type BindableForm struct { *BindableAction // contains filtered or unexported fields }
BindableForm is a bindable action, with a form attached to it. It allows binding submittable forms to commands for the autocomplete of parameters and flags, and to the channel header and post actions menu where they open as modal dialogs.
func MakeBindableForm ¶
func MakeBindableForm(name string, form apps.Form, submitHandler HandlerFunc, opts ...BindableOption) (*BindableForm, error)
func MakeBindableFormOrPanic ¶
func MakeBindableFormOrPanic(name string, form apps.Form, submitHandler HandlerFunc, opts ...BindableOption) *BindableForm
func (BindableForm) Binding ¶
func (b BindableForm) Binding(creq CallRequest) *apps.Binding
func (BindableForm) RequireConnectedUser ¶
func (b BindableForm) RequireConnectedUser() bool
func (BindableForm) RequireSystemAdmin ¶
func (b BindableForm) RequireSystemAdmin() bool
type BindableMulti ¶
type BindableMulti struct {
// contains filtered or unexported fields
}
func MakeBindableMulti ¶
func MakeBindableMulti(name string, opts ...BindableOption) (*BindableMulti, error)
func MakeBindableMultiOrPanic ¶
func MakeBindableMultiOrPanic(name string, opts ...BindableOption) *BindableMulti
func (BindableMulti) Binding ¶
func (b BindableMulti) Binding(creq CallRequest) *apps.Binding
func (BindableMulti) Init ¶
func (b BindableMulti) Init(app *App) error
func (BindableMulti) RequireConnectedUser ¶
func (b BindableMulti) RequireConnectedUser() bool
func (BindableMulti) RequireSystemAdmin ¶
func (b BindableMulti) RequireSystemAdmin() bool
type BindableOption ¶
func WithChildren ¶
func WithChildren(children ...Bindable) BindableOption
func WithDescription ¶
func WithDescription(description string) BindableOption
func WithExpand ¶
func WithExpand(expand apps.Expand) BindableOption
func WithHint ¶
func WithHint(hint string) BindableOption
func WithIcon ¶
func WithIcon(icon string) BindableOption
func WithState ¶
func WithState(state interface{}) BindableOption
func WithSubmit ¶
func WithSubmit(submit *apps.Call) BindableOption
type CallRequest ¶
type CallRequest struct { apps.CallRequest App *App `json:"-"` GoContext context.Context `json:"-"` Log utils.Logger `json:"-"` // contains filtered or unexported fields }
func (*CallRequest) ActingUserID ¶
func (creq *CallRequest) ActingUserID() string
func (CallRequest) AppProxyURL ¶
func (creq CallRequest) AppProxyURL(paths ...string) string
func (CallRequest) AsActingUser ¶
func (creq CallRequest) AsActingUser() *appclient.Client
func (CallRequest) AsBot ¶
func (creq CallRequest) AsBot() *appclient.Client
func (CallRequest) BoolValue ¶
func (creq CallRequest) BoolValue(name string) (value, found bool)
func (CallRequest) GetValue ¶
func (creq CallRequest) GetValue(name, defaultValue string) string
GetValue scans Values, then State if it is a map for a name, returns the value, or the default if not found.
func (CallRequest) IsConnectedUser ¶
func (creq CallRequest) IsConnectedUser() bool
func (CallRequest) IsSystemAdmin ¶
func (creq CallRequest) IsSystemAdmin() bool
func (CallRequest) OAuth2User ¶
func (creq CallRequest) OAuth2User() *User
func (CallRequest) StringValue ¶
func (creq CallRequest) StringValue(name string) (string, bool)
type HandlerFunc ¶
type HandlerFunc func(CallRequest) apps.CallResponse
func RequireAdmin ¶
func RequireAdmin(h HandlerFunc) HandlerFunc
func RequireConnectedUser ¶
func RequireConnectedUser(h HandlerFunc) HandlerFunc
type Initializer ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.