Documentation ¶
Index ¶
- Constants
- Variables
- type CallbackRouter
- func (r *CallbackRouter) Binary(byMsg []byte) error
- func (r *CallbackRouter) Close(or *interfaces.CloseResponse) error
- func (r *CallbackRouter) Error(er *interfaces.ErrorResponse) error
- func (r *CallbackRouter) Message(byMsg []byte) error
- func (r *CallbackRouter) Open(or *interfaces.OpenResponse) error
- func (r *CallbackRouter) UnhandledMessage(byMsg []byte) error
- type ChanRouter
- func (r *ChanRouter) Binary(byMsg []byte) error
- func (r *ChanRouter) Close(cr *interfaces.CloseResponse) error
- func (r *ChanRouter) Error(er *interfaces.ErrorResponse) error
- func (r *ChanRouter) Message(byMsg []byte) error
- func (r *ChanRouter) Open(or *interfaces.OpenResponse) error
- func (r *ChanRouter) UnhandledMessage(byMsg []byte) error
- type DefaultCallbackHandler
- func (dch *DefaultCallbackHandler) Binary(br []byte) error
- func (dch *DefaultCallbackHandler) Clear(fr *interfaces.ClearedResponse) error
- func (dch *DefaultCallbackHandler) Close(or *interfaces.CloseResponse) error
- func (dch *DefaultCallbackHandler) Error(er *interfaces.ErrorResponse) error
- func (dch *DefaultCallbackHandler) Flush(fr *interfaces.FlushedResponse) error
- func (dch *DefaultCallbackHandler) Metadata(md *interfaces.MetadataResponse) error
- func (dch *DefaultCallbackHandler) Open(or *interfaces.OpenResponse) error
- func (dch *DefaultCallbackHandler) UnhandledEvent(byData []byte) error
- func (dch *DefaultCallbackHandler) Warning(wr *interfaces.WarningResponse) error
- type DefaultChanHandler
- func (dch *DefaultChanHandler) GetBinary() []*chan *[]byte
- func (dch *DefaultChanHandler) GetClear() []*chan *interfaces.ClearedResponse
- func (dch *DefaultChanHandler) GetClose() []*chan *interfaces.CloseResponse
- func (dch *DefaultChanHandler) GetError() []*chan *interfaces.ErrorResponse
- func (dch *DefaultChanHandler) GetFlush() []*chan *interfaces.FlushedResponse
- func (dch *DefaultChanHandler) GetMetadata() []*chan *interfaces.MetadataResponse
- func (dch *DefaultChanHandler) GetOpen() []*chan *interfaces.OpenResponse
- func (dch *DefaultChanHandler) GetUnhandled() []*chan *[]byte
- func (dch *DefaultChanHandler) GetWarning() []*chan *interfaces.WarningResponse
- func (dch *DefaultChanHandler) Run() error
- type MessageRouter
Constants ¶
const (
PackageVersion string = "v1.0"
)
Variables ¶
var ( // ErrInvalidInput required input was not found ErrInvalidInput = errors.New("required input was not found") // ErrInvalidMessageType invalid message type ErrInvalidMessageType = errors.New("invalid message type") // ErrUserCallbackNotDefined user callback object not defined ErrUserCallbackNotDefined = errors.New("user callback object not defined") )
errors
Functions ¶
This section is empty.
Types ¶
type CallbackRouter ¶
type CallbackRouter struct {
// contains filtered or unexported fields
}
CallbackRouter routes events
func NewCallbackRouter ¶
func NewCallbackRouter(callback interfaces.SpeakMessageCallback) *CallbackRouter
New creates a CallbackRouter with a user-defined callback
func NewCallbackWithDefault ¶
func NewCallbackWithDefault() *CallbackRouter
NewWithDefault creates a CallbackRouter with the default callback handler
func (*CallbackRouter) Binary ¶
func (r *CallbackRouter) Binary(byMsg []byte) error
Binary handles binary messages
func (*CallbackRouter) Close ¶
func (r *CallbackRouter) Close(or *interfaces.CloseResponse) error
CloseHelper handles the OpenResponse message
func (*CallbackRouter) Error ¶
func (r *CallbackRouter) Error(er *interfaces.ErrorResponse) error
ErrorHelper handles the ErrorResponse message
func (*CallbackRouter) Message ¶
func (r *CallbackRouter) Message(byMsg []byte) error
Message handles platform messages and routes them appropriately based on the MessageType
func (*CallbackRouter) Open ¶
func (r *CallbackRouter) Open(or *interfaces.OpenResponse) error
OpenHelper handles the OpenResponse message
func (*CallbackRouter) UnhandledMessage ¶
func (r *CallbackRouter) UnhandledMessage(byMsg []byte) error
UnhandledMessage logs and handles any unexpected message types
type ChanRouter ¶
type ChanRouter struct {
// contains filtered or unexported fields
}
ChanRouter routes events
func NewChanRouter ¶
func NewChanRouter(chans interfaces.SpeakMessageChan) *ChanRouter
New creates a ChanRouter with a user-defined channels gocritic:ignore
func NewChanRouterWithDefault ¶
func NewChanRouterWithDefault() *ChanRouter
NewWithDefault creates a ChanRouter with the default callback handler
func (*ChanRouter) Binary ¶
func (r *ChanRouter) Binary(byMsg []byte) error
Binary handles platform messages and routes them appropriately based on the MessageType
func (*ChanRouter) Close ¶
func (r *ChanRouter) Close(cr *interfaces.CloseResponse) error
Close sends an CloseResponse message to the callback
func (*ChanRouter) Error ¶
func (r *ChanRouter) Error(er *interfaces.ErrorResponse) error
Error sends an ErrorResponse message to the callback
func (*ChanRouter) Message ¶
func (r *ChanRouter) Message(byMsg []byte) error
Message handles platform messages and routes them appropriately based on the MessageType
func (*ChanRouter) Open ¶
func (r *ChanRouter) Open(or *interfaces.OpenResponse) error
Open sends an OpenResponse message to the callback
func (*ChanRouter) UnhandledMessage ¶
func (r *ChanRouter) UnhandledMessage(byMsg []byte) error
UnhandledMessage logs and handles any unexpected message types
type DefaultCallbackHandler ¶
type DefaultCallbackHandler struct {
// contains filtered or unexported fields
}
Using Callbacks
DefaultCallbackHandler is a default callback handler for live transcription Simply prints the transcript to stdout
func NewDefaultCallbackHandler ¶
func NewDefaultCallbackHandler() *DefaultCallbackHandler
NewDefaultCallbackHandler creates a new DefaultCallbackHandler
func (*DefaultCallbackHandler) Binary ¶
func (dch *DefaultCallbackHandler) Binary(br []byte) error
Binary is the callback for when the connection receives binary data
func (*DefaultCallbackHandler) Clear ¶
func (dch *DefaultCallbackHandler) Clear(fr *interfaces.ClearedResponse) error
Clear is the callback for when the connection clears the buffer
func (*DefaultCallbackHandler) Close ¶
func (dch *DefaultCallbackHandler) Close(or *interfaces.CloseResponse) error
Close is the callback for when the connection closes
func (*DefaultCallbackHandler) Error ¶
func (dch *DefaultCallbackHandler) Error(er *interfaces.ErrorResponse) error
Error is the callback for error messages
func (*DefaultCallbackHandler) Flush ¶
func (dch *DefaultCallbackHandler) Flush(fr *interfaces.FlushedResponse) error
Flush is the callback for when the connection flushes
func (*DefaultCallbackHandler) Metadata ¶
func (dch *DefaultCallbackHandler) Metadata(md *interfaces.MetadataResponse) error
Metadata is the callback for information about the connection
func (*DefaultCallbackHandler) Open ¶
func (dch *DefaultCallbackHandler) Open(or *interfaces.OpenResponse) error
Open is the callback for when the connection opens
func (*DefaultCallbackHandler) UnhandledEvent ¶
func (dch *DefaultCallbackHandler) UnhandledEvent(byData []byte) error
UnhandledEvent is the callback for unknown messages
func (*DefaultCallbackHandler) Warning ¶
func (dch *DefaultCallbackHandler) Warning(wr *interfaces.WarningResponse) error
Warning is the callback for error messages
type DefaultChanHandler ¶
type DefaultChanHandler struct {
// contains filtered or unexported fields
}
Using Channels
DefaultCallbackHandler is a default callback handler for live transcription Simply prints the transcript to stdout
func NewDefaultChanHandler ¶
func NewDefaultChanHandler() *DefaultChanHandler
NewDefaultChanHandler creates a new DefaultChanHandler
func (*DefaultChanHandler) GetBinary ¶
func (dch *DefaultChanHandler) GetBinary() []*chan *[]byte
GetBinary returns the binary event channels
func (*DefaultChanHandler) GetClear ¶
func (dch *DefaultChanHandler) GetClear() []*chan *interfaces.ClearedResponse
GetCleared returns the cleared channels
func (*DefaultChanHandler) GetClose ¶
func (dch *DefaultChanHandler) GetClose() []*chan *interfaces.CloseResponse
GetClose returns the close channels
func (*DefaultChanHandler) GetError ¶
func (dch *DefaultChanHandler) GetError() []*chan *interfaces.ErrorResponse
GetError returns the error channels
func (*DefaultChanHandler) GetFlush ¶
func (dch *DefaultChanHandler) GetFlush() []*chan *interfaces.FlushedResponse
GetfFlush returns the flush channels
func (*DefaultChanHandler) GetMetadata ¶
func (dch *DefaultChanHandler) GetMetadata() []*chan *interfaces.MetadataResponse
GetMetadata returns the metadata channels
func (*DefaultChanHandler) GetOpen ¶
func (dch *DefaultChanHandler) GetOpen() []*chan *interfaces.OpenResponse
GetOpen returns the open channels
func (*DefaultChanHandler) GetUnhandled ¶
func (dch *DefaultChanHandler) GetUnhandled() []*chan *[]byte
GetUnhandled returns the unhandled event channels
func (*DefaultChanHandler) GetWarning ¶
func (dch *DefaultChanHandler) GetWarning() []*chan *interfaces.WarningResponse
GetWarning returns the warning channels
func (*DefaultChanHandler) Run ¶
func (dch *DefaultChanHandler) Run() error
Open is the callback for when the connection opens
type MessageRouter ¶
type MessageRouter = CallbackRouter
MessageRouter is the interface for routing messages Deprecated: Use CallbackRouter instead
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
This package defines interfaces for the live API
|
This package defines interfaces for the live API |