Documentation
¶
Index ¶
- Constants
- func NewHttpClient(host string, options ...Option) *httpClient
- func NewJsonClient(host string, options ...Option) *jsonClient
- func NewNopLogger() *nopLogger
- func NewNopRateLimit() *nopRateLimit
- func NewRateLimit(requests int64, period time.Duration) *rateLimit
- type HttpClient
- type JsonClient
- type Logger
- type LoggerLevel
- type Option
- type Options
- type RateLimiter
Constants ¶
View Source
const ( TimeoutDefault = 30 * time.Second SchemeDefault = "https" )
Variables ¶
This section is empty.
Functions ¶
func NewHttpClient ¶
func NewJsonClient ¶
func NewNopLogger ¶ added in v0.2.0
func NewNopLogger() *nopLogger
func NewNopRateLimit ¶ added in v0.6.0
func NewNopRateLimit() *nopRateLimit
func NewRateLimit ¶ added in v0.6.0
Types ¶
type HttpClient ¶
type HttpClient interface {
RequestNoBody(
ctx context.Context,
method string,
path string,
param map[string]string,
header http.Header,
) (statusCode int, body []byte, err error)
Request(
ctx context.Context,
method string,
path string,
param []byte,
header http.Header,
) (statusCode int, body []byte, err error)
}
type JsonClient ¶
type JsonClient interface {
Delete(
ctx context.Context,
path string,
param map[string]string,
header http.Header,
) (statusCode int, body []byte, err error)
Get(
ctx context.Context,
path string,
param map[string]string,
header http.Header,
) (statusCode int, body []byte, err error)
Patch(
ctx context.Context,
path string,
param map[string]interface{},
header http.Header,
) (statusCode int, body []byte, err error)
Post(
ctx context.Context,
path string,
param map[string]interface{},
header http.Header,
) (statusCode int, body []byte, err error)
Put(
ctx context.Context,
path string,
param map[string]interface{},
header http.Header,
) (statusCode int, body []byte, err error)
}
type LoggerLevel ¶ added in v0.7.1
type LoggerLevel int
const ( LoggerLevelNop LoggerLevel = 0 LoggerLevelError LoggerLevel = 1 LoggerLevelInfo LoggerLevel = 2 )
func (LoggerLevel) IsAllowedForLevel ¶ added in v0.7.2
func (l LoggerLevel) IsAllowedForLevel(level LoggerLevel) bool
type Option ¶ added in v0.2.0
type Option func(*Options)
func LogLevel ¶ added in v0.7.1
func LogLevel(level LoggerLevel) Option
type RateLimiter ¶ added in v0.6.0
type RateLimiter interface {
Take()
}
Click to show internal directories.
Click to hide internal directories.