Documentation ¶
Index ¶
- type Decoder
- type Encoder
- type HTTPClient
- func (c *HTTPClient) Delete(path string, data any, dest any) error
- func (c *HTTPClient) Do(method, path string, body io.Reader, dest any) error
- func (c *HTTPClient) Get(path string, params url.Values, dest any) error
- func (c *HTTPClient) Patch(path string, data any, dest any) error
- func (c *HTTPClient) Post(path string, data any, dest any) error
- func (c *HTTPClient) Put(path string, data any, dest any) error
- type HTTPOption
- type Logger
- type WSClient
- type WSOption
- func WithPingInterval(i time.Duration) WSOption
- func WithReconnectBackoff(maxBackoff time.Duration) WSOption
- func WithWSEncoder(fn func(any) ([]byte, error)) WSOption
- func WithWSHandler(fn func([]byte) error) WSOption
- func WithWSLogger(l Logger) WSOption
- func WithWSOnClose(fn func(*WSClient) error) WSOption
- func WithWSOnOpen(fn func(*WSClient) error) WSOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶
func NewHTTPClient(root string, opts ...HTTPOption) *HTTPClient
type HTTPOption ¶
type HTTPOption func(*HTTPClient)
func WithBefore ¶
func WithBefore(fn func(*http.Request) error) HTTPOption
func WithClient ¶
func WithClient(c *http.Client) HTTPOption
func WithDecoder ¶
func WithDecoder(fn func([]byte, any) error) HTTPOption
func WithEncoder ¶
func WithEncoder(fn func(obj any) ([]byte, error)) HTTPOption
func WithLogger ¶
func WithLogger(lg Logger) HTTPOption
func WithMaxStatus ¶
func WithMaxStatus(code int) HTTPOption
type WSClient ¶
type WSClient struct {
// contains filtered or unexported fields
}
func NewWSClient ¶
type WSOption ¶
type WSOption func(*WSClient)
func WithPingInterval ¶
WithPingInterval sets the ping interval
func WithReconnectBackoff ¶
WithReconnect enables exponential backoff behavior on reconnect.
func WithWSEncoder ¶
WithWSEncoder sets the encoder for objects written to the client
func WithWSHandler ¶
WithWSHandler sets the global message handler for the client.
func WithWSLogger ¶
WithWSLogger sets the logger for the websocket client.
func WithWSOnClose ¶
WithWSOnOpen sets the callback called whenver a connection is closed.
func WithWSOnOpen ¶
WithWSOnOpen sets the callback called whenver a new connection is opened.
Click to show internal directories.
Click to hide internal directories.