1e0df84beba5c94671a0928d1f2516cacf9d6397
[StratumLibrary.git] / StratumLibrary / StratumResponse.cs
1 \feffusing Newtonsoft.Json;\r
2 \r
3 namespace Stratum\r
4 {\r
5     /// <summary>\r
6     /// Represents a Stratum Response\r
7     /// </summary>\r
8     [JsonObject(MemberSerialization.OptIn)]\r
9     public class StratumResponse\r
10     {\r
11         /// <summary>\r
12         /// Response id, should be null or identical to request id\r
13         /// </summary>\r
14         [JsonProperty(PropertyName = "id")]\r
15         public object Id { get; set; }\r
16 \r
17         /// <summary>\r
18         /// Result object\r
19         /// </summary>\r
20         [JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "result")]\r
21         public object Result { get; set; }\r
22 \r
23         /// <summary>\r
24         /// Error object\r
25         /// </summary>\r
26         [JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "error")]\r
27         public StratumException Error { get; set; }\r
28     }\r
29 \r
30     /// <summary>\r
31     /// Represents a Stratum Response\r
32     /// </summary>\r
33     [JsonObject(MemberSerialization.OptIn)]\r
34     public class StratumResponse<T>\r
35     {\r
36         /// <summary>\r
37         /// Response id, should be null or identical to request id\r
38         /// </summary>\r
39         [JsonProperty(PropertyName = "id")]\r
40         public object Id { get; set; }\r
41 \r
42         /// <summary>\r
43         /// Result object\r
44         /// </summary>\r
45         [JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "result")]\r
46         public T Result { get; set; }\r
47 \r
48         /// <summary>\r
49         /// Error object\r
50         /// </summary>\r
51         [JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "error")]\r
52         public StratumException Error { get; set; }\r
53     }\r
54 }\r