speak

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 6 Imported by: 10

Documentation

Overview

This package provides the speak client implementation for the Deepgram API

Index

Constants

View Source
const (
	LogLevelDefault   = common.LogLevelDefault
	LogLevelErrorOnly = common.LogLevelErrorOnly
	LogLevelStandard  = common.LogLevelStandard
	LogLevelElevated  = common.LogLevelElevated
	LogLevelFull      = common.LogLevelFull
	LogLevelDebug     = common.LogLevelDebug
	LogLevelTrace     = common.LogLevelTrace
	LogLevelVerbose   = common.LogLevelVerbose
)

please see pkg/common/init.go for more information

View Source
const (
	RESTPackageVersion = speakv1rest.PackageVersion
)

********************************* REST Client *********************************

View Source
const (
	WebSocketPackageVersion = speakv1ws.PackageVersion
)

********************************* WebSocket Client *********************************

Variables

This section is empty.

Functions

func Init

func Init(init InitLib)

The SDK Init function for this library. Allows you to set the logging level and use of a log file. Default is output to the stdout.

func InitWithDefault

func InitWithDefault()

InitWithDefault is the SDK Init function for this library using default values.

func New deprecated

func New(apiKey string, options *interfaces.ClientOptions) *speakv1rest.RESTClient

New creates a new speak client with the specified options

Input parameters: - ctx: context.Context object - apiKey: string containing the Deepgram API key - options: ClientOptions which allows overriding things like hostname, version of the API, etc.

Deprecated: This function is deprecated. Please use NewREST(). This will be removed in a future release.

func NewREST added in v1.4.0

func NewREST(apiKey string, options *interfaces.ClientOptions) *speakv1rest.RESTClient

New creates a new speak client with the specified options

Input parameters: - apiKey: string containing the Deepgram API key - options: ClientOptions which allows overriding things like hostname, version of the API, etc.

Returns: - *Client: a new speak client

func NewRESTWithDefaults added in v1.4.0

func NewRESTWithDefaults() *speakv1rest.RESTClient

NewRESTWithDefaults creates a new speak client with all default options

Returns: - *Client: a new speak client

Notes:

  • The Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY

func NewWSUsingCallback added in v1.6.0

func NewWSUsingCallback(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, sOptions *interfaces.WSSpeakOptions, callback msginterfaces.SpeakMessageCallback) (*speakv1ws.WSCallback, error)

NewWSUsingCallbacks creates a new websocket connection with the specified options

Input parameters: - ctx: context.Context object - apiKey: string containing the Deepgram API key - cOptions: ClientOptions which allows overriding things like hostname, version of the API, etc. - sOptions: SpeakOptions which allows overriding things like model, etc. - callback: SpeakMessageCallback is a callback which lets you perform actions based on platform messages

Returns: - *Client: a new websocket client

Notes:

  • If apiKey is an empty string, the Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY
  • The callback handler is set to the default handler

func NewWSUsingCallbackForDemo added in v1.6.0

func NewWSUsingCallbackForDemo(ctx context.Context, options *interfaces.WSSpeakOptions) (*speakv1ws.WSCallback, error)
Using Callbacks

NewWSUsingCallbackForDemo creates a new websocket connection with all default options

Input parameters: - ctx: context.Context object - options: SpeakOptions which allows overriding things like model, etc.

Returns: - *Client: a new websocket client

Notes:

  • The Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY

func NewWSUsingCallbackWithCancel added in v1.6.0

func NewWSUsingCallbackWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, cOptions *interfaces.ClientOptions, sOptions *interfaces.WSSpeakOptions, callback msginterfaces.SpeakMessageCallback) (*speakv1ws.WSCallback, error)

NewWSUsingCallbackWithCancel creates a new websocket connection but has facilities to BYOC (Bring Your Own Cancel)

Input parameters: - ctx: context.Context object - ctxCancel: allow passing in own cancel - apiKey: string containing the Deepgram API key - cOptions: ClientOptions which allows overriding things like hostname, version of the API, etc. - sOptions: SpeakOptions which allows overriding things like model, etc. - callback: SpeakMessageCallback is a callback which lets you perform actions based on platform messages

Returns: - *Client: a new websocket client

Notes:

  • If apiKey is an empty string, the Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY
  • The callback handler is set to the default handler

func NewWSUsingCallbackWithDefaults added in v1.6.0

func NewWSUsingCallbackWithDefaults(ctx context.Context, options *interfaces.WSSpeakOptions, callback msginterfaces.SpeakMessageCallback) (*speakv1ws.WSCallback, error)

NewWSUsingCallbackWithDefaults creates a new websocket connection with all default options

Input parameters: - ctx: context.Context object - options: SpeakOptions which allows overriding things like model, etc. - callback: SpeakMessageCallback is a callback which lets you perform actions based on platform messages

Returns: - *Client: a new websocket client

Notes:

  • The callback handler is set to the default handler

func NewWSUsingChan added in v1.6.0

func NewWSUsingChan(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, sOptions *interfaces.WSSpeakOptions, callback msginterfaces.SpeakMessageChan) (*speakv1ws.WSChannel, error)

NewWSUsingChan creates a new websocket connection with the specified options

Input parameters: - ctx: context.Context object - apiKey: string containing the Deepgram API key - cOptions: ClientOptions which allows overriding things like hostname, version of the API, etc. - sOptions: SpeakOptions which allows overriding things like model, etc. - callback: SpeakMessageCallback is a callback which lets you perform actions based on platform messages

Returns: - *Client: a new websocket client

Notes:

  • If apiKey is an empty string, the Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY
  • The callback handler is set to the default handler

func NewWSUsingChanForDemo added in v1.6.0

func NewWSUsingChanForDemo(ctx context.Context, options *interfaces.WSSpeakOptions) (*speakv1ws.WSChannel, error)
Using Channels

NewWSUsingChanForDemo creates a new websocket connection with all default options

Input parameters: - ctx: context.Context object - options: SpeakOptions which allows overriding things like model, etc.

Returns: - *Client: a new websocket client

Notes:

  • The Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY

func NewWSUsingChanWithCancel added in v1.6.0

func NewWSUsingChanWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, cOptions *interfaces.ClientOptions, sOptions *interfaces.WSSpeakOptions, callback msginterfaces.SpeakMessageChan) (*speakv1ws.WSChannel, error)

NewWSUsingChanWithCancel creates a new websocket connection but has facilities to BYOC (Bring Your Own Cancel)

Input parameters: - ctx: context.Context object - ctxCancel: allow passing in own cancel - apiKey: string containing the Deepgram API key - cOptions: ClientOptions which allows overriding things like hostname, version of the API, etc. - sOptions: SpeakOptions which allows overriding things like model, etc. - callback: SpeakMessageCallback is a callback which lets you perform actions based on platform messages

Returns: - *Client: a new websocket client

Notes:

  • If apiKey is an empty string, the Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY
  • The callback handler is set to the default handler

func NewWSUsingChanWithDefaults added in v1.6.0

func NewWSUsingChanWithDefaults(ctx context.Context, options *interfaces.WSSpeakOptions, callback msginterfaces.SpeakMessageChan) (*speakv1ws.WSChannel, error)

NewWSUsingChanWithDefaults creates a new websocket connection with all default options

Input parameters: - ctx: context.Context object - options: SpeakOptions which allows overriding things like model, etc. - callback: SpeakMessageCallback is a callback which lets you perform actions based on platform messages

Returns: - *Client: a new websocket client

Notes:

  • The callback handler is set to the default handler

func NewWithDefaults deprecated

func NewWithDefaults() *speakv1rest.RESTClient

NewWithDefaults creates a new speak client with all default options

Deprecated: This function is deprecated. Please use NewREST(). This will be removed in a future release.

Types

type Client deprecated

type Client = speakv1rest.RESTClient

********************************* Deprecated (THESE WILL STILL WORK, BUT WILL BE REMOVED IN A FUTURE RELEASE) *********************************

Legacy Client Name

Deprecated: This struct is deprecated. Please use RestClient struct. This will be removed in a future release.

type InitLib

type InitLib struct {
	LogLevel      common.LogLevel
	DebugFilePath string
}

Initialization options for this SDK.

type RESTClient added in v1.6.0

type RESTClient = speakv1rest.RESTClient

New Client Name

type WSCallback added in v1.6.0

type WSCallback = speakv1ws.WSCallback

WSCallback is an alias for listenv1ws.WSCallback

type WSChannel added in v1.6.0

type WSChannel = speakv1ws.WSChannel

WSChannel is an alias for listenv1ws.WSChannel

Directories

Path Synopsis
v1
rest
This package provides the speak client implementation for the Deepgram API
This package provides the speak client implementation for the Deepgram API
websocket
This package provides the speak/streaming client implementation for the Deepgram API
This package provides the speak/streaming client implementation for the Deepgram API

Jump to

Keyboard shortcuts

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