restv1

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: 12 Imported by: 1

Documentation

Overview

This package provides the prerecorded client implementation for the Deepgram API

Index

Constants

View Source
const (
	PackageVersion string = "v1.0"
)

Variables

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

errors

Functions

func IsURL

func IsURL(str string) bool

IsURL returns true if a string is of a URL format

Types

type Client

type Client = RESTClient

Client is an alias for WSCallback

func New

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

New creates a new prerecorded 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 prerecorded 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.PreRecordedTranscriptionOptions, resBody interface{}) error

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

Input parameters: - 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.PreRecordedTranscriptionOptions, resBody interface{}) error

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

Input parameters: - 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

DoStream initiates a streaming API request.

func (*Client) DoURL

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

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

Input parameters: - 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 RESTClient added in v1.6.0

type RESTClient struct {
	*common.RESTClient
}

RESTClient implements helper functionality for Prerecorded API

Jump to

Keyboard shortcuts

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