Documentation ¶
Overview ¶
Package self lets you connect to a self instance via the WS API. To run a self instance, see https://github.com/watson-intu/self, or https://github.com/michaeldye/self-docker-builder
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintThingHandler ¶
func PrintThingHandler(thing Thing)
PrintThingHandler just prints the thing
func PrintThingText ¶
func PrintThingText(thing Thing)
PrintThingText prints only the text of the thing.
func PrintThingType ¶
func PrintThingType(thing Thing)
PrintThingType prints only the Type of the thing.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a ws conn + metadata
func (*Conn) Reg ¶
func (conn *Conn) Reg(name string, handlerFunc ThingHandlerFunc)
Reg registers a function to the connection
type Thing ¶
type Thing struct { GUID string `json:"GUID_"` Type string `json:"Type_"` Children []Thing `json:"m_Children"` Confidence float64 `json:"m_Confidence"` CreateTime float64 `json:"m_CreateTime"` Info string `json:"m_Info"` Name string `json:"m_Name"` ProxyID string `json:"m_ProxyID"` State string `json:"m_State"` Threshold float64 `json:"m_Threshold"` ClassifyIntent bool `json:"m_ClassifyIntent"` Language string `json:"m_Language"` LocalDialog bool `json:"m_LocalDialog"` Text string `json:"m_Text"` ECategory int `json:"m_eCategory"` FImportance int `json:"m_fImportance"` FLifeSpan int `json:"m_fLifeSpan"` }
Thing is a thing
type ThingFilter ¶
ThingFilter desides if a Thing needs to be handled.
func And ¶
func And(filters []ThingFilter) ThingFilter
And returns a filter which returns true if none of the filters return false.
func MakeFilterNth ¶
func MakeFilterNth(n int) ThingFilter
MakeFilterNth returns a filter that returns true every n times.
func MakeThingTypeFilter ¶
func MakeThingTypeFilter(typeName string) ThingFilter
MakeThingTypeFilter returns a Thing which returns true if the things type matches the given typeName
func Not ¶
func Not(filter ThingFilter) ThingFilter
Not returns a filter which inverts the provided filter.
func Or ¶
func Or(filters []ThingFilter) ThingFilter
Or returns a filter which returns true if any of the filters return true.
func Xor ¶
func Xor(filter1, filter2 ThingFilter) ThingFilter
Xor returns a filter which returns true if filter 1 xor filter2 return true.
type ThingHandlerFunc ¶
type ThingHandlerFunc func(Thing)
ThingHandlerFunc handels an incoming Thing
func MakeFilteredHandler ¶
func MakeFilteredHandler(filter func(Thing) bool, handle ThingHandlerFunc) ThingHandlerFunc
MakeFilteredHandler makes a MsgHandlerFunc that only called the given MsgHandlerFunc is filter returns true.