Class: Vapi::ServerMessageStatusUpdate
- Inherits:
-
Object
- Object
- Vapi::ServerMessageStatusUpdate
- Defined in:
- lib/vapi_server_sdk/types/server_message_status_update.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#artifact ⇒ Vapi::Artifact
readonly
This is a live version of the ‘call.artifact`.
-
#assistant ⇒ Vapi::CreateAssistantDto
readonly
This is the assistant that is currently active.
-
#call ⇒ Vapi::Call
readonly
This is the call object.
-
#customer ⇒ Vapi::CreateCustomerDto
readonly
This is the customer associated with the call.
-
#destination ⇒ Vapi::ServerMessageStatusUpdateDestination
readonly
This is the destination the call is being transferred to.
-
#ended_reason ⇒ Vapi::ServerMessageStatusUpdateEndedReason
readonly
This is the reason the call ended.
-
#inbound_phone_call_debugging_artifacts ⇒ Hash{String => Object}
readonly
This is the inbound phone call debugging artifacts.
-
#messages ⇒ Array<Vapi::ServerMessageStatusUpdateMessagesItem>
readonly
These are the conversation messages of the call.
-
#messages_open_ai_formatted ⇒ Array<Vapi::OpenAiMessage>
readonly
These are the conversation messages of the call.
-
#phone_number ⇒ Vapi::ServerMessageStatusUpdatePhoneNumber
readonly
This is the phone number associated with the call.
-
#status ⇒ Vapi::ServerMessageStatusUpdateStatus
readonly
This is the status of the call.
-
#timestamp ⇒ String
readonly
This is the ISO-8601 formatted timestamp of when the message was sent.
-
#transcript ⇒ String
readonly
This is the transcript of the call.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ServerMessageStatusUpdate
Deserialize a JSON object to an instance of ServerMessageStatusUpdate.
-
.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(status:, phone_number: OMIT, ended_reason: OMIT, messages: OMIT, messages_open_ai_formatted: OMIT, destination: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, transcript: OMIT, inbound_phone_call_debugging_artifacts: OMIT, additional_properties: nil) ⇒ Vapi::ServerMessageStatusUpdate constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ServerMessageStatusUpdate to a JSON object.
Constructor Details
#initialize(status:, phone_number: OMIT, ended_reason: OMIT, messages: OMIT, messages_open_ai_formatted: OMIT, destination: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, transcript: OMIT, inbound_phone_call_debugging_artifacts: OMIT, additional_properties: nil) ⇒ Vapi::ServerMessageStatusUpdate
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 115 def initialize(status:, phone_number: OMIT, ended_reason: OMIT, messages: OMIT, messages_open_ai_formatted: OMIT, destination: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, transcript: OMIT, inbound_phone_call_debugging_artifacts: OMIT, additional_properties: nil) @phone_number = phone_number if phone_number != OMIT @status = status @ended_reason = ended_reason if ended_reason != OMIT @messages = if != OMIT @messages_open_ai_formatted = if != OMIT @destination = destination if destination != OMIT @timestamp = if != OMIT @artifact = artifact if artifact != OMIT @assistant = assistant if assistant != OMIT @customer = customer if customer != OMIT @call = call if call != OMIT @transcript = transcript if transcript != OMIT if inbound_phone_call_debugging_artifacts != OMIT @inbound_phone_call_debugging_artifacts = inbound_phone_call_debugging_artifacts end @additional_properties = additional_properties @_field_set = { "phoneNumber": phone_number, "status": status, "endedReason": ended_reason, "messages": , "messagesOpenAIFormatted": , "destination": destination, "timestamp": , "artifact": artifact, "assistant": assistant, "customer": customer, "call": call, "transcript": transcript, "inboundPhoneCallDebuggingArtifacts": inbound_phone_call_debugging_artifacts }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
69 70 71 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 69 def additional_properties @additional_properties end |
#artifact ⇒ Vapi::Artifact (readonly)
Returns This is a live version of the ‘call.artifact`. This matches what is stored on `call.artifact` after the call.
40 41 42 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 40 def artifact @artifact end |
#assistant ⇒ Vapi::CreateAssistantDto (readonly)
Returns This is the assistant that is currently active. This is provided for convenience. This matches one of the following:
-
‘call.assistant`,
-
‘call.assistantId`,
-
‘call.squad.assistant`,
-
‘call.squad.assistantId`,
-
‘call.squadId->.assistant`,
-
‘call.squadId->.assistantId`.
50 51 52 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 50 def assistant @assistant end |
#call ⇒ Vapi::Call (readonly)
Returns This is the call object. This matches what was returned in POST /call. Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.
60 61 62 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 60 def call @call end |
#customer ⇒ Vapi::CreateCustomerDto (readonly)
Returns This is the customer associated with the call. This matches one of the following:
-
‘call.customer`,
-
‘call.customerId`.
55 56 57 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 55 def customer @customer end |
#destination ⇒ Vapi::ServerMessageStatusUpdateDestination (readonly)
Returns This is the destination the call is being transferred to. This is only sent if the status is “forwarding”.
35 36 37 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 35 def destination @destination end |
#ended_reason ⇒ Vapi::ServerMessageStatusUpdateEndedReason (readonly)
Returns This is the reason the call ended. This is only sent if the status is “ended”.
26 27 28 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 26 def ended_reason @ended_reason end |
#inbound_phone_call_debugging_artifacts ⇒ Hash{String => Object} (readonly)
Returns This is the inbound phone call debugging artifacts. This is only sent if the status is “ended” and there was an error accepting the inbound phone call. This will include any errors related to the “assistant-request” if one was made.
67 68 69 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 67 def inbound_phone_call_debugging_artifacts @inbound_phone_call_debugging_artifacts end |
#messages ⇒ Array<Vapi::ServerMessageStatusUpdateMessagesItem> (readonly)
Returns These are the conversation messages of the call. This is only sent if the status is “forwarding”.
29 30 31 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 29 def @messages end |
#messages_open_ai_formatted ⇒ Array<Vapi::OpenAiMessage> (readonly)
Returns These are the conversation messages of the call. This is only sent if the status is “forwarding”.
32 33 34 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 32 def @messages_open_ai_formatted end |
#phone_number ⇒ Vapi::ServerMessageStatusUpdatePhoneNumber (readonly)
Returns This is the phone number associated with the call. This matches one of the following:
-
‘call.phoneNumber`,
-
‘call.phoneNumberId`.
22 23 24 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 22 def phone_number @phone_number end |
#status ⇒ Vapi::ServerMessageStatusUpdateStatus (readonly)
Returns This is the status of the call.
24 25 26 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 24 def status @status end |
#timestamp ⇒ String (readonly)
Returns This is the ISO-8601 formatted timestamp of when the message was sent.
37 38 39 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 37 def @timestamp end |
#transcript ⇒ String (readonly)
Returns This is the transcript of the call. This is only sent if the status is “forwarding”.
63 64 65 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 63 def transcript @transcript end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ServerMessageStatusUpdate
Deserialize a JSON object to an instance of ServerMessageStatusUpdate
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 156 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["phoneNumber"].nil? phone_number = nil else phone_number = parsed_json["phoneNumber"].to_json phone_number = Vapi::ServerMessageStatusUpdatePhoneNumber.from_json(json_object: phone_number) end status = parsed_json["status"] ended_reason = parsed_json["endedReason"] = parsed_json["messages"]&.map do |item| item = item.to_json Vapi::ServerMessageStatusUpdateMessagesItem.from_json(json_object: item) end = parsed_json["messagesOpenAIFormatted"]&.map do |item| item = item.to_json Vapi::OpenAiMessage.from_json(json_object: item) end if parsed_json["destination"].nil? destination = nil else destination = parsed_json["destination"].to_json destination = Vapi::ServerMessageStatusUpdateDestination.from_json(json_object: destination) end = parsed_json["timestamp"] if parsed_json["artifact"].nil? artifact = nil else artifact = parsed_json["artifact"].to_json artifact = Vapi::Artifact.from_json(json_object: artifact) end if parsed_json["assistant"].nil? assistant = nil else assistant = parsed_json["assistant"].to_json assistant = Vapi::CreateAssistantDto.from_json(json_object: assistant) end if parsed_json["customer"].nil? customer = nil else customer = parsed_json["customer"].to_json customer = Vapi::CreateCustomerDto.from_json(json_object: customer) end if parsed_json["call"].nil? call = nil else call = parsed_json["call"].to_json call = Vapi::Call.from_json(json_object: call) end transcript = parsed_json["transcript"] inbound_phone_call_debugging_artifacts = parsed_json["inboundPhoneCallDebuggingArtifacts"] new( phone_number: phone_number, status: status, ended_reason: ended_reason, messages: , messages_open_ai_formatted: , destination: destination, timestamp: , artifact: artifact, assistant: assistant, customer: customer, call: call, transcript: transcript, inbound_phone_call_debugging_artifacts: inbound_phone_call_debugging_artifacts, 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.
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 239 def self.validate_raw(obj:) obj.phone_number.nil? || Vapi::ServerMessageStatusUpdatePhoneNumber.validate_raw(obj: obj.phone_number) obj.status.is_a?(Vapi::ServerMessageStatusUpdateStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.ended_reason&.is_a?(Vapi::ServerMessageStatusUpdateEndedReason) != false || raise("Passed value for field obj.ended_reason is not the expected type, validation failed.") obj.&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj.&.is_a?(Array) != false || raise("Passed value for field obj.messages_open_ai_formatted is not the expected type, validation failed.") obj.destination.nil? || Vapi::ServerMessageStatusUpdateDestination.validate_raw(obj: obj.destination) obj.&.is_a?(String) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.") obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact) obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant) obj.customer.nil? || Vapi::CreateCustomerDto.validate_raw(obj: obj.customer) obj.call.nil? || Vapi::Call.validate_raw(obj: obj.call) obj.transcript&.is_a?(String) != false || raise("Passed value for field obj.transcript is not the expected type, validation failed.") obj.inbound_phone_call_debugging_artifacts&.is_a?(Hash) != false || raise("Passed value for field obj.inbound_phone_call_debugging_artifacts is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ServerMessageStatusUpdate to a JSON object
229 230 231 |
# File 'lib/vapi_server_sdk/types/server_message_status_update.rb', line 229 def to_json(*_args) @_field_set&.to_json end |