Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
JsonRpcRequest.cs
3
5{
9 public class JsonRpcRequest
10 {
11 private readonly JsonRpcVersion version;
12 private readonly string method;
13 private readonly object? parameters;
14
15
20 public JsonRpcRequest(string Method)
21 : this(JsonRpcVersion.JsonRpcV2, Method)
22 {
23 }
24
30 public JsonRpcRequest(string Method, params object?[] Parameters)
31 : this(JsonRpcVersion.JsonRpcV2, Method, Parameters)
32 {
33 }
34
40 public JsonRpcRequest(string Method, IEnumerable Parameters)
41 : this(JsonRpcVersion.JsonRpcV2, Method, Parameters)
42 {
43 }
44
50 public JsonRpcRequest(string Method, Dictionary<string, object> Parameters)
51 : this(JsonRpcVersion.JsonRpcV2, Method, Parameters)
52 {
53 }
54
60 public JsonRpcRequest(JsonRpcVersion Version, string Method)
61 {
62 this.version = Version;
63 this.method = Method;
64 this.parameters = null;
65 }
66
73 public JsonRpcRequest(JsonRpcVersion Version, string Method, params object?[] Parameters)
74 : this(Version, Method, (IEnumerable)Parameters)
75 {
76 }
77
84 public JsonRpcRequest(JsonRpcVersion Version, string Method, IEnumerable Parameters)
85 {
86 this.version = Version;
87 this.method = Method;
88 this.parameters = Parameters;
89 }
90
97 public JsonRpcRequest(JsonRpcVersion Version, string Method, Dictionary<string, object> Parameters)
98 {
99 this.version = Version;
100 this.method = Method;
101 this.parameters = Parameters;
102 }
103
109 internal Dictionary<string, object> BuildRequest(long? Id)
110 {
111 Dictionary<string, object> Request = new Dictionary<string, object>();
112
113 if (this.version == JsonRpcVersion.JsonRpcV2)
114 Request["jsonrpc"] = "2.0";
115
116 Request["method"] = this.method;
117
118 if (!(this.parameters is null))
119 Request["params"] = this.parameters;
120
121 if (Id.HasValue)
122 Request["id"] = Id.Value;
123
124 return Request;
125 }
126
130 public virtual bool IsRequest => true;
131
132 }
133}
Information about a JSON-RPC request.
JsonRpcRequest(string Method, IEnumerable Parameters)
Information about a JSON-RPC request.
JsonRpcRequest(string Method, Dictionary< string, object > Parameters)
Information about a JSON-RPC request.
JsonRpcRequest(JsonRpcVersion Version, string Method, Dictionary< string, object > Parameters)
Information about a JSON-RPC request.
JsonRpcRequest(JsonRpcVersion Version, string Method, IEnumerable Parameters)
Information about a JSON-RPC request.
virtual bool IsRequest
If object represents a request.
JsonRpcRequest(JsonRpcVersion Version, string Method, params object?[] Parameters)
Information about a JSON-RPC request.
JsonRpcRequest(JsonRpcVersion Version, string Method)
Information about a JSON-RPC request.
JsonRpcRequest(string Method, params object?[] Parameters)
Information about a JSON-RPC request.
JsonRpcRequest(string Method)
Information about a JSON-RPC request.
JsonRpcVersion
JSON-RPC version