jsonrpc2

package module
v0.0.0-...-2362cb6 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2015 License: MIT Imports: 7 Imported by: 1

README

JSON-RPC 2.0 (client/server)

Build Status

Documentation

Index

Constants

View Source
const (
	ParseError     int16 = -32700
	InvalidRequest       = -32600
	MethodNotFound       = -32601
	InvalidParams        = -32602
	InternalError        = -32603
	ServerError          = -32000
	LogicErr             = -32001
)

Variables

View Source
var Errors = map[int16]string{
	ParseError:     "Parse Error",
	InvalidRequest: "Invalid Request",
	MethodNotFound: "Method not found",
	InvalidParams:  "Invalid params",
	InternalError:  "Internal error",
	ServerError:    "Server error",
}

Functions

This section is empty.

Types

type Client

type Client interface {
	Send(method string, params Params, result interface{}) error
}

func NewClient

func NewClient(discovery Discovery) Client

type Discovery

type Discovery interface {
	Get() ([]string, error)
}

type EmptyParams

type EmptyParams struct{}

func (EmptyParams) IsValid

func (_ EmptyParams) IsValid() bool

type Error

type Error struct {
	Code    int16  `json:"code"`
	Message string `json:"message"`
	Data    string `json:"data,omitempty"`
}

type ErrorNoLiveUpstreams

type ErrorNoLiveUpstreams struct{}

func (*ErrorNoLiveUpstreams) Error

func (e *ErrorNoLiveUpstreams) Error() string

type LogicError

type LogicError struct {
	// contains filtered or unexported fields
}

func (*LogicError) Error

func (l *LogicError) Error() string

type Params

type Params interface {
	IsValid() bool
}

type Request

type Request struct {
	Jsonrpc   string `json:"jsonrpc"`
	RequestID int    `json:"id"`
	Method    string `json:"method"`
	Params    Params `json:"params"`
}

type Response

type Response struct {
	Jsonrpc   string      `json:"jsonrpc"`
	RequestID int         `json:"id"`
	Result    interface{} `json:"result,omitempty"`
	Error     *Error      `json:"error,omitempty"`
}

type ServerRequest

type ServerRequest struct {
	Request
	Params json.RawMessage `json:"params"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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