live

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

This package defines the live API for Deepgram

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidMessageType invalid message type
	ErrInvalidMessageType = errors.New("invalid message type")

	// ErrUserCallbackNotDefined user callback object not defined
	ErrUserCallbackNotDefined = errors.New("user callback object not defined")
)

Functions

This section is empty.

Types

type DefaultCallbackHandler

type DefaultCallbackHandler struct{}

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

func (DefaultCallbackHandler) Message

Message is the callback for a message

func (DefaultCallbackHandler) Metadata

Metadata is the callback for a metadata

func (DefaultCallbackHandler) SpeechStarted added in v1.1.1

func (DefaultCallbackHandler) UtteranceEnd added in v1.0.2

type MessageRouter

type MessageRouter struct {
	// contains filtered or unexported fields
}

MessageRouter is helper struct that routes events

func New

New creates a MessageRouter with user defined callback

func NewWithDefault

func NewWithDefault() *MessageRouter

NewWithDefault creates a default MessageRouter

func (*MessageRouter) ErrorResponse

func (r *MessageRouter) ErrorResponse(byMsg []byte) error

func (*MessageRouter) Message

func (r *MessageRouter) Message(byMsg []byte) error

Message handles platform messages

func (*MessageRouter) MessageResponse

func (r *MessageRouter) MessageResponse(byMsg []byte) error

MessageResponse handles the MessageResponse message

func (*MessageRouter) MetadataResponse

func (r *MessageRouter) MetadataResponse(byMsg []byte) error

func (*MessageRouter) SpeechStartedResponse added in v1.1.1

func (r *MessageRouter) SpeechStartedResponse(byMsg []byte) error

func (*MessageRouter) UnhandledMessage

func (r *MessageRouter) UnhandledMessage(byMsg []byte) error

UnhandledMessage handles the UnhandledMessage message

func (*MessageRouter) UtteranceEndResponse added in v1.0.2

func (r *MessageRouter) UtteranceEndResponse(byMsg []byte) error

type MessageType

type MessageType struct {
	Type string `json:"type"`
}

MessageType is the header to bootstrap you way unmarshalling other messages

Example:
{
	"type": "message",
	"message": {
		...
	}
}

Directories

Path Synopsis
This package defines interfaces for the live API
This package defines interfaces for the live API

Jump to

Keyboard shortcuts

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