http

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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) Delete

func (c *Client) Delete(ctx context.Context, path string) ([]byte, error)

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string) ([]byte, error)

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, path string, body interface{}) ([]byte, error)

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body interface{}) ([]byte, error)

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, body interface{}) ([]byte, error)

func (*Client) Request

func (c *Client) Request(ctx context.Context, method, path string, body interface{}) ([]byte, error)

func (*Client) SetAccessToken

func (c *Client) SetAccessToken(token string)

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(url string)

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 WithRetry

func WithRetry(maxRetries int, waitMin, waitMax time.Duration) 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

type RoundTripperFunc func(*http.Request) (*http.Response, error)

func (RoundTripperFunc) RoundTrip

func (f RoundTripperFunc) RoundTrip(req *http.Request) (*http.Response, error)

type TokenProvider

type TokenProvider interface {
	GetToken() *types.Token
	RefreshToken(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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