goapp

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendBinding

func AppendBinding(bb []apps.Binding, b *apps.Binding) []apps.Binding

func OAuth2Logger

func OAuth2Logger(l utils.Logger, a *apps.OAuth2App, u *User) utils.Logger

Types

type App

type App struct {
	Logger utils.Logger
	Router *mux.Router
	Icon   string
}

func NewApp

func NewApp(r *mux.Router, log utils.Logger) *App

func (*App) HandleCall

func (a *App) HandleCall(p string, h HandlerFunc)

func (*App) HandleCommand

func (a *App) HandleCommand(command Command)

func (*App) RemoveConnectedUser

func (a *App) RemoveConnectedUser(creq CallRequest) error

func (*App) StoreConnectedUser

func (a *App) StoreConnectedUser(creq CallRequest, user *User) error

func (App) WithIcon

func (a App) WithIcon(iconPath string) *App

func (*App) WithManifest

func (a *App) WithManifest(m apps.Manifest) *App

func (*App) WithStatic

func (a *App) WithStatic(staticFS fs.FS) *App

type CallRequest

type CallRequest struct {
	apps.CallRequest

	App       App
	GoContext context.Context
	// contains filtered or unexported fields
}

func (CallRequest) AppProxyURL

func (creq CallRequest) AppProxyURL(paths ...string) string

func (CallRequest) AppendDebugJSON

func (creq CallRequest) AppendDebugJSON(in []apps.Field) []apps.Field

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) OAuth2User

func (creq CallRequest) OAuth2User() *User

func (CallRequest) Respond

func (creq CallRequest) Respond(message string, v interface{}) apps.CallResponse

func (CallRequest) StringValue

func (creq CallRequest) StringValue(name string) (string, bool)

type Command

type Command struct {
	Name        string
	Hint        string
	Description string
	Icon        string
	BaseSubmit  *apps.Call
	BaseForm    *apps.Form

	Handler func(CallRequest) apps.CallResponse
}

func ConnectCommand

func ConnectCommand(name string) Command

func DisconnectCommand

func DisconnectCommand(name string) Command

func (Command) Binding

func (c Command) Binding(creq CallRequest) apps.Binding

func (Command) Form

func (c Command) Form(creq CallRequest) *apps.Form

func (Command) Path

func (c Command) Path() string

func (Command) Submit

func (c Command) Submit(creq CallRequest) *apps.Call

type HandlerFunc

type HandlerFunc func(CallRequest) apps.CallResponse

func CallHandler

func CallHandler(h func(CallRequest) (string, error)) HandlerFunc

func FormHandler

func FormHandler(h func(CallRequest) (apps.Form, error)) HandlerFunc

func LookupHandler

func LookupHandler(h func(CallRequest) []apps.SelectOption) HandlerFunc

func RequireAdmin

func RequireAdmin(h HandlerFunc) HandlerFunc

func RequireConnectedUser

func RequireConnectedUser(h HandlerFunc) HandlerFunc

type User

type User struct {
	MattermostID string
	RemoteID     string
	Token        *oauth2.Token
}

Jump to

Keyboard shortcuts

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