analyze

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

This package provides the analyze/read 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

Variables

View Source
var (
	// ErrInvalidInput required input was not found
	ErrInvalidInput = errors.New("required input was not found")
)

errors

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 IsUrl

func IsUrl(str string) bool

IsUrl returns true if a string is of a URL format

Types

type Client

type Client struct {
	*rest.Client
	// contains filtered or unexported fields
}

Client implements helper functionality for Prerecorded API

func New

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

New creates a new analyze/read 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.

func NewWithDefaults

func NewWithDefaults() *Client

NewWithDefaults 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 (*Client) DoFile

func (c *Client) DoFile(ctx context.Context, filePath string, req interfaces.AnalyzeOptions, resBody interface{}) error

DoFile posts a file capturing a conversation to a given REST endpoint

Input parameters: - ctx: context.Context object - filePath: string containing the path to the file to be posted - req: PreRecordedTranscriptionOptions which allows overriding things like language, etc.

Output parameters: - resBody: interface{} which will be populated with the response from the server

func (*Client) DoStream

func (c *Client) DoStream(ctx context.Context, src io.Reader, options interfaces.AnalyzeOptions, resBody interface{}) error

DoStream posts a stream capturing a conversation to a given REST endpoint

Input parameters: - ctx: context.Context object - src: io.Reader containing the stream to be posted - req: PreRecordedTranscriptionOptions which allows overriding things like language, etc.

Output parameters: - resBody: interface{} which will be populated with the response from the server

func (*Client) DoURL

func (c *Client) DoURL(ctx context.Context, url string, options interfaces.AnalyzeOptions, resBody interface{}) error

DoURL posts a URL capturing a conversation to a given REST endpoint

Input parameters: - ctx: context.Context object - url: string containing the URL to be posted - req: PreRecordedTranscriptionOptions which allows overriding things like language, etc.

Output parameters: - resBody: interface{} which will be populated with the response from the server

type InitLib

type InitLib struct {
	LogLevel      common.LogLevel
	DebugFilePath string
}

Initialization options for this SDK.

Jump to

Keyboard shortcuts

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