Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ public TaskPushNotificationConfig createTaskPushNotificationConfiguration(TaskPu
io.a2a.grpc.CreateTaskPushNotificationConfigRequest grpcRequest = io.a2a.grpc.CreateTaskPushNotificationConfigRequest.newBuilder()
.setTaskId(request.taskId())
.setConfig(ToProto.taskPushNotificationConfig(request).getPushNotificationConfig())
.setConfigId(configId != null ? configId : request.taskId())
.setTenant(resolveTenant(request.tenant()))
.build();
PayloadAndHeaders payloadAndHeaders = applyInterceptors(SET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD, grpcRequest, agentCard, context);
Expand Down Expand Up @@ -281,7 +280,7 @@ public ListTaskPushNotificationConfigResult listTaskPushNotificationConfiguratio
@Nullable ClientCallContext context) throws A2AClientException {
checkNotNullParam("request", request);

io.a2a.grpc.ListTaskPushNotificationConfigRequest grpcRequest = io.a2a.grpc.ListTaskPushNotificationConfigRequest.newBuilder()
io.a2a.grpc.ListTaskPushNotificationConfigsRequest grpcRequest = io.a2a.grpc.ListTaskPushNotificationConfigsRequest.newBuilder()
.setTaskId(request.id())
.setTenant(resolveTenant(request.tenant()))
.setPageSize(request.pageSize())
Expand All @@ -292,7 +291,7 @@ public ListTaskPushNotificationConfigResult listTaskPushNotificationConfiguratio

try {
A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders);
io.a2a.grpc.ListTaskPushNotificationConfigResponse grpcResponse = stubWithMetadata.listTaskPushNotificationConfig(grpcRequest);
io.a2a.grpc.ListTaskPushNotificationConfigsResponse grpcResponse = stubWithMetadata.listTaskPushNotificationConfigs(grpcRequest);
return FromProto.listTaskPushNotificationConfigResult(grpcResponse);
} catch (StatusRuntimeException | StatusException e) {
throw GrpcErrorMapper.mapGrpcError(e, "Failed to list task push notification config: ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import io.a2a.jsonrpc.common.wrappers.GetExtendedAgentCardResponse;
import io.a2a.jsonrpc.common.wrappers.GetTaskPushNotificationConfigResponse;
import io.a2a.jsonrpc.common.wrappers.GetTaskResponse;
import io.a2a.jsonrpc.common.wrappers.ListTaskPushNotificationConfigResponse;
import io.a2a.jsonrpc.common.wrappers.ListTaskPushNotificationConfigsResponse;
import io.a2a.jsonrpc.common.wrappers.ListTasksResponse;
import io.a2a.jsonrpc.common.wrappers.ListTasksResult;
import io.a2a.jsonrpc.common.wrappers.SendMessageResponse;
Expand Down Expand Up @@ -228,7 +228,7 @@ public ListTaskPushNotificationConfigResult listTaskPushNotificationConfiguratio

try {
String httpResponseBody = sendPostRequest(Utils.buildBaseUrl(agentInterface, request.tenant()), payloadAndHeaders, LIST_TASK_PUSH_NOTIFICATION_CONFIG_METHOD);
ListTaskPushNotificationConfigResponse response = unmarshalResponse(httpResponseBody, LIST_TASK_PUSH_NOTIFICATION_CONFIG_METHOD);
ListTaskPushNotificationConfigsResponse response = unmarshalResponse(httpResponseBody, LIST_TASK_PUSH_NOTIFICATION_CONFIG_METHOD);
return response.getResult();
} catch (A2AClientException e) {
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ public class JsonMessages {
"id": "cd4c76de-d54c-436c-8b9f-4c2703648d64",
"result": {
"taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64",
"id": "c295ea44-7543-4f78-b524-7a38915ad6e4",
"pushNotificationConfig": {
"id": "c295ea44-7543-4f78-b524-7a38915ad6e4",
"url": "https://example.com/callback",
"authentication": {
"scheme": "jwt"
Expand All @@ -339,8 +339,8 @@ public class JsonMessages {
"method":"CreateTaskPushNotificationConfig",
"params":{
"taskId":"de38c76d-d54c-436c-8b9f-4c2703648d64",
"configId":"c295ea44-7543-4f78-b524-7a38915ad6e4",
"config":{
"id":"c295ea44-7543-4f78-b524-7a38915ad6e4",
"url":"https://example.com/callback",
"authentication":{
"scheme":"jwt"
Expand All @@ -355,8 +355,8 @@ public class JsonMessages {
"id": "cd4c76de-d54c-436c-8b9f-4c2703648d64",
"result": {
"taskId":"de38c76d-d54c-436c-8b9f-4c2703648d64",
"id":"c295ea44-7543-4f78-b524-7a38915ad6e4",
"pushNotificationConfig": {
"id":"c295ea44-7543-4f78-b524-7a38915ad6e4",
"url": "https://example.com/callback",
"authentication": {
"scheme": "jwt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,6 @@ public TaskPushNotificationConfig createTaskPushNotificationConfiguration(TaskPu
= io.a2a.grpc.CreateTaskPushNotificationConfigRequest.newBuilder();
builder.setConfig(ProtoUtils.ToProto.taskPushNotificationConfig(request).getPushNotificationConfig())
.setTaskId(request.taskId());
if (request.config().id() != null) {
builder.setConfigId(request.config().id());
}
PayloadAndHeaders payloadAndHeaders = applyInterceptors(SET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD, builder, agentCard, context);
try {
String httpResponseBody = sendPostRequest(Utils.buildBaseUrl(agentInterface, request.tenant()) + String.format("/tasks/%1s/pushNotificationConfigs", request.taskId()), payloadAndHeaders);
Expand Down Expand Up @@ -333,8 +330,8 @@ public TaskPushNotificationConfig getTaskPushNotificationConfiguration(GetTaskPu
@Override
public ListTaskPushNotificationConfigResult listTaskPushNotificationConfigurations(ListTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) throws A2AClientException {
checkNotNullParam("request", request);
io.a2a.grpc.ListTaskPushNotificationConfigRequest.Builder builder
= io.a2a.grpc.ListTaskPushNotificationConfigRequest.newBuilder();
io.a2a.grpc.ListTaskPushNotificationConfigsRequest.Builder builder
= io.a2a.grpc.ListTaskPushNotificationConfigsRequest.newBuilder();
builder.setTaskId(request.id());
PayloadAndHeaders payloadAndHeaders = applyInterceptors(LIST_TASK_PUSH_NOTIFICATION_CONFIG_METHOD, builder,
agentCard, context);
Expand All @@ -351,7 +348,7 @@ public ListTaskPushNotificationConfigResult listTaskPushNotificationConfiguratio
throw RestErrorMapper.mapRestError(response);
}
String httpResponseBody = response.body();
io.a2a.grpc.ListTaskPushNotificationConfigResponse.Builder responseBuilder = io.a2a.grpc.ListTaskPushNotificationConfigResponse.newBuilder();
io.a2a.grpc.ListTaskPushNotificationConfigsResponse.Builder responseBuilder = io.a2a.grpc.ListTaskPushNotificationConfigsResponse.newBuilder();
JsonFormat.parser().merge(httpResponseBody, responseBuilder);
return ProtoUtils.FromProto.listTaskPushNotificationConfigResult(responseBuilder);
} catch (A2AClientException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ public class JsonRestMessages {
static final String GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """
{
"taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64",
"id": "10",
"pushNotificationConfig": {
"id": "10",
"url": "https://example.com/callback",
"authentication": {
"scheme": "jwt"
Expand All @@ -321,8 +321,8 @@ public class JsonRestMessages {
"configs":[
{
"taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64",
"id": "10",
"pushNotificationConfig": {
"id": "10",
"url": "https://example.com/callback",
"authentication": {
"scheme": "jwt"
Expand All @@ -331,8 +331,8 @@ public class JsonRestMessages {
},
{
"taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64",
"id": "5",
"pushNotificationConfig": {
"id": "5",
"url": "https://test.com/callback"
}
}
Expand All @@ -343,8 +343,8 @@ public class JsonRestMessages {
static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST = """
{
"taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64",
"configId": "default-config-id",
"config": {
"id": "default-config-id",
"url": "https://example.com/callback",
"authentication": {
"scheme": "jwt"
Expand All @@ -355,8 +355,8 @@ public class JsonRestMessages {
static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """
{
"taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64",
"id": "10",
"pushNotificationConfig": {
"id": "10",
"url": "https://example.com/callback",
"authentication": {
"scheme": "jwt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @param <T> the type of the result value returned in successful responses
*/
public abstract sealed class A2AResponse<T> implements A2AMessage permits CancelTaskResponse, DeleteTaskPushNotificationConfigResponse, GetExtendedAgentCardResponse, GetTaskPushNotificationConfigResponse, GetTaskResponse, A2AErrorResponse, ListTaskPushNotificationConfigResponse, ListTasksResponse, SendMessageResponse, SendStreamingMessageResponse, CreateTaskPushNotificationConfigResponse {
public abstract sealed class A2AResponse<T> implements A2AMessage permits CancelTaskResponse, DeleteTaskPushNotificationConfigResponse, GetExtendedAgentCardResponse, GetTaskPushNotificationConfigResponse, GetTaskResponse, A2AErrorResponse, ListTaskPushNotificationConfigsResponse, ListTasksResponse, SendMessageResponse, SendStreamingMessageResponse, CreateTaskPushNotificationConfigResponse {

/** The JSON-RPC protocol version. */
protected String jsonrpc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* <p>
* This class implements the JSON-RPC {@code tasks/pushNotificationConfig/list} method.
*
* @see ListTaskPushNotificationConfigResponse for the response
* @see ListTaskPushNotificationConfigsResponse for the response
* @see ListTaskPushNotificationConfigParams for the parameter structure
* @see TaskPushNotificationConfig for the configuration structure
* @see <a href="https://a2a-protocol.org/latest/">A2A Protocol Specification</a>
*/
public final class ListTaskPushNotificationConfigRequest extends NonStreamingJSONRPCRequest<ListTaskPushNotificationConfigParams> {
public final class ListTaskPushNotificationConfigsRequest extends NonStreamingJSONRPCRequest<ListTaskPushNotificationConfigParams> {

/**
* Constructs request with all parameters.
Expand All @@ -30,7 +30,7 @@ public final class ListTaskPushNotificationConfigRequest extends NonStreamingJSO
* @param id the request ID
* @param params the request parameters
*/
public ListTaskPushNotificationConfigRequest(String jsonrpc, Object id, ListTaskPushNotificationConfigParams params) {
public ListTaskPushNotificationConfigsRequest(String jsonrpc, Object id, ListTaskPushNotificationConfigParams params) {
super(jsonrpc, LIST_TASK_PUSH_NOTIFICATION_CONFIG_METHOD, id, params);
}

Expand All @@ -40,7 +40,7 @@ public ListTaskPushNotificationConfigRequest(String jsonrpc, Object id, ListTask
* @param id the request ID
* @param params the request parameters
*/
public ListTaskPushNotificationConfigRequest(String id, ListTaskPushNotificationConfigParams params) {
public ListTaskPushNotificationConfigsRequest(String id, ListTaskPushNotificationConfigParams params) {
this(null, id, params);
}

Expand Down Expand Up @@ -105,11 +105,11 @@ public Builder params(ListTaskPushNotificationConfigParams params) {
*
* @return a new instance
*/
public ListTaskPushNotificationConfigRequest build() {
public ListTaskPushNotificationConfigsRequest build() {
if (id == null) {
id = UUID.randomUUID().toString();
}
return new ListTaskPushNotificationConfigRequest(jsonrpc, id, params);
return new ListTaskPushNotificationConfigsRequest(jsonrpc, id, params);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* <p>
* If an error occurs, the error field will contain a {@link A2AError}.
*
* @see ListTaskPushNotificationConfigRequest for the corresponding request
* @see ListTaskPushNotificationConfigsRequest for the corresponding request
* @see ListTaskPushNotificationConfigResult for the result structure
* @see TaskPushNotificationConfig for the configuration structure
* @see <a href="https://a2a-protocol.org/latest/">A2A Protocol Specification</a>
*/
public final class ListTaskPushNotificationConfigResponse extends A2AResponse<ListTaskPushNotificationConfigResult> {
public final class ListTaskPushNotificationConfigsResponse extends A2AResponse<ListTaskPushNotificationConfigResult> {

/**
* Constructs response with all parameters.
Expand All @@ -28,7 +28,7 @@ public final class ListTaskPushNotificationConfigResponse extends A2AResponse<Li
* @param result the result containing list of push notification configurations and pagination info
* @param error the error (if any)
*/
public ListTaskPushNotificationConfigResponse(String jsonrpc, Object id, ListTaskPushNotificationConfigResult result, A2AError error) {
public ListTaskPushNotificationConfigsResponse(String jsonrpc, Object id, ListTaskPushNotificationConfigResult result, A2AError error) {
super(jsonrpc, id, result, error, ListTaskPushNotificationConfigResult.class);
}

Expand All @@ -38,7 +38,7 @@ public ListTaskPushNotificationConfigResponse(String jsonrpc, Object id, ListTas
* @param id the request ID
* @param error the error
*/
public ListTaskPushNotificationConfigResponse(Object id, A2AError error) {
public ListTaskPushNotificationConfigsResponse(Object id, A2AError error) {
this(null, id, null, error);
}

Expand All @@ -48,7 +48,7 @@ public ListTaskPushNotificationConfigResponse(Object id, A2AError error) {
* @param id the request ID
* @param result the result containing list of push notification configurations and pagination info
*/
public ListTaskPushNotificationConfigResponse(Object id, ListTaskPushNotificationConfigResult result) {
public ListTaskPushNotificationConfigsResponse(Object id, ListTaskPushNotificationConfigResult result) {
this(null, id, result, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
public abstract sealed class NonStreamingJSONRPCRequest<T> extends A2ARequest<T> permits GetTaskRequest,
CancelTaskRequest, CreateTaskPushNotificationConfigRequest, GetTaskPushNotificationConfigRequest,
SendMessageRequest, DeleteTaskPushNotificationConfigRequest, ListTaskPushNotificationConfigRequest,
SendMessageRequest, DeleteTaskPushNotificationConfigRequest, ListTaskPushNotificationConfigsRequest,
GetExtendedAgentCardRequest, ListTasksRequest {

NonStreamingJSONRPCRequest(String jsonrpc, String method, Object id, T params) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
import io.a2a.jsonrpc.common.wrappers.GetTaskPushNotificationConfigResponse;
import io.a2a.jsonrpc.common.wrappers.GetTaskRequest;
import io.a2a.jsonrpc.common.wrappers.GetTaskResponse;
import io.a2a.jsonrpc.common.wrappers.ListTaskPushNotificationConfigRequest;
import io.a2a.jsonrpc.common.wrappers.ListTaskPushNotificationConfigResponse;
import io.a2a.jsonrpc.common.wrappers.ListTaskPushNotificationConfigsRequest;
import io.a2a.jsonrpc.common.wrappers.ListTaskPushNotificationConfigsResponse;
import io.a2a.jsonrpc.common.wrappers.ListTasksRequest;
import io.a2a.jsonrpc.common.wrappers.ListTasksResponse;
import io.a2a.jsonrpc.common.wrappers.NonStreamingJSONRPCRequest;
Expand Down Expand Up @@ -187,7 +187,7 @@ private A2AResponse<?> processNonStreamingRequest(NonStreamingJSONRPCRequest<?>
if (request instanceof SendMessageRequest req) {
return jsonRpcHandler.onMessageSend(req, context);
}
if (request instanceof ListTaskPushNotificationConfigRequest req) {
if (request instanceof ListTaskPushNotificationConfigsRequest req) {
return jsonRpcHandler.listPushNotificationConfig(req, context);
}
if (request instanceof DeleteTaskPushNotificationConfigRequest req) {
Expand Down Expand Up @@ -304,7 +304,7 @@ private static com.google.protobuf.MessageOrBuilder convertToProto(A2AResponse<?
return io.a2a.grpc.utils.ProtoUtils.ToProto.createTaskPushNotificationConfigResponse(r.getResult());
} else if (response instanceof GetTaskPushNotificationConfigResponse r) {
return io.a2a.grpc.utils.ProtoUtils.ToProto.getTaskPushNotificationConfigResponse(r.getResult());
} else if (response instanceof ListTaskPushNotificationConfigResponse r) {
} else if (response instanceof ListTaskPushNotificationConfigsResponse r) {
return io.a2a.grpc.utils.ProtoUtils.ToProto.listTaskPushNotificationConfigResponse(r.getResult());
} else if (response instanceof DeleteTaskPushNotificationConfigResponse) {
// DeleteTaskPushNotificationConfig has no result body, just return empty message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import io.a2a.jsonrpc.common.wrappers.GetTaskPushNotificationConfigResponse;
import io.a2a.jsonrpc.common.wrappers.GetTaskRequest;
import io.a2a.jsonrpc.common.wrappers.GetTaskResponse;
import io.a2a.jsonrpc.common.wrappers.ListTaskPushNotificationConfigRequest;
import io.a2a.jsonrpc.common.wrappers.ListTaskPushNotificationConfigResponse;
import io.a2a.jsonrpc.common.wrappers.ListTaskPushNotificationConfigsRequest;
import io.a2a.jsonrpc.common.wrappers.ListTaskPushNotificationConfigsResponse;
import io.a2a.jsonrpc.common.wrappers.SendMessageRequest;
import io.a2a.jsonrpc.common.wrappers.SendMessageResponse;
import io.a2a.jsonrpc.common.wrappers.SendStreamingMessageRequest;
Expand Down Expand Up @@ -331,8 +331,8 @@ public void testCreateTaskPushNotificationConfig_MethodNameSetInContext() {
"method": "CreateTaskPushNotificationConfig",
"params": {
"taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64",
"configId": "config-123",
"config": {
"id": "config-123",
"url": "https://example.com/callback",
"authentication": {
"scheme": "jwt"
Expand Down Expand Up @@ -435,8 +435,8 @@ public void testListTaskPushNotificationConfig_MethodNameSetInContext() {
.build(),
null
);
ListTaskPushNotificationConfigResponse realResponse = new ListTaskPushNotificationConfigResponse("1", new ListTaskPushNotificationConfigResult(singletonList(config)));
when(mockJsonRpcHandler.listPushNotificationConfig(any(ListTaskPushNotificationConfigRequest.class),
ListTaskPushNotificationConfigsResponse realResponse = new ListTaskPushNotificationConfigsResponse("1", new ListTaskPushNotificationConfigResult(singletonList(config)));
when(mockJsonRpcHandler.listPushNotificationConfig(any(ListTaskPushNotificationConfigsRequest.class),
any(ServerCallContext.class))).thenReturn(realResponse);

ArgumentCaptor<ServerCallContext> contextCaptor = ArgumentCaptor.forClass(ServerCallContext.class);
Expand All @@ -445,7 +445,7 @@ public void testListTaskPushNotificationConfig_MethodNameSetInContext() {
routes.invokeJSONRPCHandler(jsonRpcRequest, mockRoutingContext);

// Assert
verify(mockJsonRpcHandler).listPushNotificationConfig(any(ListTaskPushNotificationConfigRequest.class),
verify(mockJsonRpcHandler).listPushNotificationConfig(any(ListTaskPushNotificationConfigsRequest.class),
contextCaptor.capture());
ServerCallContext capturedContext = contextCaptor.getValue();
assertNotNull(capturedContext);
Expand Down
Loading
Loading