Documentation ¶
Index ¶
- func ServeREST(registeredExtensions RegisteredExtensions) error
- func ServeRPC(registeredExtensions RegisteredExtensions) error
- type ErrorResponse
- type ExecuteExtensionRequest
- type ExecuteExtensionResponse
- type GetAllExtensionsRequest
- type GetAllExtensionsResponse
- type GetBuildVersionRequest
- type ListenerREST
- type ListenerRPC
- func (l *ListenerRPC) ExecuteExtension(req *ExecuteExtensionRequest, res *ExecuteExtensionResponse) error
- func (l *ListenerRPC) GetAllExtensions(_ *GetAllExtensionsRequest, res *GetAllExtensionsResponse) error
- func (l *ListenerRPC) GetBuildVersion(_ *GetBuildVersionRequest, res *version.BuildResponse) error
- type RegisteredExtensions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServeREST ¶
func ServeREST(registeredExtensions RegisteredExtensions) error
ServeREST serves the registered extension functions as a REST API
func ServeRPC ¶
func ServeRPC(registeredExtensions RegisteredExtensions) error
ServeRPC serves the registered extension functions over RPC
Types ¶
type ErrorResponse ¶
ErrorResponse is used when an error occurred processing a request
type ExecuteExtensionRequest ¶
type ExecuteExtensionRequest struct { FSM *fsm.FSM `json:"fsm"` Domain *fsm.BaseDomain `json:"domain"` Extension string `json:"extension"` Question *query.Question `json:"question"` Channel string `json:"channel"` }
ExecuteExtensionRequest contains the instructions for executing a command function
type ExecuteExtensionResponse ¶
type ExecuteExtensionResponse struct { FSM *fsm.FSM `json:"fsm"` Answers []query.Answer `json:"answers"` }
ExecuteExtensionResponse contains the result of executing a command function
type GetAllExtensionsRequest ¶
type GetAllExtensionsRequest struct { }
GetAllExtensionsRequest is empty for now to match RPC interface. Maybe later we will use it for filtering/searching commands
type GetAllExtensionsResponse ¶
type GetAllExtensionsResponse struct {
Extensions []string
}
GetAllExtensionsResponse contains a list of all registered command functions
type GetBuildVersionRequest ¶
type GetBuildVersionRequest struct { }
GetBuildVersionRequest is empty for now to match RPC interface.
type ListenerREST ¶
type ListenerREST struct { RegisteredExtensions RegisteredExtensions // contains filtered or unexported fields }
ListenerREST contains the RegisteredExtensions to be served through REST
func NewListenerREST ¶
func NewListenerREST(registeredExtensions RegisteredExtensions, token string) *ListenerREST
NewListenerREST creates a ListenerREST with command functions and a token
func (*ListenerREST) ExecuteExtension ¶
func (l *ListenerREST) ExecuteExtension(w http.ResponseWriter, r *http.Request)
ExecuteExtension runs the requested command function and returns the response
func (*ListenerREST) GetAllExtensions ¶
func (l *ListenerREST) GetAllExtensions(w http.ResponseWriter, r *http.Request)
GetAllExtensions returns all command functions in RegisteredExtensions as a list of strings
func (*ListenerREST) GetBuildVersion ¶
func (l *ListenerREST) GetBuildVersion(w http.ResponseWriter, r *http.Request)
GetBuildVersion returns the current build version of the extension
type ListenerRPC ¶
type ListenerRPC struct {
RegisteredExtensions RegisteredExtensions
}
ListenerRPC contains the RegisteredExtensions to be served through RPC
func (*ListenerRPC) ExecuteExtension ¶
func (l *ListenerRPC) ExecuteExtension(req *ExecuteExtensionRequest, res *ExecuteExtensionResponse) error
ExecuteExtension runs the requested command function and returns the response
func (*ListenerRPC) GetAllExtensions ¶
func (l *ListenerRPC) GetAllExtensions(_ *GetAllExtensionsRequest, res *GetAllExtensionsResponse) error
GetAllExtensions returns all functions registered in the RegisteredExtensions map
func (*ListenerRPC) GetBuildVersion ¶
func (l *ListenerRPC) GetBuildVersion(_ *GetBuildVersionRequest, res *version.BuildResponse) error
GetBuildVersion returns the current build version of the extension
type RegisteredExtensions ¶
type RegisteredExtensions map[string]func(*ExecuteExtensionRequest) *ExecuteExtensionResponse
RegisteredExtensions maps commands to functions which are executed by extension servers
func (*RegisteredExtensions) Get ¶
func (r *RegisteredExtensions) Get() []string
Get returns a list of all registered function command names