Documentation
¶
Overview ¶
This package provides the prerecorded client implementation for the Deepgram API
Index ¶
- Constants
- func Init(init InitLib)
- func InitWithDefault()
- func NewREST(apiKey string, options *interfaces.ClientOptions) *listenv1rest.RESTClient
- func NewRESTWithDefaults() *listenv1rest.RESTClient
- func NewWSUsingCallback(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, ...) (*listenv1ws.WSCallback, error)
- func NewWSUsingCallbackForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSCallback, error)
- func NewWSUsingCallbackWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, ...) (*listenv1ws.WSCallback, error)
- func NewWSUsingCallbackWithDefaults(ctx context.Context, tOptions *interfaces.LiveTranscriptionOptions, ...) (*listenv1ws.WSCallback, error)
- func NewWSUsingChan(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, ...) (*listenv1ws.WSChannel, error)
- func NewWSUsingChanForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSChannel, error)
- func NewWSUsingChanWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, ...) (*listenv1ws.WSChannel, error)
- func NewWSUsingChanWithDefaults(ctx context.Context, options *interfaces.LiveTranscriptionOptions, ...) (*listenv1ws.WSChannel, error)
- func NewWebSocketUsingCallback(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, ...) (*listenv1ws.WSCallback, error)
- func NewWebSocketUsingCallbackForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSCallback, error)
- func NewWebSocketUsingCallbackWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, ...) (*listenv1ws.WSCallback, error)
- func NewWebSocketUsingCallbackWithDefaults(ctx context.Context, tOptions *interfaces.LiveTranscriptionOptions, ...) (*listenv1ws.WSCallback, error)
- func NewWebSocketUsingChan(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, ...) (*listenv1ws.WSChannel, error)
- func NewWebSocketUsingChanForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSChannel, error)
- func NewWebSocketUsingChanWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, ...) (*listenv1ws.WSChannel, error)
- func NewWebSocketUsingChanWithDefaults(ctx context.Context, options *interfaces.LiveTranscriptionOptions, ...) (*listenv1ws.WSChannel, error)
- type InitLib
- type RESTClient
- type WSCallback
- type WSChannel
Constants ¶
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
const (
RESTPackageVersion = listenv1rest.PackageVersion
)
********************************* REST Client *********************************
const (
WebSocketPackageVersion = listenv1ws.PackageVersion
)
********************************* WebSocket / Streaming / Live *********************************
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 NewREST ¶
func NewREST(apiKey string, options *interfaces.ClientOptions) *listenv1rest.RESTClient
NewREST creates a new prerecorded 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.
func NewRESTWithDefaults ¶
func NewRESTWithDefaults() *listenv1rest.RESTClient
NewRESTWithDefaults creates a new analyze/read client with all default options
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, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.WSCallback, error)
NewWSUsingCallback 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. - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc. - callback: LiveMessageCallback which is a callback that allows you to perform actions based on the transcription
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 which just prints all messages to the console
func NewWSUsingCallbackForDemo ¶ added in v1.6.0
func NewWSUsingCallbackForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSCallback, error)
Using Callbacks
NewWSUsingCallbackForDemo creates a new websocket connection with all default options ¶
Input parameters: - ctx: context.Context object - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc.
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, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.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. - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc. - callback: LiveMessageCallback which is a callback that allows you to perform actions based on the transcription
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 which just prints all messages to the console
func NewWSUsingCallbackWithDefaults ¶ added in v1.6.0
func NewWSUsingCallbackWithDefaults(ctx context.Context, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.WSCallback, error)
NewWSUsingCallbackWithDefaults creates a new websocket connection with all default options
Input parameters: - ctx: context.Context object - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc. - callback: LiveMessageCallback which is a callback that allows you to perform actions based on the transcription
Notes:
- The Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY
- The callback handler is set to the default handler which just prints all messages to the console
func NewWSUsingChan ¶ added in v1.6.0
func NewWSUsingChan(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, chans msginterfaces.LiveMessageChan) (*listenv1ws.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. - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc. - chans: LiveMessageCallback which is a chans that allows you to perform actions based on the transcription
func NewWSUsingChanForDemo ¶ added in v1.6.0
func NewWSUsingChanForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSChannel, error)
Using Channels
NewWSUsingChanForDemo creates a new websocket connection for demo purposes only ¶
Input parameters: - ctx: context.Context object - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc.
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, tOptions *interfaces.LiveTranscriptionOptions, chans msginterfaces.LiveMessageChan) (*listenv1ws.WSChannel, error)
NewWSUsingChanWithCancel creates a new websocket connection with the specified options
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. - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc. - chans: LiveMessageCallback which is a chans that allows you to perform actions based on the transcription
func NewWSUsingChanWithDefaults ¶ added in v1.6.0
func NewWSUsingChanWithDefaults(ctx context.Context, options *interfaces.LiveTranscriptionOptions, chans msginterfaces.LiveMessageChan) (*listenv1ws.WSChannel, error)
NewWebSocketUsingChanWithDefaults creates a new websocket connection with all default options
Input parameters: - ctx: context.Context object - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc.
Notes:
- The Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY
- The chans handler is set to the default handler which just prints all messages to the console
func NewWebSocketUsingCallback ¶ added in v1.6.0
func NewWebSocketUsingCallback(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.WSCallback, error)
NewWebSocketUsingCallback is an alias for NewWSUsingCallback TODO: Deprecate this function later
func NewWebSocketUsingCallbackForDemo ¶ added in v1.6.0
func NewWebSocketUsingCallbackForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSCallback, error)
NewWebSocketUsingCallbackForDemo is an alias for NewWSUsingCallbackForDemo TODO: Deprecate this function later
func NewWebSocketUsingCallbackWithCancel ¶ added in v1.6.0
func NewWebSocketUsingCallbackWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.WSCallback, error)
NewWebSocketUsingCallbackWithCancel is an alias for NewWSUsingCallbackWithCancel TODO: Deprecate this function later
func NewWebSocketUsingCallbackWithDefaults ¶ added in v1.6.0
func NewWebSocketUsingCallbackWithDefaults(ctx context.Context, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.WSCallback, error)
NewWebSocketUsingCallbackWithDefaults is an alias for NewWSUsingCallbackWithDefaults TODO: Deprecate this function later
func NewWebSocketUsingChan ¶ added in v1.6.0
func NewWebSocketUsingChan(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, chans msginterfaces.LiveMessageChan) (*listenv1ws.WSChannel, error)
NewWebSocketUsingChan is an alias for NewWSUsingChan TODO: Deprecate this function later
func NewWebSocketUsingChanForDemo ¶ added in v1.6.0
func NewWebSocketUsingChanForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSChannel, error)
NewWebSocketUsingChanForDemo is an alias for NewWSUsingChanForDemo TODO: Deprecate this function later
func NewWebSocketUsingChanWithCancel ¶ added in v1.6.0
func NewWebSocketUsingChanWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, chans msginterfaces.LiveMessageChan) (*listenv1ws.WSChannel, error)
NewWebSocketUsingChanWithCancel is an alias for NewWSUsingChanWithCancel TODO: Deprecate this function later
func NewWebSocketUsingChanWithDefaults ¶ added in v1.6.0
func NewWebSocketUsingChanWithDefaults(ctx context.Context, options *interfaces.LiveTranscriptionOptions, chans msginterfaces.LiveMessageChan) (*listenv1ws.WSChannel, error)
NewWebSocketUsingChanWithDefaults is an alias for NewWSUsingChanWithDefaults TODO: Deprecate this function later
Types ¶
type RESTClient ¶ added in v1.6.0
type RESTClient = listenv1rest.RESTClient
RestClient is an alias for listenv1rest.Client
type WSCallback ¶ added in v1.6.0
type WSCallback = listenv1ws.WSCallback
WSCallback is an alias for listenv1ws.WSCallback
type WSChannel ¶ added in v1.6.0
type WSChannel = listenv1ws.WSChannel
WSChannel is an alias for listenv1ws.WSChannel
Directories
¶
Path | Synopsis |
---|---|
v1
|
|
rest
This package provides the prerecorded client implementation for the Deepgram API
|
This package provides the prerecorded client implementation for the Deepgram API |
websocket
This package provides the live/streaming client implementation for the Deepgram API
|
This package provides the live/streaming client implementation for the Deepgram API |