Documentation
¶
Index ¶
- Constants
- Variables
- func Params(params ...interface{}) interface{}
- type ClientRPC
- func (client *ClientRPC) Call(ctx context.Context, method string, params ...interface{}) (response *ResponseRPC, err error)
- func (client *ClientRPC) CallBatch(ctx context.Context, requests RequestsRPC) (responses ResponsesRPC, err error)
- func (client *ClientRPC) CallBatchRaw(ctx context.Context, requests RequestsRPC) (responses ResponsesRPC, err error)
- func (client *ClientRPC) CallFor(ctx context.Context, out interface{}, method string, params ...interface{}) (err error)
- func (client *ClientRPC) CallRaw(ctx context.Context, request *RequestRPC) (response *ResponseRPC, err error)
- type CurlCommand
- type HTTPError
- type ID
- type Option
- type RPCError
- type RequestRPC
- type RequestsRPC
- type ResponseRPC
- type ResponsesRPC
Constants ¶
View Source
const (
Version = "2.0"
)
Variables ¶
View Source
var NewID = uuid.New
View Source
var NilID = uuid.Nil
Functions ¶
Types ¶
type ClientRPC ¶
type ClientRPC struct {
// contains filtered or unexported fields
}
func (*ClientRPC) CallBatch ¶
func (client *ClientRPC) CallBatch(ctx context.Context, requests RequestsRPC) (responses ResponsesRPC, err error)
func (*ClientRPC) CallBatchRaw ¶
func (client *ClientRPC) CallBatchRaw(ctx context.Context, requests RequestsRPC) (responses ResponsesRPC, err error)
func (*ClientRPC) CallRaw ¶
func (client *ClientRPC) CallRaw(ctx context.Context, request *RequestRPC) (response *ResponseRPC, err error)
type CurlCommand ¶
type CurlCommand struct {
// contains filtered or unexported fields
}
func (*CurlCommand) String ¶
func (c *CurlCommand) String() string
type Option ¶
type Option func(ops *options)
func AllowUnknownFields ¶
func HeaderFromCtx ¶
func HeaderFromCtx(headers ...interface{}) Option
func LogOnError ¶
func LogOnError() Option
func LogRequest ¶
func LogRequest() Option
type RPCError ¶
type RPCError struct { Code int `json:"code"` Message string `json:"message"` Data json.RawMessage `json:"data,omitempty"` }
func (*RPCError) Raw ¶
func (e *RPCError) Raw() (data json.RawMessage)
type RequestRPC ¶
type RequestRPC struct { ID ID `json:"id"` Method string `json:"method"` Params interface{} `json:"params,omitempty"` JSONRPC string `json:"jsonrpc"` }
func NewRequest ¶
func NewRequest(method string, params ...interface{}) *RequestRPC
func NewRequestWithID ¶
func NewRequestWithID(id ID, method string, params ...interface{}) *RequestRPC
type RequestsRPC ¶
type RequestsRPC []*RequestRPC
type ResponseRPC ¶
type ResponseRPC struct { ID uuid.UUID `json:"id"` JSONRPC string `json:"jsonrpc"` Error *RPCError `json:"error,omitempty"` Result json.RawMessage `json:"result,omitempty"` }
func (*ResponseRPC) GetObject ¶
func (responseRPC *ResponseRPC) GetObject(object interface{}) error
type ResponsesRPC ¶
type ResponsesRPC []*ResponseRPC
func (ResponsesRPC) AsMap ¶
func (res ResponsesRPC) AsMap() map[ID]*ResponseRPC
func (ResponsesRPC) GetByID ¶
func (res ResponsesRPC) GetByID(id ID) *ResponseRPC
func (ResponsesRPC) HasError ¶
func (res ResponsesRPC) HasError() bool
Click to show internal directories.
Click to hide internal directories.