internal

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAPI

func NewAPI(t authorization.TokenGetter, client *http.Client, clientID string, r HTTPRequestGenerator) (*api, error)

NewAPI returns ready to use raw API client. This is a base that is used internally by specialized clients for each API, you should use those instead

If provided client is nil, then default http client with 20s timeout is used.

func NewAPIWithFileUpload

func NewAPIWithFileUpload(t authorization.TokenGetter, client *http.Client, clientID string, r HTTPRequestGenerator) (*fileUploadAPI, error)

NewAPIWithFileUpload returns ready to use raw API client with file upload functionality.

Types

type HTTPRequestGenerator

type HTTPRequestGenerator func(*authorization.Token, string, string) (*http.Request, error)

HTTPRequestGenerator is called by each API method to generate api http url.

func DefaultHTTPRequestGenerator

func DefaultHTTPRequestGenerator(name string) HTTPRequestGenerator

DefaultHTTPRequestGenerator generates API request for given service in stable version.

type RetryStrategyFunc added in v2.3.0

type RetryStrategyFunc func(attempts uint, err error) bool

RetryStrategyFunc is called by each API method if set to retry when handling an error. If not set, there will be no retry at all.

It accepts two arguments: attempts - number of sent requests (starting from 0) and err - error as ErrAPI struct (with StatusCode and Details) It returns info whether to retry the request.

type StatsSinkFunc added in v2.4.0

type StatsSinkFunc func(callStats metrics.APICallStats)

StatsSinkFunc is called after each API method with statistics of that method execution.

Jump to

Keyboard shortcuts

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