Documentation ¶
Index ¶
- Constants
- type Config
- func (c *Config) Call(method string, params json.RawMessage) (json.RawMessage, error)
- func (c *Config) DisableCompression(t bool)
- func (c *Config) SetBasicAuth(username, password string)
- func (c *Config) SetHeader(key, value string)
- func (c *Config) SetTimeout(t int64)
- func (c *Config) SkipSSLCertificateCheck(t bool)
- type EmbeddedInternalError
- type ErrorObject
- type InternalError
- type RequestObject
- type ResponseObject
Constants ¶
const ErrorPrefix = "JSON-RPC error: "
ErrorPrefix defines default prefix for error messages.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config defines config object for JSON-RPC Call.
func GetSocketConfig ¶
GetSocketConfig returns default JSON-RPC Call config using Unix-Socket.
func (*Config) Call ¶
func (c *Config) Call(method string, params json.RawMessage) (json.RawMessage, error)
Call wraps JSON-RPC client call.
func (*Config) DisableCompression ¶
DisableCompression disables compression inside HTTP request.
func (*Config) SetBasicAuth ¶
SetBasicAuth adds Basic Authorization header to client requests.
func (*Config) SetTimeout ¶
SetTimeout sets request timeout time in seconds.
func (*Config) SkipSSLCertificateCheck ¶
SkipSSLCertificateCheck disables server's certificate chain and host name check, INSECURE!.
type EmbeddedInternalError ¶ added in v1.0.14
type EmbeddedInternalError struct { Code *int `json:"code,omitempty"` ID *string `json:"id,omitempty"` Protocol *string `json:"protocol,omitempty"` }
EmbeddedInternalError represents embedded errors internal data.
type ErrorObject ¶
type ErrorObject struct { // Code indicates the error type that occurred Code int `json:"code"` // Message provides a short description of the error Message string `json:"message"` // Data can contain additional information about the error Data json.RawMessage `json:"data,omitempty"` }
ErrorObject represents a response error object.
func (*ErrorObject) Error ¶ added in v1.0.13
func (errObj *ErrorObject) Error() string
type InternalError ¶ added in v1.0.14
type InternalError struct { Prefix string `json:"prefix"` Returned *EmbeddedInternalError `json:"returned,omitempty"` Expected *EmbeddedInternalError `json:"expected,omitempty"` Err error `json:"err,omitempty"` }
InternalError represents generic internal error object.
func NewInternalError ¶ added in v1.0.14
func NewInternalError(prefix string, err error) *InternalError
NewInternalError creates new generic internal error object.
func (*InternalError) Error ¶ added in v1.0.14
func (e *InternalError) Error() string
func (*InternalError) SetHTTPStatusCodes ¶ added in v1.0.14
func (e *InternalError) SetHTTPStatusCodes(returned, expected int) *InternalError
SetHTTPStatusCodes sets HTTP status codes in internal error object.
func (*InternalError) SetProtocolVersions ¶ added in v1.0.14
func (e *InternalError) SetProtocolVersions(returned, expected string) *InternalError
SetProtocolVersions sets JSON-RPC protocol versions in internal error object.
func (*InternalError) SetRPCIDs ¶ added in v1.0.14
func (e *InternalError) SetRPCIDs(returned, expected string) *InternalError
SetRPCIDs sets JSON-RPC IDs in internal error object.
type RequestObject ¶
type RequestObject struct { // Jsonrpc specifies the version of the JSON-RPC protocol, equals to "2.0" Jsonrpc string `json:"jsonrpc"` // Method contains the name of the method to be invoked Method string `json:"method"` // Params holds Raw JSON parameter data to be used during the invocation of the method Params json.RawMessage `json:"params"` // ID is a unique identifier established by the client ID string `json:"id"` }
RequestObject represents a request object.
type ResponseObject ¶
type ResponseObject struct { // Jsonrpc specifies the version of the JSON-RPC protocol, equals to "2.0" Jsonrpc string `json:"jsonrpc"` // Error contains the error object if an error occurred while processing the request Error *ErrorObject `json:"error,omitempty"` // Result contains the result of the called method Result json.RawMessage `json:"result,omitempty"` // ID contains the client established request id or null ID string `json:"id"` }
ResponseObject represents a response object.