vapi_server_sdk 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/lib/requests.rb +2 -2
  3. data/lib/types_export.rb +83 -12
  4. data/lib/vapi_server_sdk/analytics/client.rb +41 -26
  5. data/lib/vapi_server_sdk/assistants/client.rb +84 -84
  6. data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_server_messages_item.rb +1 -0
  7. data/lib/vapi_server_sdk/blocks/client.rb +0 -70
  8. data/lib/vapi_server_sdk/calls/client.rb +110 -76
  9. data/lib/vapi_server_sdk/files/client.rb +0 -70
  10. data/lib/vapi_server_sdk/knowledge_bases/client.rb +0 -70
  11. data/lib/vapi_server_sdk/logs/client.rb +15 -46
  12. data/lib/vapi_server_sdk/logs/types/logging_controller_logs_delete_query_request_type.rb +12 -0
  13. data/lib/vapi_server_sdk/phone_numbers/client.rb +0 -70
  14. data/lib/vapi_server_sdk/squads/client.rb +136 -78
  15. data/lib/vapi_server_sdk/test_suite_runs/client.rb +328 -0
  16. data/lib/vapi_server_sdk/test_suite_runs/types/test_suite_run_controller_find_all_paginated_request_sort_order.rb +10 -0
  17. data/lib/vapi_server_sdk/test_suite_tests/client.rb +331 -0
  18. data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_create_request.rb +81 -0
  19. data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_find_all_paginated_request_sort_order.rb +10 -0
  20. data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb +82 -0
  21. data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_update_request.rb +81 -0
  22. data/lib/vapi_server_sdk/test_suites/client.rb +338 -0
  23. data/lib/vapi_server_sdk/test_suites/types/test_suite_controller_find_all_paginated_request_sort_order.rb +10 -0
  24. data/lib/vapi_server_sdk/tools/client.rb +0 -70
  25. data/lib/vapi_server_sdk/types/ai_edge_condition.rb +55 -0
  26. data/lib/vapi_server_sdk/types/analytics_operation_column.rb +1 -0
  27. data/lib/vapi_server_sdk/types/analytics_operation_operation.rb +1 -0
  28. data/lib/vapi_server_sdk/types/analytics_query.rb +4 -3
  29. data/lib/vapi_server_sdk/types/analytics_query_table.rb +9 -0
  30. data/lib/vapi_server_sdk/types/api_request.rb +165 -0
  31. data/lib/vapi_server_sdk/types/api_request_method.rb +8 -0
  32. data/lib/vapi_server_sdk/types/api_request_mode.rb +10 -0
  33. data/lib/vapi_server_sdk/types/artifact.rb +12 -2
  34. data/lib/vapi_server_sdk/types/artifact_plan.rb +56 -8
  35. data/lib/vapi_server_sdk/types/assistant.rb +27 -13
  36. data/lib/vapi_server_sdk/types/assistant_hook_action_base.rb +47 -0
  37. data/lib/vapi_server_sdk/types/assistant_hook_filter.rb +72 -0
  38. data/lib/vapi_server_sdk/types/assistant_hooks.rb +82 -0
  39. data/lib/vapi_server_sdk/types/assistant_overrides.rb +28 -14
  40. data/lib/vapi_server_sdk/types/assistant_overrides_server_messages_item.rb +1 -0
  41. data/lib/vapi_server_sdk/types/assistant_server_messages_item.rb +1 -0
  42. data/lib/vapi_server_sdk/types/azure_credential_region.rb +4 -2
  43. data/lib/vapi_server_sdk/types/azure_open_ai_credential_models_item.rb +1 -0
  44. data/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb +4 -2
  45. data/lib/vapi_server_sdk/types/backoff_plan.rb +80 -0
  46. data/lib/vapi_server_sdk/types/bash_tool_with_tool_call.rb +175 -0
  47. data/lib/vapi_server_sdk/types/bash_tool_with_tool_call_messages_item.rb +120 -0
  48. data/lib/vapi_server_sdk/types/byo_phone_number.rb +10 -1
  49. data/lib/vapi_server_sdk/types/byo_phone_number_status.rb +10 -0
  50. data/lib/vapi_server_sdk/types/call_ended_reason.rb +10 -1
  51. data/lib/vapi_server_sdk/types/cartesia_experimental_controls.rb +69 -0
  52. data/lib/vapi_server_sdk/types/cartesia_experimental_controls_emotion.rb +26 -0
  53. data/lib/vapi_server_sdk/types/cartesia_experimental_controls_speed.rb +11 -0
  54. data/lib/vapi_server_sdk/types/cartesia_voice.rb +24 -10
  55. data/lib/vapi_server_sdk/types/chat_completion_message.rb +80 -0
  56. data/lib/vapi_server_sdk/types/chat_completion_message_metadata.rb +94 -0
  57. data/lib/vapi_server_sdk/types/chat_completions_dto.rb +84 -0
  58. data/lib/vapi_server_sdk/types/client_inbound_message_end_call.rb +47 -0
  59. data/lib/vapi_server_sdk/types/client_inbound_message_message.rb +13 -0
  60. data/lib/vapi_server_sdk/types/client_inbound_message_transfer.rb +13 -3
  61. data/lib/vapi_server_sdk/types/client_message_conversation_update.rb +15 -2
  62. data/lib/vapi_server_sdk/types/client_message_hang.rb +22 -4
  63. data/lib/vapi_server_sdk/types/client_message_language_change_detected.rb +15 -3
  64. data/lib/vapi_server_sdk/types/client_message_message.rb +165 -181
  65. data/lib/vapi_server_sdk/types/client_message_metadata.rb +15 -3
  66. data/lib/vapi_server_sdk/types/client_message_model_output.rb +15 -3
  67. data/lib/vapi_server_sdk/types/client_message_speech_update.rb +11 -2
  68. data/lib/vapi_server_sdk/types/client_message_tool_calls.rb +15 -2
  69. data/lib/vapi_server_sdk/types/client_message_tool_calls_result.rb +15 -3
  70. data/lib/vapi_server_sdk/types/client_message_tool_calls_tool_with_tool_call_list_item.rb +116 -77
  71. data/lib/vapi_server_sdk/types/client_message_transcript.rb +12 -2
  72. data/lib/vapi_server_sdk/types/client_message_transcript_type.rb +10 -0
  73. data/lib/vapi_server_sdk/types/client_message_transfer_update.rb +11 -1
  74. data/lib/vapi_server_sdk/types/client_message_user_interrupted.rb +14 -4
  75. data/lib/vapi_server_sdk/types/client_message_voice_input.rb +15 -3
  76. data/lib/vapi_server_sdk/types/client_message_workflow_node_started.rb +67 -0
  77. data/lib/vapi_server_sdk/types/compliance_plan.rb +77 -0
  78. data/lib/vapi_server_sdk/types/computer_tool_with_tool_call.rb +199 -0
  79. data/lib/vapi_server_sdk/types/computer_tool_with_tool_call_messages_item.rb +120 -0
  80. data/lib/vapi_server_sdk/types/create_assistant_dto.rb +28 -14
  81. data/lib/vapi_server_sdk/types/create_assistant_dto_server_messages_item.rb +1 -0
  82. data/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb +4 -2
  83. data/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_models_item.rb +1 -0
  84. data/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb +4 -2
  85. data/lib/vapi_server_sdk/types/create_custom_knowledge_base_dto.rb +2 -4
  86. data/lib/vapi_server_sdk/types/create_test_suite_test_voice_dto.rb +90 -0
  87. data/lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb +34 -47
  88. data/lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto_create_plan.rb +97 -0
  89. data/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb +12 -4
  90. data/lib/vapi_server_sdk/types/create_workflow_dto.rb +80 -0
  91. data/lib/vapi_server_sdk/types/create_workflow_dto_nodes_item.rb +133 -0
  92. data/lib/vapi_server_sdk/types/custom_knowledge_base.rb +2 -4
  93. data/lib/vapi_server_sdk/types/deep_seek_model.rb +4 -3
  94. data/lib/vapi_server_sdk/types/deep_seek_model_model.rb +9 -0
  95. data/lib/vapi_server_sdk/types/deepgram_transcriber.rb +28 -2
  96. data/lib/vapi_server_sdk/types/deepgram_voice.rb +22 -2
  97. data/lib/vapi_server_sdk/types/edge.rb +87 -0
  98. data/lib/vapi_server_sdk/types/edge_condition.rb +107 -0
  99. data/lib/vapi_server_sdk/types/failed_edge_condition.rb +47 -0
  100. data/lib/vapi_server_sdk/types/fallback_cartesia_voice.rb +24 -9
  101. data/lib/vapi_server_sdk/types/fallback_deepgram_voice.rb +17 -2
  102. data/lib/vapi_server_sdk/types/fallback_play_ht_voice_model.rb +1 -0
  103. data/lib/vapi_server_sdk/types/fallback_rime_ai_voice_id_enum.rb +22 -20
  104. data/lib/vapi_server_sdk/types/fallback_rime_ai_voice_model.rb +1 -0
  105. data/lib/vapi_server_sdk/types/format_plan.rb +22 -2
  106. data/lib/vapi_server_sdk/types/format_plan_formatters_enabled_item.rb +22 -0
  107. data/lib/vapi_server_sdk/types/function_tool_with_tool_call.rb +1 -10
  108. data/lib/vapi_server_sdk/types/gather.rb +143 -0
  109. data/lib/vapi_server_sdk/types/ghl_tool_with_tool_call.rb +1 -9
  110. data/lib/vapi_server_sdk/types/google_model_model.rb +4 -0
  111. data/lib/vapi_server_sdk/types/groq_model_model.rb +1 -0
  112. data/lib/vapi_server_sdk/types/hangup.rb +67 -0
  113. data/lib/vapi_server_sdk/types/hook.rb +70 -0
  114. data/lib/vapi_server_sdk/types/hook_on.rb +9 -0
  115. data/lib/vapi_server_sdk/types/invite_user_dto.rb +11 -2
  116. data/lib/vapi_server_sdk/types/json_schema.rb +37 -2
  117. data/lib/vapi_server_sdk/types/log.rb +18 -18
  118. data/lib/vapi_server_sdk/types/logic_edge_condition.rb +55 -0
  119. data/lib/vapi_server_sdk/types/make_tool_with_tool_call.rb +1 -9
  120. data/lib/vapi_server_sdk/types/message_plan.rb +12 -2
  121. data/lib/vapi_server_sdk/types/open_ai_model.rb +1 -9
  122. data/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb +2 -0
  123. data/lib/vapi_server_sdk/types/open_ai_model_model.rb +2 -0
  124. data/lib/vapi_server_sdk/types/play_ht_voice_model.rb +1 -0
  125. data/lib/vapi_server_sdk/types/rime_ai_voice_id_enum.rb +22 -20
  126. data/lib/vapi_server_sdk/types/rime_ai_voice_model.rb +1 -0
  127. data/lib/vapi_server_sdk/types/say.rb +81 -0
  128. data/lib/vapi_server_sdk/types/say_hook.rb +81 -0
  129. data/lib/vapi_server_sdk/types/server.rb +17 -2
  130. data/lib/vapi_server_sdk/types/server_message_assistant_request.rb +12 -2
  131. data/lib/vapi_server_sdk/types/server_message_conversation_update.rb +12 -2
  132. data/lib/vapi_server_sdk/types/server_message_end_of_call_report.rb +11 -1
  133. data/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb +10 -1
  134. data/lib/vapi_server_sdk/types/server_message_hang.rb +20 -2
  135. data/lib/vapi_server_sdk/types/server_message_knowledge_base_request.rb +14 -2
  136. data/lib/vapi_server_sdk/types/server_message_language_change_detected.rb +11 -1
  137. data/lib/vapi_server_sdk/types/server_message_message.rb +212 -237
  138. data/lib/vapi_server_sdk/types/server_message_model_output.rb +11 -1
  139. data/lib/vapi_server_sdk/types/server_message_phone_call_control.rb +18 -2
  140. data/lib/vapi_server_sdk/types/server_message_speech_update.rb +11 -1
  141. data/lib/vapi_server_sdk/types/server_message_status_update.rb +12 -2
  142. data/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb +10 -1
  143. data/lib/vapi_server_sdk/types/server_message_tool_calls.rb +10 -2
  144. data/lib/vapi_server_sdk/types/server_message_tool_calls_tool_with_tool_call_list_item.rb +116 -77
  145. data/lib/vapi_server_sdk/types/server_message_transcript.rb +13 -2
  146. data/lib/vapi_server_sdk/types/server_message_transcript_type.rb +10 -0
  147. data/lib/vapi_server_sdk/types/server_message_transfer_destination_request.rb +12 -2
  148. data/lib/vapi_server_sdk/types/server_message_transfer_update.rb +11 -1
  149. data/lib/vapi_server_sdk/types/server_message_user_interrupted.rb +12 -2
  150. data/lib/vapi_server_sdk/types/server_message_voice_input.rb +11 -1
  151. data/lib/vapi_server_sdk/types/server_message_voice_request.rb +50 -2
  152. data/lib/vapi_server_sdk/types/stop_speaking_plan.rb +27 -2
  153. data/lib/vapi_server_sdk/types/subscription.rb +44 -14
  154. data/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb +1 -0
  155. data/lib/vapi_server_sdk/types/test_suite.rb +104 -0
  156. data/lib/vapi_server_sdk/types/test_suite_run.rb +127 -0
  157. data/lib/vapi_server_sdk/types/test_suite_run_scorer_ai.rb +80 -0
  158. data/lib/vapi_server_sdk/types/test_suite_run_scorer_ai_result.rb +9 -0
  159. data/lib/vapi_server_sdk/types/test_suite_run_status.rb +10 -0
  160. data/lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb +75 -0
  161. data/lib/vapi_server_sdk/types/{analytics_query_dto.rb → test_suite_run_test_attempt_call.rb} +19 -17
  162. data/lib/vapi_server_sdk/types/test_suite_run_test_result.rb +75 -0
  163. data/lib/vapi_server_sdk/types/test_suite_runs_paginated_response.rb +75 -0
  164. data/lib/vapi_server_sdk/types/test_suite_test_scorer_ai.rb +65 -0
  165. data/lib/vapi_server_sdk/types/test_suite_test_voice.rb +132 -0
  166. data/lib/vapi_server_sdk/types/test_suite_tests_paginated_response.rb +75 -0
  167. data/lib/vapi_server_sdk/types/test_suites_paginated_response.rb +75 -0
  168. data/lib/vapi_server_sdk/types/text_editor_tool_with_tool_call.rb +175 -0
  169. data/lib/vapi_server_sdk/types/text_editor_tool_with_tool_call_messages_item.rb +121 -0
  170. data/lib/vapi_server_sdk/types/time_range_step.rb +1 -0
  171. data/lib/vapi_server_sdk/types/tool_message_start.rb +18 -2
  172. data/lib/vapi_server_sdk/types/transfer.rb +74 -0
  173. data/lib/vapi_server_sdk/types/transfer_assistant_hook_action.rb +75 -0
  174. data/lib/vapi_server_sdk/types/{buy_phone_number_dto_fallback_destination.rb → transfer_assistant_hook_action_destination.rb} +9 -12
  175. data/lib/vapi_server_sdk/types/transfer_destination_assistant.rb +46 -0
  176. data/lib/vapi_server_sdk/types/transfer_plan.rb +37 -1
  177. data/lib/vapi_server_sdk/types/transfer_plan_mode.rb +4 -0
  178. data/lib/vapi_server_sdk/types/trieve_knowledge_base.rb +35 -44
  179. data/lib/vapi_server_sdk/types/{trieve_knowledge_base_vector_store_create_plan.rb → trieve_knowledge_base_chunk_plan.rb} +17 -11
  180. data/lib/vapi_server_sdk/types/trieve_knowledge_base_create.rb +59 -0
  181. data/lib/vapi_server_sdk/types/trieve_knowledge_base_create_plan.rb +96 -0
  182. data/lib/vapi_server_sdk/types/trieve_knowledge_base_import.rb +55 -0
  183. data/lib/vapi_server_sdk/types/{trieve_knowledge_base_vector_store_search_plan.rb → trieve_knowledge_base_search_plan.rb} +21 -12
  184. data/lib/vapi_server_sdk/types/{trieve_knowledge_base_vector_store_search_plan_search_type.rb → trieve_knowledge_base_search_plan_search_type.rb} +1 -1
  185. data/lib/vapi_server_sdk/types/twilio_phone_number.rb +11 -2
  186. data/lib/vapi_server_sdk/types/twilio_phone_number_status.rb +10 -0
  187. data/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb +4 -2
  188. data/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_models_item.rb +1 -0
  189. data/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb +4 -2
  190. data/lib/vapi_server_sdk/types/update_custom_knowledge_base_dto.rb +2 -4
  191. data/lib/vapi_server_sdk/types/update_test_suite_test_voice_dto.rb +90 -0
  192. data/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto.rb +34 -47
  193. data/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto_create_plan.rb +97 -0
  194. data/lib/vapi_server_sdk/types/vapi_model.rb +27 -1
  195. data/lib/vapi_server_sdk/types/vapi_phone_number.rb +29 -4
  196. data/lib/vapi_server_sdk/types/vapi_phone_number_status.rb +10 -0
  197. data/lib/vapi_server_sdk/types/vonage_phone_number.rb +11 -2
  198. data/lib/vapi_server_sdk/types/vonage_phone_number_status.rb +10 -0
  199. data/lib/vapi_server_sdk/types/workflow.rb +117 -0
  200. data/lib/vapi_server_sdk/types/workflow_nodes_item.rb +133 -0
  201. data/lib/vapi_server_sdk/types/xai_model.rb +4 -3
  202. data/lib/vapi_server_sdk/types/xai_model_model.rb +10 -0
  203. data/lib/vapi_server_sdk.rb +21 -0
  204. metadata +85 -11
  205. data/lib/vapi_server_sdk/types/buy_phone_number_dto.rb +0 -147
  206. data/lib/vapi_server_sdk/types/org_with_org_user.rb +0 -262
  207. data/lib/vapi_server_sdk/types/org_with_org_user_channel.rb +0 -10
  208. data/lib/vapi_server_sdk/types/org_with_org_user_role.rb +0 -9
@@ -5,6 +5,9 @@ require "json"
5
5
 
6
6
  module Vapi
7
7
  class ClientMessageToolCallsResult
8
+ # @return [String] This is the type of the message. "tool-calls-result" is sent to forward the
9
+ # result of a tool call to the client.
10
+ attr_reader :type
8
11
  # @return [Hash{String => Object}] This is the result of the tool call.
9
12
  attr_reader :tool_call_result
10
13
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -15,13 +18,16 @@ module Vapi
15
18
 
16
19
  OMIT = Object.new
17
20
 
21
+ # @param type [String] This is the type of the message. "tool-calls-result" is sent to forward the
22
+ # result of a tool call to the client.
18
23
  # @param tool_call_result [Hash{String => Object}] This is the result of the tool call.
19
24
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
20
25
  # @return [Vapi::ClientMessageToolCallsResult]
21
- def initialize(tool_call_result:, additional_properties: nil)
26
+ def initialize(type:, tool_call_result:, additional_properties: nil)
27
+ @type = type
22
28
  @tool_call_result = tool_call_result
23
29
  @additional_properties = additional_properties
24
- @_field_set = { "toolCallResult": tool_call_result }
30
+ @_field_set = { "type": type, "toolCallResult": tool_call_result }
25
31
  end
26
32
 
27
33
  # Deserialize a JSON object to an instance of ClientMessageToolCallsResult
@@ -31,8 +37,13 @@ module Vapi
31
37
  def self.from_json(json_object:)
32
38
  struct = JSON.parse(json_object, object_class: OpenStruct)
33
39
  parsed_json = JSON.parse(json_object)
40
+ type = parsed_json["type"]
34
41
  tool_call_result = parsed_json["toolCallResult"]
35
- new(tool_call_result: tool_call_result, additional_properties: struct)
42
+ new(
43
+ type: type,
44
+ tool_call_result: tool_call_result,
45
+ additional_properties: struct
46
+ )
36
47
  end
37
48
 
38
49
  # Serialize an instance of ClientMessageToolCallsResult to a JSON object
@@ -49,6 +60,7 @@ module Vapi
49
60
  # @param obj [Object]
50
61
  # @return [Void]
51
62
  def self.validate_raw(obj:)
63
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
52
64
  obj.tool_call_result.is_a?(Hash) != false || raise("Passed value for field obj.tool_call_result is not the expected type, validation failed.")
53
65
  end
54
66
  end
@@ -4,9 +4,28 @@ require "json"
4
4
  require_relative "function_tool_with_tool_call"
5
5
  require_relative "ghl_tool_with_tool_call"
6
6
  require_relative "make_tool_with_tool_call"
7
+ require_relative "bash_tool_with_tool_call"
8
+ require_relative "computer_tool_with_tool_call"
9
+ require_relative "text_editor_tool_with_tool_call"
7
10
 
8
11
  module Vapi
9
12
  class ClientMessageToolCallsToolWithToolCallListItem
13
+ # @return [Object]
14
+ attr_reader :member
15
+ # @return [String]
16
+ attr_reader :discriminant
17
+
18
+ private_class_method :new
19
+ alias kind_of? is_a?
20
+
21
+ # @param member [Object]
22
+ # @param discriminant [String]
23
+ # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem]
24
+ def initialize(member:, discriminant:)
25
+ @member = member
26
+ @discriminant = discriminant
27
+ end
28
+
10
29
  # Deserialize a JSON object to an instance of
11
30
  # ClientMessageToolCallsToolWithToolCallListItem
12
31
  #
@@ -14,55 +33,46 @@ module Vapi
14
33
  # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem]
15
34
  def self.from_json(json_object:)
16
35
  struct = JSON.parse(json_object, object_class: OpenStruct)
17
- begin
18
- Vapi::FunctionToolWithToolCall.validate_raw(obj: struct)
19
- return Vapi::FunctionToolWithToolCall.from_json(json_object: struct) unless struct.nil?
20
-
21
- return nil
22
- rescue StandardError
23
- # noop
24
- end
25
- begin
26
- Vapi::GhlToolWithToolCall.validate_raw(obj: struct)
27
- return Vapi::GhlToolWithToolCall.from_json(json_object: struct) unless struct.nil?
28
-
29
- return nil
30
- rescue StandardError
31
- # noop
32
- end
33
- begin
34
- Vapi::MakeToolWithToolCall.validate_raw(obj: struct)
35
- return Vapi::MakeToolWithToolCall.from_json(json_object: struct) unless struct.nil?
36
-
37
- return nil
38
- rescue StandardError
39
- # noop
40
- end
41
- begin
42
- struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.")
43
- return struct unless struct.nil?
44
-
45
- return nil
46
- rescue StandardError
47
- # noop
48
- end
49
- begin
50
- struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.")
51
- return struct unless struct.nil?
52
-
53
- return nil
54
- rescue StandardError
55
- # noop
56
- end
57
- begin
58
- struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.")
59
- return struct unless struct.nil?
36
+ member = case struct.type
37
+ when "function"
38
+ Vapi::FunctionToolWithToolCall.from_json(json_object: json_object)
39
+ when "ghl"
40
+ Vapi::GhlToolWithToolCall.from_json(json_object: json_object)
41
+ when "make"
42
+ Vapi::MakeToolWithToolCall.from_json(json_object: json_object)
43
+ when "bash"
44
+ Vapi::BashToolWithToolCall.from_json(json_object: json_object)
45
+ when "computer"
46
+ Vapi::ComputerToolWithToolCall.from_json(json_object: json_object)
47
+ when "textEditor"
48
+ Vapi::TextEditorToolWithToolCall.from_json(json_object: json_object)
49
+ else
50
+ Vapi::FunctionToolWithToolCall.from_json(json_object: json_object)
51
+ end
52
+ new(member: member, discriminant: struct.type)
53
+ end
60
54
 
61
- return nil
62
- rescue StandardError
63
- # noop
55
+ # For Union Types, to_json functionality is delegated to the wrapped member.
56
+ #
57
+ # @return [String]
58
+ def to_json(*_args)
59
+ case @discriminant
60
+ when "function"
61
+ { **@member.to_json, type: @discriminant }.to_json
62
+ when "ghl"
63
+ { **@member.to_json, type: @discriminant }.to_json
64
+ when "make"
65
+ { **@member.to_json, type: @discriminant }.to_json
66
+ when "bash"
67
+ { **@member.to_json, type: @discriminant }.to_json
68
+ when "computer"
69
+ { **@member.to_json, type: @discriminant }.to_json
70
+ when "textEditor"
71
+ { **@member.to_json, type: @discriminant }.to_json
72
+ else
73
+ { "type": @discriminant, value: @member }.to_json
64
74
  end
65
- struct
75
+ @member.to_json
66
76
  end
67
77
 
68
78
  # Leveraged for Union-type generation, validate_raw attempts to parse the given
@@ -72,37 +82,66 @@ module Vapi
72
82
  # @param obj [Object]
73
83
  # @return [Void]
74
84
  def self.validate_raw(obj:)
75
- begin
76
- return Vapi::FunctionToolWithToolCall.validate_raw(obj: obj)
77
- rescue StandardError
78
- # noop
79
- end
80
- begin
81
- return Vapi::GhlToolWithToolCall.validate_raw(obj: obj)
82
- rescue StandardError
83
- # noop
84
- end
85
- begin
86
- return Vapi::MakeToolWithToolCall.validate_raw(obj: obj)
87
- rescue StandardError
88
- # noop
89
- end
90
- begin
91
- return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.")
92
- rescue StandardError
93
- # noop
94
- end
95
- begin
96
- return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.")
97
- rescue StandardError
98
- # noop
99
- end
100
- begin
101
- return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.")
102
- rescue StandardError
103
- # noop
85
+ case obj.type
86
+ when "function"
87
+ Vapi::FunctionToolWithToolCall.validate_raw(obj: obj)
88
+ when "ghl"
89
+ Vapi::GhlToolWithToolCall.validate_raw(obj: obj)
90
+ when "make"
91
+ Vapi::MakeToolWithToolCall.validate_raw(obj: obj)
92
+ when "bash"
93
+ Vapi::BashToolWithToolCall.validate_raw(obj: obj)
94
+ when "computer"
95
+ Vapi::ComputerToolWithToolCall.validate_raw(obj: obj)
96
+ when "textEditor"
97
+ Vapi::TextEditorToolWithToolCall.validate_raw(obj: obj)
98
+ else
99
+ raise("Passed value matched no type within the union, validation failed.")
104
100
  end
105
- raise("Passed value matched no type within the union, validation failed.")
101
+ end
102
+
103
+ # For Union Types, is_a? functionality is delegated to the wrapped member.
104
+ #
105
+ # @param obj [Object]
106
+ # @return [Boolean]
107
+ def is_a?(obj)
108
+ @member.is_a?(obj)
109
+ end
110
+
111
+ # @param member [Vapi::FunctionToolWithToolCall]
112
+ # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem]
113
+ def self.function(member:)
114
+ new(member: member, discriminant: "function")
115
+ end
116
+
117
+ # @param member [Vapi::GhlToolWithToolCall]
118
+ # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem]
119
+ def self.ghl(member:)
120
+ new(member: member, discriminant: "ghl")
121
+ end
122
+
123
+ # @param member [Vapi::MakeToolWithToolCall]
124
+ # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem]
125
+ def self.make(member:)
126
+ new(member: member, discriminant: "make")
127
+ end
128
+
129
+ # @param member [Vapi::BashToolWithToolCall]
130
+ # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem]
131
+ def self.bash(member:)
132
+ new(member: member, discriminant: "bash")
133
+ end
134
+
135
+ # @param member [Vapi::ComputerToolWithToolCall]
136
+ # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem]
137
+ def self.computer(member:)
138
+ new(member: member, discriminant: "computer")
139
+ end
140
+
141
+ # @param member [Vapi::TextEditorToolWithToolCall]
142
+ # @return [Vapi::ClientMessageToolCallsToolWithToolCallListItem]
143
+ def self.text_editor(member:)
144
+ new(member: member, discriminant: "textEditor")
106
145
  end
107
146
  end
108
147
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "client_message_transcript_type"
3
4
  require_relative "client_message_transcript_role"
4
5
  require_relative "client_message_transcript_transcript_type"
5
6
  require "ostruct"
@@ -7,6 +8,9 @@ require "json"
7
8
 
8
9
  module Vapi
9
10
  class ClientMessageTranscript
11
+ # @return [Vapi::ClientMessageTranscriptType] This is the type of the message. "transcript" is sent as transcriber outputs
12
+ # partial or final transcript.
13
+ attr_reader :type
10
14
  # @return [Vapi::ClientMessageTranscriptRole] This is the role for which the transcript is for.
11
15
  attr_reader :role
12
16
  # @return [Vapi::ClientMessageTranscriptTranscriptType] This is the type of the transcript.
@@ -21,17 +25,20 @@ module Vapi
21
25
 
22
26
  OMIT = Object.new
23
27
 
28
+ # @param type [Vapi::ClientMessageTranscriptType] This is the type of the message. "transcript" is sent as transcriber outputs
29
+ # partial or final transcript.
24
30
  # @param role [Vapi::ClientMessageTranscriptRole] This is the role for which the transcript is for.
25
31
  # @param transcript_type [Vapi::ClientMessageTranscriptTranscriptType] This is the type of the transcript.
26
32
  # @param transcript [String] This is the transcript content.
27
33
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
28
34
  # @return [Vapi::ClientMessageTranscript]
29
- def initialize(role:, transcript_type:, transcript:, additional_properties: nil)
35
+ def initialize(type:, role:, transcript_type:, transcript:, additional_properties: nil)
36
+ @type = type
30
37
  @role = role
31
38
  @transcript_type = transcript_type
32
39
  @transcript = transcript
33
40
  @additional_properties = additional_properties
34
- @_field_set = { "role": role, "transcriptType": transcript_type, "transcript": transcript }
41
+ @_field_set = { "type": type, "role": role, "transcriptType": transcript_type, "transcript": transcript }
35
42
  end
36
43
 
37
44
  # Deserialize a JSON object to an instance of ClientMessageTranscript
@@ -41,10 +48,12 @@ module Vapi
41
48
  def self.from_json(json_object:)
42
49
  struct = JSON.parse(json_object, object_class: OpenStruct)
43
50
  parsed_json = JSON.parse(json_object)
51
+ type = parsed_json["type"]
44
52
  role = parsed_json["role"]
45
53
  transcript_type = parsed_json["transcriptType"]
46
54
  transcript = parsed_json["transcript"]
47
55
  new(
56
+ type: type,
48
57
  role: role,
49
58
  transcript_type: transcript_type,
50
59
  transcript: transcript,
@@ -66,6 +75,7 @@ module Vapi
66
75
  # @param obj [Object]
67
76
  # @return [Void]
68
77
  def self.validate_raw(obj:)
78
+ obj.type.is_a?(Vapi::ClientMessageTranscriptType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
69
79
  obj.role.is_a?(Vapi::ClientMessageTranscriptRole) != false || raise("Passed value for field obj.role is not the expected type, validation failed.")
70
80
  obj.transcript_type.is_a?(Vapi::ClientMessageTranscriptTranscriptType) != false || raise("Passed value for field obj.transcript_type is not the expected type, validation failed.")
71
81
  obj.transcript.is_a?(String) != false || raise("Passed value for field obj.transcript is not the expected type, validation failed.")
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vapi
4
+ # This is the type of the message. "transcript" is sent as transcriber outputs
5
+ # partial or final transcript.
6
+ class ClientMessageTranscriptType
7
+ TRANSCRIPT = "transcript"
8
+ TRANSCRIPT_TRANSCRIPT_TYPE_FINAL = "transcript[transcriptType='final']"
9
+ end
10
+ end
@@ -7,6 +7,9 @@ require "json"
7
7
 
8
8
  module Vapi
9
9
  class ClientMessageTransferUpdate
10
+ # @return [String] This is the type of the message. "transfer-update" is sent whenever a transfer
11
+ # happens.
12
+ attr_reader :type
10
13
  # @return [Vapi::ClientMessageTransferUpdateDestination] This is the destination of the transfer.
11
14
  attr_reader :destination
12
15
  # @return [Vapi::CreateAssistantDto] This is the assistant that the call is being transferred to. This is only sent
@@ -27,6 +30,8 @@ module Vapi
27
30
 
28
31
  OMIT = Object.new
29
32
 
33
+ # @param type [String] This is the type of the message. "transfer-update" is sent whenever a transfer
34
+ # happens.
30
35
  # @param destination [Vapi::ClientMessageTransferUpdateDestination] This is the destination of the transfer.
31
36
  # @param to_assistant [Vapi::CreateAssistantDto] This is the assistant that the call is being transferred to. This is only sent
32
37
  # if `destination.type` is "assistant".
@@ -36,8 +41,9 @@ module Vapi
36
41
  # @param from_step_record [Hash{String => Object}] This is the step that the conversation moved from. =
37
42
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
38
43
  # @return [Vapi::ClientMessageTransferUpdate]
39
- def initialize(destination: OMIT, to_assistant: OMIT, from_assistant: OMIT, to_step_record: OMIT,
44
+ def initialize(type:, destination: OMIT, to_assistant: OMIT, from_assistant: OMIT, to_step_record: OMIT,
40
45
  from_step_record: OMIT, additional_properties: nil)
46
+ @type = type
41
47
  @destination = destination if destination != OMIT
42
48
  @to_assistant = to_assistant if to_assistant != OMIT
43
49
  @from_assistant = from_assistant if from_assistant != OMIT
@@ -45,6 +51,7 @@ module Vapi
45
51
  @from_step_record = from_step_record if from_step_record != OMIT
46
52
  @additional_properties = additional_properties
47
53
  @_field_set = {
54
+ "type": type,
48
55
  "destination": destination,
49
56
  "toAssistant": to_assistant,
50
57
  "fromAssistant": from_assistant,
@@ -62,6 +69,7 @@ module Vapi
62
69
  def self.from_json(json_object:)
63
70
  struct = JSON.parse(json_object, object_class: OpenStruct)
64
71
  parsed_json = JSON.parse(json_object)
72
+ type = parsed_json["type"]
65
73
  if parsed_json["destination"].nil?
66
74
  destination = nil
67
75
  else
@@ -83,6 +91,7 @@ module Vapi
83
91
  to_step_record = parsed_json["toStepRecord"]
84
92
  from_step_record = parsed_json["fromStepRecord"]
85
93
  new(
94
+ type: type,
86
95
  destination: destination,
87
96
  to_assistant: to_assistant,
88
97
  from_assistant: from_assistant,
@@ -106,6 +115,7 @@ module Vapi
106
115
  # @param obj [Object]
107
116
  # @return [Void]
108
117
  def self.validate_raw(obj:)
118
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
109
119
  obj.destination.nil? || Vapi::ClientMessageTransferUpdateDestination.validate_raw(obj: obj.destination)
110
120
  obj.to_assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.to_assistant)
111
121
  obj.from_assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.from_assistant)
@@ -5,6 +5,9 @@ require "json"
5
5
 
6
6
  module Vapi
7
7
  class ClientMessageUserInterrupted
8
+ # @return [String] This is the type of the message. "user-interrupted" is sent when the user
9
+ # interrupts the assistant.
10
+ attr_reader :type
8
11
  # @return [OpenStruct] Additional properties unmapped to the current class definition
9
12
  attr_reader :additional_properties
10
13
  # @return [Object]
@@ -13,11 +16,14 @@ module Vapi
13
16
 
14
17
  OMIT = Object.new
15
18
 
19
+ # @param type [String] This is the type of the message. "user-interrupted" is sent when the user
20
+ # interrupts the assistant.
16
21
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
17
22
  # @return [Vapi::ClientMessageUserInterrupted]
18
- def initialize(additional_properties: nil)
23
+ def initialize(type:, additional_properties: nil)
24
+ @type = type
19
25
  @additional_properties = additional_properties
20
- @_field_set = {}
26
+ @_field_set = { "type": type }
21
27
  end
22
28
 
23
29
  # Deserialize a JSON object to an instance of ClientMessageUserInterrupted
@@ -26,7 +32,9 @@ module Vapi
26
32
  # @return [Vapi::ClientMessageUserInterrupted]
27
33
  def self.from_json(json_object:)
28
34
  struct = JSON.parse(json_object, object_class: OpenStruct)
29
- new(additional_properties: struct)
35
+ parsed_json = JSON.parse(json_object)
36
+ type = parsed_json["type"]
37
+ new(type: type, additional_properties: struct)
30
38
  end
31
39
 
32
40
  # Serialize an instance of ClientMessageUserInterrupted to a JSON object
@@ -42,6 +50,8 @@ module Vapi
42
50
  #
43
51
  # @param obj [Object]
44
52
  # @return [Void]
45
- def self.validate_raw(obj:); end
53
+ def self.validate_raw(obj:)
54
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
55
+ end
46
56
  end
47
57
  end
@@ -5,6 +5,9 @@ require "json"
5
5
 
6
6
  module Vapi
7
7
  class ClientMessageVoiceInput
8
+ # @return [String] This is the type of the message. "voice-input" is sent when a generation is
9
+ # requested from voice provider.
10
+ attr_reader :type
8
11
  # @return [String] This is the voice input content
9
12
  attr_reader :input
10
13
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -15,13 +18,16 @@ module Vapi
15
18
 
16
19
  OMIT = Object.new
17
20
 
21
+ # @param type [String] This is the type of the message. "voice-input" is sent when a generation is
22
+ # requested from voice provider.
18
23
  # @param input [String] This is the voice input content
19
24
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
20
25
  # @return [Vapi::ClientMessageVoiceInput]
21
- def initialize(input:, additional_properties: nil)
26
+ def initialize(type:, input:, additional_properties: nil)
27
+ @type = type
22
28
  @input = input
23
29
  @additional_properties = additional_properties
24
- @_field_set = { "input": input }
30
+ @_field_set = { "type": type, "input": input }
25
31
  end
26
32
 
27
33
  # Deserialize a JSON object to an instance of ClientMessageVoiceInput
@@ -31,8 +37,13 @@ module Vapi
31
37
  def self.from_json(json_object:)
32
38
  struct = JSON.parse(json_object, object_class: OpenStruct)
33
39
  parsed_json = JSON.parse(json_object)
40
+ type = parsed_json["type"]
34
41
  input = parsed_json["input"]
35
- new(input: input, additional_properties: struct)
42
+ new(
43
+ type: type,
44
+ input: input,
45
+ additional_properties: struct
46
+ )
36
47
  end
37
48
 
38
49
  # Serialize an instance of ClientMessageVoiceInput to a JSON object
@@ -49,6 +60,7 @@ module Vapi
49
60
  # @param obj [Object]
50
61
  # @return [Void]
51
62
  def self.validate_raw(obj:)
63
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
52
64
  obj.input.is_a?(String) != false || raise("Passed value for field obj.input is not the expected type, validation failed.")
53
65
  end
54
66
  end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vapi
7
+ class ClientMessageWorkflowNodeStarted
8
+ # @return [String] This is the type of the message. "workflow.node.started" is sent when the active
9
+ # node changes.
10
+ attr_reader :type
11
+ # @return [Hash{String => Object}] This is the active node.
12
+ attr_reader :node
13
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
14
+ attr_reader :additional_properties
15
+ # @return [Object]
16
+ attr_reader :_field_set
17
+ protected :_field_set
18
+
19
+ OMIT = Object.new
20
+
21
+ # @param type [String] This is the type of the message. "workflow.node.started" is sent when the active
22
+ # node changes.
23
+ # @param node [Hash{String => Object}] This is the active node.
24
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
25
+ # @return [Vapi::ClientMessageWorkflowNodeStarted]
26
+ def initialize(type:, node:, additional_properties: nil)
27
+ @type = type
28
+ @node = node
29
+ @additional_properties = additional_properties
30
+ @_field_set = { "type": type, "node": node }
31
+ end
32
+
33
+ # Deserialize a JSON object to an instance of ClientMessageWorkflowNodeStarted
34
+ #
35
+ # @param json_object [String]
36
+ # @return [Vapi::ClientMessageWorkflowNodeStarted]
37
+ def self.from_json(json_object:)
38
+ struct = JSON.parse(json_object, object_class: OpenStruct)
39
+ parsed_json = JSON.parse(json_object)
40
+ type = parsed_json["type"]
41
+ node = parsed_json["node"]
42
+ new(
43
+ type: type,
44
+ node: node,
45
+ additional_properties: struct
46
+ )
47
+ end
48
+
49
+ # Serialize an instance of ClientMessageWorkflowNodeStarted to a JSON object
50
+ #
51
+ # @return [String]
52
+ def to_json(*_args)
53
+ @_field_set&.to_json
54
+ end
55
+
56
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
57
+ # hash and check each fields type against the current object's property
58
+ # definitions.
59
+ #
60
+ # @param obj [Object]
61
+ # @return [Void]
62
+ def self.validate_raw(obj:)
63
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
64
+ obj.node.is_a?(Hash) != false || raise("Passed value for field obj.node is not the expected type, validation failed.")
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vapi
7
+ class CompliancePlan
8
+ # @return [Boolean] When this is enabled, no logs, recordings, or transcriptions will be stored. At
9
+ # the end of the call, you will still receive an end-of-call-report message to
10
+ # store on your server. Defaults to false.
11
+ attr_reader :hipaa_enabled
12
+ # @return [Boolean] When this is enabled, the user will be restricted to use PCI-compliant
13
+ # providers, and no logs or transcripts are stored. At the end of the call, you
14
+ # will receive an end-of-call-report message to store on your server. Defaults to
15
+ # false.
16
+ attr_reader :pci_enabled
17
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
18
+ attr_reader :additional_properties
19
+ # @return [Object]
20
+ attr_reader :_field_set
21
+ protected :_field_set
22
+
23
+ OMIT = Object.new
24
+
25
+ # @param hipaa_enabled [Boolean] When this is enabled, no logs, recordings, or transcriptions will be stored. At
26
+ # the end of the call, you will still receive an end-of-call-report message to
27
+ # store on your server. Defaults to false.
28
+ # @param pci_enabled [Boolean] When this is enabled, the user will be restricted to use PCI-compliant
29
+ # providers, and no logs or transcripts are stored. At the end of the call, you
30
+ # will receive an end-of-call-report message to store on your server. Defaults to
31
+ # false.
32
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
33
+ # @return [Vapi::CompliancePlan]
34
+ def initialize(hipaa_enabled: OMIT, pci_enabled: OMIT, additional_properties: nil)
35
+ @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT
36
+ @pci_enabled = pci_enabled if pci_enabled != OMIT
37
+ @additional_properties = additional_properties
38
+ @_field_set = { "hipaaEnabled": hipaa_enabled, "pciEnabled": pci_enabled }.reject do |_k, v|
39
+ v == OMIT
40
+ end
41
+ end
42
+
43
+ # Deserialize a JSON object to an instance of CompliancePlan
44
+ #
45
+ # @param json_object [String]
46
+ # @return [Vapi::CompliancePlan]
47
+ def self.from_json(json_object:)
48
+ struct = JSON.parse(json_object, object_class: OpenStruct)
49
+ parsed_json = JSON.parse(json_object)
50
+ hipaa_enabled = parsed_json["hipaaEnabled"]
51
+ pci_enabled = parsed_json["pciEnabled"]
52
+ new(
53
+ hipaa_enabled: hipaa_enabled,
54
+ pci_enabled: pci_enabled,
55
+ additional_properties: struct
56
+ )
57
+ end
58
+
59
+ # Serialize an instance of CompliancePlan to a JSON object
60
+ #
61
+ # @return [String]
62
+ def to_json(*_args)
63
+ @_field_set&.to_json
64
+ end
65
+
66
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
67
+ # hash and check each fields type against the current object's property
68
+ # definitions.
69
+ #
70
+ # @param obj [Object]
71
+ # @return [Void]
72
+ def self.validate_raw(obj:)
73
+ obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.")
74
+ obj.pci_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.pci_enabled is not the expected type, validation failed.")
75
+ end
76
+ end
77
+ end