Documentation
¶
Index ¶
- Variables
- func Get(ctx context.Context, url string, opts ...Option) (*http.Response, error)
- func GetJSON[T any](ctx context.Context, url string, opts ...Option) (*T, error)
- func GetJSONWithConfig[T any](ctx context.Context, conf *Config, url string, opts ...Option) (*T, error)
- func GetWithConfig(ctx context.Context, conf *Config, url string, opts ...Option) (*http.Response, error)
- func NewErrorStatusCode(code int, message string) error
- func NewErrorStatusCode429(message string, retryAfter int) error
- func Post(ctx context.Context, url string, body io.Reader, opts ...Option) (*http.Response, error)
- func PostJson[T any](ctx context.Context, url string, body any, opts ...Option) (*T, error)
- func PostJsonSse[T any](ctx context.Context, url string, body any, opts ...Option) (chan *JsonSseEvent[T], error)
- func PostJsonSseWithConfig[T any](ctx context.Context, conf *Config, url string, body any, opts ...Option) (chan *JsonSseEvent[T], error)
- func PostJsonWithConfig[T any](ctx context.Context, conf *Config, url string, body any, opts ...Option) (*T, error)
- func PostWithConfig(ctx context.Context, conf *Config, url string, body io.Reader, opts ...Option) (*http.Response, error)
- type Config
- type ErrorStatusCode
- type JsonSseEvent
- type Option
- type Retry
- type SseEvent
- type SseResponse
- type WSClient
- func (w *WSClient) Close()
- func (w *WSClient) Ping(ctx context.Context)
- func (w *WSClient) Recv(ctx context.Context) (WSMessageType, []byte, error)
- func (w *WSClient) Send(ctx context.Context, messageType WSMessageType, data []byte) error
- func (w *WSClient) SendJsonMessage(ctx context.Context, msg any) error
- func (w *WSClient) SetReadLimit(n int64)
- type WSClientOptions
- type WSEventHandler
- type WSHandler
- type WSMessageType
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUnsupportedMessageType = errors.New("unsupported message type")
)
Functions ¶
func GetJSONWithConfig ¶
func GetWithConfig ¶
func NewErrorStatusCode ¶
func NewErrorStatusCode429 ¶
func PostJsonSse ¶
func PostJsonSseWithConfig ¶
func PostJsonWithConfig ¶
Types ¶
type ErrorStatusCode ¶
func (*ErrorStatusCode) Error ¶
func (e *ErrorStatusCode) Error() string
func (*ErrorStatusCode) RetryAfterDuration ¶
func (e *ErrorStatusCode) RetryAfterDuration() time.Duration
func (*ErrorStatusCode) StatusCode ¶
func (e *ErrorStatusCode) StatusCode() int
type JsonSseEvent ¶
type SseResponse ¶
type SseResponse struct {
// contains filtered or unexported fields
}
func NewSseResponse ¶
func NewSseResponse(r io.Reader) *SseResponse
type WSClient ¶
type WSClient struct {
// contains filtered or unexported fields
}
func (*WSClient) SendJsonMessage ¶
func (*WSClient) SetReadLimit ¶
type WSEventHandler ¶
type WSEventHandler func(ctx context.Context, messageType WSMessageType, data []byte) error
type WSHandler ¶
type WSHandler func(messageType WSMessageType, data []byte)
type WSMessageType ¶
type WSMessageType int
const ( WSMessageUnknown WSMessageType = iota + 1 WSMessageText WSMessageBinary )
Click to show internal directories.
Click to hide internal directories.