]>
nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/jsonrpc/JsonRpcRequest.java
1ae8552a8cb4af03f3382aa2d0d0f16c4c239608
1 package org
.asamk
.signal
.jsonrpc
;
3 import com
.fasterxml
.jackson
.annotation
.JsonInclude
;
4 import com
.fasterxml
.jackson
.databind
.node
.ContainerNode
;
5 import com
.fasterxml
.jackson
.databind
.node
.ValueNode
;
8 * Represents a JSON-RPC request.
9 * https://www.jsonrpc.org/specification#request_object
11 public class JsonRpcRequest
extends JsonRpcMessage
{
14 * A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".
19 * A String containing the name of the method to be invoked.
20 * Method names that begin with the word rpc followed by a period character (U+002E or ASCII 46)
21 * are reserved for rpc-internal methods and extensions and MUST NOT be used for anything else.
26 * A Structured value that holds the parameter values to be used during the invocation of the method.
27 * This member MAY be omitted.
29 @JsonInclude(JsonInclude
.Include
.NON_NULL
)
30 ContainerNode
<?
> params
;
33 * An identifier established by the Client that MUST contain a String, Number, or NULL value if included.
34 * If it is not included it is assumed to be a notification.
35 * The value SHOULD normally not be Null and Numbers SHOULD NOT contain fractional parts
37 @JsonInclude(JsonInclude
.Include
.NON_NULL
)
40 public static JsonRpcRequest
forNotification(
41 final String method
, final ContainerNode
<?
> params
, final ValueNode id
43 return new JsonRpcRequest("2.0", method
, params
, id
);
46 private JsonRpcRequest() {
49 private JsonRpcRequest(
50 final String jsonrpc
, final String method
, final ContainerNode
<?
> params
, final ValueNode id
52 this.jsonrpc
= jsonrpc
;
58 public String
getJsonrpc() {
62 public String
getMethod() {
66 public ContainerNode
<?
> getParams() {
70 public ValueNode
getId() {