Documentation ¶
Index ¶
- func NewAPI(t authorization.TokenGetter, client *http.Client, clientID string, ...) (*api, error)
- func NewAPIWithFileUpload(t authorization.TokenGetter, client *http.Client, clientID string, ...) (*fileUploadAPI, error)
- type CallOptions
- type HTTPEndpointGenerator
- type RetryStrategyFunc
- type StatsSinkFunc
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.
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 ¶
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.