Class: A2A::Types::TaskArtifactUpdateEvent

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/a2a/types/events.rb

Overview

Represents a task artifact update event

These events are sent when artifacts are added or updated for a task, supporting streaming artifact delivery.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#==, #camelize, from_h, from_json, #hash, #to_h, #to_json, underscore, #valid?, #validate_array_type, #validate_inclusion, #validate_required, #validate_type

Constructor Details

#initialize(task_id:, context_id:, artifact:, append: false, metadata: nil) ⇒ TaskArtifactUpdateEvent

Initialize a new task artifact update event

Parameters:

  • The task identifier

  • The context identifier

  • The artifact being updated

  • (defaults to: false)

    Whether to append to existing artifact

  • (defaults to: nil)

    Additional event metadata



73
74
75
76
77
78
79
80
81
# File 'lib/a2a/types/events.rb', line 73

def initialize(task_id:, context_id:, artifact:, append: false, metadata: nil)
  @task_id = task_id
  @context_id = context_id
  @artifact = artifact.is_a?(Artifact) ? artifact : Artifact.from_h(artifact)
  @append = append
   = 

  validate!
end

Instance Attribute Details

#appendObject (readonly)

Returns the value of attribute append.



63
64
65
# File 'lib/a2a/types/events.rb', line 63

def append
  @append
end

#artifactObject (readonly)

Returns the value of attribute artifact.



63
64
65
# File 'lib/a2a/types/events.rb', line 63

def artifact
  @artifact
end

#context_idObject (readonly)

Returns the value of attribute context_id.



63
64
65
# File 'lib/a2a/types/events.rb', line 63

def context_id
  @context_id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



63
64
65
# File 'lib/a2a/types/events.rb', line 63

def 
  
end

#task_idObject (readonly)

Returns the value of attribute task_id.



63
64
65
# File 'lib/a2a/types/events.rb', line 63

def task_id
  @task_id
end

Instance Method Details

#append?Boolean

Check if this is an append operation

Returns:

  • True if appending to existing artifact



95
96
97
# File 'lib/a2a/types/events.rb', line 95

def append?
  @append
end

#event_typeString

Get the event type

Returns:

  • The event type



87
88
89
# File 'lib/a2a/types/events.rb', line 87

def event_type
  "task_artifact_update"
end

#replace?Boolean

Check if this is a replace operation

Returns:

  • True if replacing existing artifact



103
104
105
# File 'lib/a2a/types/events.rb', line 103

def replace?
  !@append
end

#validate!Object (private)



109
110
111
112
113
114
# File 'lib/a2a/types/events.rb', line 109

def validate!
  validate_required(:task_id, :context_id, :artifact)
  validate_type(:task_id, String)
  validate_type(:context_id, String)
  validate_type(:artifact, Artifact)
end