Documentation
¶
Overview ¶
This package defines interfaces for the live API
Index ¶
Constants ¶
const ( // message types TypeOpenResponse = commoninterfaces.TypeOpenResponse TypeMetadataResponse TypeResponse = "Metadata" TypeFlushedResponse TypeResponse = "Flushed" TypeClearedResponse TypeResponse = "Cleared" TypeCloseResponse = commoninterfaces.TypeCloseResponse // "Error" type TypeWarningResponse TypeResponse = "Warning" TypeErrorResponse = commoninterfaces.TypeErrorResponse TypeUnhandledResponse TypeResponse = "Unhandled" )
These are the message types that can be received from the text-to-speech streaming API
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClearedResponse ¶
type ClearedResponse struct {
Type string `json:"type,omitempty"`
SequenceID int `json:"sequence_id,omitempty"`
}
ClearedResponse is the response which indicates that the server has cleared the buffer
type CloseResponse ¶
type CloseResponse = commoninterfaces.CloseResponse
CloseResponse is the response from closing the connection
type ErrorResponse ¶
type ErrorResponse = interfaces.DeepgramError
ErrorResponse is the Deepgram specific response error
type FlushedResponse ¶
type FlushedResponse struct {
Type string `json:"type,omitempty"`
SequenceID int `json:"sequence_id,omitempty"`
}
FlushedResponse is the response which indicates that the server has flushed the buffer and is ready to return audio
type MessageType ¶
type MessageType struct {
Type string `json:"type"`
}
********************************* MessageType is the header to bootstrap you way unmarshalling other messages *********************************
Example:
{
"type": "message",
"message": {
...
}
}
type MetadataResponse ¶
type MetadataResponse struct {
Type string `json:"type,omitempty"`
RequestID string `json:"request_id,omitempty"`
}
MetadataResponse is the response from the text-to-speech request which contains metadata about the request
type OpenResponse ¶
type OpenResponse = commoninterfaces.OpenResponse
OpenResponse is the response from opening the connection
type SpeakMessageCallback ¶
type SpeakMessageCallback interface {
// These are WS TextMessage that are used for flow control.
Open(or *OpenResponse) error
Metadata(md *MetadataResponse) error
Flush(fl *FlushedResponse) error
Clear(cl *ClearedResponse) error
Close(cr *CloseResponse) error
Warning(er *WarningResponse) error
Error(er *ErrorResponse) error
UnhandledEvent(byMsg []byte) error
// These are WS BinaryMessage that are used to send audio data to the client
Binary(byMsg []byte) error
}
Callback Interfaces
SpeakMessageCallback is a callback used to receive notifications for platforms messages
type SpeakMessageChan ¶
type SpeakMessageChan interface {
// These are WS TextMessage that are used for flow control.
GetBinary() []*chan *[]byte
GetOpen() []*chan *OpenResponse
GetMetadata() []*chan *MetadataResponse
GetFlush() []*chan *FlushedResponse
GetClear() []*chan *ClearedResponse
GetClose() []*chan *CloseResponse
GetWarning() []*chan *WarningResponse
GetError() []*chan *ErrorResponse
GetUnhandled() []*chan *[]byte
}
Chan Interfaces
SpeakMessageChan is a channel used to receive notifcations for platforms messages
type SpeakOptions ¶
type SpeakOptions interfaces.SpeakOptions
********************************* Request/Input structs *********************************
type TypeResponse ¶
type TypeResponse commoninterfaces.TypeResponse
These are the message types that can be received from the live API
type WarningResponse ¶
type WarningResponse = interfaces.DeepgramWarning
WarningResponse is the Deepgram specific response warning