vapi_server_sdk 0.2.0 → 0.3.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 +129 -62
- data/lib/vapi_server_sdk/assistants/client.rb +15 -2
- data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_credentials_item.rb +512 -0
- data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb +13 -0
- data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_transcriber.rb +13 -0
- data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_voice.rb +13 -0
- data/lib/vapi_server_sdk/blocks/client.rb +7 -166
- data/lib/vapi_server_sdk/blocks/types/blocks_update_request.rb +109 -0
- data/lib/vapi_server_sdk/calls/client.rb +16 -4
- data/lib/vapi_server_sdk/knowledge_bases/client.rb +7 -8
- data/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_request.rb +96 -0
- data/lib/vapi_server_sdk/logs/client.rb +84 -0
- data/lib/vapi_server_sdk/phone_numbers/client.rb +7 -69
- data/lib/vapi_server_sdk/phone_numbers/types/phone_numbers_update_request.rb +122 -0
- data/lib/vapi_server_sdk/squads/client.rb +8 -0
- data/lib/vapi_server_sdk/tools/client.rb +7 -91
- data/lib/vapi_server_sdk/tools/types/tools_update_request.rb +200 -0
- data/lib/vapi_server_sdk/types/assistant.rb +19 -1
- data/lib/vapi_server_sdk/types/assistant_credentials_item.rb +510 -0
- data/lib/vapi_server_sdk/types/assistant_model.rb +13 -0
- data/lib/vapi_server_sdk/types/assistant_overrides.rb +19 -1
- data/lib/vapi_server_sdk/types/assistant_overrides_credentials_item.rb +510 -0
- data/lib/vapi_server_sdk/types/assistant_overrides_model.rb +13 -0
- data/lib/vapi_server_sdk/types/assistant_overrides_transcriber.rb +13 -0
- data/lib/vapi_server_sdk/types/assistant_overrides_voice.rb +13 -0
- data/lib/vapi_server_sdk/types/assistant_transcriber.rb +13 -0
- data/lib/vapi_server_sdk/types/assistant_voice.rb +13 -0
- data/lib/vapi_server_sdk/types/azure_blob_storage_bucket_plan.rb +88 -0
- data/lib/vapi_server_sdk/types/azure_credential.rb +22 -5
- data/lib/vapi_server_sdk/types/azure_credential_region.rb +1 -1
- data/lib/vapi_server_sdk/types/azure_credential_service.rb +9 -0
- data/lib/vapi_server_sdk/types/azure_open_ai_credential.rb +9 -1
- data/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb +1 -1
- data/lib/vapi_server_sdk/types/azure_speech_transcriber.rb +62 -0
- data/lib/vapi_server_sdk/types/azure_speech_transcriber_language.rb +152 -0
- data/lib/vapi_server_sdk/types/buy_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/byo_phone_number.rb +25 -29
- data/lib/vapi_server_sdk/types/call_ended_reason.rb +44 -29
- data/lib/vapi_server_sdk/types/cartesia_voice_model.rb +2 -0
- data/lib/vapi_server_sdk/types/cerebras_credential.rb +111 -0
- data/lib/vapi_server_sdk/types/chat_dto.rb +103 -0
- data/lib/vapi_server_sdk/types/{credits_buy_dto.rb → chat_service_response.rb} +9 -17
- data/lib/vapi_server_sdk/types/cloudflare_credential.rb +142 -0
- data/lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb +105 -0
- data/lib/vapi_server_sdk/types/create_anthropic_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_anyscale_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_assembly_ai_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_assistant_dto.rb +19 -1
- data/lib/vapi_server_sdk/types/create_assistant_dto_credentials_item.rb +510 -0
- data/lib/vapi_server_sdk/types/create_assistant_dto_model.rb +13 -0
- data/lib/vapi_server_sdk/types/create_assistant_dto_transcriber.rb +13 -0
- data/lib/vapi_server_sdk/types/create_assistant_dto_voice.rb +13 -0
- data/lib/vapi_server_sdk/types/create_azure_credential_dto.rb +21 -12
- data/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb +1 -1
- data/lib/vapi_server_sdk/types/create_azure_credential_dto_service.rb +9 -0
- data/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto.rb +10 -9
- data/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb +1 -1
- data/lib/vapi_server_sdk/types/create_byo_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb +1 -9
- data/lib/vapi_server_sdk/types/create_cartesia_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_cerebras_credential_dto.rb +74 -0
- data/lib/vapi_server_sdk/types/create_cloudflare_credential_dto.rb +101 -0
- data/lib/vapi_server_sdk/types/create_custom_llm_credential_dto.rb +2 -14
- data/lib/vapi_server_sdk/types/create_deep_infra_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_deep_seek_credential_dto.rb +67 -0
- data/lib/vapi_server_sdk/types/create_deepgram_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_eleven_labs_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_gcp_credential_dto.rb +2 -14
- data/lib/vapi_server_sdk/types/create_gladia_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_go_high_level_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_groq_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_langfuse_credential_dto.rb +2 -15
- data/lib/vapi_server_sdk/types/create_lmnt_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_make_credential_dto.rb +2 -15
- data/lib/vapi_server_sdk/types/create_open_ai_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_open_router_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_org_dto.rb +25 -25
- data/lib/vapi_server_sdk/types/create_perplexity_ai_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_play_ht_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_rime_ai_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_runpod_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_s_3_credential_dto.rb +2 -10
- data/lib/vapi_server_sdk/types/create_smallest_ai_credential_dto.rb +67 -0
- data/lib/vapi_server_sdk/types/create_tavus_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_together_ai_credential_dto.rb +2 -9
- data/lib/vapi_server_sdk/types/create_twilio_credential_dto.rb +2 -14
- data/lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/create_vonage_credential_dto.rb +2 -14
- data/lib/vapi_server_sdk/types/create_vonage_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/create_webhook_credential_dto.rb +2 -13
- data/lib/vapi_server_sdk/types/create_x_ai_credential_dto.rb +2 -11
- data/lib/vapi_server_sdk/types/deep_seek_credential.rb +111 -0
- data/lib/vapi_server_sdk/types/deep_seek_model.rb +177 -0
- data/lib/vapi_server_sdk/types/deep_seek_model_tools_item.rb +159 -0
- data/lib/vapi_server_sdk/types/eleven_labs_voice_model.rb +2 -0
- data/lib/vapi_server_sdk/types/fallback_cartesia_voice_model.rb +2 -0
- data/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_model.rb +2 -0
- data/lib/vapi_server_sdk/types/fallback_open_ai_voice.rb +4 -4
- data/lib/vapi_server_sdk/types/fallback_open_ai_voice_id.rb +2 -2
- data/lib/vapi_server_sdk/types/fallback_plan_voices_item.rb +13 -0
- data/lib/vapi_server_sdk/types/fallback_smallest_ai_voice.rb +95 -0
- data/lib/vapi_server_sdk/types/fallback_smallest_ai_voice_id.rb +53 -0
- data/lib/vapi_server_sdk/types/fallback_smallest_ai_voice_id_enum.rb +31 -0
- data/lib/vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config.rb +58 -0
- data/lib/vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config_voice_name.rb +11 -0
- data/lib/vapi_server_sdk/types/gemini_multimodal_live_speech_config.rb +61 -0
- data/lib/vapi_server_sdk/types/gemini_multimodal_live_voice_config.rb +61 -0
- data/lib/vapi_server_sdk/types/google_model.rb +17 -1
- data/lib/vapi_server_sdk/types/google_model_model.rb +2 -0
- data/lib/vapi_server_sdk/types/google_realtime_config.rb +121 -0
- data/lib/vapi_server_sdk/types/groq_model_model.rb +1 -3
- data/lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb +25 -29
- data/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb +6 -0
- data/lib/vapi_server_sdk/types/open_ai_model_model.rb +6 -0
- data/lib/vapi_server_sdk/types/open_ai_voice.rb +4 -4
- data/lib/vapi_server_sdk/types/open_ai_voice_id.rb +2 -2
- data/lib/vapi_server_sdk/types/org.rb +25 -25
- data/lib/vapi_server_sdk/types/org_with_org_user.rb +25 -25
- data/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb +44 -29
- data/lib/vapi_server_sdk/types/server_message_status_update.rb +11 -1
- data/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb +44 -29
- data/lib/vapi_server_sdk/types/smallest_ai_credential.rb +111 -0
- data/lib/vapi_server_sdk/types/smallest_ai_voice.rb +117 -0
- data/lib/vapi_server_sdk/types/smallest_ai_voice_id.rb +53 -0
- data/lib/vapi_server_sdk/types/smallest_ai_voice_id_enum.rb +31 -0
- data/lib/vapi_server_sdk/types/subscription.rb +2 -2
- data/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb +1 -0
- data/lib/vapi_server_sdk/types/transfer_plan.rb +26 -6
- data/lib/vapi_server_sdk/types/transfer_plan_message.rb +2 -1
- data/lib/vapi_server_sdk/types/twilio_phone_number.rb +25 -29
- data/lib/vapi_server_sdk/types/update_anthropic_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_anyscale_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_assembly_ai_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_azure_credential_dto.rb +24 -14
- data/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb +1 -1
- data/lib/vapi_server_sdk/types/update_azure_credential_dto_service.rb +9 -0
- data/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto.rb +25 -24
- data/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb +1 -1
- data/lib/vapi_server_sdk/types/update_bash_tool_dto.rb +161 -0
- data/lib/vapi_server_sdk/types/update_bash_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_byo_phone_number_dto.rb +187 -0
- data/lib/vapi_server_sdk/types/update_byo_phone_number_dto_fallback_destination.rb +101 -0
- data/lib/vapi_server_sdk/types/update_byo_sip_trunk_credential_dto.rb +13 -21
- data/lib/vapi_server_sdk/types/update_cartesia_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_cerebras_credential_dto.rb +67 -0
- data/lib/vapi_server_sdk/types/update_cloudflare_credential_dto.rb +101 -0
- data/lib/vapi_server_sdk/types/update_computer_tool_dto.rb +185 -0
- data/lib/vapi_server_sdk/types/update_computer_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_conversation_block_dto.rb +206 -0
- data/lib/vapi_server_sdk/types/update_conversation_block_dto_messages_item.rb +95 -0
- data/lib/vapi_server_sdk/types/update_custom_knowledge_base_dto.rb +139 -0
- data/lib/vapi_server_sdk/types/update_custom_llm_credential_dto.rb +4 -16
- data/lib/vapi_server_sdk/types/update_deep_infra_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_deep_seek_credential_dto.rb +67 -0
- data/lib/vapi_server_sdk/types/update_deepgram_credential_dto.rb +11 -18
- data/lib/vapi_server_sdk/types/update_dtmf_tool_dto.rb +139 -0
- data/lib/vapi_server_sdk/types/update_dtmf_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_eleven_labs_credential_dto.rb +11 -11
- data/lib/vapi_server_sdk/types/update_end_call_tool_dto.rb +139 -0
- data/lib/vapi_server_sdk/types/update_end_call_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_function_tool_dto.rb +139 -0
- data/lib/vapi_server_sdk/types/update_function_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_gcp_credential_dto.rb +11 -23
- data/lib/vapi_server_sdk/types/update_ghl_tool_dto.rb +159 -0
- data/lib/vapi_server_sdk/types/update_ghl_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_gladia_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_go_high_level_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_google_credential_dto.rb +4 -13
- data/lib/vapi_server_sdk/types/update_groq_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_inflection_ai_credential_dto.rb +4 -13
- data/lib/vapi_server_sdk/types/update_langfuse_credential_dto.rb +8 -21
- data/lib/vapi_server_sdk/types/update_lmnt_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_make_credential_dto.rb +8 -21
- data/lib/vapi_server_sdk/types/update_make_tool_dto.rb +159 -0
- data/lib/vapi_server_sdk/types/update_make_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_open_ai_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_open_router_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_org_dto.rb +25 -25
- data/lib/vapi_server_sdk/types/update_output_tool_dto.rb +139 -0
- data/lib/vapi_server_sdk/types/update_output_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_perplexity_ai_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_play_ht_credential_dto.rb +11 -18
- data/lib/vapi_server_sdk/types/update_rime_ai_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_runpod_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_s_3_credential_dto.rb +12 -20
- data/lib/vapi_server_sdk/types/update_smallest_ai_credential_dto.rb +67 -0
- data/lib/vapi_server_sdk/types/update_tavus_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_text_editor_tool_dto.rb +161 -0
- data/lib/vapi_server_sdk/types/update_text_editor_tool_dto_messages_item.rb +120 -0
- data/lib/vapi_server_sdk/types/update_together_ai_credential_dto.rb +4 -11
- data/lib/vapi_server_sdk/types/update_token_dto.rb +81 -0
- data/lib/vapi_server_sdk/types/update_token_dto_tag.rb +9 -0
- data/lib/vapi_server_sdk/types/update_tool_call_block_dto.rb +168 -0
- data/lib/vapi_server_sdk/types/update_tool_call_block_dto_messages_item.rb +94 -0
- data/lib/vapi_server_sdk/types/update_tool_call_block_dto_tool.rb +161 -0
- data/lib/vapi_server_sdk/types/update_transfer_call_tool_dto.rb +161 -0
- data/lib/vapi_server_sdk/types/update_transfer_call_tool_dto_destinations_item.rb +121 -0
- data/lib/vapi_server_sdk/types/update_transfer_call_tool_dto_messages_item.rb +121 -0
- data/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto.rb +109 -0
- data/lib/vapi_server_sdk/types/update_twilio_credential_dto.rb +11 -23
- data/lib/vapi_server_sdk/types/update_twilio_phone_number_dto.rb +163 -0
- data/lib/vapi_server_sdk/types/update_twilio_phone_number_dto_fallback_destination.rb +101 -0
- data/lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb +169 -0
- data/lib/vapi_server_sdk/types/update_vapi_phone_number_dto_fallback_destination.rb +101 -0
- data/lib/vapi_server_sdk/types/update_vonage_credential_dto.rb +11 -23
- data/lib/vapi_server_sdk/types/update_vonage_phone_number_dto.rb +157 -0
- data/lib/vapi_server_sdk/types/update_vonage_phone_number_dto_fallback_destination.rb +101 -0
- data/lib/vapi_server_sdk/types/update_workflow_block_dto.rb +154 -0
- data/lib/vapi_server_sdk/types/update_workflow_block_dto_messages_item.rb +94 -0
- data/lib/vapi_server_sdk/types/update_workflow_block_dto_steps_item.rb +94 -0
- data/lib/vapi_server_sdk/types/update_x_ai_credential_dto.rb +4 -13
- data/lib/vapi_server_sdk/types/vapi_phone_number.rb +25 -29
- data/lib/vapi_server_sdk/types/vonage_phone_number.rb +25 -29
- metadata +88 -21
- data/lib/vapi_server_sdk/blocks/types/update_block_dto_messages_item.rb +0 -96
- data/lib/vapi_server_sdk/blocks/types/update_block_dto_steps_item.rb +0 -96
- data/lib/vapi_server_sdk/blocks/types/update_block_dto_tool.rb +0 -163
- data/lib/vapi_server_sdk/phone_numbers/types/update_phone_number_dto_fallback_destination.rb +0 -103
- data/lib/vapi_server_sdk/tools/types/update_tool_dto_messages_item.rb +0 -122
- data/lib/vapi_server_sdk/types/auto_reload_plan_dto.rb +0 -65
- data/lib/vapi_server_sdk/types/hipaa_buy_dto.rb +0 -65
- data/lib/vapi_server_sdk/types/payment.rb +0 -167
- data/lib/vapi_server_sdk/types/payment_retry_dto.rb +0 -55
- data/lib/vapi_server_sdk/types/payment_status.rb +0 -11
- data/lib/vapi_server_sdk/types/payments_paginated_response.rb +0 -75
- data/lib/vapi_server_sdk/types/subscription_concurrency_line_buy_dto.rb +0 -55
- data/lib/vapi_server_sdk/types/subscription_concurrency_line_remove_dto.rb +0 -55
- data/lib/vapi_server_sdk/types/subscription_coupon_add_dto.rb +0 -67
- data/lib/vapi_server_sdk/types/subscription_monthly_charge.rb +0 -65
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "transfer_destination_number"
|
5
|
+
require_relative "transfer_destination_sip"
|
6
|
+
|
7
|
+
module Vapi
|
8
|
+
# This is the fallback destination an inbound call will be transferred to if:
|
9
|
+
# 1. `assistantId` is not set
|
10
|
+
# 2. `squadId` is not set
|
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 UpdateVapiPhoneNumberDtoFallbackDestination
|
15
|
+
# @return [Object]
|
16
|
+
attr_reader :member
|
17
|
+
# @return [String]
|
18
|
+
attr_reader :discriminant
|
19
|
+
|
20
|
+
private_class_method :new
|
21
|
+
alias kind_of? is_a?
|
22
|
+
|
23
|
+
# @param member [Object]
|
24
|
+
# @param discriminant [String]
|
25
|
+
# @return [Vapi::UpdateVapiPhoneNumberDtoFallbackDestination]
|
26
|
+
def initialize(member:, discriminant:)
|
27
|
+
@member = member
|
28
|
+
@discriminant = discriminant
|
29
|
+
end
|
30
|
+
|
31
|
+
# Deserialize a JSON object to an instance of
|
32
|
+
# UpdateVapiPhoneNumberDtoFallbackDestination
|
33
|
+
#
|
34
|
+
# @param json_object [String]
|
35
|
+
# @return [Vapi::UpdateVapiPhoneNumberDtoFallbackDestination]
|
36
|
+
def self.from_json(json_object:)
|
37
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
38
|
+
member = case struct.type
|
39
|
+
when "number"
|
40
|
+
Vapi::TransferDestinationNumber.from_json(json_object: json_object)
|
41
|
+
when "sip"
|
42
|
+
Vapi::TransferDestinationSip.from_json(json_object: json_object)
|
43
|
+
else
|
44
|
+
Vapi::TransferDestinationNumber.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 "number"
|
55
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
56
|
+
when "sip"
|
57
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
58
|
+
else
|
59
|
+
{ "type": @discriminant, value: @member }.to_json
|
60
|
+
end
|
61
|
+
@member.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
|
+
case obj.type
|
72
|
+
when "number"
|
73
|
+
Vapi::TransferDestinationNumber.validate_raw(obj: obj)
|
74
|
+
when "sip"
|
75
|
+
Vapi::TransferDestinationSip.validate_raw(obj: obj)
|
76
|
+
else
|
77
|
+
raise("Passed value matched no type within the union, validation failed.")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
82
|
+
#
|
83
|
+
# @param obj [Object]
|
84
|
+
# @return [Boolean]
|
85
|
+
def is_a?(obj)
|
86
|
+
@member.is_a?(obj)
|
87
|
+
end
|
88
|
+
|
89
|
+
# @param member [Vapi::TransferDestinationNumber]
|
90
|
+
# @return [Vapi::UpdateVapiPhoneNumberDtoFallbackDestination]
|
91
|
+
def self.number(member:)
|
92
|
+
new(member: member, discriminant: "number")
|
93
|
+
end
|
94
|
+
|
95
|
+
# @param member [Vapi::TransferDestinationSip]
|
96
|
+
# @return [Vapi::UpdateVapiPhoneNumberDtoFallbackDestination]
|
97
|
+
def self.sip(member:)
|
98
|
+
new(member: member, discriminant: "sip")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -5,14 +5,12 @@ require "json"
|
|
5
5
|
|
6
6
|
module Vapi
|
7
7
|
class UpdateVonageCredentialDto
|
8
|
-
# @return [String]
|
9
|
-
attr_reader :provider
|
10
8
|
# @return [String] This is not returned in the API.
|
11
9
|
attr_reader :api_secret
|
12
|
-
# @return [String]
|
13
|
-
attr_reader :api_key
|
14
10
|
# @return [String] This is the name of credential. This is just for your reference.
|
15
11
|
attr_reader :name
|
12
|
+
# @return [String]
|
13
|
+
attr_reader :api_key
|
16
14
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
17
15
|
attr_reader :additional_properties
|
18
16
|
# @return [Object]
|
@@ -21,24 +19,17 @@ module Vapi
|
|
21
19
|
|
22
20
|
OMIT = Object.new
|
23
21
|
|
24
|
-
# @param provider [String]
|
25
22
|
# @param api_secret [String] This is not returned in the API.
|
26
|
-
# @param api_key [String]
|
27
23
|
# @param name [String] This is the name of credential. This is just for your reference.
|
24
|
+
# @param api_key [String]
|
28
25
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
29
26
|
# @return [Vapi::UpdateVonageCredentialDto]
|
30
|
-
def initialize(
|
31
|
-
@
|
32
|
-
@api_secret = api_secret
|
33
|
-
@api_key = api_key
|
27
|
+
def initialize(api_secret: OMIT, name: OMIT, api_key: OMIT, additional_properties: nil)
|
28
|
+
@api_secret = api_secret if api_secret != OMIT
|
34
29
|
@name = name if name != OMIT
|
30
|
+
@api_key = api_key if api_key != OMIT
|
35
31
|
@additional_properties = additional_properties
|
36
|
-
@_field_set = {
|
37
|
-
"provider": provider,
|
38
|
-
"apiSecret": api_secret,
|
39
|
-
"apiKey": api_key,
|
40
|
-
"name": name
|
41
|
-
}.reject do |_k, v|
|
32
|
+
@_field_set = { "apiSecret": api_secret, "name": name, "apiKey": api_key }.reject do |_k, v|
|
42
33
|
v == OMIT
|
43
34
|
end
|
44
35
|
end
|
@@ -50,15 +41,13 @@ module Vapi
|
|
50
41
|
def self.from_json(json_object:)
|
51
42
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
52
43
|
parsed_json = JSON.parse(json_object)
|
53
|
-
provider = parsed_json["provider"]
|
54
44
|
api_secret = parsed_json["apiSecret"]
|
55
|
-
api_key = parsed_json["apiKey"]
|
56
45
|
name = parsed_json["name"]
|
46
|
+
api_key = parsed_json["apiKey"]
|
57
47
|
new(
|
58
|
-
provider: provider,
|
59
48
|
api_secret: api_secret,
|
60
|
-
api_key: api_key,
|
61
49
|
name: name,
|
50
|
+
api_key: api_key,
|
62
51
|
additional_properties: struct
|
63
52
|
)
|
64
53
|
end
|
@@ -77,10 +66,9 @@ module Vapi
|
|
77
66
|
# @param obj [Object]
|
78
67
|
# @return [Void]
|
79
68
|
def self.validate_raw(obj:)
|
80
|
-
obj.
|
81
|
-
obj.api_secret.is_a?(String) != false || raise("Passed value for field obj.api_secret is not the expected type, validation failed.")
|
82
|
-
obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.")
|
69
|
+
obj.api_secret&.is_a?(String) != false || raise("Passed value for field obj.api_secret is not the expected type, validation failed.")
|
83
70
|
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
71
|
+
obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.")
|
84
72
|
end
|
85
73
|
end
|
86
74
|
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "update_vonage_phone_number_dto_fallback_destination"
|
4
|
+
require_relative "server"
|
5
|
+
require "ostruct"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vapi
|
9
|
+
class UpdateVonagePhoneNumberDto
|
10
|
+
# @return [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if:
|
11
|
+
# 1. `assistantId` is not set
|
12
|
+
# 2. `squadId` is not set
|
13
|
+
# 3. and, `assistant-request` message to the `serverUrl` fails
|
14
|
+
# If this is not set and above conditions are met, the inbound call is hung up
|
15
|
+
# with an error message.
|
16
|
+
attr_reader :fallback_destination
|
17
|
+
# @return [String] This is the name of the phone number. This is just for your own reference.
|
18
|
+
attr_reader :name
|
19
|
+
# @return [String] This is the assistant that will be used for incoming calls to this phone number.
|
20
|
+
# If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent
|
21
|
+
# to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the
|
22
|
+
# shape of the message and response that is expected.
|
23
|
+
attr_reader :assistant_id
|
24
|
+
# @return [String] This is the squad that will be used for incoming calls to this phone number.
|
25
|
+
# If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent
|
26
|
+
# to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the
|
27
|
+
# shape of the message and response that is expected.
|
28
|
+
attr_reader :squad_id
|
29
|
+
# @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along
|
30
|
+
# with their shape in ServerMessage schema.
|
31
|
+
# The order of precedence is:
|
32
|
+
# 1. assistant.server
|
33
|
+
# 2. phoneNumber.server
|
34
|
+
# 3. org.server
|
35
|
+
attr_reader :server
|
36
|
+
# @return [String] These are the digits of the phone number you own on your Vonage.
|
37
|
+
attr_reader :number
|
38
|
+
# @return [String] This is the credential that is used to make outgoing calls, and do operations
|
39
|
+
# like call transfer and hang up.
|
40
|
+
attr_reader :credential_id
|
41
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
42
|
+
attr_reader :additional_properties
|
43
|
+
# @return [Object]
|
44
|
+
attr_reader :_field_set
|
45
|
+
protected :_field_set
|
46
|
+
|
47
|
+
OMIT = Object.new
|
48
|
+
|
49
|
+
# @param fallback_destination [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if:
|
50
|
+
# 1. `assistantId` is not set
|
51
|
+
# 2. `squadId` is not set
|
52
|
+
# 3. and, `assistant-request` message to the `serverUrl` fails
|
53
|
+
# If this is not set and above conditions are met, the inbound call is hung up
|
54
|
+
# with an error message.
|
55
|
+
# @param name [String] This is the name of the phone number. This is just for your own reference.
|
56
|
+
# @param assistant_id [String] This is the assistant that will be used for incoming calls to this phone number.
|
57
|
+
# If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent
|
58
|
+
# to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the
|
59
|
+
# shape of the message and response that is expected.
|
60
|
+
# @param squad_id [String] This is the squad that will be used for incoming calls to this phone number.
|
61
|
+
# If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent
|
62
|
+
# to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the
|
63
|
+
# shape of the message and response that is expected.
|
64
|
+
# @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along
|
65
|
+
# with their shape in ServerMessage schema.
|
66
|
+
# The order of precedence is:
|
67
|
+
# 1. assistant.server
|
68
|
+
# 2. phoneNumber.server
|
69
|
+
# 3. org.server
|
70
|
+
# @param number [String] These are the digits of the phone number you own on your Vonage.
|
71
|
+
# @param credential_id [String] This is the credential that is used to make outgoing calls, and do operations
|
72
|
+
# like call transfer and hang up.
|
73
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
74
|
+
# @return [Vapi::UpdateVonagePhoneNumberDto]
|
75
|
+
def initialize(fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT,
|
76
|
+
number: OMIT, credential_id: OMIT, additional_properties: nil)
|
77
|
+
@fallback_destination = fallback_destination if fallback_destination != OMIT
|
78
|
+
@name = name if name != OMIT
|
79
|
+
@assistant_id = assistant_id if assistant_id != OMIT
|
80
|
+
@squad_id = squad_id if squad_id != OMIT
|
81
|
+
@server = server if server != OMIT
|
82
|
+
@number = number if number != OMIT
|
83
|
+
@credential_id = credential_id if credential_id != OMIT
|
84
|
+
@additional_properties = additional_properties
|
85
|
+
@_field_set = {
|
86
|
+
"fallbackDestination": fallback_destination,
|
87
|
+
"name": name,
|
88
|
+
"assistantId": assistant_id,
|
89
|
+
"squadId": squad_id,
|
90
|
+
"server": server,
|
91
|
+
"number": number,
|
92
|
+
"credentialId": credential_id
|
93
|
+
}.reject do |_k, v|
|
94
|
+
v == OMIT
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Deserialize a JSON object to an instance of UpdateVonagePhoneNumberDto
|
99
|
+
#
|
100
|
+
# @param json_object [String]
|
101
|
+
# @return [Vapi::UpdateVonagePhoneNumberDto]
|
102
|
+
def self.from_json(json_object:)
|
103
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
104
|
+
parsed_json = JSON.parse(json_object)
|
105
|
+
if parsed_json["fallbackDestination"].nil?
|
106
|
+
fallback_destination = nil
|
107
|
+
else
|
108
|
+
fallback_destination = parsed_json["fallbackDestination"].to_json
|
109
|
+
fallback_destination = Vapi::UpdateVonagePhoneNumberDtoFallbackDestination.from_json(json_object: fallback_destination)
|
110
|
+
end
|
111
|
+
name = parsed_json["name"]
|
112
|
+
assistant_id = parsed_json["assistantId"]
|
113
|
+
squad_id = parsed_json["squadId"]
|
114
|
+
if parsed_json["server"].nil?
|
115
|
+
server = nil
|
116
|
+
else
|
117
|
+
server = parsed_json["server"].to_json
|
118
|
+
server = Vapi::Server.from_json(json_object: server)
|
119
|
+
end
|
120
|
+
number = parsed_json["number"]
|
121
|
+
credential_id = parsed_json["credentialId"]
|
122
|
+
new(
|
123
|
+
fallback_destination: fallback_destination,
|
124
|
+
name: name,
|
125
|
+
assistant_id: assistant_id,
|
126
|
+
squad_id: squad_id,
|
127
|
+
server: server,
|
128
|
+
number: number,
|
129
|
+
credential_id: credential_id,
|
130
|
+
additional_properties: struct
|
131
|
+
)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Serialize an instance of UpdateVonagePhoneNumberDto to a JSON object
|
135
|
+
#
|
136
|
+
# @return [String]
|
137
|
+
def to_json(*_args)
|
138
|
+
@_field_set&.to_json
|
139
|
+
end
|
140
|
+
|
141
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
142
|
+
# hash and check each fields type against the current object's property
|
143
|
+
# definitions.
|
144
|
+
#
|
145
|
+
# @param obj [Object]
|
146
|
+
# @return [Void]
|
147
|
+
def self.validate_raw(obj:)
|
148
|
+
obj.fallback_destination.nil? || Vapi::UpdateVonagePhoneNumberDtoFallbackDestination.validate_raw(obj: obj.fallback_destination)
|
149
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
150
|
+
obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.")
|
151
|
+
obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.")
|
152
|
+
obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server)
|
153
|
+
obj.number&.is_a?(String) != false || raise("Passed value for field obj.number is not the expected type, validation failed.")
|
154
|
+
obj.credential_id&.is_a?(String) != false || raise("Passed value for field obj.credential_id is not the expected type, validation failed.")
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "transfer_destination_number"
|
5
|
+
require_relative "transfer_destination_sip"
|
6
|
+
|
7
|
+
module Vapi
|
8
|
+
# This is the fallback destination an inbound call will be transferred to if:
|
9
|
+
# 1. `assistantId` is not set
|
10
|
+
# 2. `squadId` is not set
|
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 UpdateVonagePhoneNumberDtoFallbackDestination
|
15
|
+
# @return [Object]
|
16
|
+
attr_reader :member
|
17
|
+
# @return [String]
|
18
|
+
attr_reader :discriminant
|
19
|
+
|
20
|
+
private_class_method :new
|
21
|
+
alias kind_of? is_a?
|
22
|
+
|
23
|
+
# @param member [Object]
|
24
|
+
# @param discriminant [String]
|
25
|
+
# @return [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination]
|
26
|
+
def initialize(member:, discriminant:)
|
27
|
+
@member = member
|
28
|
+
@discriminant = discriminant
|
29
|
+
end
|
30
|
+
|
31
|
+
# Deserialize a JSON object to an instance of
|
32
|
+
# UpdateVonagePhoneNumberDtoFallbackDestination
|
33
|
+
#
|
34
|
+
# @param json_object [String]
|
35
|
+
# @return [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination]
|
36
|
+
def self.from_json(json_object:)
|
37
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
38
|
+
member = case struct.type
|
39
|
+
when "number"
|
40
|
+
Vapi::TransferDestinationNumber.from_json(json_object: json_object)
|
41
|
+
when "sip"
|
42
|
+
Vapi::TransferDestinationSip.from_json(json_object: json_object)
|
43
|
+
else
|
44
|
+
Vapi::TransferDestinationNumber.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 "number"
|
55
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
56
|
+
when "sip"
|
57
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
58
|
+
else
|
59
|
+
{ "type": @discriminant, value: @member }.to_json
|
60
|
+
end
|
61
|
+
@member.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
|
+
case obj.type
|
72
|
+
when "number"
|
73
|
+
Vapi::TransferDestinationNumber.validate_raw(obj: obj)
|
74
|
+
when "sip"
|
75
|
+
Vapi::TransferDestinationSip.validate_raw(obj: obj)
|
76
|
+
else
|
77
|
+
raise("Passed value matched no type within the union, validation failed.")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
82
|
+
#
|
83
|
+
# @param obj [Object]
|
84
|
+
# @return [Boolean]
|
85
|
+
def is_a?(obj)
|
86
|
+
@member.is_a?(obj)
|
87
|
+
end
|
88
|
+
|
89
|
+
# @param member [Vapi::TransferDestinationNumber]
|
90
|
+
# @return [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination]
|
91
|
+
def self.number(member:)
|
92
|
+
new(member: member, discriminant: "number")
|
93
|
+
end
|
94
|
+
|
95
|
+
# @param member [Vapi::TransferDestinationSip]
|
96
|
+
# @return [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination]
|
97
|
+
def self.sip(member:)
|
98
|
+
new(member: member, discriminant: "sip")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "update_workflow_block_dto_messages_item"
|
4
|
+
require_relative "json_schema"
|
5
|
+
require_relative "update_workflow_block_dto_steps_item"
|
6
|
+
require "ostruct"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Vapi
|
10
|
+
class UpdateWorkflowBlockDto
|
11
|
+
# @return [Array<Vapi::UpdateWorkflowBlockDtoMessagesItem>] These are the pre-configured messages that will be spoken to the user while the
|
12
|
+
# block is running.
|
13
|
+
attr_reader :messages
|
14
|
+
# @return [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to
|
15
|
+
# run. It's given to the block as `steps[0].input`
|
16
|
+
# These are accessible as variables:
|
17
|
+
# - ({{input.propertyName}}) in context of the block execution (step)
|
18
|
+
# - ({{stepName.input.propertyName}}) in context of the workflow
|
19
|
+
attr_reader :input_schema
|
20
|
+
# @return [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will
|
21
|
+
# return to the workflow (`{{stepName.output}}`).
|
22
|
+
# These are accessible as variables:
|
23
|
+
# - ({{output.propertyName}}) in context of the block execution (step)
|
24
|
+
# - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
|
25
|
+
# - ({{blockName.output.propertyName}}) in context of the workflow (read caveat
|
26
|
+
# #2)
|
27
|
+
# Caveats:
|
28
|
+
# 1. a workflow can execute a step multiple times. example, if a loop is used in
|
29
|
+
# the graph. {{stepName.output.propertyName}} will reference the latest usage of
|
30
|
+
# the step.
|
31
|
+
# 2. a workflow can execute a block multiple times. example, if a step is called
|
32
|
+
# multiple times or if a block is used in multiple steps.
|
33
|
+
# {{blockName.output.propertyName}} will reference the latest usage of the block.
|
34
|
+
# this liquid variable is just provided for convenience when creating blocks
|
35
|
+
# outside of a workflow with steps.
|
36
|
+
attr_reader :output_schema
|
37
|
+
# @return [Array<Vapi::UpdateWorkflowBlockDtoStepsItem>] These are the steps in the workflow.
|
38
|
+
attr_reader :steps
|
39
|
+
# @return [String] This is the name of the block. This is just for your reference.
|
40
|
+
attr_reader :name
|
41
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
42
|
+
attr_reader :additional_properties
|
43
|
+
# @return [Object]
|
44
|
+
attr_reader :_field_set
|
45
|
+
protected :_field_set
|
46
|
+
|
47
|
+
OMIT = Object.new
|
48
|
+
|
49
|
+
# @param messages [Array<Vapi::UpdateWorkflowBlockDtoMessagesItem>] These are the pre-configured messages that will be spoken to the user while the
|
50
|
+
# block is running.
|
51
|
+
# @param input_schema [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to
|
52
|
+
# run. It's given to the block as `steps[0].input`
|
53
|
+
# These are accessible as variables:
|
54
|
+
# - ({{input.propertyName}}) in context of the block execution (step)
|
55
|
+
# - ({{stepName.input.propertyName}}) in context of the workflow
|
56
|
+
# @param output_schema [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will
|
57
|
+
# return to the workflow (`{{stepName.output}}`).
|
58
|
+
# These are accessible as variables:
|
59
|
+
# - ({{output.propertyName}}) in context of the block execution (step)
|
60
|
+
# - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
|
61
|
+
# - ({{blockName.output.propertyName}}) in context of the workflow (read caveat
|
62
|
+
# #2)
|
63
|
+
# Caveats:
|
64
|
+
# 1. a workflow can execute a step multiple times. example, if a loop is used in
|
65
|
+
# the graph. {{stepName.output.propertyName}} will reference the latest usage of
|
66
|
+
# the step.
|
67
|
+
# 2. a workflow can execute a block multiple times. example, if a step is called
|
68
|
+
# multiple times or if a block is used in multiple steps.
|
69
|
+
# {{blockName.output.propertyName}} will reference the latest usage of the block.
|
70
|
+
# this liquid variable is just provided for convenience when creating blocks
|
71
|
+
# outside of a workflow with steps.
|
72
|
+
# @param steps [Array<Vapi::UpdateWorkflowBlockDtoStepsItem>] These are the steps in the workflow.
|
73
|
+
# @param name [String] This is the name of the block. This is just for your reference.
|
74
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
75
|
+
# @return [Vapi::UpdateWorkflowBlockDto]
|
76
|
+
def initialize(messages: OMIT, input_schema: OMIT, output_schema: OMIT, steps: OMIT, name: OMIT,
|
77
|
+
additional_properties: nil)
|
78
|
+
@messages = messages if messages != OMIT
|
79
|
+
@input_schema = input_schema if input_schema != OMIT
|
80
|
+
@output_schema = output_schema if output_schema != OMIT
|
81
|
+
@steps = steps if steps != OMIT
|
82
|
+
@name = name if name != OMIT
|
83
|
+
@additional_properties = additional_properties
|
84
|
+
@_field_set = {
|
85
|
+
"messages": messages,
|
86
|
+
"inputSchema": input_schema,
|
87
|
+
"outputSchema": output_schema,
|
88
|
+
"steps": steps,
|
89
|
+
"name": name
|
90
|
+
}.reject do |_k, v|
|
91
|
+
v == OMIT
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Deserialize a JSON object to an instance of UpdateWorkflowBlockDto
|
96
|
+
#
|
97
|
+
# @param json_object [String]
|
98
|
+
# @return [Vapi::UpdateWorkflowBlockDto]
|
99
|
+
def self.from_json(json_object:)
|
100
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
101
|
+
parsed_json = JSON.parse(json_object)
|
102
|
+
messages = parsed_json["messages"]&.map do |item|
|
103
|
+
item = item.to_json
|
104
|
+
Vapi::UpdateWorkflowBlockDtoMessagesItem.from_json(json_object: item)
|
105
|
+
end
|
106
|
+
if parsed_json["inputSchema"].nil?
|
107
|
+
input_schema = nil
|
108
|
+
else
|
109
|
+
input_schema = parsed_json["inputSchema"].to_json
|
110
|
+
input_schema = Vapi::JsonSchema.from_json(json_object: input_schema)
|
111
|
+
end
|
112
|
+
if parsed_json["outputSchema"].nil?
|
113
|
+
output_schema = nil
|
114
|
+
else
|
115
|
+
output_schema = parsed_json["outputSchema"].to_json
|
116
|
+
output_schema = Vapi::JsonSchema.from_json(json_object: output_schema)
|
117
|
+
end
|
118
|
+
steps = parsed_json["steps"]&.map do |item|
|
119
|
+
item = item.to_json
|
120
|
+
Vapi::UpdateWorkflowBlockDtoStepsItem.from_json(json_object: item)
|
121
|
+
end
|
122
|
+
name = parsed_json["name"]
|
123
|
+
new(
|
124
|
+
messages: messages,
|
125
|
+
input_schema: input_schema,
|
126
|
+
output_schema: output_schema,
|
127
|
+
steps: steps,
|
128
|
+
name: name,
|
129
|
+
additional_properties: struct
|
130
|
+
)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Serialize an instance of UpdateWorkflowBlockDto to a JSON object
|
134
|
+
#
|
135
|
+
# @return [String]
|
136
|
+
def to_json(*_args)
|
137
|
+
@_field_set&.to_json
|
138
|
+
end
|
139
|
+
|
140
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
141
|
+
# hash and check each fields type against the current object's property
|
142
|
+
# definitions.
|
143
|
+
#
|
144
|
+
# @param obj [Object]
|
145
|
+
# @return [Void]
|
146
|
+
def self.validate_raw(obj:)
|
147
|
+
obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
|
148
|
+
obj.input_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.input_schema)
|
149
|
+
obj.output_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.output_schema)
|
150
|
+
obj.steps&.is_a?(Array) != false || raise("Passed value for field obj.steps is not the expected type, validation failed.")
|
151
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "block_start_message"
|
5
|
+
require_relative "block_complete_message"
|
6
|
+
|
7
|
+
module Vapi
|
8
|
+
class UpdateWorkflowBlockDtoMessagesItem
|
9
|
+
# @return [Object]
|
10
|
+
attr_reader :member
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :discriminant
|
13
|
+
|
14
|
+
private_class_method :new
|
15
|
+
alias kind_of? is_a?
|
16
|
+
|
17
|
+
# @param member [Object]
|
18
|
+
# @param discriminant [String]
|
19
|
+
# @return [Vapi::UpdateWorkflowBlockDtoMessagesItem]
|
20
|
+
def initialize(member:, discriminant:)
|
21
|
+
@member = member
|
22
|
+
@discriminant = discriminant
|
23
|
+
end
|
24
|
+
|
25
|
+
# Deserialize a JSON object to an instance of UpdateWorkflowBlockDtoMessagesItem
|
26
|
+
#
|
27
|
+
# @param json_object [String]
|
28
|
+
# @return [Vapi::UpdateWorkflowBlockDtoMessagesItem]
|
29
|
+
def self.from_json(json_object:)
|
30
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
31
|
+
member = case struct.type
|
32
|
+
when "block-start"
|
33
|
+
Vapi::BlockStartMessage.from_json(json_object: json_object)
|
34
|
+
when "block-complete"
|
35
|
+
Vapi::BlockCompleteMessage.from_json(json_object: json_object)
|
36
|
+
else
|
37
|
+
Vapi::BlockStartMessage.from_json(json_object: json_object)
|
38
|
+
end
|
39
|
+
new(member: member, discriminant: struct.type)
|
40
|
+
end
|
41
|
+
|
42
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
43
|
+
#
|
44
|
+
# @return [String]
|
45
|
+
def to_json(*_args)
|
46
|
+
case @discriminant
|
47
|
+
when "block-start"
|
48
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
49
|
+
when "block-complete"
|
50
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
51
|
+
else
|
52
|
+
{ "type": @discriminant, value: @member }.to_json
|
53
|
+
end
|
54
|
+
@member.to_json
|
55
|
+
end
|
56
|
+
|
57
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
58
|
+
# hash and check each fields type against the current object's property
|
59
|
+
# definitions.
|
60
|
+
#
|
61
|
+
# @param obj [Object]
|
62
|
+
# @return [Void]
|
63
|
+
def self.validate_raw(obj:)
|
64
|
+
case obj.type
|
65
|
+
when "block-start"
|
66
|
+
Vapi::BlockStartMessage.validate_raw(obj: obj)
|
67
|
+
when "block-complete"
|
68
|
+
Vapi::BlockCompleteMessage.validate_raw(obj: obj)
|
69
|
+
else
|
70
|
+
raise("Passed value matched no type within the union, validation failed.")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
75
|
+
#
|
76
|
+
# @param obj [Object]
|
77
|
+
# @return [Boolean]
|
78
|
+
def is_a?(obj)
|
79
|
+
@member.is_a?(obj)
|
80
|
+
end
|
81
|
+
|
82
|
+
# @param member [Vapi::BlockStartMessage]
|
83
|
+
# @return [Vapi::UpdateWorkflowBlockDtoMessagesItem]
|
84
|
+
def self.block_start(member:)
|
85
|
+
new(member: member, discriminant: "block-start")
|
86
|
+
end
|
87
|
+
|
88
|
+
# @param member [Vapi::BlockCompleteMessage]
|
89
|
+
# @return [Vapi::UpdateWorkflowBlockDtoMessagesItem]
|
90
|
+
def self.block_complete(member:)
|
91
|
+
new(member: member, discriminant: "block-complete")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|