Documentation
¶
Index ¶
- type Client
- func (c *Client) Delete(ctx context.Context, path string) ([]byte, error)
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) Get(ctx context.Context, path string) ([]byte, error)
- func (c *Client) Patch(ctx context.Context, path string, body interface{}) ([]byte, error)
- func (c *Client) Post(ctx context.Context, path string, body interface{}) ([]byte, error)
- func (c *Client) Put(ctx context.Context, path string, body interface{}) ([]byte, error)
- func (c *Client) Request(ctx context.Context, method, path string, body interface{}) ([]byte, error)
- func (c *Client) SetAccessToken(token string)
- func (c *Client) SetBaseURL(url string)
- type ClientOption
- func WithAPIVersion(version string) ClientOption
- func WithAccessToken(token string) ClientOption
- func WithBaseURL(url string) ClientOption
- func WithHTTPClient(client *http.Client) ClientOption
- func WithLogger(logger types.Logger) ClientOption
- func WithMiddleware(middleware ...Middleware) ClientOption
- func WithRetry(maxRetries int, waitMin, waitMax time.Duration) ClientOption
- func WithTokenProvider(provider TokenProvider) ClientOption
- type DefaultLogger
- type Middleware
- type RoundTripperFunc
- type TokenProvider
Constants ¶
This section is empty.
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(opts ...ClientOption) *Client
func (*Client) SetAccessToken ¶
func (*Client) SetBaseURL ¶
type ClientOption ¶
type ClientOption func(*Client)
func WithAPIVersion ¶
func WithAPIVersion(version string) ClientOption
func WithAccessToken ¶
func WithAccessToken(token string) ClientOption
func WithBaseURL ¶
func WithBaseURL(url string) ClientOption
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ClientOption
func WithLogger ¶
func WithLogger(logger types.Logger) ClientOption
func WithMiddleware ¶
func WithMiddleware(middleware ...Middleware) ClientOption
func WithTokenProvider ¶
func WithTokenProvider(provider TokenProvider) ClientOption
type DefaultLogger ¶
type DefaultLogger struct {
// contains filtered or unexported fields
}
func NewDefaultLogger ¶
func NewDefaultLogger(debug bool) *DefaultLogger
func (*DefaultLogger) Debug ¶
func (l *DefaultLogger) Debug(msg string, args ...interface{})
func (*DefaultLogger) Error ¶
func (l *DefaultLogger) Error(msg string, args ...interface{})
func (*DefaultLogger) Info ¶
func (l *DefaultLogger) Info(msg string, args ...interface{})
func (*DefaultLogger) Warn ¶
func (l *DefaultLogger) Warn(msg string, args ...interface{})
type Middleware ¶
type Middleware func(next RoundTripperFunc) RoundTripperFunc
func LoggingMiddleware ¶
func LoggingMiddleware(logger types.Logger) Middleware
type RoundTripperFunc ¶
Click to show internal directories.
Click to hide internal directories.