types

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const JSONRPC = "2.0"

JSONRPC is the JSON RPC version we support.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	ID     int           `json:"id"`
	Method string        `json:"method"`
	Params []interface{} `json:"params"`
}

Request is a JSON RPC request.

type Response

type Response struct {
	JSONRPC string           `json:"jsonrpc"`
	ID      *int             `json:"id"`
	Error   *json.RawMessage `json:"error"`
	Result  json.RawMessage  `json:"result"`
	Method  *string          `json:"method"`
	Params  json.RawMessage  `json:"params"`
}

Response is a catch-all JSON RPC response. A notification contains: - jsonrpc - method - params A method call response contains: - jsonrpc - id - result - (error)

func (*Response) ParseError

func (r *Response) ParseError() error

ParseError checks if the JSON RPC response contains an error and extracts its message.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL