Documentation
¶
Index ¶
Constants ¶
View Source
const ( ParseErrorCode = -32700 InvalidRequestCode = -32600 MethodNotFoundCode = -32601 InvalidParamsCode = -32602 InternalErrorCode = -32603 )
Standard error codes
View Source
const Version = "2.0"
Version is the JSON-RPC version string
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
Error represents a JSON-RPC error
func InternalError ¶
func InternalError(data interface{}) *Error
InternalError creates an Internal Error
func InvalidParamsError ¶
func InvalidParamsError(data interface{}) *Error
InvalidParamsError creates an Invalid Params error
func InvalidRequestError ¶
func InvalidRequestError(data interface{}) *Error
InvalidRequestError creates an Invalid Request error
func MethodNotFoundError ¶
MethodNotFoundError creates a Method Not Found error
type Request ¶
type Request struct { JSONRPC string `json:"jsonrpc"` ID interface{} `json:"id,omitempty"` Method string `json:"method"` Params interface{} `json:"params,omitempty"` }
Request represents a JSON-RPC request
func (*Request) IsNotification ¶
IsNotification returns true if the request is a notification (has no ID)
type Response ¶
type Response struct { JSONRPC string `json:"jsonrpc"` ID interface{} `json:"id,omitempty"` Result interface{} `json:"result,omitempty"` Error *Error `json:"error,omitempty"` }
Response represents a JSON-RPC response
func NewResponse ¶
NewResponse creates a new response for the given request
Click to show internal directories.
Click to hide internal directories.