Skip to content

Commit 4d328ae

Browse files
feat: seal api and clean up a2aclient tests (#37)
* make required props not optional, use jsonrequired attribute instead of required one, etc * format test class * change type of FilePart.File property from the specific FileWithBytes to the FileContent base one. * seal classes
1 parent c5a8b7e commit 4d328ae

30 files changed

+104
-136
lines changed

src/A2A/JsonRpc/ErrorTypes.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public A2AClientException(string message, Exception? innerException = null)
2121
/// <summary>
2222
/// Exception for HTTP errors.
2323
/// </summary>
24-
public class A2AClientHTTPException : A2AClientException
24+
public sealed class A2AClientHTTPException : A2AClientException
2525
{
2626
/// <summary>
2727
/// The HTTP status code.
@@ -49,7 +49,7 @@ public A2AClientHTTPException(HttpStatusCode statusCode, string message)
4949
/// <summary>
5050
/// Exception for JSON parsing errors.
5151
/// </summary>
52-
public class A2AClientJsonException : A2AClientException
52+
public sealed class A2AClientJsonException : A2AClientException
5353
{
5454
/// <summary>
5555
/// The error message.
@@ -70,7 +70,7 @@ public A2AClientJsonException(string message)
7070
/// <summary>
7171
/// Exception for missing API key.
7272
/// </summary>
73-
public class MissingAPIKeyException : Exception
73+
public sealed class MissingAPIKeyException : Exception
7474
{
7575
/// <summary>
7676
/// Creates a new missing API key error.

src/A2A/JsonRpc/JsonRpcRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace A2A;
66
/// <summary>
77
/// Represents a JSON-RPC 2.0 Request object.
88
/// </summary>
9-
public class JsonRpcRequest
9+
public sealed class JsonRpcRequest
1010
{
1111
/// <summary>
1212
/// Gets or sets the version of the JSON-RPC protocol.

src/A2A/JsonRpc/JsonRpcResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace A2A;
88
/// <summary>
99
/// Represents a JSON-RPC 2.0 Response object.
1010
/// </summary>
11-
public class JsonRpcResponse
11+
public sealed class JsonRpcResponse
1212
{
1313
/// <summary>
1414
/// Gets or sets the version of the JSON-RPC protocol. MUST be exactly "2.0".

src/A2A/JsonRpc/MethodNotFoundError.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace A2A;
33
/// <summary>
44
/// Error for method not found.
55
/// </summary>
6-
public class MethodNotFoundError : JsonRpcError
6+
public sealed class MethodNotFoundError : JsonRpcError
77
{
88
/// <summary>
99
/// Creates a new method not found error.

src/A2A/Models/A2AResponse.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace A2A;
1010
[JsonDerivedType(typeof(TaskArtifactUpdateEvent), "artifact-update")]
1111
[JsonDerivedType(typeof(Message), "message")]
1212
[JsonDerivedType(typeof(AgentTask), "task")]
13-
public class A2AEvent
13+
public abstract class A2AEvent
1414
{
1515
}
1616

@@ -20,6 +20,6 @@ public class A2AEvent
2020
[JsonPolymorphic(TypeDiscriminatorPropertyName = "kind")]
2121
[JsonDerivedType(typeof(Message), "message")]
2222
[JsonDerivedType(typeof(AgentTask), "task")]
23-
public class A2AResponse : A2AEvent
23+
public abstract class A2AResponse : A2AEvent
2424
{
2525
}

src/A2A/Models/AgentCapabilities.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace A2A;
55
/// <summary>
66
/// Defines optional capabilities supported by an agent.
77
/// </summary>
8-
public class AgentCapabilities
8+
public sealed class AgentCapabilities
99
{
1010
/// <summary>
1111
/// Gets or sets a value indicating whether the agent supports SSE.

src/A2A/Models/AgentCard.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace A2A;
1111
/// - Default modalities/content types supported by the agent.
1212
/// - Authentication requirements.
1313
/// </remarks>
14-
public class AgentCard
14+
public sealed class AgentCard
1515
{
1616
/// <summary>
1717
/// Gets or sets the human readable name of the agent.

src/A2A/Models/AgentInterface.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace A2A;
55
/// <summary>
66
/// Provides a declaration of a combination of target URL and supported transport to interact with an agent.
77
/// </summary>
8-
public class AgentInterface
8+
public sealed class AgentInterface
99
{
1010
/// <summary>
1111
/// The transport supported by this URL.

src/A2A/Models/AgentProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace A2A;
55
/// <summary>
66
/// Represents the service provider of an agent.
77
/// </summary>
8-
public class AgentProvider
8+
public sealed class AgentProvider
99
{
1010
/// <summary>
1111
/// Agent provider's organization name.

src/A2A/Models/AgentSkill.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace A2A;
55
/// <summary>
66
/// Represents a unit of capability that an agent can perform.
77
/// </summary>
8-
public class AgentSkill
8+
public sealed class AgentSkill
99
{
1010
/// <summary>
1111
/// Unique identifier for the agent's skill.

0 commit comments

Comments
 (0)