2626import io .a2a .spec .Message ;
2727import io .a2a .spec .MessageSendConfiguration ;
2828import io .a2a .spec .MessageSendParams ;
29- import io .a2a .spec .PushNotificationConfig ;
3029import io .a2a .spec .StreamingEventKind ;
3130import io .a2a .spec .Task ;
3231import io .a2a .spec .TaskArtifactUpdateEvent ;
132131 * <b>Push notifications:</b> Configure webhooks to receive task updates:
133132 * <pre>{@code
134133 * // Configure push notifications for a task
135- * PushNotificationConfig pushConfig = new PushNotificationConfig(
136- * "https://my-app.com/webhooks/task-updates",
137- * Map.of("Authorization", "Bearer my-token")
138- * );
134+ * TaskPushNotificationConfig pushConfig = TaskPushNotificationConfig.builder()
135+ * .id("config-1")
136+ * .url("https://my-app.com/webhooks/task-updates")
137+ * .authentication(new AuthenticationInfo("Bearer", "my-token"))
138+ * .build();
139139 *
140140 * // Send message with push notifications
141141 * client.sendMessage(
@@ -236,7 +236,7 @@ public void sendMessage(@NonNull Message request,
236236 @ NonNull List <BiConsumer <ClientEvent , AgentCard >> consumers ,
237237 @ Nullable Consumer <Throwable > streamingErrorHandler ,
238238 @ Nullable ClientCallContext context ) throws A2AClientException {
239- MessageSendConfiguration messageSendConfiguration = createMessageSendConfiguration (clientConfig .getPushNotificationConfig ());
239+ MessageSendConfiguration messageSendConfiguration = createMessageSendConfiguration (clientConfig .getTaskPushNotificationConfig ());
240240
241241 MessageSendParams messageSendParams = MessageSendParams .builder ()
242242 .message (request )
@@ -267,10 +267,11 @@ public void sendMessage(@NonNull Message request,
267267 * <p>
268268 * <b>With push notifications:</b>
269269 * <pre>{@code
270- * PushNotificationConfig pushConfig = new PushNotificationConfig(
271- * "https://my-app.com/webhook",
272- * Map.of("Authorization", "Bearer token")
273- * );
270+ * TaskPushNotificationConfig pushConfig = TaskPushNotificationConfig.builder()
271+ * .id("config-1")
272+ * .url("https://my-app.com/webhook")
273+ * .authentication(new AuthenticationInfo("Bearer", "token"))
274+ * .build();
274275 * client.sendMessage(userMessage, pushConfig, null, null);
275276 * }</pre>
276277 * <p>
@@ -289,11 +290,11 @@ public void sendMessage(@NonNull Message request,
289290 * @param context custom call context for request interceptors (optional)
290291 * @throws A2AClientException if the message cannot be sent or if the agent returns an error
291292 * @see #sendMessage(Message, List, Consumer, ClientCallContext)
292- * @see PushNotificationConfig
293+ * @see TaskPushNotificationConfig
293294 */
294295 @ Override
295296 public void sendMessage (@ NonNull Message request ,
296- @ Nullable PushNotificationConfig pushNotificationConfiguration ,
297+ @ Nullable TaskPushNotificationConfig pushNotificationConfiguration ,
297298 @ Nullable Map <String , Object > metadata ,
298299 @ Nullable ClientCallContext context ) throws A2AClientException {
299300 MessageSendConfiguration messageSendConfiguration = createMessageSendConfiguration (pushNotificationConfiguration );
@@ -459,16 +460,12 @@ public Task cancelTask(CancelTaskParams request, @Nullable ClientCallContext con
459460 * <p>
460461 * Example:
461462 * <pre>{@code
462- * TaskPushNotificationConfig config = new TaskPushNotificationConfig(
463- * "task-123",
464- * new PushNotificationConfig(
465- * "https://my-app.com/webhooks/task-updates",
466- * Map.of(
467- * "Authorization", "Bearer my-webhook-secret",
468- * "X-App-ID", "my-app"
469- * )
470- * )
471- * );
463+ * TaskPushNotificationConfig config = TaskPushNotificationConfig.builder()
464+ * .id("config-1")
465+ * .taskId("task-123")
466+ * .url("https://my-app.com/webhooks/task-updates")
467+ * .authentication(new AuthenticationInfo("Bearer", "my-webhook-secret"))
468+ * .build();
472469 * client.createTaskPushNotificationConfiguration(config);
473470 * }</pre>
474471 *
@@ -477,7 +474,6 @@ public Task cancelTask(CancelTaskParams request, @Nullable ClientCallContext con
477474 * @return the stored configuration (may include server-assigned IDs)
478475 * @throws A2AClientException if the configuration cannot be set
479476 * @see TaskPushNotificationConfig
480- * @see PushNotificationConfig
481477 */
482478 @ Override
483479 public TaskPushNotificationConfig createTaskPushNotificationConfiguration (
@@ -495,7 +491,7 @@ public TaskPushNotificationConfig createTaskPushNotificationConfiguration(
495491 * TaskPushNotificationConfig config =
496492 * client.getTaskPushNotificationConfiguration(params);
497493 * System.out.println("Webhook URL: " +
498- * config.pushNotificationConfig(). url());
494+ * config.url());
499495 * }</pre>
500496 *
501497 * @param request the parameters specifying which task's configuration to retrieve
@@ -522,7 +518,7 @@ public TaskPushNotificationConfig getTaskPushNotificationConfiguration(
522518 * client.listTaskPushNotificationConfigurations(params);
523519 * for (TaskPushNotificationConfig config : result.configurations()) {
524520 * System.out.println("Task " + config.taskId() + " -> " +
525- * config.pushNotificationConfig(). url());
521+ * config.url());
526522 * }
527523 * }</pre>
528524 *
@@ -697,12 +693,12 @@ private ClientEvent getClientEvent(StreamingEventKind event, ClientTaskManager t
697693 }
698694 }
699695
700- private MessageSendConfiguration createMessageSendConfiguration (@ Nullable PushNotificationConfig pushNotificationConfig ) {
696+ private MessageSendConfiguration createMessageSendConfiguration (@ Nullable TaskPushNotificationConfig taskPushNotificationConfig ) {
701697 return MessageSendConfiguration .builder ()
702698 .acceptedOutputModes (clientConfig .getAcceptedOutputModes ())
703699 .blocking (!clientConfig .isPolling ())
704700 .historyLength (clientConfig .getHistoryLength ())
705- .pushNotificationConfig ( pushNotificationConfig )
701+ .taskPushNotificationConfig ( taskPushNotificationConfig )
706702 .build ();
707703 }
708704
0 commit comments