Class: A2A::Streaming::StatusUpdateEvent
- Inherits:
-
Object
- Object
- A2A::Streaming::StatusUpdateEvent
- Defined in:
- lib/a2a/streaming/status_update_event.rb
Overview
The ‘final` field is a gem-level streaming-termination hint, not in the A2A proto. Servers that set “final”: true signal this is the last status event for the task.
Instance Attribute Summary collapse
-
#context_id ⇒ Object
readonly
Returns the value of attribute context_id.
-
#final ⇒ Object
readonly
Returns the value of attribute final.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#task_id ⇒ Object
readonly
Returns the value of attribute task_id.
Class Method Summary collapse
Instance Method Summary collapse
- #final? ⇒ Boolean
-
#initialize(context_id:, task_id:, status:, **kwargs) ⇒ StatusUpdateEvent
constructor
A new instance of StatusUpdateEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(context_id:, task_id:, status:, **kwargs) ⇒ StatusUpdateEvent
Returns a new instance of StatusUpdateEvent.
10 11 12 13 14 15 16 17 18 |
# File 'lib/a2a/streaming/status_update_event.rb', line 10 def initialize(context_id:, task_id:, status:, **kwargs) raise TypeError, "status must be a Task::Status" unless status.is_a?(Task::Status) @context_id = context_id @task_id = task_id @status = status @final = kwargs.fetch(:final, false) @metadata = kwargs[:metadata] end |
Instance Attribute Details
#context_id ⇒ Object (readonly)
Returns the value of attribute context_id.
8 9 10 |
# File 'lib/a2a/streaming/status_update_event.rb', line 8 def context_id @context_id end |
#final ⇒ Object (readonly)
Returns the value of attribute final.
8 9 10 |
# File 'lib/a2a/streaming/status_update_event.rb', line 8 def final @final end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/a2a/streaming/status_update_event.rb', line 8 def @metadata end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/a2a/streaming/status_update_event.rb', line 8 def status @status end |
#task_id ⇒ Object (readonly)
Returns the value of attribute task_id.
8 9 10 |
# File 'lib/a2a/streaming/status_update_event.rb', line 8 def task_id @task_id end |
Class Method Details
.from_h(hash) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/a2a/streaming/status_update_event.rb', line 32 def self.from_h(hash) new( task_id: hash.fetch("taskId"), context_id: hash.fetch("contextId"), status: Task::Status.from_h(hash.fetch("status")), final: hash.fetch("final", false), metadata: hash["metadata"] ) end |
Instance Method Details
#final? ⇒ Boolean
20 |
# File 'lib/a2a/streaming/status_update_event.rb', line 20 def final? = @final |
#to_h ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/a2a/streaming/status_update_event.rb', line 22 def to_h { "taskId" => task_id, "contextId" => context_id, "status" => status.to_h, "final" => final, "metadata" => }.compact end |