Class: Vapi::ClientInboundMessageAddMessage
- Inherits:
-
Object
- Object
- Vapi::ClientInboundMessageAddMessage
- Defined in:
- lib/vapi_server_sdk/types/client_inbound_message_add_message.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#message ⇒ Vapi::OpenAiMessage
readonly
This is the message to add to the conversation.
-
#trigger_response_enabled ⇒ Boolean
readonly
This is the flag to trigger a response, or to insert the message into the conversation history silently.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ClientInboundMessageAddMessage
Deserialize a JSON object to an instance of ClientInboundMessageAddMessage.
-
.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(message:, trigger_response_enabled: OMIT, additional_properties: nil) ⇒ Vapi::ClientInboundMessageAddMessage constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ClientInboundMessageAddMessage to a JSON object.
Constructor Details
#initialize(message:, trigger_response_enabled: OMIT, additional_properties: nil) ⇒ Vapi::ClientInboundMessageAddMessage
35 36 37 38 39 40 41 42 |
# File 'lib/vapi_server_sdk/types/client_inbound_message_add_message.rb', line 35 def initialize(message:, trigger_response_enabled: OMIT, additional_properties: nil) @message = @trigger_response_enabled = trigger_response_enabled if trigger_response_enabled != OMIT @additional_properties = additional_properties @_field_set = { "message": , "triggerResponseEnabled": trigger_response_enabled }.reject do |_k, v| v == OMIT end 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/client_inbound_message_add_message.rb', line 19 def additional_properties @additional_properties end |
#message ⇒ Vapi::OpenAiMessage (readonly)
Returns This is the message to add to the conversation.
10 11 12 |
# File 'lib/vapi_server_sdk/types/client_inbound_message_add_message.rb', line 10 def @message end |
#trigger_response_enabled ⇒ Boolean (readonly)
Returns This is the flag to trigger a response, or to insert the message into the conversation history silently. Defaults to ‘true`. Usage:
-
Use ‘true` to trigger a response.
-
Use ‘false` to insert the message into the conversation history silently.
@default true.
17 18 19 |
# File 'lib/vapi_server_sdk/types/client_inbound_message_add_message.rb', line 17 def trigger_response_enabled @trigger_response_enabled end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ClientInboundMessageAddMessage
Deserialize a JSON object to an instance of ClientInboundMessageAddMessage
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/vapi_server_sdk/types/client_inbound_message_add_message.rb', line 48 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["message"].nil? = nil else = parsed_json["message"].to_json = Vapi::OpenAiMessage.from_json(json_object: ) end trigger_response_enabled = parsed_json["triggerResponseEnabled"] new( message: , trigger_response_enabled: trigger_response_enabled, 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.
78 79 80 81 |
# File 'lib/vapi_server_sdk/types/client_inbound_message_add_message.rb', line 78 def self.validate_raw(obj:) Vapi::OpenAiMessage.validate_raw(obj: obj.) obj.trigger_response_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.trigger_response_enabled is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ClientInboundMessageAddMessage to a JSON object
68 69 70 |
# File 'lib/vapi_server_sdk/types/client_inbound_message_add_message.rb', line 68 def to_json(*_args) @_field_set&.to_json end |