]>
nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/jsonrpc/JsonRpcRequest.java
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 * <a href="https://www.jsonrpc.org/specification#request_object">https://www.jsonrpc.org/specification#request_object</a>
11 public final class JsonRpcRequest
extends JsonRpcMessage
{
14 * A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".
16 private String jsonrpc
;
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.
23 private String method
;
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 private 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(
42 final ContainerNode
<?
> params
,
45 return new JsonRpcRequest("2.0", method
, params
, id
);
48 private JsonRpcRequest() {
51 private JsonRpcRequest(
54 final ContainerNode
<?
> params
,
57 this.jsonrpc
= jsonrpc
;
63 public String
getJsonrpc() {
67 public String
getMethod() {
71 public ContainerNode
<?
> getParams() {
75 public ValueNode
getId() {