Documentation ¶
Index ¶
- Constants
- func IsOk(statusCode int) bool
- func NetworkError() error
- func NoNetworkError() error
- type APIBadRequestError
- type APIError
- type APINotFoundError
- type APIResponse
- type APISecurityError
- type Headers
- type IClient
- type MockError
- type MockRequest
- type MockResponse
- type RESTClient
- type RESTCommand
- type RESTPool
- type RESTPoolBuilder
- func (restPoolBuilder *RESTPoolBuilder) Build() (*RESTPool, error)
- func (restPoolBuilder *RESTPoolBuilder) MakeDefault() *RESTPoolBuilder
- func (restPoolBuilder *RESTPoolBuilder) WithIdleConnectionTimeout(idleConnectionTimeout time.Duration) *RESTPoolBuilder
- func (restPoolBuilder *RESTPoolBuilder) WithMaxConnectionsPerHost(maxConnectionsPerHost int) *RESTPoolBuilder
- func (restPoolBuilder *RESTPoolBuilder) WithMaxIdleConnections(maxIdleConnections int) *RESTPoolBuilder
- func (restPoolBuilder *RESTPoolBuilder) WithMaxIdleConnectionsPerHost(maxIdleConnectionsPerHost int) *RESTPoolBuilder
- func (restPoolBuilder *RESTPoolBuilder) WithName(name string) *RESTPoolBuilder
- func (restPoolBuilder *RESTPoolBuilder) WithSocketKeepAlive(socketKeepAlive time.Duration) *RESTPoolBuilder
- func (restPoolBuilder *RESTPoolBuilder) WithSocketTimeout(socketTimeout time.Duration) *RESTPoolBuilder
- func (restPoolBuilder *RESTPoolBuilder) WithTLSHandshakeTimeout(tlsHandshakeTimeout time.Duration) *RESTPoolBuilder
- func (restPoolBuilder *RESTPoolBuilder) WithTimeout(timeout time.Duration) *RESTPoolBuilder
- type RESTQuery
- type Read
- type Tuple
- type Write
Constants ¶
View Source
const IdleConnectionTimeout = time.Millisecond * 1000
View Source
const MaxConnectionsPerHost = 50
View Source
const MaxIdleConnections = 50
View Source
const MaxIdleConnectionsPerHost = 100
View Source
const SocketKeepAlive = time.Millisecond * 5000
View Source
const SocketTimeout = time.Millisecond * 5000
View Source
const TLSHandshakeTimeout = time.Second * 1000
View Source
const Timeout = time.Millisecond * 1000
Variables ¶
This section is empty.
Functions ¶
func NetworkError ¶
func NetworkError() error
func NoNetworkError ¶
func NoNetworkError() error
Types ¶
type APIBadRequestError ¶
type APIBadRequestError struct {
APIError
}
type APIError ¶
func NewAPIError ¶ added in v0.1.1
type APINotFoundError ¶
type APINotFoundError struct {
APIError
}
type APIResponse ¶
type APISecurityError ¶
type APISecurityError struct {
APIError
}
type Headers ¶
type Headers struct {
// contains filtered or unexported fields
}
func NewHeaders ¶ added in v0.2.1
func NewHeaders() *Headers
type MockRequest ¶
func (MockRequest) GetHashCode ¶
func (mockRequest MockRequest) GetHashCode() uint64
type MockResponse ¶
func (MockResponse[TOutput]) AddMockRequest ¶
func (mockResponse MockResponse[TOutput]) AddMockRequest(mockRequest MockRequest, response APIResponse[TOutput], err error) *MockResponse[TOutput]
func (MockResponse[TOutput]) Build ¶
func (mockResponse MockResponse[TOutput]) Build() *RESTClient
func (MockResponse[TOutput]) NewRESTClient ¶
func (mockResponse MockResponse[TOutput]) NewRESTClient() *MockResponse[TOutput]
type RESTClient ¶
func NewRESTClient ¶
func NewRESTClient(restPool RESTPool) *RESTClient
type RESTCommand ¶
type RESTCommand[TInput any, TOutput any] interface { Post(url string, request TInput) (*APIResponse[TOutput], error) }
type RESTPoolBuilder ¶
type RESTPoolBuilder struct { Name string MaxConnectionsPerHost int MaxIdleConnections int MaxIdleConnectionsPerHost int Timeout time.Duration IdleConnectionTimeout time.Duration TLSHandshakeTimeout time.Duration SocketTimeout time.Duration SocketKeepAlive time.Duration }
func NewRESTPoolBuilder ¶
func NewRESTPoolBuilder() *RESTPoolBuilder
func (*RESTPoolBuilder) Build ¶
func (restPoolBuilder *RESTPoolBuilder) Build() (*RESTPool, error)
func (*RESTPoolBuilder) MakeDefault ¶
func (restPoolBuilder *RESTPoolBuilder) MakeDefault() *RESTPoolBuilder
func (*RESTPoolBuilder) WithIdleConnectionTimeout ¶
func (restPoolBuilder *RESTPoolBuilder) WithIdleConnectionTimeout(idleConnectionTimeout time.Duration) *RESTPoolBuilder
func (*RESTPoolBuilder) WithMaxConnectionsPerHost ¶
func (restPoolBuilder *RESTPoolBuilder) WithMaxConnectionsPerHost(maxConnectionsPerHost int) *RESTPoolBuilder
func (*RESTPoolBuilder) WithMaxIdleConnections ¶
func (restPoolBuilder *RESTPoolBuilder) WithMaxIdleConnections(maxIdleConnections int) *RESTPoolBuilder
func (*RESTPoolBuilder) WithMaxIdleConnectionsPerHost ¶
func (restPoolBuilder *RESTPoolBuilder) WithMaxIdleConnectionsPerHost(maxIdleConnectionsPerHost int) *RESTPoolBuilder
func (*RESTPoolBuilder) WithName ¶
func (restPoolBuilder *RESTPoolBuilder) WithName(name string) *RESTPoolBuilder
func (*RESTPoolBuilder) WithSocketKeepAlive ¶
func (restPoolBuilder *RESTPoolBuilder) WithSocketKeepAlive(socketKeepAlive time.Duration) *RESTPoolBuilder
func (*RESTPoolBuilder) WithSocketTimeout ¶
func (restPoolBuilder *RESTPoolBuilder) WithSocketTimeout(socketTimeout time.Duration) *RESTPoolBuilder
func (*RESTPoolBuilder) WithTLSHandshakeTimeout ¶
func (restPoolBuilder *RESTPoolBuilder) WithTLSHandshakeTimeout(tlsHandshakeTimeout time.Duration) *RESTPoolBuilder
func (*RESTPoolBuilder) WithTimeout ¶
func (restPoolBuilder *RESTPoolBuilder) WithTimeout(timeout time.Duration) *RESTPoolBuilder
type RESTQuery ¶
type RESTQuery[TOutput any] interface { Get(url string) (*APIResponse[TOutput], error) }
type Read ¶
type Read[TOutput any] struct { *RESTClient }
func (Read[TOutput]) Get ¶
func (e Read[TOutput]) Get(url string, headers *Headers) (*APIResponse[TOutput], error)
func (Read[TOutput]) GetMock ¶
func (e Read[TOutput]) GetMock(method string, url string, result *APIResponse[TOutput]) (*APIResponse[TOutput], error)
type Tuple ¶
type Tuple[TOutput any] struct { Method string Response *APIResponse[TOutput] Error error }
type Write ¶
type Write[TInput any, TOutput any] struct { *RESTClient }
func (Write[TInput, TOutput]) GetMock ¶
func (e Write[TInput, TOutput]) GetMock(method string, url string, result *APIResponse[TOutput]) (*APIResponse[TOutput], error)
Click to show internal directories.
Click to hide internal directories.