diff options
Diffstat (limited to 'jsonrpc/message')
-rw-r--r-- | jsonrpc/message/message.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/jsonrpc/message/message.go b/jsonrpc/message/message.go index ff68da2..b01c05d 100644 --- a/jsonrpc/message/message.go +++ b/jsonrpc/message/message.go @@ -26,7 +26,7 @@ type Request struct { type Response struct { JSONRPC string `json:"jsonrpc"` // JSON-RPC version, typically "2.0". ID *RequestID `json:"id,omitempty"` // Unique identifier matching the request ID, can be null for notifications. - Result *json.RawMessage `json:"result,omitempty"` // Result of the request if it was successful. + Result json.RawMessage `json:"result,omitempty"` // Result of the request if it was successful. Error *Error `json:"error,omitempty"` // Error object if the request failed. } @@ -34,13 +34,13 @@ type Response struct { type Notification struct { JSONRPC string `json:"jsonrpc"` // JSON-RPC version, typically "2.0". Method string `json:"method"` // The name of the method to be invoked. - Params *json.RawMessage `json:"params,omitempty"` // Optional parameters for the method. + Params json.RawMessage `json:"params,omitempty"` // Optional parameters for the method. } // NotificationResult represents the result of a subscription notification. // It includes the result and the subscription ID that triggered the notification. type NotificationResult struct { - Result *json.RawMessage `json:"result,omitempty"` // Result data of the notification. + Result json.RawMessage `json:"result,omitempty"` // Result data of the notification. Subscription SubscriptionID `json:"subscription"` // ID of the subscription that triggered the notification. } @@ -49,7 +49,7 @@ type NotificationResult struct { type Error struct { Code int `json:"code"` // Error code indicating the type of error. Message string `json:"message"` // Human-readable error message. - Data *json.RawMessage `json:"data,omitempty"` // Optional additional data about the error. + Data json.RawMessage `json:"data,omitempty"` // Optional additional data about the error. } func (req *Request) String() string { @@ -57,11 +57,11 @@ func (req *Request) String() string { } func (res *Response) String() string { - return fmt.Sprintf("{JSONRPC: %s, ID: %s, RESULT: %s, ERROR: %v}", res.JSONRPC, *res.ID, *res.Result, res.Error) + return fmt.Sprintf("{JSONRPC: %s, ID: %v, RESULT: %v, ERROR: %v}", res.JSONRPC, res.ID, res.Result, res.Error) } func (nt *Notification) String() string { - return fmt.Sprintf("{JSONRPC: %s, METHOD: %s, PARAMS: %s}", nt.JSONRPC, nt.Method, *nt.Params) + return fmt.Sprintf("{JSONRPC: %s, METHOD: %s, PARAMS: %s}", nt.JSONRPC, nt.Method, nt.Params) } func (err *Error) String() string { |