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.
- checksums.yaml +4 -4
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +83 -12
- data/lib/vapi_server_sdk/analytics/client.rb +41 -26
- data/lib/vapi_server_sdk/assistants/client.rb +84 -84
- data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_server_messages_item.rb +1 -0
- data/lib/vapi_server_sdk/blocks/client.rb +0 -70
- data/lib/vapi_server_sdk/calls/client.rb +110 -76
- data/lib/vapi_server_sdk/files/client.rb +0 -70
- data/lib/vapi_server_sdk/knowledge_bases/client.rb +0 -70
- data/lib/vapi_server_sdk/logs/client.rb +15 -46
- data/lib/vapi_server_sdk/logs/types/logging_controller_logs_delete_query_request_type.rb +12 -0
- data/lib/vapi_server_sdk/phone_numbers/client.rb +0 -70
- data/lib/vapi_server_sdk/squads/client.rb +136 -78
- data/lib/vapi_server_sdk/test_suite_runs/client.rb +328 -0
- data/lib/vapi_server_sdk/test_suite_runs/types/test_suite_run_controller_find_all_paginated_request_sort_order.rb +10 -0
- data/lib/vapi_server_sdk/test_suite_tests/client.rb +331 -0
- data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_create_request.rb +81 -0
- data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_find_all_paginated_request_sort_order.rb +10 -0
- data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb +82 -0
- data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_update_request.rb +81 -0
- data/lib/vapi_server_sdk/test_suites/client.rb +338 -0
- data/lib/vapi_server_sdk/test_suites/types/test_suite_controller_find_all_paginated_request_sort_order.rb +10 -0
- data/lib/vapi_server_sdk/tools/client.rb +0 -70
- data/lib/vapi_server_sdk/types/ai_edge_condition.rb +55 -0
- data/lib/vapi_server_sdk/types/analytics_operation_column.rb +1 -0
- data/lib/vapi_server_sdk/types/analytics_operation_operation.rb +1 -0
- data/lib/vapi_server_sdk/types/analytics_query.rb +4 -3
- data/lib/vapi_server_sdk/types/analytics_query_table.rb +9 -0
- data/lib/vapi_server_sdk/types/api_request.rb +165 -0
- data/lib/vapi_server_sdk/types/api_request_method.rb +8 -0
- data/lib/vapi_server_sdk/types/api_request_mode.rb +10 -0
- data/lib/vapi_server_sdk/types/artifact.rb +12 -2
- data/lib/vapi_server_sdk/types/artifact_plan.rb +56 -8
- data/lib/vapi_server_sdk/types/assistant.rb +27 -13
- data/lib/vapi_server_sdk/types/assistant_hook_action_base.rb +47 -0
- data/lib/vapi_server_sdk/types/assistant_hook_filter.rb +72 -0
- data/lib/vapi_server_sdk/types/assistant_hooks.rb +82 -0
- data/lib/vapi_server_sdk/types/assistant_overrides.rb +28 -14
- data/lib/vapi_server_sdk/types/assistant_overrides_server_messages_item.rb +1 -0
- data/lib/vapi_server_sdk/types/assistant_server_messages_item.rb +1 -0
- data/lib/vapi_server_sdk/types/azure_credential_region.rb +4 -2
- data/lib/vapi_server_sdk/types/azure_open_ai_credential_models_item.rb +1 -0
- data/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb +4 -2
- data/lib/vapi_server_sdk/types/backoff_plan.rb +80 -0
- data/lib/vapi_server_sdk/types/bash_tool_with_tool_call.rb +175 -0
- data/lib/vapi_server_sdk/types/bash_tool_with_tool_call_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/byo_phone_number.rb +10 -1
- data/lib/vapi_server_sdk/types/byo_phone_number_status.rb +10 -0
- data/lib/vapi_server_sdk/types/call_ended_reason.rb +10 -1
- data/lib/vapi_server_sdk/types/cartesia_experimental_controls.rb +69 -0
- data/lib/vapi_server_sdk/types/cartesia_experimental_controls_emotion.rb +26 -0
- data/lib/vapi_server_sdk/types/cartesia_experimental_controls_speed.rb +11 -0
- data/lib/vapi_server_sdk/types/cartesia_voice.rb +24 -10
- data/lib/vapi_server_sdk/types/chat_completion_message.rb +80 -0
- data/lib/vapi_server_sdk/types/chat_completion_message_metadata.rb +94 -0
- data/lib/vapi_server_sdk/types/chat_completions_dto.rb +84 -0
- data/lib/vapi_server_sdk/types/client_inbound_message_end_call.rb +47 -0
- data/lib/vapi_server_sdk/types/client_inbound_message_message.rb +13 -0
- data/lib/vapi_server_sdk/types/client_inbound_message_transfer.rb +13 -3
- data/lib/vapi_server_sdk/types/client_message_conversation_update.rb +15 -2
- data/lib/vapi_server_sdk/types/client_message_hang.rb +22 -4
- data/lib/vapi_server_sdk/types/client_message_language_change_detected.rb +15 -3
- data/lib/vapi_server_sdk/types/client_message_message.rb +165 -181
- data/lib/vapi_server_sdk/types/client_message_metadata.rb +15 -3
- data/lib/vapi_server_sdk/types/client_message_model_output.rb +15 -3
- data/lib/vapi_server_sdk/types/client_message_speech_update.rb +11 -2
- data/lib/vapi_server_sdk/types/client_message_tool_calls.rb +15 -2
- data/lib/vapi_server_sdk/types/client_message_tool_calls_result.rb +15 -3
- data/lib/vapi_server_sdk/types/client_message_tool_calls_tool_with_tool_call_list_item.rb +116 -77
- data/lib/vapi_server_sdk/types/client_message_transcript.rb +12 -2
- data/lib/vapi_server_sdk/types/client_message_transcript_type.rb +10 -0
- data/lib/vapi_server_sdk/types/client_message_transfer_update.rb +11 -1
- data/lib/vapi_server_sdk/types/client_message_user_interrupted.rb +14 -4
- data/lib/vapi_server_sdk/types/client_message_voice_input.rb +15 -3
- data/lib/vapi_server_sdk/types/client_message_workflow_node_started.rb +67 -0
- data/lib/vapi_server_sdk/types/compliance_plan.rb +77 -0
- data/lib/vapi_server_sdk/types/computer_tool_with_tool_call.rb +199 -0
- data/lib/vapi_server_sdk/types/computer_tool_with_tool_call_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/create_assistant_dto.rb +28 -14
- data/lib/vapi_server_sdk/types/create_assistant_dto_server_messages_item.rb +1 -0
- data/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb +4 -2
- data/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_models_item.rb +1 -0
- data/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb +4 -2
- data/lib/vapi_server_sdk/types/create_custom_knowledge_base_dto.rb +2 -4
- data/lib/vapi_server_sdk/types/create_test_suite_test_voice_dto.rb +90 -0
- data/lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb +34 -47
- data/lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto_create_plan.rb +97 -0
- data/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb +12 -4
- data/lib/vapi_server_sdk/types/create_workflow_dto.rb +80 -0
- data/lib/vapi_server_sdk/types/create_workflow_dto_nodes_item.rb +133 -0
- data/lib/vapi_server_sdk/types/custom_knowledge_base.rb +2 -4
- data/lib/vapi_server_sdk/types/deep_seek_model.rb +4 -3
- data/lib/vapi_server_sdk/types/deep_seek_model_model.rb +9 -0
- data/lib/vapi_server_sdk/types/deepgram_transcriber.rb +28 -2
- data/lib/vapi_server_sdk/types/deepgram_voice.rb +22 -2
- data/lib/vapi_server_sdk/types/edge.rb +87 -0
- data/lib/vapi_server_sdk/types/edge_condition.rb +107 -0
- data/lib/vapi_server_sdk/types/failed_edge_condition.rb +47 -0
- data/lib/vapi_server_sdk/types/fallback_cartesia_voice.rb +24 -9
- data/lib/vapi_server_sdk/types/fallback_deepgram_voice.rb +17 -2
- data/lib/vapi_server_sdk/types/fallback_play_ht_voice_model.rb +1 -0
- data/lib/vapi_server_sdk/types/fallback_rime_ai_voice_id_enum.rb +22 -20
- data/lib/vapi_server_sdk/types/fallback_rime_ai_voice_model.rb +1 -0
- data/lib/vapi_server_sdk/types/format_plan.rb +22 -2
- data/lib/vapi_server_sdk/types/format_plan_formatters_enabled_item.rb +22 -0
- data/lib/vapi_server_sdk/types/function_tool_with_tool_call.rb +1 -10
- data/lib/vapi_server_sdk/types/gather.rb +143 -0
- data/lib/vapi_server_sdk/types/ghl_tool_with_tool_call.rb +1 -9
- data/lib/vapi_server_sdk/types/google_model_model.rb +4 -0
- data/lib/vapi_server_sdk/types/groq_model_model.rb +1 -0
- data/lib/vapi_server_sdk/types/hangup.rb +67 -0
- data/lib/vapi_server_sdk/types/hook.rb +70 -0
- data/lib/vapi_server_sdk/types/hook_on.rb +9 -0
- data/lib/vapi_server_sdk/types/invite_user_dto.rb +11 -2
- data/lib/vapi_server_sdk/types/json_schema.rb +37 -2
- data/lib/vapi_server_sdk/types/log.rb +18 -18
- data/lib/vapi_server_sdk/types/logic_edge_condition.rb +55 -0
- data/lib/vapi_server_sdk/types/make_tool_with_tool_call.rb +1 -9
- data/lib/vapi_server_sdk/types/message_plan.rb +12 -2
- data/lib/vapi_server_sdk/types/open_ai_model.rb +1 -9
- data/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb +2 -0
- data/lib/vapi_server_sdk/types/open_ai_model_model.rb +2 -0
- data/lib/vapi_server_sdk/types/play_ht_voice_model.rb +1 -0
- data/lib/vapi_server_sdk/types/rime_ai_voice_id_enum.rb +22 -20
- data/lib/vapi_server_sdk/types/rime_ai_voice_model.rb +1 -0
- data/lib/vapi_server_sdk/types/say.rb +81 -0
- data/lib/vapi_server_sdk/types/say_hook.rb +81 -0
- data/lib/vapi_server_sdk/types/server.rb +17 -2
- data/lib/vapi_server_sdk/types/server_message_assistant_request.rb +12 -2
- data/lib/vapi_server_sdk/types/server_message_conversation_update.rb +12 -2
- data/lib/vapi_server_sdk/types/server_message_end_of_call_report.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb +10 -1
- data/lib/vapi_server_sdk/types/server_message_hang.rb +20 -2
- data/lib/vapi_server_sdk/types/server_message_knowledge_base_request.rb +14 -2
- data/lib/vapi_server_sdk/types/server_message_language_change_detected.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_message.rb +212 -237
- data/lib/vapi_server_sdk/types/server_message_model_output.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_phone_call_control.rb +18 -2
- data/lib/vapi_server_sdk/types/server_message_speech_update.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_status_update.rb +12 -2
- data/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb +10 -1
- data/lib/vapi_server_sdk/types/server_message_tool_calls.rb +10 -2
- data/lib/vapi_server_sdk/types/server_message_tool_calls_tool_with_tool_call_list_item.rb +116 -77
- data/lib/vapi_server_sdk/types/server_message_transcript.rb +13 -2
- data/lib/vapi_server_sdk/types/server_message_transcript_type.rb +10 -0
- data/lib/vapi_server_sdk/types/server_message_transfer_destination_request.rb +12 -2
- data/lib/vapi_server_sdk/types/server_message_transfer_update.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_user_interrupted.rb +12 -2
- data/lib/vapi_server_sdk/types/server_message_voice_input.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_voice_request.rb +50 -2
- data/lib/vapi_server_sdk/types/stop_speaking_plan.rb +27 -2
- data/lib/vapi_server_sdk/types/subscription.rb +44 -14
- data/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb +1 -0
- data/lib/vapi_server_sdk/types/test_suite.rb +104 -0
- data/lib/vapi_server_sdk/types/test_suite_run.rb +127 -0
- data/lib/vapi_server_sdk/types/test_suite_run_scorer_ai.rb +80 -0
- data/lib/vapi_server_sdk/types/test_suite_run_scorer_ai_result.rb +9 -0
- data/lib/vapi_server_sdk/types/test_suite_run_status.rb +10 -0
- data/lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb +75 -0
- data/lib/vapi_server_sdk/types/{analytics_query_dto.rb → test_suite_run_test_attempt_call.rb} +19 -17
- data/lib/vapi_server_sdk/types/test_suite_run_test_result.rb +75 -0
- data/lib/vapi_server_sdk/types/test_suite_runs_paginated_response.rb +75 -0
- data/lib/vapi_server_sdk/types/test_suite_test_scorer_ai.rb +65 -0
- data/lib/vapi_server_sdk/types/test_suite_test_voice.rb +132 -0
- data/lib/vapi_server_sdk/types/test_suite_tests_paginated_response.rb +75 -0
- data/lib/vapi_server_sdk/types/test_suites_paginated_response.rb +75 -0
- data/lib/vapi_server_sdk/types/text_editor_tool_with_tool_call.rb +175 -0
- data/lib/vapi_server_sdk/types/text_editor_tool_with_tool_call_messages_item.rb +121 -0
- data/lib/vapi_server_sdk/types/time_range_step.rb +1 -0
- data/lib/vapi_server_sdk/types/tool_message_start.rb +18 -2
- data/lib/vapi_server_sdk/types/transfer.rb +74 -0
- data/lib/vapi_server_sdk/types/transfer_assistant_hook_action.rb +75 -0
- data/lib/vapi_server_sdk/types/{buy_phone_number_dto_fallback_destination.rb → transfer_assistant_hook_action_destination.rb} +9 -12
- data/lib/vapi_server_sdk/types/transfer_destination_assistant.rb +46 -0
- data/lib/vapi_server_sdk/types/transfer_plan.rb +37 -1
- data/lib/vapi_server_sdk/types/transfer_plan_mode.rb +4 -0
- data/lib/vapi_server_sdk/types/trieve_knowledge_base.rb +35 -44
- data/lib/vapi_server_sdk/types/{trieve_knowledge_base_vector_store_create_plan.rb → trieve_knowledge_base_chunk_plan.rb} +17 -11
- data/lib/vapi_server_sdk/types/trieve_knowledge_base_create.rb +59 -0
- data/lib/vapi_server_sdk/types/trieve_knowledge_base_create_plan.rb +96 -0
- data/lib/vapi_server_sdk/types/trieve_knowledge_base_import.rb +55 -0
- data/lib/vapi_server_sdk/types/{trieve_knowledge_base_vector_store_search_plan.rb → trieve_knowledge_base_search_plan.rb} +21 -12
- 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
- data/lib/vapi_server_sdk/types/twilio_phone_number.rb +11 -2
- data/lib/vapi_server_sdk/types/twilio_phone_number_status.rb +10 -0
- data/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb +4 -2
- data/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_models_item.rb +1 -0
- data/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb +4 -2
- data/lib/vapi_server_sdk/types/update_custom_knowledge_base_dto.rb +2 -4
- data/lib/vapi_server_sdk/types/update_test_suite_test_voice_dto.rb +90 -0
- data/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto.rb +34 -47
- data/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto_create_plan.rb +97 -0
- data/lib/vapi_server_sdk/types/vapi_model.rb +27 -1
- data/lib/vapi_server_sdk/types/vapi_phone_number.rb +29 -4
- data/lib/vapi_server_sdk/types/vapi_phone_number_status.rb +10 -0
- data/lib/vapi_server_sdk/types/vonage_phone_number.rb +11 -2
- data/lib/vapi_server_sdk/types/vonage_phone_number_status.rb +10 -0
- data/lib/vapi_server_sdk/types/workflow.rb +117 -0
- data/lib/vapi_server_sdk/types/workflow_nodes_item.rb +133 -0
- data/lib/vapi_server_sdk/types/xai_model.rb +4 -3
- data/lib/vapi_server_sdk/types/xai_model_model.rb +10 -0
- data/lib/vapi_server_sdk.rb +21 -0
- metadata +85 -11
- data/lib/vapi_server_sdk/types/buy_phone_number_dto.rb +0 -147
- data/lib/vapi_server_sdk/types/org_with_org_user.rb +0 -262
- data/lib/vapi_server_sdk/types/org_with_org_user_channel.rb +0 -10
- data/lib/vapi_server_sdk/types/org_with_org_user_role.rb +0 -9
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "test_suite"
|
4
|
+
require_relative "pagination_meta"
|
5
|
+
require "ostruct"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vapi
|
9
|
+
class TestSuitesPaginatedResponse
|
10
|
+
# @return [Array<Vapi::TestSuite>]
|
11
|
+
attr_reader :results
|
12
|
+
# @return [Vapi::PaginationMeta]
|
13
|
+
attr_reader :metadata
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param results [Array<Vapi::TestSuite>]
|
23
|
+
# @param metadata [Vapi::PaginationMeta]
|
24
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
25
|
+
# @return [Vapi::TestSuitesPaginatedResponse]
|
26
|
+
def initialize(results:, metadata:, additional_properties: nil)
|
27
|
+
@results = results
|
28
|
+
@metadata = metadata
|
29
|
+
@additional_properties = additional_properties
|
30
|
+
@_field_set = { "results": results, "metadata": metadata }
|
31
|
+
end
|
32
|
+
|
33
|
+
# Deserialize a JSON object to an instance of TestSuitesPaginatedResponse
|
34
|
+
#
|
35
|
+
# @param json_object [String]
|
36
|
+
# @return [Vapi::TestSuitesPaginatedResponse]
|
37
|
+
def self.from_json(json_object:)
|
38
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
39
|
+
parsed_json = JSON.parse(json_object)
|
40
|
+
results = parsed_json["results"]&.map do |item|
|
41
|
+
item = item.to_json
|
42
|
+
Vapi::TestSuite.from_json(json_object: item)
|
43
|
+
end
|
44
|
+
if parsed_json["metadata"].nil?
|
45
|
+
metadata = nil
|
46
|
+
else
|
47
|
+
metadata = parsed_json["metadata"].to_json
|
48
|
+
metadata = Vapi::PaginationMeta.from_json(json_object: metadata)
|
49
|
+
end
|
50
|
+
new(
|
51
|
+
results: results,
|
52
|
+
metadata: metadata,
|
53
|
+
additional_properties: struct
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Serialize an instance of TestSuitesPaginatedResponse to a JSON object
|
58
|
+
#
|
59
|
+
# @return [String]
|
60
|
+
def to_json(*_args)
|
61
|
+
@_field_set&.to_json
|
62
|
+
end
|
63
|
+
|
64
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
65
|
+
# hash and check each fields type against the current object's property
|
66
|
+
# definitions.
|
67
|
+
#
|
68
|
+
# @param obj [Object]
|
69
|
+
# @return [Void]
|
70
|
+
def self.validate_raw(obj:)
|
71
|
+
obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
|
72
|
+
Vapi::PaginationMeta.validate_raw(obj: obj.metadata)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "text_editor_tool_with_tool_call_messages_item"
|
4
|
+
require_relative "tool_call"
|
5
|
+
require_relative "open_ai_function"
|
6
|
+
require_relative "server"
|
7
|
+
require "ostruct"
|
8
|
+
require "json"
|
9
|
+
|
10
|
+
module Vapi
|
11
|
+
class TextEditorToolWithToolCall
|
12
|
+
# @return [Boolean] This determines if the tool is async.
|
13
|
+
# If async, the assistant will move forward without waiting for your server to
|
14
|
+
# respond. This is useful if you just want to trigger something on your server.
|
15
|
+
# If sync, the assistant will wait for your server to respond. This is useful if
|
16
|
+
# want assistant to respond with the result from your server.
|
17
|
+
# Defaults to synchronous (`false`).
|
18
|
+
attr_reader :async
|
19
|
+
# @return [Array<Vapi::TextEditorToolWithToolCallMessagesItem>] These are the messages that will be spoken to the user as the tool is running.
|
20
|
+
# For some tools, this is auto-filled based on special fields like
|
21
|
+
# `tool.destinations`. For others like the function tool, these can be custom
|
22
|
+
# configured.
|
23
|
+
attr_reader :messages
|
24
|
+
# @return [String] The sub type of tool.
|
25
|
+
attr_reader :sub_type
|
26
|
+
# @return [Vapi::ToolCall]
|
27
|
+
attr_reader :tool_call
|
28
|
+
# @return [String] The name of the tool, fixed to 'str_replace_editor'
|
29
|
+
attr_reader :name
|
30
|
+
# @return [Vapi::OpenAiFunction] This is the function definition of the tool.
|
31
|
+
# For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on
|
32
|
+
# tool-specific fields like `tool.destinations`. But, even in those cases, you can
|
33
|
+
# provide a custom function definition for advanced use cases.
|
34
|
+
# An example of an advanced use case is if you want to customize the message
|
35
|
+
# that's spoken for `endCall` tool. You can specify a function where it returns an
|
36
|
+
# argument "reason". Then, in `messages` array, you can have many
|
37
|
+
# "request-complete" messages. One of these messages will be triggered if the
|
38
|
+
# `messages[].conditions` matches the "reason" argument.
|
39
|
+
attr_reader :function
|
40
|
+
# @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model.
|
41
|
+
# All requests will be sent with the call object among other things. You can find
|
42
|
+
# more details in the Server URL documentation.
|
43
|
+
# This overrides the serverUrl set on the org and the phoneNumber. Order of
|
44
|
+
# precedence: highest tool.server.url, then assistant.serverUrl, then
|
45
|
+
# phoneNumber.serverUrl, then org.serverUrl.
|
46
|
+
attr_reader :server
|
47
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
48
|
+
attr_reader :additional_properties
|
49
|
+
# @return [Object]
|
50
|
+
attr_reader :_field_set
|
51
|
+
protected :_field_set
|
52
|
+
|
53
|
+
OMIT = Object.new
|
54
|
+
|
55
|
+
# @param async [Boolean] This determines if the tool is async.
|
56
|
+
# If async, the assistant will move forward without waiting for your server to
|
57
|
+
# respond. This is useful if you just want to trigger something on your server.
|
58
|
+
# If sync, the assistant will wait for your server to respond. This is useful if
|
59
|
+
# want assistant to respond with the result from your server.
|
60
|
+
# Defaults to synchronous (`false`).
|
61
|
+
# @param messages [Array<Vapi::TextEditorToolWithToolCallMessagesItem>] These are the messages that will be spoken to the user as the tool is running.
|
62
|
+
# For some tools, this is auto-filled based on special fields like
|
63
|
+
# `tool.destinations`. For others like the function tool, these can be custom
|
64
|
+
# configured.
|
65
|
+
# @param sub_type [String] The sub type of tool.
|
66
|
+
# @param tool_call [Vapi::ToolCall]
|
67
|
+
# @param name [String] The name of the tool, fixed to 'str_replace_editor'
|
68
|
+
# @param function [Vapi::OpenAiFunction] This is the function definition of the tool.
|
69
|
+
# For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on
|
70
|
+
# tool-specific fields like `tool.destinations`. But, even in those cases, you can
|
71
|
+
# provide a custom function definition for advanced use cases.
|
72
|
+
# An example of an advanced use case is if you want to customize the message
|
73
|
+
# that's spoken for `endCall` tool. You can specify a function where it returns an
|
74
|
+
# argument "reason". Then, in `messages` array, you can have many
|
75
|
+
# "request-complete" messages. One of these messages will be triggered if the
|
76
|
+
# `messages[].conditions` matches the "reason" argument.
|
77
|
+
# @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model.
|
78
|
+
# All requests will be sent with the call object among other things. You can find
|
79
|
+
# more details in the Server URL documentation.
|
80
|
+
# This overrides the serverUrl set on the org and the phoneNumber. Order of
|
81
|
+
# precedence: highest tool.server.url, then assistant.serverUrl, then
|
82
|
+
# phoneNumber.serverUrl, then org.serverUrl.
|
83
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
84
|
+
# @return [Vapi::TextEditorToolWithToolCall]
|
85
|
+
def initialize(sub_type:, tool_call:, name:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT,
|
86
|
+
additional_properties: nil)
|
87
|
+
@async = async if async != OMIT
|
88
|
+
@messages = messages if messages != OMIT
|
89
|
+
@sub_type = sub_type
|
90
|
+
@tool_call = tool_call
|
91
|
+
@name = name
|
92
|
+
@function = function if function != OMIT
|
93
|
+
@server = server if server != OMIT
|
94
|
+
@additional_properties = additional_properties
|
95
|
+
@_field_set = {
|
96
|
+
"async": async,
|
97
|
+
"messages": messages,
|
98
|
+
"subType": sub_type,
|
99
|
+
"toolCall": tool_call,
|
100
|
+
"name": name,
|
101
|
+
"function": function,
|
102
|
+
"server": server
|
103
|
+
}.reject do |_k, v|
|
104
|
+
v == OMIT
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# Deserialize a JSON object to an instance of TextEditorToolWithToolCall
|
109
|
+
#
|
110
|
+
# @param json_object [String]
|
111
|
+
# @return [Vapi::TextEditorToolWithToolCall]
|
112
|
+
def self.from_json(json_object:)
|
113
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
114
|
+
parsed_json = JSON.parse(json_object)
|
115
|
+
async = parsed_json["async"]
|
116
|
+
messages = parsed_json["messages"]&.map do |item|
|
117
|
+
item = item.to_json
|
118
|
+
Vapi::TextEditorToolWithToolCallMessagesItem.from_json(json_object: item)
|
119
|
+
end
|
120
|
+
sub_type = parsed_json["subType"]
|
121
|
+
if parsed_json["toolCall"].nil?
|
122
|
+
tool_call = nil
|
123
|
+
else
|
124
|
+
tool_call = parsed_json["toolCall"].to_json
|
125
|
+
tool_call = Vapi::ToolCall.from_json(json_object: tool_call)
|
126
|
+
end
|
127
|
+
name = parsed_json["name"]
|
128
|
+
if parsed_json["function"].nil?
|
129
|
+
function = nil
|
130
|
+
else
|
131
|
+
function = parsed_json["function"].to_json
|
132
|
+
function = Vapi::OpenAiFunction.from_json(json_object: function)
|
133
|
+
end
|
134
|
+
if parsed_json["server"].nil?
|
135
|
+
server = nil
|
136
|
+
else
|
137
|
+
server = parsed_json["server"].to_json
|
138
|
+
server = Vapi::Server.from_json(json_object: server)
|
139
|
+
end
|
140
|
+
new(
|
141
|
+
async: async,
|
142
|
+
messages: messages,
|
143
|
+
sub_type: sub_type,
|
144
|
+
tool_call: tool_call,
|
145
|
+
name: name,
|
146
|
+
function: function,
|
147
|
+
server: server,
|
148
|
+
additional_properties: struct
|
149
|
+
)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Serialize an instance of TextEditorToolWithToolCall to a JSON object
|
153
|
+
#
|
154
|
+
# @return [String]
|
155
|
+
def to_json(*_args)
|
156
|
+
@_field_set&.to_json
|
157
|
+
end
|
158
|
+
|
159
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
160
|
+
# hash and check each fields type against the current object's property
|
161
|
+
# definitions.
|
162
|
+
#
|
163
|
+
# @param obj [Object]
|
164
|
+
# @return [Void]
|
165
|
+
def self.validate_raw(obj:)
|
166
|
+
obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.")
|
167
|
+
obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
|
168
|
+
obj.sub_type.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.")
|
169
|
+
Vapi::ToolCall.validate_raw(obj: obj.tool_call)
|
170
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
171
|
+
obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function)
|
172
|
+
obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "tool_message_start"
|
5
|
+
require_relative "tool_message_complete"
|
6
|
+
require_relative "tool_message_failed"
|
7
|
+
require_relative "tool_message_delayed"
|
8
|
+
|
9
|
+
module Vapi
|
10
|
+
class TextEditorToolWithToolCallMessagesItem
|
11
|
+
# @return [Object]
|
12
|
+
attr_reader :member
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :discriminant
|
15
|
+
|
16
|
+
private_class_method :new
|
17
|
+
alias kind_of? is_a?
|
18
|
+
|
19
|
+
# @param member [Object]
|
20
|
+
# @param discriminant [String]
|
21
|
+
# @return [Vapi::TextEditorToolWithToolCallMessagesItem]
|
22
|
+
def initialize(member:, discriminant:)
|
23
|
+
@member = member
|
24
|
+
@discriminant = discriminant
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deserialize a JSON object to an instance of
|
28
|
+
# TextEditorToolWithToolCallMessagesItem
|
29
|
+
#
|
30
|
+
# @param json_object [String]
|
31
|
+
# @return [Vapi::TextEditorToolWithToolCallMessagesItem]
|
32
|
+
def self.from_json(json_object:)
|
33
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
34
|
+
member = case struct.type
|
35
|
+
when "request-start"
|
36
|
+
Vapi::ToolMessageStart.from_json(json_object: json_object)
|
37
|
+
when "request-complete"
|
38
|
+
Vapi::ToolMessageComplete.from_json(json_object: json_object)
|
39
|
+
when "request-failed"
|
40
|
+
Vapi::ToolMessageFailed.from_json(json_object: json_object)
|
41
|
+
when "request-response-delayed"
|
42
|
+
Vapi::ToolMessageDelayed.from_json(json_object: json_object)
|
43
|
+
else
|
44
|
+
Vapi::ToolMessageStart.from_json(json_object: json_object)
|
45
|
+
end
|
46
|
+
new(member: member, discriminant: struct.type)
|
47
|
+
end
|
48
|
+
|
49
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
50
|
+
#
|
51
|
+
# @return [String]
|
52
|
+
def to_json(*_args)
|
53
|
+
case @discriminant
|
54
|
+
when "request-start"
|
55
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
56
|
+
when "request-complete"
|
57
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
58
|
+
when "request-failed"
|
59
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
60
|
+
when "request-response-delayed"
|
61
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
62
|
+
else
|
63
|
+
{ "type": @discriminant, value: @member }.to_json
|
64
|
+
end
|
65
|
+
@member.to_json
|
66
|
+
end
|
67
|
+
|
68
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
69
|
+
# hash and check each fields type against the current object's property
|
70
|
+
# definitions.
|
71
|
+
#
|
72
|
+
# @param obj [Object]
|
73
|
+
# @return [Void]
|
74
|
+
def self.validate_raw(obj:)
|
75
|
+
case obj.type
|
76
|
+
when "request-start"
|
77
|
+
Vapi::ToolMessageStart.validate_raw(obj: obj)
|
78
|
+
when "request-complete"
|
79
|
+
Vapi::ToolMessageComplete.validate_raw(obj: obj)
|
80
|
+
when "request-failed"
|
81
|
+
Vapi::ToolMessageFailed.validate_raw(obj: obj)
|
82
|
+
when "request-response-delayed"
|
83
|
+
Vapi::ToolMessageDelayed.validate_raw(obj: obj)
|
84
|
+
else
|
85
|
+
raise("Passed value matched no type within the union, validation failed.")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
90
|
+
#
|
91
|
+
# @param obj [Object]
|
92
|
+
# @return [Boolean]
|
93
|
+
def is_a?(obj)
|
94
|
+
@member.is_a?(obj)
|
95
|
+
end
|
96
|
+
|
97
|
+
# @param member [Vapi::ToolMessageStart]
|
98
|
+
# @return [Vapi::TextEditorToolWithToolCallMessagesItem]
|
99
|
+
def self.request_start(member:)
|
100
|
+
new(member: member, discriminant: "request-start")
|
101
|
+
end
|
102
|
+
|
103
|
+
# @param member [Vapi::ToolMessageComplete]
|
104
|
+
# @return [Vapi::TextEditorToolWithToolCallMessagesItem]
|
105
|
+
def self.request_complete(member:)
|
106
|
+
new(member: member, discriminant: "request-complete")
|
107
|
+
end
|
108
|
+
|
109
|
+
# @param member [Vapi::ToolMessageFailed]
|
110
|
+
# @return [Vapi::TextEditorToolWithToolCallMessagesItem]
|
111
|
+
def self.request_failed(member:)
|
112
|
+
new(member: member, discriminant: "request-failed")
|
113
|
+
end
|
114
|
+
|
115
|
+
# @param member [Vapi::ToolMessageDelayed]
|
116
|
+
# @return [Vapi::TextEditorToolWithToolCallMessagesItem]
|
117
|
+
def self.request_response_delayed(member:)
|
118
|
+
new(member: member, discriminant: "request-response-delayed")
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -16,6 +16,10 @@ module Vapi
|
|
16
16
|
# be automatically translated to the active language at that moment.
|
17
17
|
# This will override the `content` property.
|
18
18
|
attr_reader :contents
|
19
|
+
# @return [Boolean] This is an optional boolean that if true, the tool call will only trigger after
|
20
|
+
# the message is spoken. Default is false.
|
21
|
+
# @default false
|
22
|
+
attr_reader :blocking
|
19
23
|
# @return [String] This is the content that the assistant says when this message is triggered.
|
20
24
|
attr_reader :content
|
21
25
|
# @return [Array<Vapi::Condition>] This is an optional array of conditions that the tool call arguments must meet
|
@@ -37,17 +41,26 @@ module Vapi
|
|
37
41
|
# - If you don't provide content for a language, the first item in the array will
|
38
42
|
# be automatically translated to the active language at that moment.
|
39
43
|
# This will override the `content` property.
|
44
|
+
# @param blocking [Boolean] This is an optional boolean that if true, the tool call will only trigger after
|
45
|
+
# the message is spoken. Default is false.
|
46
|
+
# @default false
|
40
47
|
# @param content [String] This is the content that the assistant says when this message is triggered.
|
41
48
|
# @param conditions [Array<Vapi::Condition>] This is an optional array of conditions that the tool call arguments must meet
|
42
49
|
# in order for this message to be triggered.
|
43
50
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
44
51
|
# @return [Vapi::ToolMessageStart]
|
45
|
-
def initialize(contents: OMIT, content: OMIT, conditions: OMIT, additional_properties: nil)
|
52
|
+
def initialize(contents: OMIT, blocking: OMIT, content: OMIT, conditions: OMIT, additional_properties: nil)
|
46
53
|
@contents = contents if contents != OMIT
|
54
|
+
@blocking = blocking if blocking != OMIT
|
47
55
|
@content = content if content != OMIT
|
48
56
|
@conditions = conditions if conditions != OMIT
|
49
57
|
@additional_properties = additional_properties
|
50
|
-
@_field_set = {
|
58
|
+
@_field_set = {
|
59
|
+
"contents": contents,
|
60
|
+
"blocking": blocking,
|
61
|
+
"content": content,
|
62
|
+
"conditions": conditions
|
63
|
+
}.reject do |_k, v|
|
51
64
|
v == OMIT
|
52
65
|
end
|
53
66
|
end
|
@@ -63,6 +76,7 @@ module Vapi
|
|
63
76
|
item = item.to_json
|
64
77
|
Vapi::TextContent.from_json(json_object: item)
|
65
78
|
end
|
79
|
+
blocking = parsed_json["blocking"]
|
66
80
|
content = parsed_json["content"]
|
67
81
|
conditions = parsed_json["conditions"]&.map do |item|
|
68
82
|
item = item.to_json
|
@@ -70,6 +84,7 @@ module Vapi
|
|
70
84
|
end
|
71
85
|
new(
|
72
86
|
contents: contents,
|
87
|
+
blocking: blocking,
|
73
88
|
content: content,
|
74
89
|
conditions: conditions,
|
75
90
|
additional_properties: struct
|
@@ -91,6 +106,7 @@ module Vapi
|
|
91
106
|
# @return [Void]
|
92
107
|
def self.validate_raw(obj:)
|
93
108
|
obj.contents&.is_a?(Array) != false || raise("Passed value for field obj.contents is not the expected type, validation failed.")
|
109
|
+
obj.blocking&.is_a?(Boolean) != false || raise("Passed value for field obj.blocking is not the expected type, validation failed.")
|
94
110
|
obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.")
|
95
111
|
obj.conditions&.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.")
|
96
112
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vapi
|
7
|
+
class Transfer
|
8
|
+
# @return [Hash{String => Object}]
|
9
|
+
attr_reader :destination
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :name
|
12
|
+
# @return [Hash{String => Object}] This is for metadata you want to store on the task.
|
13
|
+
attr_reader :metadata
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param destination [Hash{String => Object}]
|
23
|
+
# @param name [String]
|
24
|
+
# @param metadata [Hash{String => Object}] This is for metadata you want to store on the task.
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
# @return [Vapi::Transfer]
|
27
|
+
def initialize(destination:, name:, metadata: OMIT, additional_properties: nil)
|
28
|
+
@destination = destination
|
29
|
+
@name = name
|
30
|
+
@metadata = metadata if metadata != OMIT
|
31
|
+
@additional_properties = additional_properties
|
32
|
+
@_field_set = { "destination": destination, "name": name, "metadata": metadata }.reject do |_k, v|
|
33
|
+
v == OMIT
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Deserialize a JSON object to an instance of Transfer
|
38
|
+
#
|
39
|
+
# @param json_object [String]
|
40
|
+
# @return [Vapi::Transfer]
|
41
|
+
def self.from_json(json_object:)
|
42
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
|
+
parsed_json = JSON.parse(json_object)
|
44
|
+
destination = parsed_json["destination"]
|
45
|
+
name = parsed_json["name"]
|
46
|
+
metadata = parsed_json["metadata"]
|
47
|
+
new(
|
48
|
+
destination: destination,
|
49
|
+
name: name,
|
50
|
+
metadata: metadata,
|
51
|
+
additional_properties: struct
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Serialize an instance of Transfer to a JSON object
|
56
|
+
#
|
57
|
+
# @return [String]
|
58
|
+
def to_json(*_args)
|
59
|
+
@_field_set&.to_json
|
60
|
+
end
|
61
|
+
|
62
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
63
|
+
# hash and check each fields type against the current object's property
|
64
|
+
# definitions.
|
65
|
+
#
|
66
|
+
# @param obj [Object]
|
67
|
+
# @return [Void]
|
68
|
+
def self.validate_raw(obj:)
|
69
|
+
obj.destination.is_a?(Hash) != false || raise("Passed value for field obj.destination is not the expected type, validation failed.")
|
70
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
71
|
+
obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "transfer_assistant_hook_action_destination"
|
4
|
+
require "ostruct"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vapi
|
8
|
+
class TransferAssistantHookAction
|
9
|
+
# @return [String] This is the type of action - must be "transfer"
|
10
|
+
attr_reader :type
|
11
|
+
# @return [Vapi::TransferAssistantHookActionDestination] This is the destination details for the transfer - can be a phone number or SIP
|
12
|
+
# URI
|
13
|
+
attr_reader :destination
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
attr_reader :additional_properties
|
16
|
+
# @return [Object]
|
17
|
+
attr_reader :_field_set
|
18
|
+
protected :_field_set
|
19
|
+
|
20
|
+
OMIT = Object.new
|
21
|
+
|
22
|
+
# @param type [String] This is the type of action - must be "transfer"
|
23
|
+
# @param destination [Vapi::TransferAssistantHookActionDestination] This is the destination details for the transfer - can be a phone number or SIP
|
24
|
+
# URI
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
# @return [Vapi::TransferAssistantHookAction]
|
27
|
+
def initialize(type:, destination: OMIT, additional_properties: nil)
|
28
|
+
@type = type
|
29
|
+
@destination = destination if destination != OMIT
|
30
|
+
@additional_properties = additional_properties
|
31
|
+
@_field_set = { "type": type, "destination": destination }.reject do |_k, v|
|
32
|
+
v == OMIT
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Deserialize a JSON object to an instance of TransferAssistantHookAction
|
37
|
+
#
|
38
|
+
# @param json_object [String]
|
39
|
+
# @return [Vapi::TransferAssistantHookAction]
|
40
|
+
def self.from_json(json_object:)
|
41
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
42
|
+
parsed_json = JSON.parse(json_object)
|
43
|
+
type = parsed_json["type"]
|
44
|
+
if parsed_json["destination"].nil?
|
45
|
+
destination = nil
|
46
|
+
else
|
47
|
+
destination = parsed_json["destination"].to_json
|
48
|
+
destination = Vapi::TransferAssistantHookActionDestination.from_json(json_object: destination)
|
49
|
+
end
|
50
|
+
new(
|
51
|
+
type: type,
|
52
|
+
destination: destination,
|
53
|
+
additional_properties: struct
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Serialize an instance of TransferAssistantHookAction to a JSON object
|
58
|
+
#
|
59
|
+
# @return [String]
|
60
|
+
def to_json(*_args)
|
61
|
+
@_field_set&.to_json
|
62
|
+
end
|
63
|
+
|
64
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
65
|
+
# hash and check each fields type against the current object's property
|
66
|
+
# definitions.
|
67
|
+
#
|
68
|
+
# @param obj [Object]
|
69
|
+
# @return [Void]
|
70
|
+
def self.validate_raw(obj:)
|
71
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
72
|
+
obj.destination.nil? || Vapi::TransferAssistantHookActionDestination.validate_raw(obj: obj.destination)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -5,13 +5,9 @@ require_relative "transfer_destination_number"
|
|
5
5
|
require_relative "transfer_destination_sip"
|
6
6
|
|
7
7
|
module Vapi
|
8
|
-
# This is the
|
9
|
-
#
|
10
|
-
|
11
|
-
# 3. and, `assistant-request` message to the `serverUrl` fails
|
12
|
-
# If this is not set and above conditions are met, the inbound call is hung up
|
13
|
-
# with an error message.
|
14
|
-
class BuyPhoneNumberDtoFallbackDestination
|
8
|
+
# This is the destination details for the transfer - can be a phone number or SIP
|
9
|
+
# URI
|
10
|
+
class TransferAssistantHookActionDestination
|
15
11
|
# @return [Object]
|
16
12
|
attr_reader :member
|
17
13
|
# @return [String]
|
@@ -22,16 +18,17 @@ module Vapi
|
|
22
18
|
|
23
19
|
# @param member [Object]
|
24
20
|
# @param discriminant [String]
|
25
|
-
# @return [Vapi::
|
21
|
+
# @return [Vapi::TransferAssistantHookActionDestination]
|
26
22
|
def initialize(member:, discriminant:)
|
27
23
|
@member = member
|
28
24
|
@discriminant = discriminant
|
29
25
|
end
|
30
26
|
|
31
|
-
# Deserialize a JSON object to an instance of
|
27
|
+
# Deserialize a JSON object to an instance of
|
28
|
+
# TransferAssistantHookActionDestination
|
32
29
|
#
|
33
30
|
# @param json_object [String]
|
34
|
-
# @return [Vapi::
|
31
|
+
# @return [Vapi::TransferAssistantHookActionDestination]
|
35
32
|
def self.from_json(json_object:)
|
36
33
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
37
34
|
member = case struct.type
|
@@ -86,13 +83,13 @@ module Vapi
|
|
86
83
|
end
|
87
84
|
|
88
85
|
# @param member [Vapi::TransferDestinationNumber]
|
89
|
-
# @return [Vapi::
|
86
|
+
# @return [Vapi::TransferAssistantHookActionDestination]
|
90
87
|
def self.number(member:)
|
91
88
|
new(member: member, discriminant: "number")
|
92
89
|
end
|
93
90
|
|
94
91
|
# @param member [Vapi::TransferDestinationSip]
|
95
|
-
# @return [Vapi::
|
92
|
+
# @return [Vapi::TransferAssistantHookActionDestination]
|
96
93
|
def self.sip(member:)
|
97
94
|
new(member: member, discriminant: "sip")
|
98
95
|
end
|