2020-08-03 20:01:38 +00:00
|
|
|
package rpc
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
2020-11-13 14:04:10 +00:00
|
|
|
type RequestBody struct {
|
2020-11-13 15:36:01 +00:00
|
|
|
Jsonrpc string `json:"jsonrpc"`
|
|
|
|
Method string `json:"method"`
|
|
|
|
Params []interface{} `json:"params"`
|
|
|
|
ID int `json:"id"`
|
2020-11-13 14:04:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewRequestBody(method string) *RequestBody {
|
2020-11-13 15:36:01 +00:00
|
|
|
var i []interface{}
|
2020-11-13 14:04:10 +00:00
|
|
|
return &RequestBody{
|
|
|
|
Jsonrpc: "2.0",
|
|
|
|
Method: method,
|
2020-11-13 15:36:01 +00:00
|
|
|
Params: i,
|
2020-11-13 14:04:10 +00:00
|
|
|
ID: 0,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-03 20:01:38 +00:00
|
|
|
type Client interface {
|
|
|
|
HandleRequest(r *http.Request, data []byte) (*http.Response, error)
|
|
|
|
}
|