Documentation
¶
Index ¶
- func CreateTLSConfigMinTls(minTlsVersion uint16) *tls.Config
- func DefaultInsecureStandardClient() *http.Client
- func DefaultStandardClient(tlsConfig *tls.Config) *http.Client
- func NewStandardClient(clientTimeout time.Duration, transport *http.Transport) *http.Client
- type Client
- func (hc *Client) Delete(url string, header http.Header, queries map[string]string, ...) ([]byte, error)
- func (hc *Client) DeleteContext(ctx context.Context, url string, header http.Header, queries map[string]string, ...) ([]byte, error)
- func (hc *Client) DeleteDecode(url string, header http.Header, queries map[string]string, res any, ...) error
- func (hc *Client) DeleteDecodeContext(ctx context.Context, url string, header http.Header, queries map[string]string, ...) error
- func (hc *Client) Do(request *http.Request) (*http.Response, error)
- func (hc *Client) DoDecode(request *http.Request, res any) error
- func (hc *Client) DoRead(request *http.Request) ([]byte, error)
- func (hc *Client) Get(url string, header http.Header, queries map[string]string, ...) ([]byte, error)
- func (hc *Client) GetContext(ctx context.Context, url string, header http.Header, queries map[string]string, ...) ([]byte, error)
- func (hc *Client) GetDecode(url string, header http.Header, queries map[string]string, res any, ...) error
- func (hc *Client) GetDecodeContext(ctx context.Context, url string, header http.Header, queries map[string]string, ...) error
- func (hc *Client) Patch(url string, header http.Header, body any, opts ...RequestOption) ([]byte, error)
- func (hc *Client) PatchContext(ctx context.Context, url string, header http.Header, body any, ...) ([]byte, error)
- func (hc *Client) PatchDecode(url string, header http.Header, body any, res any, opts ...RequestOption) error
- func (hc *Client) PatchDecodeContext(ctx context.Context, url string, header http.Header, body any, res any, ...) error
- func (hc *Client) Post(url string, header http.Header, body any, opts ...RequestOption) ([]byte, error)
- func (hc *Client) PostContext(ctx context.Context, url string, header http.Header, body any, ...) ([]byte, error)
- func (hc *Client) PostDecode(url string, header http.Header, body any, res any, opts ...RequestOption) error
- func (hc *Client) PostDecodeContext(ctx context.Context, url string, header http.Header, body any, res any, ...) error
- func (hc *Client) PostFile(url string, header http.Header, params map[string]string, ...) ([]byte, error)
- func (hc *Client) PostFileContext(ctx context.Context, url string, header http.Header, params map[string]string, ...) ([]byte, error)
- func (hc *Client) Put(url string, header http.Header, body any, opts ...RequestOption) ([]byte, error)
- func (hc *Client) PutContext(ctx context.Context, url string, header http.Header, body any, ...) ([]byte, error)
- func (hc *Client) PutDecode(url string, header http.Header, body any, res any, opts ...RequestOption) error
- func (hc *Client) PutDecodeContext(ctx context.Context, url string, header http.Header, body any, res any, ...) error
- func (hc *Client) Request(method string, url string, header http.Header, queries map[string]string, ...) ([]byte, error)
- func (hc *Client) RequestContext(ctx context.Context, method string, url string, header http.Header, ...) ([]byte, error)
- func (hc *Client) RequestDecode(method string, url string, header http.Header, queries map[string]string, ...) error
- func (hc *Client) RequestDecodeContext(ctx context.Context, method string, url string, header http.Header, ...) error
- type ClientOption
- type ClientOptionFunc
- func WithBaseUrl(baseUrl string) ClientOptionFunc
- func WithDefaultHeaders(defaultHeaders map[string]string) ClientOptionFunc
- func WithReaderOpt(opt sio.ReaderOption) ClientOptionFunc
- func WithRequestHeaderHmac256(key string, secret []byte) ClientOptionFunc
- func WithRequestOpt(opt RequestOption) ClientOptionFunc
- func WithRetryAttempts(attempts int) ClientOptionFunc
- func WithWriterOpt(opt sio.WriterOption) ClientOptionFunc
- type Error
- type RequestOption
- type RequestOptionFunc
- func WithBasicAuth(username, password string) RequestOptionFunc
- func WithBearerToken(token string) RequestOptionFunc
- func WithHeaderAdd(key string, value string) RequestOptionFunc
- func WithHeaderHmac256(key string, secret []byte) RequestOptionFunc
- func WithHeaderSet(key string, value string) RequestOptionFunc
- func WithTokenSource(tokenSource oauth2.TokenSource) RequestOptionFunc
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTLSConfigMinTls ¶
func DefaultInsecureStandardClient ¶
DefaultInsecureStandardClient instantiate http.Client with InsecureSkipVerify set to true
func DefaultStandardClient ¶
DefaultStandardClient instantiate http.Client with input parameter `tlsConfig`
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper of http.Client
func NewClient ¶
func NewClient(client *http.Client, opts ...ClientOption) *Client
NewClient returns Client
func (*Client) DeleteContext ¶
func (*Client) DeleteDecode ¶
func (*Client) DeleteDecodeContext ¶
func (*Client) GetContext ¶
func (*Client) GetDecodeContext ¶
func (*Client) PatchContext ¶
func (*Client) PatchDecode ¶
func (*Client) PatchDecodeContext ¶
func (*Client) PostContext ¶
func (*Client) PostDecode ¶
func (*Client) PostDecodeContext ¶
func (*Client) PostFileContext ¶
func (*Client) PutContext ¶
func (*Client) PutDecodeContext ¶
func (*Client) RequestContext ¶
func (*Client) RequestDecode ¶
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
type ClientOptionFunc ¶
func WithBaseUrl ¶
func WithBaseUrl(baseUrl string) ClientOptionFunc
func WithDefaultHeaders ¶
func WithDefaultHeaders(defaultHeaders map[string]string) ClientOptionFunc
WithDefaultHeaders set Client with defaultHeaders that will be set on every request
func WithReaderOpt ¶
func WithReaderOpt(opt sio.ReaderOption) ClientOptionFunc
func WithRequestHeaderHmac256 ¶
func WithRequestHeaderHmac256(key string, secret []byte) ClientOptionFunc
func WithRequestOpt ¶
func WithRequestOpt(opt RequestOption) ClientOptionFunc
func WithRetryAttempts ¶
func WithRetryAttempts(attempts int) ClientOptionFunc
func WithWriterOpt ¶
func WithWriterOpt(opt sio.WriterOption) ClientOptionFunc
type Error ¶
func (Error) GetStatusCode ¶
type RequestOption ¶
type RequestOption interface {
// contains filtered or unexported methods
}
type RequestOptionFunc ¶
func WithBasicAuth ¶
func WithBasicAuth(username, password string) RequestOptionFunc
func WithBearerToken ¶
func WithBearerToken(token string) RequestOptionFunc
func WithHeaderAdd ¶
func WithHeaderAdd(key string, value string) RequestOptionFunc
func WithHeaderHmac256 ¶
func WithHeaderHmac256(key string, secret []byte) RequestOptionFunc
func WithHeaderSet ¶
func WithHeaderSet(key string, value string) RequestOptionFunc
func WithTokenSource ¶
func WithTokenSource(tokenSource oauth2.TokenSource) RequestOptionFunc
Click to show internal directories.
Click to hide internal directories.