Help us shape the future of Go! Take the 2026 Go Developer Survey

jsonrpc

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// RequestJsonrpcNr20 captures enum value "2.0"
	RequestJsonrpcNr20 string = "2.0"
)
View Source
const (

	// ResponseJsonrpcNr20 captures enum value "2.0"
	ResponseJsonrpcNr20 string = "2.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {

	// A Number that indicates the error type that occurred.
	// This MUST be an integer.
	//
	Code int64 `json:"code,omitempty"`

	// A Primitive or Structured value that contains additional information about the error.
	// This may be omitted.
	// The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).
	//
	Data interface{} `json:"data,omitempty"`

	// A String providing a short description of the error.
	// The message SHOULD be limited to a concise single sentence.
	//
	Message string `json:"message,omitempty"`
}

Error JSON-RPC Error Object swagger:model Error

func (*Error) MarshalBinary

func (m *Error) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*Error) UnmarshalBinary

func (m *Error) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*Error) Validate

func (m *Error) Validate(formats strfmt.Registry) error

Validate validates this error

type Request

type Request struct {

	// An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]
	// The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.
	//
	// [1] The use of Null as a value for the id member in a Request object is discouraged, because this specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses an id value of Null for Notifications this could cause confusion in handling.
	//
	// [2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly as binary fractions.
	//
	ID interface{} `json:"id,omitempty"`

	// A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".
	//
	// Required: true
	// Enum: [2.0]
	Jsonrpc *string `json:"jsonrpc"`

	// A String containing the name of the method to be invoked. Method names that begin with the word rpc followed by a period character (U+002E or ASCII 46) are reserved for rpc-internal methods and extensions and MUST NOT be used for anything else.
	//
	// Required: true
	Method *string `json:"method"`

	// A Structured value that holds the parameter values to be used during the invocation of the method. This member MAY be omitted.
	//
	Params json.RawMessage `json:"params,omitempty"`
}

Request JSON-RPC Request Object swagger:model Request

func (*Request) MarshalBinary

func (m *Request) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*Request) UnmarshalBinary

func (m *Request) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*Request) Validate

func (m *Request) Validate(formats strfmt.Registry) error

Validate validates this request

type Response

type Response struct {

	// error
	Error *Error `json:"error,omitempty"`

	// This member is REQUIRED.
	// It MUST be the same as the value of the id member in the Request Object.
	// If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.
	//
	// Required: true
	ID interface{} `json:"id"`

	// A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".
	//
	// Required: true
	// Enum: [2.0]
	Jsonrpc *string `json:"jsonrpc"`

	// This member is REQUIRED on success.
	// This member MUST NOT exist if there was an error invoking the method.
	// The value of this member is determined by the method invoked on the Server.
	//
	Result interface{} `json:"result,omitempty"`
	// contains filtered or unexported fields
}

Response JSON-RPC Response Object swagger:model Response

func (*Response) MarshalBinary

func (m *Response) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*Response) SetResult

func (m *Response) SetResult(result interface{}) *Response

func (*Response) UnmarshalBinary

func (m *Response) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*Response) Validate

func (m *Response) Validate(formats strfmt.Registry) error

Validate validates this response

func (*Response) WriteResponse

func (m *Response) WriteResponse(rw http.ResponseWriter, pr runtime.Producer)

WriteResponse implements the middleware.Responder interface

Jump to

Keyboard shortcuts

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