Class: A2A::Streaming::ArtifactUpdateEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/a2a/streaming/artifact_update_event.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task_id:, context_id:, artifact:, **kwargs) ⇒ ArtifactUpdateEvent

Returns a new instance of ArtifactUpdateEvent.



8
9
10
11
12
13
14
15
# File 'lib/a2a/streaming/artifact_update_event.rb', line 8

def initialize(task_id:, context_id:, artifact:, **kwargs)
  @task_id = task_id
  @context_id = context_id
  @artifact = artifact
  @append = kwargs[:append] || false
  @last_chunk = kwargs[:last_chunk] || false
  @metadata = kwargs[:metadata]
end

Instance Attribute Details

#appendObject (readonly)

Returns the value of attribute append.



6
7
8
# File 'lib/a2a/streaming/artifact_update_event.rb', line 6

def append
  @append
end

#artifactObject (readonly)

Returns the value of attribute artifact.



6
7
8
# File 'lib/a2a/streaming/artifact_update_event.rb', line 6

def artifact
  @artifact
end

#context_idObject (readonly)

Returns the value of attribute context_id.



6
7
8
# File 'lib/a2a/streaming/artifact_update_event.rb', line 6

def context_id
  @context_id
end

#last_chunkObject (readonly)

Returns the value of attribute last_chunk.



6
7
8
# File 'lib/a2a/streaming/artifact_update_event.rb', line 6

def last_chunk
  @last_chunk
end

#metadataObject (readonly)

Returns the value of attribute metadata.



6
7
8
# File 'lib/a2a/streaming/artifact_update_event.rb', line 6

def 
  @metadata
end

#task_idObject (readonly)

Returns the value of attribute task_id.



6
7
8
# File 'lib/a2a/streaming/artifact_update_event.rb', line 6

def task_id
  @task_id
end

Class Method Details

.from_h(hash) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/a2a/streaming/artifact_update_event.rb', line 28

def self.from_h(hash)
  new(
    task_id: hash.fetch("taskId"),
    context_id: hash.fetch("contextId"),
    artifact: Artifact.from_h(hash.fetch("artifact")),
    append: hash["append"],
    last_chunk: hash["lastChunk"],
    metadata: hash["metadata"]
  )
end

Instance Method Details

#to_hObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/a2a/streaming/artifact_update_event.rb', line 17

def to_h
  {
    "taskId" => task_id,
    "contextId" => context_id,
    "artifact" => artifact.to_h,
    "append" => append,
    "lastChunk" => last_chunk,
    "metadata" => 
  }.compact
end