Class: Vapi::ResponseTextDeltaEvent
- Inherits:
-
Object
- Object
- Vapi::ResponseTextDeltaEvent
- Defined in:
- lib/vapi_server_sdk/types/response_text_delta_event.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#content_index ⇒ Float
readonly
Index of the content part.
-
#delta ⇒ String
readonly
Text delta being added.
-
#item_id ⇒ String
readonly
ID of the output item.
-
#output_index ⇒ Float
readonly
Index of the output item.
-
#type ⇒ String
readonly
Event type.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ResponseTextDeltaEvent
Deserialize a JSON object to an instance of ResponseTextDeltaEvent.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(content_index:, delta:, item_id:, output_index:, type:, additional_properties: nil) ⇒ Vapi::ResponseTextDeltaEvent constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ResponseTextDeltaEvent to a JSON object.
Constructor Details
#initialize(content_index:, delta:, item_id:, output_index:, type:, additional_properties: nil) ⇒ Vapi::ResponseTextDeltaEvent
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vapi_server_sdk/types/response_text_delta_event.rb', line 33 def initialize(content_index:, delta:, item_id:, output_index:, type:, additional_properties: nil) @content_index = content_index @delta = delta @item_id = item_id @output_index = output_index @type = type @additional_properties = additional_properties @_field_set = { "content_index": content_index, "delta": delta, "item_id": item_id, "output_index": output_index, "type": type } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/vapi_server_sdk/types/response_text_delta_event.rb', line 19 def additional_properties @additional_properties end |
#content_index ⇒ Float (readonly)
Returns Index of the content part.
9 10 11 |
# File 'lib/vapi_server_sdk/types/response_text_delta_event.rb', line 9 def content_index @content_index end |
#delta ⇒ String (readonly)
Returns Text delta being added.
11 12 13 |
# File 'lib/vapi_server_sdk/types/response_text_delta_event.rb', line 11 def delta @delta end |
#item_id ⇒ String (readonly)
Returns ID of the output item.
13 14 15 |
# File 'lib/vapi_server_sdk/types/response_text_delta_event.rb', line 13 def item_id @item_id end |
#output_index ⇒ Float (readonly)
Returns Index of the output item.
15 16 17 |
# File 'lib/vapi_server_sdk/types/response_text_delta_event.rb', line 15 def output_index @output_index end |
#type ⇒ String (readonly)
Returns Event type.
17 18 19 |
# File 'lib/vapi_server_sdk/types/response_text_delta_event.rb', line 17 def type @type end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ResponseTextDeltaEvent
Deserialize a JSON object to an instance of ResponseTextDeltaEvent
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/vapi_server_sdk/types/response_text_delta_event.rb', line 53 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) content_index = parsed_json["content_index"] delta = parsed_json["delta"] item_id = parsed_json["item_id"] output_index = parsed_json["output_index"] type = parsed_json["type"] new( content_index: content_index, delta: delta, item_id: item_id, output_index: output_index, type: type, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
84 85 86 87 88 89 90 |
# File 'lib/vapi_server_sdk/types/response_text_delta_event.rb', line 84 def self.validate_raw(obj:) obj.content_index.is_a?(Float) != false || raise("Passed value for field obj.content_index is not the expected type, validation failed.") obj.delta.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.") obj.item_id.is_a?(String) != false || raise("Passed value for field obj.item_id is not the expected type, validation failed.") obj.output_index.is_a?(Float) != false || raise("Passed value for field obj.output_index is not the expected type, validation failed.") obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ResponseTextDeltaEvent to a JSON object
74 75 76 |
# File 'lib/vapi_server_sdk/types/response_text_delta_event.rb', line 74 def to_json(*_args) @_field_set&.to_json end |