rest

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 16 Imported by: 12

Documentation

Overview

This package contains the initialization code for the Deepgram Go SDK

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
)

Variables

View Source
var (
	// Trace reads an http request or response from rc and writes to w.
	// The content type (kind) should be one of "xml" or "json".
	Trace = func(rc io.ReadCloser, w io.Writer, kind string) io.ReadCloser {
		return debug.NewTeeReader(rc, w)
	}
)

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.

Types

type Client

type Client struct {
	*HttpClient

	Options *ClientOptions
	// contains filtered or unexported fields
}

Client which extends HttpClient to support REST

func New

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

New allocated a REST client

func NewWithDefaults

func NewWithDefaults() *Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, resBody interface{}) error

Do is a generic REST API call to the platform

type ClientOptions

type ClientOptions struct {
	Host    string
	Version string
}

ClientOptions defines any options for the client

type HttpClient

type HttpClient struct {
	http.Client

	UserAgent string
	// contains filtered or unexported fields
}

HttpClient which extends HTTP client

func NewHTTPClient

func NewHTTPClient() *HttpClient

New allocated a Simple HTTP client

func (*HttpClient) Do

func (c *HttpClient) Do(ctx context.Context, req *http.Request, f func(*http.Response) error) error

Do performs a simple HTTP-style call

type InitLib

type InitLib struct {
	LogLevel      common.LogLevel
	DebugFilePath string
}

Initialization options for this SDK.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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