1 module djrpc.base;
2 
3 import std.json;
4 import std.typecons : Nullable;
5 
6 enum JsonRpcVersion : string {
7     V1_0 = "1.0",
8     V2_0 = "2.0"
9 }
10 
11 interface JsonRpcMessage {
12     JsonRpcVersion getVersion();
13     static JsonRpcMessage parse(string msg);
14     string encode();
15 }
16 
17 interface JsonRpcRequest: JsonRpcMessage {
18     JSONValue getID();
19     string getMethod();
20     JSONValue getParams();
21 }
22 
23 interface JsonRpcResponse: JsonRpcMessage {
24     JSONValue getID();
25     bool success();
26     Nullable!JSONValue getResult();
27     Nullable!JSONValue getError();
28 }
29 
30 interface JsonRpcNotification: JsonRpcMessage {
31 
32 }