api

package
v0.0.74 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiClient = getApiClient()
View Source
var ErrorTimeout = errors.New("timeout")

Functions

func AddAuthToRequestHeader added in v0.0.41

func AddAuthToRequestHeader(h *http.Header, apiKey string)

func CheckRes added in v0.0.45

func CheckRes(response *http.Response, err error) error

func CreateAuthenticatedContext

func CreateAuthenticatedContext(parentCtx context.Context, apiKey string, baseUrl string) context.Context

func DetectContentTypeFromUrl added in v0.0.45

func DetectContentTypeFromUrl(u string) string

func DownloadFile

func DownloadFile(url string, file io.Writer) error

func GetAuthFromContext added in v0.0.41

func GetAuthFromContext(ctx context.Context) (baseUrl string, apiKey string)

func IsValidStatus added in v0.0.45

func IsValidStatus(response *http.Response) bool

func NewDefaultClient added in v0.0.59

func NewDefaultClient() *http.Client

NewDefaultClient returns a new http.Client with default settings.

func UploadFile

func UploadFile(url string, file io.Reader, fileSize int64) error

func WaitForCondition added in v0.0.22

func WaitForCondition(ctx context.Context, message string, condition func() (bool, error), sleepDuration time.Duration, timeoutDuration time.Duration) error

Types

type HTTPError added in v0.0.45

type HTTPError struct {
	URL        string
	StatusCode int
	Body       string
}

HTTPError represents an error with details about an HTTP response.

func (*HTTPError) Error added in v0.0.45

func (e *HTTPError) Error() string

Jump to

Keyboard shortcuts

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