Package org.a2aproject.sdk.spec
Class TaskArtifactUpdateEvent.Builder
java.lang.Object
org.a2aproject.sdk.spec.TaskArtifactUpdateEvent.Builder
- Enclosing class:
- TaskArtifactUpdateEvent
Builder for constructing
TaskArtifactUpdateEvent instances.
Example for complete artifact:
TaskArtifactUpdateEvent event = TaskArtifactUpdateEvent.builder()
.taskId("task-123")
.contextId("ctx-456")
.artifact(new Artifact.Builder()
.artifactId("artifact-789")
.parts(List.of(new TextPart("Analysis complete")))
.build())
.build();
Example for incremental chunk:
TaskArtifactUpdateEvent chunk = TaskArtifactUpdateEvent.builder()
.taskId("task-123")
.contextId("ctx-456")
.artifact(new Artifact.Builder()
.artifactId("artifact-789")
.parts(List.of(new TextPart("more text...")))
.build())
.append(true)
.lastChunk(false)
.build();
-
Method Summary
Modifier and TypeMethodDescriptionSets whether this update should append to an existing artifact.Sets the artifact being updated.build()Builds the TaskArtifactUpdateEvent.Sets the context identifier.Sets whether this is the final chunk for the artifact.Sets the metadata for this event.Sets the task identifier.
-
Method Details
-
taskId
Sets the task identifier.- Parameters:
taskId- the task ID (required)- Returns:
- this builder for method chaining
-
artifact
Sets the artifact being updated.- Parameters:
artifact- the artifact (required)- Returns:
- this builder for method chaining
-
contextId
Sets the context identifier.- Parameters:
contextId- the context ID (required)- Returns:
- this builder for method chaining
-
append
Sets whether this update should append to an existing artifact.- Parameters:
append- true to append, false or null for new artifact- Returns:
- this builder for method chaining
-
lastChunk
Sets whether this is the final chunk for the artifact.- Parameters:
lastChunk- true if final chunk, false or null otherwise- Returns:
- this builder for method chaining
-
metadata
Sets the metadata for this event.- Parameters:
metadata- map of metadata key-value pairs (optional)- Returns:
- this builder for method chaining
-
build
Builds the TaskArtifactUpdateEvent.- Returns:
- a new TaskArtifactUpdateEvent instance
- Throws:
IllegalArgumentException- if required fields are missing
-