api

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBaseURL = "https://api.openai.com/v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseurl, apikey string, maxIdleConns int, idleConnTimeout time.Duration, httpsProxy string) *Client

func (*Client) DoForm

func (c *Client) DoForm(method, path string, body interface{}) ([]byte, error)

func (*Client) DoJson

func (c *Client) DoJson(method, path string, body interface{}) ([]byte, error)

func (*Client) DoStream added in v1.2.2

func (c *Client) DoStream(method, path string, body interface{}) (*http.Response, error)

func (*Client) Download

func (c *Client) Download(path string) (io.ReadCloser, error)

type Error

type Error struct {
	Message string      `json:"message"`
	Type    string      `json:"type"`
	Param   interface{} `json:"param"`
	Code    string      `json:"code"`
}

func (*Error) Error

func (e *Error) Error() string

type ErrorResponse

type ErrorResponse struct {
	Error Error `json:"error"`
}

Jump to

Keyboard shortcuts

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