-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathJsonRpcRequest.cs
More file actions
43 lines (38 loc) · 1.33 KB
/
JsonRpcRequest.cs
File metadata and controls
43 lines (38 loc) · 1.33 KB
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
using System.Text.Json;
using System.Text.Json.Serialization;
namespace A2A;
/// <summary>
/// Represents a JSON-RPC 2.0 Request object.
/// </summary>
[JsonConverter(typeof(JsonRpcRequestConverter))]
public sealed class JsonRpcRequest
{
/// <summary>
/// Gets or sets the version of the JSON-RPC protocol.
/// </summary>
/// <remarks>
/// MUST be exactly "2.0".
/// </remarks>
[JsonPropertyName("jsonrpc")]
// [JsonRequired] - we have to reject this with a special payload
public string JsonRpc { get; set; } = "2.0";
/// <summary>
/// Gets or sets the identifier established by the Client that MUST contain a String, Number.
/// </summary>
/// <remarks>
/// Numbers SHOULD NOT contain fractional parts.
/// </remarks>
[JsonPropertyName("id")]
public JsonRpcId Id { get; set; }
/// <summary>
/// Gets or sets the string containing the name of the method to be invoked.
/// </summary>
[JsonPropertyName("method")]
// [JsonRequired] - we have to reject this with a special payload
public string Method { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the structured value that holds the parameter values to be used during the invocation of the method.
/// </summary>
[JsonPropertyName("params")]
public JsonElement? Params { get; set; }
}