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
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ public class WeatherAgentCardProducer {
.capabilities(AgentCapabilities.builder()
.streaming(true)
.pushNotifications(false)
.stateTransitionHistory(false)
.build())
.defaultInputModes(Collections.singletonList("text"))
.defaultOutputModes(Collections.singletonList("text"))
Expand Down Expand Up @@ -575,10 +574,10 @@ TaskPushNotificationConfig taskConfig = TaskPushNotificationConfig.builder()
.pushNotificationConfig(pushNotificationConfig)
.build();

TaskPushNotificationConfig result = client.setTaskPushNotificationConfiguration(taskConfig);
TaskPushNotificationConfig result = client.createTaskPushNotificationConfiguration(taskConfig);

// You can also optionally specify a ClientCallContext with call-specific config to use
TaskPushNotificationConfig result = client.setTaskPushNotificationConfiguration(taskConfig, clientCallContext);
TaskPushNotificationConfig result = client.createTaskPushNotificationConfiguration(taskConfig, clientCallContext);
```

#### List the push notification configurations for a task
Expand Down
10 changes: 5 additions & 5 deletions client/base/src/main/java/io/a2a/client/AbstractClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,26 +224,26 @@ public Task cancelTask(TaskIdParams request) throws A2AClientException {
public abstract Task cancelTask(TaskIdParams request, @Nullable ClientCallContext context) throws A2AClientException;

/**
* Set or update the push notification configuration for a specific task.
* Create or update the push notification configuration for a specific task.
*
* @param request the push notification configuration to set for the task
* @return the configured TaskPushNotificationConfig
* @throws A2AClientException if setting the task push notification configuration fails for any reason
*/
public TaskPushNotificationConfig setTaskPushNotificationConfiguration(
public TaskPushNotificationConfig createTaskPushNotificationConfiguration(
TaskPushNotificationConfig request) throws A2AClientException {
return setTaskPushNotificationConfiguration(request, null);
return createTaskPushNotificationConfiguration(request, null);
}

/**
* Set or update the push notification configuration for a specific task.
* Create or update the push notification configuration for a specific task.
*
* @param request the push notification configuration to set for the task
* @param context optional client call context for the request (may be {@code null})
* @return the configured TaskPushNotificationConfig
* @throws A2AClientException if setting the task push notification configuration fails for any reason
*/
public abstract TaskPushNotificationConfig setTaskPushNotificationConfiguration(
public abstract TaskPushNotificationConfig createTaskPushNotificationConfiguration(
TaskPushNotificationConfig request,
@Nullable ClientCallContext context) throws A2AClientException;

Expand Down
6 changes: 3 additions & 3 deletions client/base/src/main/java/io/a2a/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ public Task cancelTask(TaskIdParams request, @Nullable ClientCallContext context
* )
* )
* );
* client.setTaskPushNotificationConfiguration(config);
* client.createTaskPushNotificationConfiguration(config);
* }</pre>
*
* @param request the push notification configuration for the task
Expand All @@ -442,9 +442,9 @@ public Task cancelTask(TaskIdParams request, @Nullable ClientCallContext context
* @see PushNotificationConfig
*/
@Override
public TaskPushNotificationConfig setTaskPushNotificationConfiguration(
public TaskPushNotificationConfig createTaskPushNotificationConfiguration(
TaskPushNotificationConfig request, @Nullable ClientCallContext context) throws A2AClientException {
return clientTransport.setTaskPushNotificationConfiguration(request, context);
return clientTransport.createTaskPushNotificationConfiguration(request, context);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class ClientBuilderTest {
.capabilities(AgentCapabilities.builder()
.streaming(true)
.pushNotifications(true)
.stateTransitionHistory(true)
.build())
.defaultInputModes(Collections.singletonList("text"))
.defaultOutputModes(Collections.singletonList("text"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@ public ListTasksResult listTasks(ListTasksParams request, @Nullable ClientCallCo
}

@Override
public TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushNotificationConfig request,
@Nullable ClientCallContext context) throws A2AClientException {
public TaskPushNotificationConfig createTaskPushNotificationConfiguration(TaskPushNotificationConfig request,
@Nullable ClientCallContext context) throws A2AClientException {
checkNotNullParam("request", request);

String configId = request.pushNotificationConfig().id();
io.a2a.grpc.SetTaskPushNotificationConfigRequest grpcRequest = io.a2a.grpc.SetTaskPushNotificationConfigRequest.newBuilder()
io.a2a.grpc.CreateTaskPushNotificationConfigRequest grpcRequest = io.a2a.grpc.CreateTaskPushNotificationConfigRequest.newBuilder()
.setParent("tasks/" + request.taskId())
.setConfig(ToProto.taskPushNotificationConfig(request))
.setConfigId(configId != null ? configId : request.taskId())
Expand All @@ -244,7 +244,7 @@ public TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushN

try {
A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders);
return FromProto.taskPushNotificationConfig(stubWithMetadata.setTaskPushNotificationConfig(grpcRequest));
return FromProto.taskPushNotificationConfig(stubWithMetadata.createTaskPushNotificationConfig(grpcRequest));
} catch (StatusRuntimeException | StatusException e) {
throw GrpcErrorMapper.mapGrpcError(e, "Failed to create task push notification config: ");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import io.a2a.jsonrpc.common.wrappers.ListTasksResponse;
import io.a2a.jsonrpc.common.wrappers.ListTasksResult;
import io.a2a.jsonrpc.common.wrappers.SendMessageResponse;
import io.a2a.jsonrpc.common.wrappers.SetTaskPushNotificationConfigResponse;
import io.a2a.jsonrpc.common.wrappers.CreateTaskPushNotificationConfigResponse;
import io.a2a.spec.A2AClientError;
import io.a2a.spec.A2AClientException;
import io.a2a.spec.A2AError;
Expand Down Expand Up @@ -182,15 +182,15 @@ public ListTasksResult listTasks(ListTasksParams request, @Nullable ClientCallCo
}

@Override
public TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushNotificationConfig request,
@Nullable ClientCallContext context) throws A2AClientException {
public TaskPushNotificationConfig createTaskPushNotificationConfiguration(TaskPushNotificationConfig request,
@Nullable ClientCallContext context) throws A2AClientException {
checkNotNullParam("request", request);
PayloadAndHeaders payloadAndHeaders = applyInterceptors(SET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD,
ProtoUtils.ToProto.setTaskPushNotificationConfigRequest(request), agentCard, context);
ProtoUtils.ToProto.CreateTaskPushNotificationConfigRequest(request), agentCard, context);

try {
String httpResponseBody = sendPostRequest(Utils.buildBaseUrl(agentInterface, request.tenant()), payloadAndHeaders, SET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD);
SetTaskPushNotificationConfigResponse response = unmarshalResponse(httpResponseBody, SET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD);
CreateTaskPushNotificationConfigResponse response = unmarshalResponse(httpResponseBody, SET_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
@@ -1,7 +1,5 @@
package io.a2a.client.transport.jsonrpc;

import static io.a2a.client.transport.jsonrpc.JsonMessages.AGENT_CARD;
import static io.a2a.client.transport.jsonrpc.JsonMessages.AGENT_CARD_SUPPORTS_EXTENDED;
import static io.a2a.client.transport.jsonrpc.JsonMessages.CANCEL_TASK_TEST_REQUEST;
import static io.a2a.client.transport.jsonrpc.JsonMessages.CANCEL_TASK_TEST_RESPONSE;
import static io.a2a.client.transport.jsonrpc.JsonMessages.GET_AUTHENTICATED_EXTENDED_AGENT_CARD_REQUEST;
Expand Down Expand Up @@ -43,7 +41,6 @@
import io.a2a.spec.AgentCard;
import io.a2a.spec.ExtensionSupportRequiredError;
import io.a2a.spec.VersionNotSupportedError;
import io.a2a.spec.AgentInterface;
import io.a2a.spec.AgentSkill;
import io.a2a.spec.Artifact;
import io.a2a.spec.AuthenticationInfo;
Expand All @@ -67,7 +64,6 @@
import io.a2a.spec.TaskQueryParams;
import io.a2a.spec.TaskState;
import io.a2a.spec.TextPart;
import io.a2a.spec.TransportProtocol;
import io.a2a.util.Utils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -322,7 +318,7 @@ public void testA2AClientGetTaskPushNotificationConfig() throws Exception {
}

@Test
public void testA2AClientSetTaskPushNotificationConfig() throws Exception {
public void testA2AClientCreateTaskPushNotificationConfig() throws Exception {
this.server.when(
request()
.withMethod("POST")
Expand All @@ -337,7 +333,7 @@ public void testA2AClientSetTaskPushNotificationConfig() throws Exception {
);

JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001");
TaskPushNotificationConfig taskPushNotificationConfig = client.setTaskPushNotificationConfiguration(
TaskPushNotificationConfig taskPushNotificationConfig = client.createTaskPushNotificationConfiguration(
new TaskPushNotificationConfig("de38c76d-d54c-436c-8b9f-4c2703648d64",
PushNotificationConfig.builder()
.id("c295ea44-7543-4f78-b524-7a38915ad6e4")
Expand Down Expand Up @@ -378,7 +374,6 @@ public void testA2AClientGetExtendedAgentCard() throws Exception {
assertEquals("https://docs.examplegeoservices.com/georoute-agent/api", agentCard.documentationUrl());
assertTrue(agentCard.capabilities().streaming());
assertTrue(agentCard.capabilities().pushNotifications());
assertFalse(agentCard.capabilities().stateTransitionHistory());
assertTrue(agentCard.capabilities().extendedAgentCard());
Map<String, SecurityScheme> securitySchemes = agentCard.securitySchemes();
assertNotNull(securitySchemes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class JsonMessages {
"capabilities": {
"streaming": true,
"pushNotifications": true,
"stateTransitionHistory": false,
"extendedAgentCard": false
},
"securitySchemes": {
Expand Down Expand Up @@ -340,7 +339,7 @@ public class JsonMessages {
static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST = """
{
"jsonrpc":"2.0",
"method":"SetTaskPushNotificationConfig",
"method":"CreateTaskPushNotificationConfig",
"params":{
"parent":"tasks/de38c76d-d54c-436c-8b9f-4c2703648d64",
"configId":"c295ea44-7543-4f78-b524-7a38915ad6e4",
Expand Down Expand Up @@ -610,7 +609,6 @@ public class JsonMessages {
"capabilities": {
"streaming": true,
"pushNotifications": true,
"stateTransitionHistory": false,
"extendedAgentCard": true
},
"securitySchemes": {
Expand Down Expand Up @@ -691,7 +689,6 @@ public class JsonMessages {
"capabilities": {
"streaming": true,
"pushNotifications": true,
"stateTransitionHistory": false,
"extendedAgentCard": true
},
"securitySchemes": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ private String buildListTasksQueryString(ListTasksParams request) {
}

@Override
public TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushNotificationConfig request, @Nullable ClientCallContext context) throws A2AClientException {
public TaskPushNotificationConfig createTaskPushNotificationConfiguration(TaskPushNotificationConfig request, @Nullable ClientCallContext context) throws A2AClientException {
checkNotNullParam("request", request);
io.a2a.grpc.SetTaskPushNotificationConfigRequest.Builder builder
= io.a2a.grpc.SetTaskPushNotificationConfigRequest.newBuilder();
io.a2a.grpc.CreateTaskPushNotificationConfigRequest.Builder builder
= io.a2a.grpc.CreateTaskPushNotificationConfigRequest.newBuilder();
builder.setConfig(ProtoUtils.ToProto.taskPushNotificationConfig(request))
.setParent("tasks/" + request.taskId());
if (request.pushNotificationConfig().id() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ public class JsonRestMessages {
"documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api",
"capabilities": {
"streaming": true,
"pushNotifications": true,
"stateTransitionHistory": false
"pushNotifications": true
},
"securitySchemes": {
"google": {
Expand Down Expand Up @@ -188,8 +187,7 @@ public class JsonRestMessages {
"documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api",
"capabilities": {
"streaming": true,
"pushNotifications": true,
"stateTransitionHistory": false
"pushNotifications": true
},
"securitySchemes": {
"google": {
Expand Down Expand Up @@ -255,8 +253,7 @@ public class JsonRestMessages {
"documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api",
"capabilities": {
"streaming": true,
"pushNotifications": true,
"stateTransitionHistory": false
"pushNotifications": true
},
"securitySchemes": {
"google": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public class RestTransportTest {
.capabilities(AgentCapabilities.builder()
.streaming(true)
.pushNotifications(true)
.stateTransitionHistory(true)
.build())
.defaultInputModes(Collections.singletonList("text"))
.defaultOutputModes(Collections.singletonList("text"))
Expand Down Expand Up @@ -287,11 +286,11 @@ public void testSendMessageStreaming() throws Exception {
}

/**
* Test of setTaskPushNotificationConfiguration method, of class JSONRestTransport.
* Test of CreateTaskPushNotificationConfiguration method, of class JSONRestTransport.
*/
@Test
public void testSetTaskPushNotificationConfiguration() throws Exception {
log.info("Testing setTaskPushNotificationConfiguration");
public void testCreateTaskPushNotificationConfiguration() throws Exception {
log.info("Testing CreateTaskPushNotificationConfiguration");
this.server.when(
request()
.withMethod("POST")
Expand All @@ -312,7 +311,7 @@ public void testSetTaskPushNotificationConfiguration() throws Exception {
.authentication(
new AuthenticationInfo(Collections.singletonList("jwt"), null))
.build(), "tenant");
TaskPushNotificationConfig taskPushNotificationConfig = client.setTaskPushNotificationConfiguration(pushedConfig, null);
TaskPushNotificationConfig taskPushNotificationConfig = client.createTaskPushNotificationConfiguration(pushedConfig, null);
PushNotificationConfig pushNotificationConfig = taskPushNotificationConfig.pushNotificationConfig();
assertNotNull(pushNotificationConfig);
assertEquals("https://example.com/callback", pushNotificationConfig.url());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ void sendMessageStreaming(MessageSendParams request, Consumer<StreamingEventKind
ListTasksResult listTasks(ListTasksParams request, @Nullable ClientCallContext context) throws A2AClientException;

/**
* Set or update the push notification configuration for a specific task.
* Create or update the push notification configuration for a specific task.
*
* @param request the push notification configuration to set for the task
* @param context optional client call context for the request (may be {@code null})
* @return the configured TaskPushNotificationConfig
* @throws A2AClientException if setting the task push notification configuration fails for any reason
* @throws A2AClientException if creating or updating the task push notification configuration fails for any reason
*/
TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushNotificationConfig request,
@Nullable ClientCallContext context) throws A2AClientException;
TaskPushNotificationConfig createTaskPushNotificationConfiguration(TaskPushNotificationConfig request,
@Nullable ClientCallContext context) throws A2AClientException;

/**
* Retrieve the push notification configuration for a specific task.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public AgentCard agentCard() {
.capabilities(AgentCapabilities.builder()
.streaming(true)
.pushNotifications(false)
.stateTransitionHistory(false)
.build())
.defaultInputModes(Collections.singletonList("text"))
.defaultOutputModes(Collections.singletonList("text"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public AgentCard agentCard() {
.capabilities(AgentCapabilities.builder()
.streaming(true)
.pushNotifications(true)
.stateTransitionHistory(true)
.build())
.defaultInputModes(Collections.singletonList("text"))
.defaultOutputModes(Collections.singletonList("text"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void testJpaDatabasePushNotificationConfigStoreIntegration() throws Excep
.build();

TaskPushNotificationConfig taskPushConfig = new TaskPushNotificationConfig(taskId, pushConfig, "");
TaskPushNotificationConfig setResult = client.setTaskPushNotificationConfiguration(taskPushConfig);
TaskPushNotificationConfig setResult = client.createTaskPushNotificationConfiguration(taskPushConfig);
assertNotNull(setResult);

// Step 3: Verify the configuration was stored using client API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public static AgentCard createAgentCard(int instanceNumber, int port) {
.capabilities(AgentCapabilities.builder()
.streaming(true)
.pushNotifications(false)
.stateTransitionHistory(false)
.build())
.defaultInputModes(Collections.singletonList("text"))
.defaultOutputModes(Collections.singletonList("text"))
Expand Down
Loading