Class: A2A::Types::TaskStatusUpdateEvent
- Defined in:
- lib/a2a/types/events.rb
Overview
Represents a task status update event
These events are sent when a task's status changes, allowing clients to track task progress in real-time.
Instance Attribute Summary collapse
-
#context_id ⇒ Object
readonly
Returns the value of attribute context_id.
-
#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.
Instance Method Summary collapse
-
#event_type ⇒ String
Get the event type.
-
#initialize(task_id:, context_id:, status:, metadata: nil) ⇒ TaskStatusUpdateEvent
constructor
Initialize a new task status update event.
-
#terminal? ⇒ Boolean
Check if this is a terminal status update.
- #validate! ⇒ Object private
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:, status:, metadata: nil) ⇒ TaskStatusUpdateEvent
Initialize a new task status update event
21 22 23 24 25 26 27 28 |
# File 'lib/a2a/types/events.rb', line 21 def initialize(task_id:, context_id:, status:, metadata: nil) @task_id = task_id @context_id = context_id @status = status.is_a?(TaskStatus) ? status : TaskStatus.from_h(status) = validate! end |
Instance Attribute Details
#context_id ⇒ Object (readonly)
Returns the value of attribute context_id.
12 13 14 |
# File 'lib/a2a/types/events.rb', line 12 def context_id @context_id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
12 13 14 |
# File 'lib/a2a/types/events.rb', line 12 def end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
12 13 14 |
# File 'lib/a2a/types/events.rb', line 12 def status @status end |
#task_id ⇒ Object (readonly)
Returns the value of attribute task_id.
12 13 14 |
# File 'lib/a2a/types/events.rb', line 12 def task_id @task_id end |
Instance Method Details
#event_type ⇒ String
Get the event type
34 35 36 |
# File 'lib/a2a/types/events.rb', line 34 def event_type "task_status_update" end |
#terminal? ⇒ Boolean
Check if this is a terminal status update
42 43 44 |
# File 'lib/a2a/types/events.rb', line 42 def terminal? @status.state.in?(%w[completed canceled failed rejected]) end |
#validate! ⇒ Object (private)
48 49 50 51 52 53 |
# File 'lib/a2a/types/events.rb', line 48 def validate! validate_required(:task_id, :context_id, :status) validate_type(:task_id, String) validate_type(:context_id, String) validate_type(:status, TaskStatus) end |