-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
137 lines (137 loc) · 5.7 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/**
*
* If it is not included it is assumed to be a notification. The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.
*
*/
export type JSONRPCRequestIdAsString = string;
/**
*
* If it is not included it is assumed to be a notification. The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.
*
*/
export type JSONRPCRequestIdAsNumber = number;
/**
*
* If it is not included it is assumed to be a notification. The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.
*
*/
export type JSONRPCRequestIdAsNull = null;
/**
*
* If it is not included it is assumed to be a notification. The Server MUST reply with the same value in the Response object if included. This member is used to correlate the context between the two objects.
*
*/
export type JSONRPCRequestId = JSONRPCRequestIdAsString | JSONRPCRequestIdAsNumber | JSONRPCRequestIdAsNull;
/**
*
* A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".
*
*/
export type JSONRPCVersion = "2.0";
/**
*
* A String containing the name of the method to be invoked. Method names that begin with the word rpc followed by a period character (U+002E or ASCII 46) are reserved for rpc-internal methods and extensions and MUST NOT be used for anything else.
*
*/
export type JSONRPCMethod = string;
/**
*
* Parameters literal value as provided to the invocation of the method.
*
*/
export type JSONRPCParamValue = any;
/**
*
* by-position: params MUST be an Array, containing the values in the Server expected order.
*
*/
export type JSONRPCParamsByPosition = JSONRPCParamValue[];
/**
*
* by-name: params MUST be an Object, with member names that match the Server expected parameter names. The absence of expected names MAY result in an error being generated. The names MUST match exactly, including case, to the method's expected parameters.
*
*/
export interface JSONRPCParamsByName { [key: string]: any; }
/**
*
* A Structured value that holds the parameter values to be used during the invocation of the method. This member MAY be omitted.
*
*/
export type JSONRPCParams = JSONRPCParamsByPosition | JSONRPCParamsByName;
/**
*
* A rpc call is represented by sending a Request object to a Server.
*
*/
export interface JSONRPCRequest {
id?: JSONRPCRequestId;
jsonrpc: JSONRPCVersion;
method: JSONRPCMethod;
params?: JSONRPCParams;
[k: string]: any;
}
/**
*
* A Number that indicates the error type that occurred. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. Any code within this range, but not defined explicitly below is reserved for future use. The error codes are nearly the same as those suggested for XML-RPC at the [following url](http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php)
*
*/
export type JSONRPCErrorCode = number;
/**
*
* A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.
*
*/
export type JSONRPCErrorMessage = string;
/**
*
* A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).
*
*/
export type JSONRPCErrorData = any;
/**
*
* When a rpc call encounters an error, the Response Object MUST contain the error member with a value that is a Object.
*
*/
export interface JSONRPCError {
code?: JSONRPCErrorCode;
message?: JSONRPCErrorMessage;
data?: JSONRPCErrorData;
[k: string]: any;
}
/**
*
* This member is REQUIRED on success. This member MUST NOT exist if there was an error invoking the method. The value of this member is determined by the method invoked on the Server.
*
*/
export type JSONRPCResponseResult = any;
/**
*
* When a rpc call is made, the Server MUST reply with a Response, except for in the case of Notifications. The Response is expressed as a single JSON Object,
*
*/
export interface JSONRPCResponse {
id: JSONRPCRequestId;
jsonrpc: JSONRPCVersion;
error?: JSONRPCError;
result?: JSONRPCResponseResult;
[k: string]: any;
}
/**
*
* To send several Request objects at the same time, the Client MAY send an Array filled with Request objects. The Client SHOULD match contexts between the set of Request objects and the resulting set of Response objects based on the id member within each Object.
*
*/
export type JSONRPCBatchRequest = JSONRPCRequest[];
/**
*
* The Server should respond with an Array containing the corresponding Response objects, after all of the batch Request objects have been processed. A Response object SHOULD exist for each Request object, except that there SHOULD NOT be any Response objects for notifications. The Server MAY process a batch rpc call as a set of concurrent tasks, processing them in any order and with any width of parallelism. The Response objects being returned from a batch call MAY be returned in any order within the Array. If the batch rpc call itself fails to be recognized as an valid JSON or as an Array with at least one value, the response from the Server MUST be a single Response object. If there are no Response objects contained within the Response array as it is to be sent to the client, the server MUST NOT return an empty Array and should return nothing at all.
*
*/
export type JSONRPCBatchResponse = JSONRPCResponse[];
/**
*
* Either a (possibly batch of) JSON-RPC request(s) and response(s)
*
*/
export type JSONRPCTypes = JSONRPCRequest | JSONRPCResponse | JSONRPCBatchRequest | JSONRPCBatchResponse;