jsonrpc

package
v0.0.0-...-1403f21 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Host          string
	Username      string
	Password      string
	HTTPTransport http.RoundTripper
	// contains filtered or unexported fields
}

Client represents a client for interaction with a JSON RPC API

func (*Client) Do

func (c *Client) Do(req *Request) (*json.RawMessage, error)

Do sends the API Request, parses the response as JSON, and returns the "result" value as raw JSON

type Request

type Request struct {
	BaseURL string      `json:"-"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params"`
}

Request represents a request to a JSON RPC API

func (*Request) BuildHTTPReq

func (r *Request) BuildHTTPReq(host, user, pass string) (*http.Request, error)

BuildHTTPReq builds an HTTP request to carry out the JSON RPC request

type Response

type Response struct {
	Result *json.RawMessage `json:"result"`
	Error  *ResponseError   `json:"error"`
}

Response represents a Response to a JSON RPC API call

type ResponseError

type ResponseError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Name    string `json:"name"`
}

func (*ResponseError) Error

func (e *ResponseError) Error() string

Jump to

Keyboard shortcuts

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