Documentation
¶
Overview ¶
Package jsonrpc is a JSON-RPC 2.0 client that communicates over HTTP.
Index ¶
Constants ¶
View Source
const Version = "2.0"
Version is a JSON-RPC version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // HTTPClient is a HTTP client you want to use. // Use http.DefaultClient if it is nil. HTTPClient *http.Client }
Client represents a JSPN-RPC 2.0 Client.
type ErrorCode ¶
type ErrorCode int
ErrorCode is a number that indicates the error type that occurred.
const ( // Invalid JSON was received by the server. // An error occurred on the server while parsing the JSON text. ParseError ErrorCode = -32700 // The JSON sent is not a valid Request object. InvalidRequest ErrorCode = -32600 // The method does not exist or is not available. MethodNotFound ErrorCode = -32601 // Invalid method parameter(s). InvalidParams ErrorCode = -32602 // nternal JSON-RPC error. InternalError ErrorCode = -32603 )
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option represents an option used to method calling.
func WithHeader ¶
type ResponseError ¶
type ResponseError struct { Code ErrorCode `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }
ResponseError represents an error responded by the server.
func (*ResponseError) Error ¶
func (err *ResponseError) Error() string
Click to show internal directories.
Click to hide internal directories.