Skip to content

Commit 475cdb2

Browse files
committed
refactor!: renamed XXAuthenticatedExtendedCardXXX class to XXXExtendedAgentCardXXX
Signed-off-by: Jeff Mesnil <jmesnil@ibm.com>
1 parent 3756747 commit 475cdb2

20 files changed

Lines changed: 90 additions & 101 deletions

File tree

‎client/transport/grpc/src/main/java/io/a2a/client/transport/grpc/GrpcErrorMapper.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import io.a2a.common.A2AErrorMessages;
44
import io.a2a.spec.A2AClientException;
55
import io.a2a.spec.ContentTypeNotSupportedError;
6-
import io.a2a.spec.ExtendedCardNotConfiguredError;
6+
import io.a2a.spec.ExtendedAgentCardNotConfiguredError;
77
import io.a2a.spec.ExtensionSupportRequiredError;
88
import io.a2a.spec.InvalidAgentResponseError;
99
import io.a2a.spec.InvalidParamsError;
@@ -56,7 +56,7 @@ public static A2AClientException mapGrpcError(Throwable e, String errorPrefix) {
5656
} else if (description.contains("InvalidAgentResponseError")) {
5757
return new A2AClientException(errorPrefix + description, new InvalidAgentResponseError(null, description, null));
5858
} else if (description.contains("ExtendedCardNotConfiguredError")) {
59-
return new A2AClientException(errorPrefix + description, new ExtendedCardNotConfiguredError(null, description, null));
59+
return new A2AClientException(errorPrefix + description, new ExtendedAgentCardNotConfiguredError(null, description, null));
6060
} else if (description.contains("ExtensionSupportRequiredError")) {
6161
return new A2AClientException(errorPrefix + description, new ExtensionSupportRequiredError(null, description, null));
6262
} else if (description.contains("VersionNotSupportedError")) {

‎client/transport/grpc/src/test/java/io/a2a/client/transport/grpc/GrpcErrorMapperTest.java‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,9 @@
77

88
import io.a2a.spec.A2AClientException;
99
import io.a2a.spec.ContentTypeNotSupportedError;
10-
import io.a2a.spec.ExtendedCardNotConfiguredError;
10+
import io.a2a.spec.ExtendedAgentCardNotConfiguredError;
1111
import io.a2a.spec.ExtensionSupportRequiredError;
12-
import io.a2a.spec.InvalidAgentResponseError;
1312
import io.a2a.spec.InvalidParamsError;
14-
import io.a2a.spec.InvalidRequestError;
15-
import io.a2a.spec.JSONParseError;
16-
import io.a2a.spec.MethodNotFoundError;
17-
import io.a2a.spec.PushNotificationNotSupportedError;
18-
import io.a2a.spec.TaskNotCancelableError;
1913
import io.a2a.spec.TaskNotFoundError;
2014
import io.a2a.spec.UnsupportedOperationError;
2115
import io.a2a.spec.VersionNotSupportedError;
@@ -85,9 +79,9 @@ public void testExtendedCardNotConfiguredErrorUnmarshalling() {
8579
// Verify the result
8680
assertNotNull(result);
8781
assertNotNull(result.getCause());
88-
assertInstanceOf(ExtendedCardNotConfiguredError.class, result.getCause());
82+
assertInstanceOf(ExtendedAgentCardNotConfiguredError.class, result.getCause());
8983

90-
ExtendedCardNotConfiguredError extendedCardError = (ExtendedCardNotConfiguredError) result.getCause();
84+
ExtendedAgentCardNotConfiguredError extendedCardError = (ExtendedAgentCardNotConfiguredError) result.getCause();
9185
assertNotNull(extendedCardError.getMessage());
9286
assertTrue(extendedCardError.getMessage().contains("Extended card not configured"));
9387
}

‎client/transport/jsonrpc/src/main/java/io/a2a/client/transport/jsonrpc/JSONRPCTransport.java‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import java.util.function.Consumer;
2222

2323
import com.google.protobuf.MessageOrBuilder;
24-
import io.a2a.client.http.A2ACardResolver;
24+
2525
import io.a2a.client.http.A2AHttpClient;
2626
import io.a2a.client.http.A2AHttpClientFactory;
2727
import io.a2a.client.http.A2AHttpResponse;
@@ -33,12 +33,10 @@
3333
import io.a2a.grpc.utils.JSONRPCUtils;
3434
import io.a2a.grpc.utils.ProtoUtils;
3535
import io.a2a.jsonrpc.common.json.JsonProcessingException;
36-
import io.a2a.jsonrpc.common.wrappers.A2AMessage;
3736
import io.a2a.jsonrpc.common.wrappers.A2AResponse;
3837
import io.a2a.jsonrpc.common.wrappers.CancelTaskResponse;
3938
import io.a2a.jsonrpc.common.wrappers.DeleteTaskPushNotificationConfigResponse;
40-
import io.a2a.jsonrpc.common.wrappers.GetAuthenticatedExtendedCardRequest;
41-
import io.a2a.jsonrpc.common.wrappers.GetAuthenticatedExtendedCardResponse;
39+
import io.a2a.jsonrpc.common.wrappers.GetExtendedAgentCardResponse;
4240
import io.a2a.jsonrpc.common.wrappers.GetTaskPushNotificationConfigResponse;
4341
import io.a2a.jsonrpc.common.wrappers.GetTaskResponse;
4442
import io.a2a.jsonrpc.common.wrappers.ListTaskPushNotificationConfigResponse;
@@ -293,7 +291,7 @@ public AgentCard getExtendedAgentCard(@Nullable ClientCallContext context) throw
293291

294292
try {
295293
String httpResponseBody = sendPostRequest(Utils.buildBaseUrl(agentInterface, ""), payloadAndHeaders, GET_EXTENDED_AGENT_CARD_METHOD);
296-
GetAuthenticatedExtendedCardResponse response = unmarshalResponse(httpResponseBody, GET_EXTENDED_AGENT_CARD_METHOD);
294+
GetExtendedAgentCardResponse response = unmarshalResponse(httpResponseBody, GET_EXTENDED_AGENT_CARD_METHOD);
297295
return response.getResult();
298296
} catch (IOException | InterruptedException | JsonProcessingException e) {
299297
throw new A2AClientException("Failed to get authenticated extended agent card: " + e, e);

‎client/transport/rest/src/main/java/io/a2a/client/transport/rest/RestErrorMapper.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import io.a2a.jsonrpc.common.json.JsonProcessingException;
99
import io.a2a.jsonrpc.common.json.JsonUtil;
1010
import io.a2a.spec.A2AClientException;
11-
import io.a2a.spec.ExtendedCardNotConfiguredError;
11+
import io.a2a.spec.ExtendedAgentCardNotConfiguredError;
1212
import io.a2a.spec.ContentTypeNotSupportedError;
1313
import io.a2a.spec.ExtensionSupportRequiredError;
1414
import io.a2a.spec.InternalError;
@@ -50,8 +50,7 @@ public static A2AClientException mapRestError(String body, int code) {
5050
public static A2AClientException mapRestError(String className, String errorMessage, int code) {
5151
return switch (className) {
5252
case "io.a2a.spec.TaskNotFoundError" -> new A2AClientException(errorMessage, new TaskNotFoundError());
53-
case "io.a2a.spec.AuthenticatedExtendedCardNotConfiguredError",
54-
"io.a2a.spec.ExtendedCardNotConfiguredError" -> new A2AClientException(errorMessage, new ExtendedCardNotConfiguredError(null, errorMessage, null));
53+
case "io.a2a.spec.ExtendedCardNotConfiguredError" -> new A2AClientException(errorMessage, new ExtendedAgentCardNotConfiguredError(null, errorMessage, null));
5554
case "io.a2a.spec.ContentTypeNotSupportedError" -> new A2AClientException(errorMessage, new ContentTypeNotSupportedError(null, null, errorMessage));
5655
case "io.a2a.spec.InternalError" -> new A2AClientException(errorMessage, new InternalError(errorMessage));
5756
case "io.a2a.spec.InvalidAgentResponseError" -> new A2AClientException(errorMessage, new InvalidAgentResponseError(null, null, errorMessage));

‎examples/helloworld/client/src/main/java/io/a2a/examples/helloworld/HelloWorldClient.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ public static void main(String[] args) {
4141
finalAgentCard = publicAgentCard;
4242

4343
if (publicAgentCard.capabilities().extendedAgentCard()) {
44-
System.out.println("Public card supports authenticated extended card. Attempting to fetch from: " + SERVER_URL + "/agent/authenticatedExtendedCard");
44+
System.out.println("Public card supports authenticated extended card. Attempting to fetch from: " + SERVER_URL + "/ExtendedAgentCard");
4545
Map<String, String> authHeaders = new HashMap<>();
4646
authHeaders.put("Authorization", "Bearer dummy-token-for-extended-card");
47-
AgentCard extendedAgentCard = A2A.getAgentCard(SERVER_URL, "/agent/authenticatedExtendedCard", authHeaders);
47+
AgentCard extendedAgentCard = A2A.getAgentCard(SERVER_URL, "/ExtendedAgentCard", authHeaders);
4848
System.out.println("Successfully fetched authenticated extended agent card:");
4949
System.out.println(JsonUtil.toJson(extendedAgentCard));
5050
System.out.println("Using AUTHENTICATED EXTENDED agent card for client initialization.");

‎jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/A2AResponse.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @param <T> the type of the result value returned in successful responses
1212
*/
13-
public abstract sealed class A2AResponse<T> implements A2AMessage permits CancelTaskResponse, DeleteTaskPushNotificationConfigResponse, GetAuthenticatedExtendedCardResponse, GetTaskPushNotificationConfigResponse, GetTaskResponse, A2AErrorResponse, ListTaskPushNotificationConfigResponse, ListTasksResponse, SendMessageResponse, SendStreamingMessageResponse, SetTaskPushNotificationConfigResponse {
13+
public abstract sealed class A2AResponse<T> implements A2AMessage permits CancelTaskResponse, DeleteTaskPushNotificationConfigResponse, GetExtendedAgentCardResponse, GetTaskPushNotificationConfigResponse, GetTaskResponse, A2AErrorResponse, ListTaskPushNotificationConfigResponse, ListTasksResponse, SendMessageResponse, SendStreamingMessageResponse, SetTaskPushNotificationConfigResponse {
1414

1515
/** The JSON-RPC protocol version. */
1616
protected String jsonrpc;

jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/GetAuthenticatedExtendedCardRequest.java renamed to jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/GetExtendedAgentCardRequest.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
import java.util.UUID;
66

7+
import io.a2a.spec.AgentCapabilities;
78
import io.a2a.spec.AgentCard;
8-
import io.a2a.spec.ExtendedCardNotConfiguredError;
9+
import io.a2a.spec.ExtendedAgentCardNotConfiguredError;
910

1011
/**
1112
* JSON-RPC request to retrieve an agent's extended card with authenticated details.
@@ -20,26 +21,26 @@
2021
* </ul>
2122
* <p>
2223
* The agent must support authenticated extended cards (indicated by
23-
* {@link AgentCard#supportsExtendedAgentCard()}) and the client must provide
24+
* {@link AgentCapabilities#extendedAgentCard()} }) and the client must provide
2425
* valid authentication credentials for this request to succeed.
2526
* <p>
26-
* This class implements the JSON-RPC {@code agent/getAuthenticatedExtendedCard} method
27+
* This class implements the JSON-RPC {@code GetExtendedAgentCard} method
2728
* as specified in the A2A Protocol.
2829
*
29-
* @see GetAuthenticatedExtendedCardResponse for the corresponding response
30+
* @see GetExtendedAgentCardResponse for the corresponding response
3031
* @see AgentCard for the card structure
31-
* @see ExtendedCardNotConfiguredError for the error when unsupported
32+
* @see ExtendedAgentCardNotConfiguredError for the error when unsupported
3233
* @see <a href="https://a2a-protocol.org/latest/">A2A Protocol Specification</a>
3334
*/
34-
public final class GetAuthenticatedExtendedCardRequest extends NonStreamingJSONRPCRequest<Void> {
35+
public final class GetExtendedAgentCardRequest extends NonStreamingJSONRPCRequest<Void> {
3536

3637
/**
3738
* Constructs request with full parameters.
3839
*
3940
* @param jsonrpc the JSON-RPC version
4041
* @param id the request ID
4142
*/
42-
public GetAuthenticatedExtendedCardRequest(String jsonrpc, Object id) {
43+
public GetExtendedAgentCardRequest(String jsonrpc, Object id) {
4344
super(jsonrpc, GET_EXTENDED_AGENT_CARD_METHOD, id);
4445
}
4546

@@ -48,7 +49,7 @@ public GetAuthenticatedExtendedCardRequest(String jsonrpc, Object id) {
4849
*
4950
* @param id the request ID
5051
*/
51-
public GetAuthenticatedExtendedCardRequest(String id) {
52+
public GetExtendedAgentCardRequest(String id) {
5253
this(null, id);
5354
}
5455

@@ -80,7 +81,7 @@ private Builder() {
8081
* @param jsonrpc the JSON-RPC version
8182
* @return this builder for method chaining
8283
*/
83-
public GetAuthenticatedExtendedCardRequest.Builder jsonrpc(String jsonrpc) {
84+
public GetExtendedAgentCardRequest.Builder jsonrpc(String jsonrpc) {
8485
this.jsonrpc = jsonrpc;
8586
return this;
8687
}
@@ -91,7 +92,7 @@ public GetAuthenticatedExtendedCardRequest.Builder jsonrpc(String jsonrpc) {
9192
* @param id the request ID
9293
* @return this builder for method chaining
9394
*/
94-
public GetAuthenticatedExtendedCardRequest.Builder id(Object id) {
95+
public GetExtendedAgentCardRequest.Builder id(Object id) {
9596
this.id = id;
9697
return this;
9798
}
@@ -101,11 +102,11 @@ public GetAuthenticatedExtendedCardRequest.Builder id(Object id) {
101102
*
102103
* @return a new instance
103104
*/
104-
public GetAuthenticatedExtendedCardRequest build() {
105+
public GetExtendedAgentCardRequest build() {
105106
if (id == null) {
106107
id = UUID.randomUUID().toString();
107108
}
108-
return new GetAuthenticatedExtendedCardRequest(jsonrpc, id);
109+
return new GetExtendedAgentCardRequest(jsonrpc, id);
109110
}
110111
}
111112
}

jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/GetAuthenticatedExtendedCardResponse.java renamed to jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/GetExtendedAgentCardResponse.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import io.a2a.spec.A2AError;
44
import io.a2a.spec.AgentCard;
5-
import io.a2a.spec.ExtendedCardNotConfiguredError;
5+
import io.a2a.spec.ExtendedAgentCardNotConfiguredError;
66

77
/**
88
* JSON-RPC response containing an agent's extended card with authenticated details.
@@ -13,14 +13,14 @@
1313
* <p>
1414
* If the agent doesn't support authenticated extended cards or authentication fails,
1515
* the error field will contain a {@link A2AError} such as
16-
* {@link ExtendedCardNotConfiguredError}.
16+
* {@link ExtendedAgentCardNotConfiguredError}.
1717
*
18-
* @see GetAuthenticatedExtendedCardRequest for the corresponding request
18+
* @see GetExtendedAgentCardRequest for the corresponding request
1919
* @see AgentCard for the card structure
20-
* @see ExtendedCardNotConfiguredError for the error when unsupported
20+
* @see ExtendedAgentCardNotConfiguredError for the error when unsupported
2121
* @see <a href="https://a2a-protocol.org/latest/">A2A Protocol Specification</a>
2222
*/
23-
public final class GetAuthenticatedExtendedCardResponse extends A2AResponse<AgentCard> {
23+
public final class GetExtendedAgentCardResponse extends A2AResponse<AgentCard> {
2424

2525
/**
2626
* Constructs response with full parameters.
@@ -30,7 +30,7 @@ public final class GetAuthenticatedExtendedCardResponse extends A2AResponse<Agen
3030
* @param result the agent card result
3131
* @param error the error if any
3232
*/
33-
public GetAuthenticatedExtendedCardResponse(String jsonrpc, Object id, AgentCard result, A2AError error) {
33+
public GetExtendedAgentCardResponse(String jsonrpc, Object id, AgentCard result, A2AError error) {
3434
super(jsonrpc, id, result, error, AgentCard.class);
3535
}
3636

@@ -40,7 +40,7 @@ public GetAuthenticatedExtendedCardResponse(String jsonrpc, Object id, AgentCard
4040
* @param id the request ID
4141
* @param error the error
4242
*/
43-
public GetAuthenticatedExtendedCardResponse(Object id, A2AError error) {
43+
public GetExtendedAgentCardResponse(Object id, A2AError error) {
4444
this(null, id, null, error);
4545
}
4646

@@ -50,7 +50,7 @@ public GetAuthenticatedExtendedCardResponse(Object id, A2AError error) {
5050
* @param id the request ID
5151
* @param result the agent card result
5252
*/
53-
public GetAuthenticatedExtendedCardResponse(Object id, AgentCard result) {
53+
public GetExtendedAgentCardResponse(Object id, AgentCard result) {
5454
this(null, id, result, null);
5555
}
5656

‎jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/NonStreamingJSONRPCRequest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public abstract sealed class NonStreamingJSONRPCRequest<T> extends A2ARequest<T> permits GetTaskRequest,
99
CancelTaskRequest, SetTaskPushNotificationConfigRequest, GetTaskPushNotificationConfigRequest,
1010
SendMessageRequest, DeleteTaskPushNotificationConfigRequest, ListTaskPushNotificationConfigRequest,
11-
GetAuthenticatedExtendedCardRequest, ListTasksRequest {
11+
GetExtendedAgentCardRequest, ListTasksRequest {
1212

1313
NonStreamingJSONRPCRequest(String jsonrpc, String method, Object id, T params) {
1414
validateAndSetJsonParameters(jsonrpc, method, id, params, true);

‎reference/jsonrpc/src/main/java/io/a2a/server/apps/quarkus/A2AServerRoutes.java‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
import io.a2a.jsonrpc.common.wrappers.CancelTaskResponse;
3636
import io.a2a.jsonrpc.common.wrappers.DeleteTaskPushNotificationConfigRequest;
3737
import io.a2a.jsonrpc.common.wrappers.DeleteTaskPushNotificationConfigResponse;
38-
import io.a2a.jsonrpc.common.wrappers.GetAuthenticatedExtendedCardRequest;
39-
import io.a2a.jsonrpc.common.wrappers.GetAuthenticatedExtendedCardResponse;
38+
import io.a2a.jsonrpc.common.wrappers.GetExtendedAgentCardRequest;
39+
import io.a2a.jsonrpc.common.wrappers.GetExtendedAgentCardResponse;
4040
import io.a2a.jsonrpc.common.wrappers.GetTaskPushNotificationConfigRequest;
4141
import io.a2a.jsonrpc.common.wrappers.GetTaskPushNotificationConfigResponse;
4242
import io.a2a.jsonrpc.common.wrappers.GetTaskRequest;
@@ -59,7 +59,6 @@
5959
import io.a2a.server.extensions.A2AExtensions;
6060
import io.a2a.server.util.async.Internal;
6161
import io.a2a.spec.A2AError;
62-
import io.a2a.spec.AgentCard;
6362
import io.a2a.spec.InternalError;
6463
import io.a2a.spec.JSONParseError;
6564
import io.a2a.spec.UnsupportedOperationError;
@@ -186,8 +185,8 @@ private A2AResponse<?> processNonStreamingRequest(NonStreamingJSONRPCRequest<?>
186185
if (request instanceof DeleteTaskPushNotificationConfigRequest req) {
187186
return jsonRpcHandler.deletePushNotificationConfig(req, context);
188187
}
189-
if (request instanceof GetAuthenticatedExtendedCardRequest req) {
190-
return jsonRpcHandler.onGetAuthenticatedExtendedCardRequest(req, context);
188+
if (request instanceof GetExtendedAgentCardRequest req) {
189+
return jsonRpcHandler.onGetExtendedCardRequest(req, context);
191190
}
192191
return generateErrorResponse(request, new UnsupportedOperationError());
193192
}
@@ -287,8 +286,8 @@ private static com.google.protobuf.MessageOrBuilder convertToProto(A2AResponse<?
287286
} else if (response instanceof DeleteTaskPushNotificationConfigResponse) {
288287
// DeleteTaskPushNotificationConfig has no result body, just return empty message
289288
return com.google.protobuf.Empty.getDefaultInstance();
290-
} else if (response instanceof GetAuthenticatedExtendedCardResponse r) {
291-
return io.a2a.grpc.utils.ProtoUtils.ToProto.getAuthenticatedExtendedCardResponse(r.getResult());
289+
} else if (response instanceof GetExtendedAgentCardResponse r) {
290+
return io.a2a.grpc.utils.ProtoUtils.ToProto.getExtendedCardResponse(r.getResult());
292291
} else if (response instanceof SendStreamingMessageResponse r) {
293292
return io.a2a.grpc.utils.ProtoUtils.ToProto.taskOrMessageStream(r.getResult());
294293
} else {

0 commit comments

Comments
 (0)