Documentation
¶
Index ¶
Constants ¶
View Source
const (
Version = "2.0" // JSON-RPC protocol version
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
Code ErrorCode `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
Error represents a JSON-RPC error object
type ErrorCode ¶
type ErrorCode int
ErrorCode represents a JSON-RPC error code
const ( // Parse error (-32700) // Invalid JSON was received by the server. // An error occurred on the server while parsing the JSON text. ErrParse ErrorCode = -32700 // Invalid Request (-32600) // The JSON sent is not a valid Request object. ErrInvalidRequest ErrorCode = -32600 // Method not found (-32601) // The method does not exist / is not available. ErrMethodNotFound ErrorCode = -32601 // Invalid params (-32602) // Invalid method parameter(s). ErrInvalidParams ErrorCode = -32602 // Internal error (-32603) // Internal JSON-RPC error. ErrInternal ErrorCode = -32603 // Server error (-32000 to -32099) // Reserved for implementation-defined server-errors. ErrServer ErrorCode = -32000 )
JSON-RPC 2.0 error codes as defined in https://www.jsonrpc.org/specification
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID represents a JSON-RPC ID which must be either a string or number
func (ID) MarshalJSON ¶
func (*ID) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type Request ¶
type Request struct {
Version string `json:"jsonrpc"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
ID ID `json:"id"`
}
Request represents a JSON-RPC request object
func NewRequest ¶
func NewRequest(method string, params json.RawMessage, id interface{}) Request
NewRequest creates a new Request object
Click to show internal directories.
Click to hide internal directories.