rpc/protocol/json/server_response.go

30 lines
986 B
Go
Raw Permalink Normal View History

2017-11-26 10:15:51 +00:00
package json
import (
"encoding/json"
2018-03-27 11:23:43 +00:00
crp "git.loafle.net/commons_go/rpc/protocol"
2017-11-26 10:15:51 +00:00
)
// ----------------------------------------------------------------------------
// Response
// ----------------------------------------------------------------------------
// serverResponse represents a JSON-RPC response returned by the server.
type serverResponse struct {
2017-11-28 16:19:03 +00:00
// JSON-RPC protocol.
Version string `json:"jsonrpc"`
2017-11-26 10:15:51 +00:00
// The Object that was returned by the invoked method. This must be null
// in case there was an error invoking the method.
// As per spec the member will be omitted if there was an error.
Result interface{} `json:"result,omitempty"`
// An Error object if there was an error invoking the method. It must be
// null if there was no error.
// As per spec the member will be omitted if there was no error.
2018-03-27 11:23:43 +00:00
Error *crp.Error `json:"error,omitempty"`
2017-11-26 10:15:51 +00:00
// This must be the same id as the request it is responding to.
ID *json.RawMessage `json:"id,omitempty"`
}