internal

package
v6.0.0-...-97dcf11 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 13 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 HTTPEndpointGenerator) (*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 HTTPEndpointGenerator) (*fileUploadAPI, error)

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

func UnmarshalOptionalRawField

func UnmarshalOptionalRawField(source json.RawMessage, target interface{}) error

Types

type CallOptions

type CallOptions struct {
	Method string
}

type HTTPEndpointGenerator

type HTTPEndpointGenerator func(*authorization.Token, string, string) string

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

func DefaultHTTPRequestGenerator

func DefaultHTTPRequestGenerator(name string) HTTPEndpointGenerator

DefaultHTTPRequestGenerator generates API request for given service in stable version.

type RetryStrategyFunc

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

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