diff --git a/lib/requests.rb b/lib/requests.rb index 9e40b1b..a9aba3f 100644 --- a/lib/requests.rb +++ b/lib/requests.rb @@ -45,7 +45,7 @@ def get_url(request_options: nil) # @return [Hash{String => String}] def get_headers - headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.2.0" } + headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.3.0" } headers["Authorization"] = ((@token.is_a? Method) ? @token.call : @token) unless @token.nil? headers end @@ -90,7 +90,7 @@ def get_url(request_options: nil) # @return [Hash{String => String}] def get_headers - headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.2.0" } + headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "vapi_server_sdk", "X-Fern-SDK-Version": "0.3.0" } headers["Authorization"] = ((@token.is_a? Method) ? @token.call : @token) unless @token.nil? headers end diff --git a/lib/types_export.rb b/lib/types_export.rb index 1d46f6f..6b5da28 100644 --- a/lib/types_export.rb +++ b/lib/types_export.rb @@ -7,34 +7,34 @@ require_relative "vapi_server_sdk/assistants/types/update_assistant_dto_client_messages_item" require_relative "vapi_server_sdk/assistants/types/update_assistant_dto_server_messages_item" require_relative "vapi_server_sdk/assistants/types/update_assistant_dto_background_sound" +require_relative "vapi_server_sdk/assistants/types/update_assistant_dto_credentials_item" require_relative "vapi_server_sdk/phone_numbers/types/phone_numbers_list_response_item" require_relative "vapi_server_sdk/phone_numbers/types/phone_numbers_create_request" require_relative "vapi_server_sdk/phone_numbers/types/phone_numbers_create_response" require_relative "vapi_server_sdk/phone_numbers/types/phone_numbers_get_response" require_relative "vapi_server_sdk/phone_numbers/types/phone_numbers_delete_response" -require_relative "vapi_server_sdk/phone_numbers/types/update_phone_number_dto_fallback_destination" +require_relative "vapi_server_sdk/phone_numbers/types/phone_numbers_update_request" require_relative "vapi_server_sdk/phone_numbers/types/phone_numbers_update_response" require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_list_response_item" require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_request" require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_create_response" require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_get_response" require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_delete_response" +require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_request" require_relative "vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_response" require_relative "vapi_server_sdk/blocks/types/blocks_list_response_item" require_relative "vapi_server_sdk/blocks/types/blocks_create_request" require_relative "vapi_server_sdk/blocks/types/blocks_create_response" require_relative "vapi_server_sdk/blocks/types/blocks_get_response" require_relative "vapi_server_sdk/blocks/types/blocks_delete_response" -require_relative "vapi_server_sdk/blocks/types/update_block_dto_messages_item" -require_relative "vapi_server_sdk/blocks/types/update_block_dto_tool" -require_relative "vapi_server_sdk/blocks/types/update_block_dto_steps_item" +require_relative "vapi_server_sdk/blocks/types/blocks_update_request" require_relative "vapi_server_sdk/blocks/types/blocks_update_response" require_relative "vapi_server_sdk/tools/types/tools_list_response_item" require_relative "vapi_server_sdk/tools/types/tools_create_request" require_relative "vapi_server_sdk/tools/types/tools_create_response" require_relative "vapi_server_sdk/tools/types/tools_get_response" require_relative "vapi_server_sdk/tools/types/tools_delete_response" -require_relative "vapi_server_sdk/tools/types/update_tool_dto_messages_item" +require_relative "vapi_server_sdk/tools/types/tools_update_request" require_relative "vapi_server_sdk/tools/types/tools_update_response" require_relative "vapi_server_sdk/logs/types/logs_get_request_type" require_relative "vapi_server_sdk/logs/types/logs_get_request_sort_order" @@ -48,6 +48,8 @@ require_relative "vapi_server_sdk/types/gladia_transcriber_language_behaviour" require_relative "vapi_server_sdk/types/gladia_transcriber_language" require_relative "vapi_server_sdk/types/gladia_transcriber" +require_relative "vapi_server_sdk/types/azure_speech_transcriber_language" +require_relative "vapi_server_sdk/types/azure_speech_transcriber" require_relative "vapi_server_sdk/types/text_content_language" require_relative "vapi_server_sdk/types/text_content" require_relative "vapi_server_sdk/types/condition_operator" @@ -104,6 +106,11 @@ require_relative "vapi_server_sdk/types/custom_llm_model" require_relative "vapi_server_sdk/types/deep_infra_model_tools_item" require_relative "vapi_server_sdk/types/deep_infra_model" +require_relative "vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config_voice_name" +require_relative "vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config" +require_relative "vapi_server_sdk/types/gemini_multimodal_live_voice_config" +require_relative "vapi_server_sdk/types/gemini_multimodal_live_speech_config" +require_relative "vapi_server_sdk/types/google_realtime_config" require_relative "vapi_server_sdk/types/google_model_tools_item" require_relative "vapi_server_sdk/types/google_model_model" require_relative "vapi_server_sdk/types/google_model" @@ -112,6 +119,8 @@ require_relative "vapi_server_sdk/types/groq_model" require_relative "vapi_server_sdk/types/inflection_ai_model_tools_item" require_relative "vapi_server_sdk/types/inflection_ai_model" +require_relative "vapi_server_sdk/types/deep_seek_model_tools_item" +require_relative "vapi_server_sdk/types/deep_seek_model" require_relative "vapi_server_sdk/types/open_ai_model_tools_item" require_relative "vapi_server_sdk/types/open_ai_model_model" require_relative "vapi_server_sdk/types/open_ai_model_fallback_models_item" @@ -168,6 +177,9 @@ require_relative "vapi_server_sdk/types/rime_ai_voice_id" require_relative "vapi_server_sdk/types/rime_ai_voice_model" require_relative "vapi_server_sdk/types/rime_ai_voice" +require_relative "vapi_server_sdk/types/smallest_ai_voice_id_enum" +require_relative "vapi_server_sdk/types/smallest_ai_voice_id" +require_relative "vapi_server_sdk/types/smallest_ai_voice" require_relative "vapi_server_sdk/types/tavus_conversation_properties" require_relative "vapi_server_sdk/types/tavus_voice_voice_id" require_relative "vapi_server_sdk/types/tavus_voice" @@ -203,10 +215,61 @@ require_relative "vapi_server_sdk/types/fallback_rime_ai_voice_id" require_relative "vapi_server_sdk/types/fallback_rime_ai_voice_model" require_relative "vapi_server_sdk/types/fallback_rime_ai_voice" +require_relative "vapi_server_sdk/types/fallback_smallest_ai_voice_id_enum" +require_relative "vapi_server_sdk/types/fallback_smallest_ai_voice_id" +require_relative "vapi_server_sdk/types/fallback_smallest_ai_voice" require_relative "vapi_server_sdk/types/fallback_tavus_voice_voice_id" require_relative "vapi_server_sdk/types/fallback_tavus_voice" require_relative "vapi_server_sdk/types/transport_configuration_twilio_recording_channels" require_relative "vapi_server_sdk/types/transport_configuration_twilio" +require_relative "vapi_server_sdk/types/create_anthropic_credential_dto" +require_relative "vapi_server_sdk/types/create_anyscale_credential_dto" +require_relative "vapi_server_sdk/types/create_assembly_ai_credential_dto" +require_relative "vapi_server_sdk/types/azure_blob_storage_bucket_plan" +require_relative "vapi_server_sdk/types/create_azure_credential_dto_service" +require_relative "vapi_server_sdk/types/create_azure_credential_dto_region" +require_relative "vapi_server_sdk/types/create_azure_credential_dto" +require_relative "vapi_server_sdk/types/create_azure_open_ai_credential_dto_region" +require_relative "vapi_server_sdk/types/create_azure_open_ai_credential_dto_models_item" +require_relative "vapi_server_sdk/types/create_azure_open_ai_credential_dto" +require_relative "vapi_server_sdk/types/sip_trunk_gateway_outbound_protocol" +require_relative "vapi_server_sdk/types/sip_trunk_gateway" +require_relative "vapi_server_sdk/types/sip_trunk_outbound_sip_register_plan" +require_relative "vapi_server_sdk/types/sip_trunk_outbound_authentication_plan" +require_relative "vapi_server_sdk/types/sbc_configuration" +require_relative "vapi_server_sdk/types/create_byo_sip_trunk_credential_dto" +require_relative "vapi_server_sdk/types/create_cartesia_credential_dto" +require_relative "vapi_server_sdk/types/cloudflare_r_2_bucket_plan" +require_relative "vapi_server_sdk/types/create_cloudflare_credential_dto" +require_relative "vapi_server_sdk/types/o_auth_2_authentication_plan" +require_relative "vapi_server_sdk/types/create_custom_llm_credential_dto" +require_relative "vapi_server_sdk/types/create_deepgram_credential_dto" +require_relative "vapi_server_sdk/types/create_deep_infra_credential_dto" +require_relative "vapi_server_sdk/types/create_deep_seek_credential_dto" +require_relative "vapi_server_sdk/types/create_eleven_labs_credential_dto" +require_relative "vapi_server_sdk/types/gcp_key" +require_relative "vapi_server_sdk/types/bucket_plan" +require_relative "vapi_server_sdk/types/create_gcp_credential_dto" +require_relative "vapi_server_sdk/types/create_gladia_credential_dto" +require_relative "vapi_server_sdk/types/create_go_high_level_credential_dto" +require_relative "vapi_server_sdk/types/create_groq_credential_dto" +require_relative "vapi_server_sdk/types/create_langfuse_credential_dto" +require_relative "vapi_server_sdk/types/create_lmnt_credential_dto" +require_relative "vapi_server_sdk/types/create_make_credential_dto" +require_relative "vapi_server_sdk/types/create_open_ai_credential_dto" +require_relative "vapi_server_sdk/types/create_open_router_credential_dto" +require_relative "vapi_server_sdk/types/create_perplexity_ai_credential_dto" +require_relative "vapi_server_sdk/types/create_play_ht_credential_dto" +require_relative "vapi_server_sdk/types/create_rime_ai_credential_dto" +require_relative "vapi_server_sdk/types/create_runpod_credential_dto" +require_relative "vapi_server_sdk/types/create_s_3_credential_dto" +require_relative "vapi_server_sdk/types/create_smallest_ai_credential_dto" +require_relative "vapi_server_sdk/types/create_tavus_credential_dto" +require_relative "vapi_server_sdk/types/create_together_ai_credential_dto" +require_relative "vapi_server_sdk/types/create_twilio_credential_dto" +require_relative "vapi_server_sdk/types/create_vonage_credential_dto" +require_relative "vapi_server_sdk/types/create_webhook_credential_dto" +require_relative "vapi_server_sdk/types/create_x_ai_credential_dto" require_relative "vapi_server_sdk/types/twilio_voicemail_detection_voicemail_detection_types_item" require_relative "vapi_server_sdk/types/twilio_voicemail_detection" require_relative "vapi_server_sdk/types/structured_data_plan" @@ -231,6 +294,7 @@ require_relative "vapi_server_sdk/types/create_assistant_dto_client_messages_item" require_relative "vapi_server_sdk/types/create_assistant_dto_server_messages_item" require_relative "vapi_server_sdk/types/create_assistant_dto_background_sound" +require_relative "vapi_server_sdk/types/create_assistant_dto_credentials_item" require_relative "vapi_server_sdk/types/create_assistant_dto" require_relative "vapi_server_sdk/types/assistant_overrides_transcriber" require_relative "vapi_server_sdk/types/assistant_overrides_model" @@ -239,6 +303,7 @@ require_relative "vapi_server_sdk/types/assistant_overrides_client_messages_item" require_relative "vapi_server_sdk/types/assistant_overrides_server_messages_item" require_relative "vapi_server_sdk/types/assistant_overrides_background_sound" +require_relative "vapi_server_sdk/types/assistant_overrides_credentials_item" require_relative "vapi_server_sdk/types/assistant_overrides" require_relative "vapi_server_sdk/types/squad_member_dto" require_relative "vapi_server_sdk/types/create_squad_dto" @@ -278,6 +343,7 @@ require_relative "vapi_server_sdk/types/assistant_client_messages_item" require_relative "vapi_server_sdk/types/assistant_server_messages_item" require_relative "vapi_server_sdk/types/assistant_background_sound" +require_relative "vapi_server_sdk/types/assistant_credentials_item" require_relative "vapi_server_sdk/types/assistant" require_relative "vapi_server_sdk/types/byo_phone_number_fallback_destination" require_relative "vapi_server_sdk/types/byo_phone_number" @@ -296,27 +362,20 @@ require_relative "vapi_server_sdk/types/create_vonage_phone_number_dto" require_relative "vapi_server_sdk/types/create_vapi_phone_number_dto_fallback_destination" require_relative "vapi_server_sdk/types/create_vapi_phone_number_dto" +require_relative "vapi_server_sdk/types/update_byo_phone_number_dto_fallback_destination" +require_relative "vapi_server_sdk/types/update_byo_phone_number_dto" +require_relative "vapi_server_sdk/types/update_twilio_phone_number_dto_fallback_destination" +require_relative "vapi_server_sdk/types/update_twilio_phone_number_dto" +require_relative "vapi_server_sdk/types/update_vonage_phone_number_dto_fallback_destination" +require_relative "vapi_server_sdk/types/update_vonage_phone_number_dto" +require_relative "vapi_server_sdk/types/update_vapi_phone_number_dto_fallback_destination" +require_relative "vapi_server_sdk/types/update_vapi_phone_number_dto" require_relative "vapi_server_sdk/types/buy_phone_number_dto_fallback_destination" require_relative "vapi_server_sdk/types/buy_phone_number_dto" require_relative "vapi_server_sdk/types/import_vonage_phone_number_dto_fallback_destination" require_relative "vapi_server_sdk/types/import_vonage_phone_number_dto" require_relative "vapi_server_sdk/types/phone_number_paginated_response_results_item" require_relative "vapi_server_sdk/types/phone_number_paginated_response" -require_relative "vapi_server_sdk/types/auto_reload_plan" -require_relative "vapi_server_sdk/types/subscription_type" -require_relative "vapi_server_sdk/types/subscription_status" -require_relative "vapi_server_sdk/types/subscription" -require_relative "vapi_server_sdk/types/payment_status" -require_relative "vapi_server_sdk/types/payment" -require_relative "vapi_server_sdk/types/payments_paginated_response" -require_relative "vapi_server_sdk/types/subscription_monthly_charge" -require_relative "vapi_server_sdk/types/credits_buy_dto" -require_relative "vapi_server_sdk/types/auto_reload_plan_dto" -require_relative "vapi_server_sdk/types/payment_retry_dto" -require_relative "vapi_server_sdk/types/subscription_concurrency_line_buy_dto" -require_relative "vapi_server_sdk/types/subscription_concurrency_line_remove_dto" -require_relative "vapi_server_sdk/types/hipaa_buy_dto" -require_relative "vapi_server_sdk/types/subscription_coupon_add_dto" require_relative "vapi_server_sdk/types/squad" require_relative "vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan_search_type" require_relative "vapi_server_sdk/types/trieve_knowledge_base_vector_store_search_plan" @@ -324,6 +383,8 @@ require_relative "vapi_server_sdk/types/trieve_knowledge_base" require_relative "vapi_server_sdk/types/custom_knowledge_base" require_relative "vapi_server_sdk/types/create_trieve_knowledge_base_dto" +require_relative "vapi_server_sdk/types/update_trieve_knowledge_base_dto" +require_relative "vapi_server_sdk/types/update_custom_knowledge_base_dto" require_relative "vapi_server_sdk/types/conversation_block_messages_item" require_relative "vapi_server_sdk/types/conversation_block" require_relative "vapi_server_sdk/types/tool_call_block_messages_item" @@ -347,6 +408,14 @@ require_relative "vapi_server_sdk/types/create_workflow_block_dto_messages_item" require_relative "vapi_server_sdk/types/create_workflow_block_dto_steps_item" require_relative "vapi_server_sdk/types/create_workflow_block_dto" +require_relative "vapi_server_sdk/types/update_conversation_block_dto_messages_item" +require_relative "vapi_server_sdk/types/update_conversation_block_dto" +require_relative "vapi_server_sdk/types/update_tool_call_block_dto_messages_item" +require_relative "vapi_server_sdk/types/update_tool_call_block_dto_tool" +require_relative "vapi_server_sdk/types/update_tool_call_block_dto" +require_relative "vapi_server_sdk/types/update_workflow_block_dto_messages_item" +require_relative "vapi_server_sdk/types/update_workflow_block_dto_steps_item" +require_relative "vapi_server_sdk/types/update_workflow_block_dto" require_relative "vapi_server_sdk/types/dtmf_tool_messages_item" require_relative "vapi_server_sdk/types/dtmf_tool" require_relative "vapi_server_sdk/types/end_call_tool_messages_item" @@ -376,6 +445,27 @@ require_relative "vapi_server_sdk/types/create_computer_tool_dto" require_relative "vapi_server_sdk/types/create_text_editor_tool_dto_messages_item" require_relative "vapi_server_sdk/types/create_text_editor_tool_dto" +require_relative "vapi_server_sdk/types/update_dtmf_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/update_dtmf_tool_dto" +require_relative "vapi_server_sdk/types/update_end_call_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/update_end_call_tool_dto" +require_relative "vapi_server_sdk/types/update_function_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/update_function_tool_dto" +require_relative "vapi_server_sdk/types/update_ghl_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/update_ghl_tool_dto" +require_relative "vapi_server_sdk/types/update_make_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/update_make_tool_dto" +require_relative "vapi_server_sdk/types/update_transfer_call_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/update_transfer_call_tool_dto_destinations_item" +require_relative "vapi_server_sdk/types/update_transfer_call_tool_dto" +require_relative "vapi_server_sdk/types/update_output_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/update_output_tool_dto" +require_relative "vapi_server_sdk/types/update_bash_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/update_bash_tool_dto" +require_relative "vapi_server_sdk/types/update_computer_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/update_computer_tool_dto" +require_relative "vapi_server_sdk/types/update_text_editor_tool_dto_messages_item" +require_relative "vapi_server_sdk/types/update_text_editor_tool_dto" require_relative "vapi_server_sdk/types/file_status" require_relative "vapi_server_sdk/types/file" require_relative "vapi_server_sdk/types/metrics" @@ -397,29 +487,27 @@ require_relative "vapi_server_sdk/types/log_request_http_method" require_relative "vapi_server_sdk/types/log" require_relative "vapi_server_sdk/types/logs_paginated_response" +require_relative "vapi_server_sdk/types/chat_dto" +require_relative "vapi_server_sdk/types/chat_service_response" require_relative "vapi_server_sdk/types/anthropic_credential" require_relative "vapi_server_sdk/types/anyscale_credential" require_relative "vapi_server_sdk/types/assembly_ai_credential" +require_relative "vapi_server_sdk/types/azure_credential_service" require_relative "vapi_server_sdk/types/azure_credential_region" require_relative "vapi_server_sdk/types/azure_credential" require_relative "vapi_server_sdk/types/azure_open_ai_credential_region" require_relative "vapi_server_sdk/types/azure_open_ai_credential_models_item" require_relative "vapi_server_sdk/types/azure_open_ai_credential" -require_relative "vapi_server_sdk/types/sip_trunk_gateway_outbound_protocol" -require_relative "vapi_server_sdk/types/sip_trunk_gateway" -require_relative "vapi_server_sdk/types/sip_trunk_outbound_sip_register_plan" -require_relative "vapi_server_sdk/types/sip_trunk_outbound_authentication_plan" -require_relative "vapi_server_sdk/types/sbc_configuration" require_relative "vapi_server_sdk/types/byo_sip_trunk_credential" require_relative "vapi_server_sdk/types/cartesia_credential" -require_relative "vapi_server_sdk/types/o_auth_2_authentication_plan" +require_relative "vapi_server_sdk/types/cerebras_credential" +require_relative "vapi_server_sdk/types/cloudflare_credential" require_relative "vapi_server_sdk/types/oauth_2_authentication_session" require_relative "vapi_server_sdk/types/custom_llm_credential" require_relative "vapi_server_sdk/types/deepgram_credential" require_relative "vapi_server_sdk/types/deep_infra_credential" +require_relative "vapi_server_sdk/types/deep_seek_credential" require_relative "vapi_server_sdk/types/eleven_labs_credential" -require_relative "vapi_server_sdk/types/gcp_key" -require_relative "vapi_server_sdk/types/bucket_plan" require_relative "vapi_server_sdk/types/gcp_credential" require_relative "vapi_server_sdk/types/gladia_credential" require_relative "vapi_server_sdk/types/go_high_level_credential" @@ -436,51 +524,20 @@ require_relative "vapi_server_sdk/types/rime_ai_credential" require_relative "vapi_server_sdk/types/runpod_credential" require_relative "vapi_server_sdk/types/s_3_credential" +require_relative "vapi_server_sdk/types/smallest_ai_credential" require_relative "vapi_server_sdk/types/tavus_credential" require_relative "vapi_server_sdk/types/together_ai_credential" require_relative "vapi_server_sdk/types/twilio_credential" require_relative "vapi_server_sdk/types/vonage_credential" require_relative "vapi_server_sdk/types/webhook_credential" require_relative "vapi_server_sdk/types/x_ai_credential" -require_relative "vapi_server_sdk/types/create_anthropic_credential_dto" -require_relative "vapi_server_sdk/types/create_anyscale_credential_dto" -require_relative "vapi_server_sdk/types/create_assembly_ai_credential_dto" -require_relative "vapi_server_sdk/types/create_azure_credential_dto_region" -require_relative "vapi_server_sdk/types/create_azure_credential_dto" -require_relative "vapi_server_sdk/types/create_azure_open_ai_credential_dto_region" -require_relative "vapi_server_sdk/types/create_azure_open_ai_credential_dto_models_item" -require_relative "vapi_server_sdk/types/create_azure_open_ai_credential_dto" -require_relative "vapi_server_sdk/types/create_byo_sip_trunk_credential_dto" -require_relative "vapi_server_sdk/types/create_cartesia_credential_dto" -require_relative "vapi_server_sdk/types/create_custom_llm_credential_dto" -require_relative "vapi_server_sdk/types/create_deepgram_credential_dto" -require_relative "vapi_server_sdk/types/create_deep_infra_credential_dto" -require_relative "vapi_server_sdk/types/create_eleven_labs_credential_dto" -require_relative "vapi_server_sdk/types/create_gcp_credential_dto" -require_relative "vapi_server_sdk/types/create_gladia_credential_dto" -require_relative "vapi_server_sdk/types/create_go_high_level_credential_dto" +require_relative "vapi_server_sdk/types/create_cerebras_credential_dto" require_relative "vapi_server_sdk/types/create_google_credential_dto" -require_relative "vapi_server_sdk/types/create_groq_credential_dto" require_relative "vapi_server_sdk/types/create_inflection_ai_credential_dto" -require_relative "vapi_server_sdk/types/create_langfuse_credential_dto" -require_relative "vapi_server_sdk/types/create_lmnt_credential_dto" -require_relative "vapi_server_sdk/types/create_make_credential_dto" -require_relative "vapi_server_sdk/types/create_open_ai_credential_dto" -require_relative "vapi_server_sdk/types/create_open_router_credential_dto" -require_relative "vapi_server_sdk/types/create_perplexity_ai_credential_dto" -require_relative "vapi_server_sdk/types/create_play_ht_credential_dto" -require_relative "vapi_server_sdk/types/create_rime_ai_credential_dto" -require_relative "vapi_server_sdk/types/create_runpod_credential_dto" -require_relative "vapi_server_sdk/types/create_s_3_credential_dto" -require_relative "vapi_server_sdk/types/create_tavus_credential_dto" -require_relative "vapi_server_sdk/types/create_together_ai_credential_dto" -require_relative "vapi_server_sdk/types/create_twilio_credential_dto" -require_relative "vapi_server_sdk/types/create_vonage_credential_dto" -require_relative "vapi_server_sdk/types/create_webhook_credential_dto" -require_relative "vapi_server_sdk/types/create_x_ai_credential_dto" require_relative "vapi_server_sdk/types/update_anthropic_credential_dto" require_relative "vapi_server_sdk/types/update_anyscale_credential_dto" require_relative "vapi_server_sdk/types/update_assembly_ai_credential_dto" +require_relative "vapi_server_sdk/types/update_azure_credential_dto_service" require_relative "vapi_server_sdk/types/update_azure_credential_dto_region" require_relative "vapi_server_sdk/types/update_azure_credential_dto" require_relative "vapi_server_sdk/types/update_azure_open_ai_credential_dto_region" @@ -488,9 +545,12 @@ require_relative "vapi_server_sdk/types/update_azure_open_ai_credential_dto" require_relative "vapi_server_sdk/types/update_byo_sip_trunk_credential_dto" require_relative "vapi_server_sdk/types/update_cartesia_credential_dto" +require_relative "vapi_server_sdk/types/update_cerebras_credential_dto" +require_relative "vapi_server_sdk/types/update_cloudflare_credential_dto" require_relative "vapi_server_sdk/types/update_custom_llm_credential_dto" require_relative "vapi_server_sdk/types/update_deepgram_credential_dto" require_relative "vapi_server_sdk/types/update_deep_infra_credential_dto" +require_relative "vapi_server_sdk/types/update_deep_seek_credential_dto" require_relative "vapi_server_sdk/types/update_eleven_labs_credential_dto" require_relative "vapi_server_sdk/types/update_gcp_credential_dto" require_relative "vapi_server_sdk/types/update_gladia_credential_dto" @@ -508,6 +568,7 @@ require_relative "vapi_server_sdk/types/update_rime_ai_credential_dto" require_relative "vapi_server_sdk/types/update_runpod_credential_dto" require_relative "vapi_server_sdk/types/update_s_3_credential_dto" +require_relative "vapi_server_sdk/types/update_smallest_ai_credential_dto" require_relative "vapi_server_sdk/types/update_tavus_credential_dto" require_relative "vapi_server_sdk/types/update_together_ai_credential_dto" require_relative "vapi_server_sdk/types/update_twilio_credential_dto" @@ -515,6 +576,10 @@ require_relative "vapi_server_sdk/types/update_x_ai_credential_dto" require_relative "vapi_server_sdk/types/create_org_dto_channel" require_relative "vapi_server_sdk/types/create_org_dto" +require_relative "vapi_server_sdk/types/auto_reload_plan" +require_relative "vapi_server_sdk/types/subscription_type" +require_relative "vapi_server_sdk/types/subscription_status" +require_relative "vapi_server_sdk/types/subscription" require_relative "vapi_server_sdk/types/org_plan" require_relative "vapi_server_sdk/types/org_channel" require_relative "vapi_server_sdk/types/org" @@ -558,6 +623,8 @@ require_relative "vapi_server_sdk/types/create_token_dto" require_relative "vapi_server_sdk/types/token_tag" require_relative "vapi_server_sdk/types/token" +require_relative "vapi_server_sdk/types/update_token_dto_tag" +require_relative "vapi_server_sdk/types/update_token_dto" require_relative "vapi_server_sdk/types/sync_voice_library_dto_providers_item" require_relative "vapi_server_sdk/types/sync_voice_library_dto" require_relative "vapi_server_sdk/types/client_message_conversation_update_messages_item" diff --git a/lib/vapi_server_sdk/assistants/client.rb b/lib/vapi_server_sdk/assistants/client.rb index beaa278..bd8c1f0 100644 --- a/lib/vapi_server_sdk/assistants/client.rb +++ b/lib/vapi_server_sdk/assistants/client.rb @@ -13,6 +13,7 @@ require_relative "types/update_assistant_dto_server_messages_item" require_relative "types/update_assistant_dto_background_sound" require_relative "../types/transport_configuration_twilio" +require_relative "types/update_assistant_dto_credentials_item" require_relative "../types/twilio_voicemail_detection" require_relative "../types/analysis_plan" require_relative "../types/artifact_plan" @@ -105,6 +106,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :name (String) # * :voicemail_detection (Hash) # * :provider (String) @@ -307,6 +309,10 @@ def delete(id:, request_options: nil) # * :timeout (Float) # * :record (Boolean) # * :recording_channels (Vapi::TransportConfigurationTwilioRecordingChannels) + # @param credentials [Array] These are dynamic credentials that will be used for the assistant calls. By + # default, all the credentials are available for use in the call but you can + # supplement an additional credentials using this. Dynamic credentials override + # existing credentials.Request of type Array, as a Hash # @param name [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. # @param voicemail_detection [Hash] These are the settings to configure or disable voicemail detection. @@ -430,7 +436,7 @@ def delete(id:, request_options: nil) # ) # api.assistants.update(id: "id") def update(id:, transcriber: nil, model: nil, voice: nil, first_message: nil, first_message_mode: nil, - hipaa_enabled: nil, client_messages: nil, server_messages: nil, silence_timeout_seconds: nil, max_duration_seconds: nil, background_sound: nil, background_denoising_enabled: nil, model_output_in_messages_enabled: nil, transport_configurations: nil, name: nil, voicemail_detection: nil, voicemail_message: nil, end_call_message: nil, end_call_phrases: nil, metadata: nil, analysis_plan: nil, artifact_plan: nil, message_plan: nil, start_speaking_plan: nil, stop_speaking_plan: nil, monitor_plan: nil, credential_ids: nil, server: nil, request_options: nil) + hipaa_enabled: nil, client_messages: nil, server_messages: nil, silence_timeout_seconds: nil, max_duration_seconds: nil, background_sound: nil, background_denoising_enabled: nil, model_output_in_messages_enabled: nil, transport_configurations: nil, credentials: nil, name: nil, voicemail_detection: nil, voicemail_message: nil, end_call_message: nil, end_call_phrases: nil, metadata: nil, analysis_plan: nil, artifact_plan: nil, message_plan: nil, start_speaking_plan: nil, stop_speaking_plan: nil, monitor_plan: nil, credential_ids: nil, server: nil, request_options: nil) response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.token unless request_options&.token.nil? @@ -458,6 +464,7 @@ def update(id:, transcriber: nil, model: nil, voice: nil, first_message: nil, fi backgroundDenoisingEnabled: background_denoising_enabled, modelOutputInMessagesEnabled: model_output_in_messages_enabled, transportConfigurations: transport_configurations, + credentials: credentials, name: name, voicemailDetection: voicemail_detection, voicemailMessage: voicemail_message, @@ -562,6 +569,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :name (String) # * :voicemail_detection (Hash) # * :provider (String) @@ -770,6 +778,10 @@ def delete(id:, request_options: nil) # * :timeout (Float) # * :record (Boolean) # * :recording_channels (Vapi::TransportConfigurationTwilioRecordingChannels) + # @param credentials [Array] These are dynamic credentials that will be used for the assistant calls. By + # default, all the credentials are available for use in the call but you can + # supplement an additional credentials using this. Dynamic credentials override + # existing credentials.Request of type Array, as a Hash # @param name [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. # @param voicemail_detection [Hash] These are the settings to configure or disable voicemail detection. @@ -893,7 +905,7 @@ def delete(id:, request_options: nil) # ) # api.assistants.update(id: "id") def update(id:, transcriber: nil, model: nil, voice: nil, first_message: nil, first_message_mode: nil, - hipaa_enabled: nil, client_messages: nil, server_messages: nil, silence_timeout_seconds: nil, max_duration_seconds: nil, background_sound: nil, background_denoising_enabled: nil, model_output_in_messages_enabled: nil, transport_configurations: nil, name: nil, voicemail_detection: nil, voicemail_message: nil, end_call_message: nil, end_call_phrases: nil, metadata: nil, analysis_plan: nil, artifact_plan: nil, message_plan: nil, start_speaking_plan: nil, stop_speaking_plan: nil, monitor_plan: nil, credential_ids: nil, server: nil, request_options: nil) + hipaa_enabled: nil, client_messages: nil, server_messages: nil, silence_timeout_seconds: nil, max_duration_seconds: nil, background_sound: nil, background_denoising_enabled: nil, model_output_in_messages_enabled: nil, transport_configurations: nil, credentials: nil, name: nil, voicemail_detection: nil, voicemail_message: nil, end_call_message: nil, end_call_phrases: nil, metadata: nil, analysis_plan: nil, artifact_plan: nil, message_plan: nil, start_speaking_plan: nil, stop_speaking_plan: nil, monitor_plan: nil, credential_ids: nil, server: nil, request_options: nil) Async do response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? @@ -922,6 +934,7 @@ def update(id:, transcriber: nil, model: nil, voice: nil, first_message: nil, fi backgroundDenoisingEnabled: background_denoising_enabled, modelOutputInMessagesEnabled: model_output_in_messages_enabled, transportConfigurations: transport_configurations, + credentials: credentials, name: name, voicemailDetection: voicemail_detection, voicemailMessage: voicemail_message, diff --git a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_credentials_item.rb b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_credentials_item.rb new file mode 100644 index 0000000..39c2949 --- /dev/null +++ b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_credentials_item.rb @@ -0,0 +1,512 @@ +# frozen_string_literal: true + +require "json" +require_relative "../../types/create_anthropic_credential_dto" +require_relative "../../types/create_anyscale_credential_dto" +require_relative "../../types/create_assembly_ai_credential_dto" +require_relative "../../types/create_azure_open_ai_credential_dto" +require_relative "../../types/create_azure_credential_dto" +require_relative "../../types/create_byo_sip_trunk_credential_dto" +require_relative "../../types/create_cartesia_credential_dto" +require_relative "../../types/create_cloudflare_credential_dto" +require_relative "../../types/create_custom_llm_credential_dto" +require_relative "../../types/create_deepgram_credential_dto" +require_relative "../../types/create_deep_infra_credential_dto" +require_relative "../../types/create_deep_seek_credential_dto" +require_relative "../../types/create_eleven_labs_credential_dto" +require_relative "../../types/create_gcp_credential_dto" +require_relative "../../types/create_gladia_credential_dto" +require_relative "../../types/create_go_high_level_credential_dto" +require_relative "../../types/create_groq_credential_dto" +require_relative "../../types/create_langfuse_credential_dto" +require_relative "../../types/create_lmnt_credential_dto" +require_relative "../../types/create_make_credential_dto" +require_relative "../../types/create_open_ai_credential_dto" +require_relative "../../types/create_open_router_credential_dto" +require_relative "../../types/create_perplexity_ai_credential_dto" +require_relative "../../types/create_play_ht_credential_dto" +require_relative "../../types/create_rime_ai_credential_dto" +require_relative "../../types/create_runpod_credential_dto" +require_relative "../../types/create_s_3_credential_dto" +require_relative "../../types/create_smallest_ai_credential_dto" +require_relative "../../types/create_tavus_credential_dto" +require_relative "../../types/create_together_ai_credential_dto" +require_relative "../../types/create_twilio_credential_dto" +require_relative "../../types/create_vonage_credential_dto" +require_relative "../../types/create_webhook_credential_dto" +require_relative "../../types/create_x_ai_credential_dto" + +module Vapi + class Assistants + class UpdateAssistantDtoCredentialsItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateAssistantDtoCredentialsItem + # + # @param json_object [String] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "anthropic" + Vapi::CreateAnthropicCredentialDto.from_json(json_object: json_object) + when "anyscale" + Vapi::CreateAnyscaleCredentialDto.from_json(json_object: json_object) + when "assembly-ai" + Vapi::CreateAssemblyAiCredentialDto.from_json(json_object: json_object) + when "azure-openai" + Vapi::CreateAzureOpenAiCredentialDto.from_json(json_object: json_object) + when "azure" + Vapi::CreateAzureCredentialDto.from_json(json_object: json_object) + when "byo-sip-trunk" + Vapi::CreateByoSipTrunkCredentialDto.from_json(json_object: json_object) + when "cartesia" + Vapi::CreateCartesiaCredentialDto.from_json(json_object: json_object) + when "cloudflare" + Vapi::CreateCloudflareCredentialDto.from_json(json_object: json_object) + when "custom-llm" + Vapi::CreateCustomLlmCredentialDto.from_json(json_object: json_object) + when "deepgram" + Vapi::CreateDeepgramCredentialDto.from_json(json_object: json_object) + when "deepinfra" + Vapi::CreateDeepInfraCredentialDto.from_json(json_object: json_object) + when "deep-seek" + Vapi::CreateDeepSeekCredentialDto.from_json(json_object: json_object) + when "11labs" + Vapi::CreateElevenLabsCredentialDto.from_json(json_object: json_object) + when "gcp" + Vapi::CreateGcpCredentialDto.from_json(json_object: json_object) + when "gladia" + Vapi::CreateGladiaCredentialDto.from_json(json_object: json_object) + when "gohighlevel" + Vapi::CreateGoHighLevelCredentialDto.from_json(json_object: json_object) + when "groq" + Vapi::CreateGroqCredentialDto.from_json(json_object: json_object) + when "langfuse" + Vapi::CreateLangfuseCredentialDto.from_json(json_object: json_object) + when "lmnt" + Vapi::CreateLmntCredentialDto.from_json(json_object: json_object) + when "make" + Vapi::CreateMakeCredentialDto.from_json(json_object: json_object) + when "openai" + Vapi::CreateOpenAiCredentialDto.from_json(json_object: json_object) + when "openrouter" + Vapi::CreateOpenRouterCredentialDto.from_json(json_object: json_object) + when "perplexity-ai" + Vapi::CreatePerplexityAiCredentialDto.from_json(json_object: json_object) + when "playht" + Vapi::CreatePlayHtCredentialDto.from_json(json_object: json_object) + when "rime-ai" + Vapi::CreateRimeAiCredentialDto.from_json(json_object: json_object) + when "runpod" + Vapi::CreateRunpodCredentialDto.from_json(json_object: json_object) + when "s3" + Vapi::CreateS3CredentialDto.from_json(json_object: json_object) + when "smallest-ai" + Vapi::CreateSmallestAiCredentialDto.from_json(json_object: json_object) + when "tavus" + Vapi::CreateTavusCredentialDto.from_json(json_object: json_object) + when "together-ai" + Vapi::CreateTogetherAiCredentialDto.from_json(json_object: json_object) + when "twilio" + Vapi::CreateTwilioCredentialDto.from_json(json_object: json_object) + when "vonage" + Vapi::CreateVonageCredentialDto.from_json(json_object: json_object) + when "webhook" + Vapi::CreateWebhookCredentialDto.from_json(json_object: json_object) + when "xai" + Vapi::CreateXAiCredentialDto.from_json(json_object: json_object) + else + Vapi::CreateAnthropicCredentialDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "anthropic" + { **@member.to_json, provider: @discriminant }.to_json + when "anyscale" + { **@member.to_json, provider: @discriminant }.to_json + when "assembly-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "azure-openai" + { **@member.to_json, provider: @discriminant }.to_json + when "azure" + { **@member.to_json, provider: @discriminant }.to_json + when "byo-sip-trunk" + { **@member.to_json, provider: @discriminant }.to_json + when "cartesia" + { **@member.to_json, provider: @discriminant }.to_json + when "cloudflare" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-llm" + { **@member.to_json, provider: @discriminant }.to_json + when "deepgram" + { **@member.to_json, provider: @discriminant }.to_json + when "deepinfra" + { **@member.to_json, provider: @discriminant }.to_json + when "deep-seek" + { **@member.to_json, provider: @discriminant }.to_json + when "11labs" + { **@member.to_json, provider: @discriminant }.to_json + when "gcp" + { **@member.to_json, provider: @discriminant }.to_json + when "gladia" + { **@member.to_json, provider: @discriminant }.to_json + when "gohighlevel" + { **@member.to_json, provider: @discriminant }.to_json + when "groq" + { **@member.to_json, provider: @discriminant }.to_json + when "langfuse" + { **@member.to_json, provider: @discriminant }.to_json + when "lmnt" + { **@member.to_json, provider: @discriminant }.to_json + when "make" + { **@member.to_json, provider: @discriminant }.to_json + when "openai" + { **@member.to_json, provider: @discriminant }.to_json + when "openrouter" + { **@member.to_json, provider: @discriminant }.to_json + when "perplexity-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "playht" + { **@member.to_json, provider: @discriminant }.to_json + when "rime-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "runpod" + { **@member.to_json, provider: @discriminant }.to_json + when "s3" + { **@member.to_json, provider: @discriminant }.to_json + when "smallest-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "tavus" + { **@member.to_json, provider: @discriminant }.to_json + when "together-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "twilio" + { **@member.to_json, provider: @discriminant }.to_json + when "vonage" + { **@member.to_json, provider: @discriminant }.to_json + when "webhook" + { **@member.to_json, provider: @discriminant }.to_json + when "xai" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "anthropic" + Vapi::CreateAnthropicCredentialDto.validate_raw(obj: obj) + when "anyscale" + Vapi::CreateAnyscaleCredentialDto.validate_raw(obj: obj) + when "assembly-ai" + Vapi::CreateAssemblyAiCredentialDto.validate_raw(obj: obj) + when "azure-openai" + Vapi::CreateAzureOpenAiCredentialDto.validate_raw(obj: obj) + when "azure" + Vapi::CreateAzureCredentialDto.validate_raw(obj: obj) + when "byo-sip-trunk" + Vapi::CreateByoSipTrunkCredentialDto.validate_raw(obj: obj) + when "cartesia" + Vapi::CreateCartesiaCredentialDto.validate_raw(obj: obj) + when "cloudflare" + Vapi::CreateCloudflareCredentialDto.validate_raw(obj: obj) + when "custom-llm" + Vapi::CreateCustomLlmCredentialDto.validate_raw(obj: obj) + when "deepgram" + Vapi::CreateDeepgramCredentialDto.validate_raw(obj: obj) + when "deepinfra" + Vapi::CreateDeepInfraCredentialDto.validate_raw(obj: obj) + when "deep-seek" + Vapi::CreateDeepSeekCredentialDto.validate_raw(obj: obj) + when "11labs" + Vapi::CreateElevenLabsCredentialDto.validate_raw(obj: obj) + when "gcp" + Vapi::CreateGcpCredentialDto.validate_raw(obj: obj) + when "gladia" + Vapi::CreateGladiaCredentialDto.validate_raw(obj: obj) + when "gohighlevel" + Vapi::CreateGoHighLevelCredentialDto.validate_raw(obj: obj) + when "groq" + Vapi::CreateGroqCredentialDto.validate_raw(obj: obj) + when "langfuse" + Vapi::CreateLangfuseCredentialDto.validate_raw(obj: obj) + when "lmnt" + Vapi::CreateLmntCredentialDto.validate_raw(obj: obj) + when "make" + Vapi::CreateMakeCredentialDto.validate_raw(obj: obj) + when "openai" + Vapi::CreateOpenAiCredentialDto.validate_raw(obj: obj) + when "openrouter" + Vapi::CreateOpenRouterCredentialDto.validate_raw(obj: obj) + when "perplexity-ai" + Vapi::CreatePerplexityAiCredentialDto.validate_raw(obj: obj) + when "playht" + Vapi::CreatePlayHtCredentialDto.validate_raw(obj: obj) + when "rime-ai" + Vapi::CreateRimeAiCredentialDto.validate_raw(obj: obj) + when "runpod" + Vapi::CreateRunpodCredentialDto.validate_raw(obj: obj) + when "s3" + Vapi::CreateS3CredentialDto.validate_raw(obj: obj) + when "smallest-ai" + Vapi::CreateSmallestAiCredentialDto.validate_raw(obj: obj) + when "tavus" + Vapi::CreateTavusCredentialDto.validate_raw(obj: obj) + when "together-ai" + Vapi::CreateTogetherAiCredentialDto.validate_raw(obj: obj) + when "twilio" + Vapi::CreateTwilioCredentialDto.validate_raw(obj: obj) + when "vonage" + Vapi::CreateVonageCredentialDto.validate_raw(obj: obj) + when "webhook" + Vapi::CreateWebhookCredentialDto.validate_raw(obj: obj) + when "xai" + Vapi::CreateXAiCredentialDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::CreateAnthropicCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.anthropic(member:) + new(member: member, discriminant: "anthropic") + end + + # @param member [Vapi::CreateAnyscaleCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.anyscale(member:) + new(member: member, discriminant: "anyscale") + end + + # @param member [Vapi::CreateAssemblyAiCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.assembly_ai(member:) + new(member: member, discriminant: "assembly-ai") + end + + # @param member [Vapi::CreateAzureOpenAiCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.azure_openai(member:) + new(member: member, discriminant: "azure-openai") + end + + # @param member [Vapi::CreateAzureCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.azure(member:) + new(member: member, discriminant: "azure") + end + + # @param member [Vapi::CreateByoSipTrunkCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.byo_sip_trunk(member:) + new(member: member, discriminant: "byo-sip-trunk") + end + + # @param member [Vapi::CreateCartesiaCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.cartesia(member:) + new(member: member, discriminant: "cartesia") + end + + # @param member [Vapi::CreateCloudflareCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.cloudflare(member:) + new(member: member, discriminant: "cloudflare") + end + + # @param member [Vapi::CreateCustomLlmCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.custom_llm(member:) + new(member: member, discriminant: "custom-llm") + end + + # @param member [Vapi::CreateDeepgramCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.deepgram(member:) + new(member: member, discriminant: "deepgram") + end + + # @param member [Vapi::CreateDeepInfraCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.deepinfra(member:) + new(member: member, discriminant: "deepinfra") + end + + # @param member [Vapi::CreateDeepSeekCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.deep_seek(member:) + new(member: member, discriminant: "deep-seek") + end + + # @param member [Vapi::CreateElevenLabsCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self._11_labs(member:) + new(member: member, discriminant: "11labs") + end + + # @param member [Vapi::CreateGcpCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.gcp(member:) + new(member: member, discriminant: "gcp") + end + + # @param member [Vapi::CreateGladiaCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.gladia(member:) + new(member: member, discriminant: "gladia") + end + + # @param member [Vapi::CreateGoHighLevelCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.gohighlevel(member:) + new(member: member, discriminant: "gohighlevel") + end + + # @param member [Vapi::CreateGroqCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.groq(member:) + new(member: member, discriminant: "groq") + end + + # @param member [Vapi::CreateLangfuseCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.langfuse(member:) + new(member: member, discriminant: "langfuse") + end + + # @param member [Vapi::CreateLmntCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.lmnt(member:) + new(member: member, discriminant: "lmnt") + end + + # @param member [Vapi::CreateMakeCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.make(member:) + new(member: member, discriminant: "make") + end + + # @param member [Vapi::CreateOpenAiCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.openai(member:) + new(member: member, discriminant: "openai") + end + + # @param member [Vapi::CreateOpenRouterCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.openrouter(member:) + new(member: member, discriminant: "openrouter") + end + + # @param member [Vapi::CreatePerplexityAiCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.perplexity_ai(member:) + new(member: member, discriminant: "perplexity-ai") + end + + # @param member [Vapi::CreatePlayHtCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.playht(member:) + new(member: member, discriminant: "playht") + end + + # @param member [Vapi::CreateRimeAiCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.rime_ai(member:) + new(member: member, discriminant: "rime-ai") + end + + # @param member [Vapi::CreateRunpodCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.runpod(member:) + new(member: member, discriminant: "runpod") + end + + # @param member [Vapi::CreateS3CredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.s_3(member:) + new(member: member, discriminant: "s3") + end + + # @param member [Vapi::CreateSmallestAiCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.smallest_ai(member:) + new(member: member, discriminant: "smallest-ai") + end + + # @param member [Vapi::CreateTavusCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.tavus(member:) + new(member: member, discriminant: "tavus") + end + + # @param member [Vapi::CreateTogetherAiCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.together_ai(member:) + new(member: member, discriminant: "together-ai") + end + + # @param member [Vapi::CreateTwilioCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.twilio(member:) + new(member: member, discriminant: "twilio") + end + + # @param member [Vapi::CreateVonageCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.vonage(member:) + new(member: member, discriminant: "vonage") + end + + # @param member [Vapi::CreateWebhookCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.webhook(member:) + new(member: member, discriminant: "webhook") + end + + # @param member [Vapi::CreateXAiCredentialDto] + # @return [Vapi::Assistants::UpdateAssistantDtoCredentialsItem] + def self.xai(member:) + new(member: member, discriminant: "xai") + end + end + end +end diff --git a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb index 19574a4..40bf936 100644 --- a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb +++ b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_model.rb @@ -8,6 +8,7 @@ require_relative "../../types/google_model" require_relative "../../types/groq_model" require_relative "../../types/inflection_ai_model" +require_relative "../../types/deep_seek_model" require_relative "../../types/open_ai_model" require_relative "../../types/open_router_model" require_relative "../../types/perplexity_ai_model" @@ -56,6 +57,8 @@ def self.from_json(json_object:) Vapi::GroqModel.from_json(json_object: json_object) when "inflection-ai" Vapi::InflectionAiModel.from_json(json_object: json_object) + when "deep-seek" + Vapi::DeepSeekModel.from_json(json_object: json_object) when "openai" Vapi::OpenAiModel.from_json(json_object: json_object) when "openrouter" @@ -93,6 +96,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "inflection-ai" { **@member.to_json, provider: @discriminant }.to_json + when "deep-seek" + { **@member.to_json, provider: @discriminant }.to_json when "openai" { **@member.to_json, provider: @discriminant }.to_json when "openrouter" @@ -133,6 +138,8 @@ def self.validate_raw(obj:) Vapi::GroqModel.validate_raw(obj: obj) when "inflection-ai" Vapi::InflectionAiModel.validate_raw(obj: obj) + when "deep-seek" + Vapi::DeepSeekModel.validate_raw(obj: obj) when "openai" Vapi::OpenAiModel.validate_raw(obj: obj) when "openrouter" @@ -200,6 +207,12 @@ def self.inflection_ai(member:) new(member: member, discriminant: "inflection-ai") end + # @param member [Vapi::DeepSeekModel] + # @return [Vapi::Assistants::UpdateAssistantDtoModel] + def self.deep_seek(member:) + new(member: member, discriminant: "deep-seek") + end + # @param member [Vapi::OpenAiModel] # @return [Vapi::Assistants::UpdateAssistantDtoModel] def self.openai(member:) diff --git a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_transcriber.rb b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_transcriber.rb index 04e1e22..b8d2edb 100644 --- a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_transcriber.rb +++ b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_transcriber.rb @@ -2,6 +2,7 @@ require "json" require_relative "../../types/assembly_ai_transcriber" +require_relative "../../types/azure_speech_transcriber" require_relative "../../types/custom_transcriber" require_relative "../../types/deepgram_transcriber" require_relative "../../types/gladia_transcriber" @@ -36,6 +37,8 @@ def self.from_json(json_object:) member = case struct.provider when "assembly-ai" Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) + when "azure" + Vapi::AzureSpeechTranscriber.from_json(json_object: json_object) when "custom-transcriber" Vapi::CustomTranscriber.from_json(json_object: json_object) when "deepgram" @@ -57,6 +60,8 @@ def to_json(*_args) case @discriminant when "assembly-ai" { **@member.to_json, provider: @discriminant }.to_json + when "azure" + { **@member.to_json, provider: @discriminant }.to_json when "custom-transcriber" { **@member.to_json, provider: @discriminant }.to_json when "deepgram" @@ -81,6 +86,8 @@ def self.validate_raw(obj:) case obj.provider when "assembly-ai" Vapi::AssemblyAiTranscriber.validate_raw(obj: obj) + when "azure" + Vapi::AzureSpeechTranscriber.validate_raw(obj: obj) when "custom-transcriber" Vapi::CustomTranscriber.validate_raw(obj: obj) when "deepgram" @@ -108,6 +115,12 @@ def self.assembly_ai(member:) new(member: member, discriminant: "assembly-ai") end + # @param member [Vapi::AzureSpeechTranscriber] + # @return [Vapi::Assistants::UpdateAssistantDtoTranscriber] + def self.azure(member:) + new(member: member, discriminant: "azure") + end + # @param member [Vapi::CustomTranscriber] # @return [Vapi::Assistants::UpdateAssistantDtoTranscriber] def self.custom_transcriber(member:) diff --git a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_voice.rb b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_voice.rb index 26e36c3..24b7b9e 100644 --- a/lib/vapi_server_sdk/assistants/types/update_assistant_dto_voice.rb +++ b/lib/vapi_server_sdk/assistants/types/update_assistant_dto_voice.rb @@ -11,6 +11,7 @@ require_relative "../../types/open_ai_voice" require_relative "../../types/play_ht_voice" require_relative "../../types/rime_ai_voice" +require_relative "../../types/smallest_ai_voice" require_relative "../../types/tavus_voice" module Vapi @@ -60,6 +61,8 @@ def self.from_json(json_object:) Vapi::PlayHtVoice.from_json(json_object: json_object) when "rime-ai" Vapi::RimeAiVoice.from_json(json_object: json_object) + when "smallest-ai" + Vapi::SmallestAiVoice.from_json(json_object: json_object) when "tavus" Vapi::TavusVoice.from_json(json_object: json_object) else @@ -93,6 +96,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "rime-ai" { **@member.to_json, provider: @discriminant }.to_json + when "smallest-ai" + { **@member.to_json, provider: @discriminant }.to_json when "tavus" { **@member.to_json, provider: @discriminant }.to_json else @@ -129,6 +134,8 @@ def self.validate_raw(obj:) Vapi::PlayHtVoice.validate_raw(obj: obj) when "rime-ai" Vapi::RimeAiVoice.validate_raw(obj: obj) + when "smallest-ai" + Vapi::SmallestAiVoice.validate_raw(obj: obj) when "tavus" Vapi::TavusVoice.validate_raw(obj: obj) else @@ -204,6 +211,12 @@ def self.rime_ai(member:) new(member: member, discriminant: "rime-ai") end + # @param member [Vapi::SmallestAiVoice] + # @return [Vapi::Assistants::UpdateAssistantDtoVoice] + def self.smallest_ai(member:) + new(member: member, discriminant: "smallest-ai") + end + # @param member [Vapi::TavusVoice] # @return [Vapi::Assistants::UpdateAssistantDtoVoice] def self.tavus(member:) diff --git a/lib/vapi_server_sdk/blocks/client.rb b/lib/vapi_server_sdk/blocks/client.rb index 0f94de7..97dfe50 100644 --- a/lib/vapi_server_sdk/blocks/client.rb +++ b/lib/vapi_server_sdk/blocks/client.rb @@ -8,10 +8,7 @@ require_relative "types/blocks_create_response" require_relative "types/blocks_get_response" require_relative "types/blocks_delete_response" -require_relative "types/update_block_dto_messages_item" -require_relative "../types/json_schema" -require_relative "types/update_block_dto_tool" -require_relative "types/update_block_dto_steps_item" +require_relative "types/blocks_update_request" require_relative "types/blocks_update_response" require "async" @@ -171,74 +168,7 @@ def delete(id:, request_options: nil) end # @param id [String] - # @param messages [Array] These are the pre-configured messages that will be spoken to the user while the - # block is running.Request of type Array, as a Hash - # @param input_schema [Hash] This is the input schema for the block. This is the input the block needs to - # run. It's given to the block as `steps[0].input` - # These are accessible as variables: - # - ({{input.propertyName}}) in context of the block execution (step) - # - ({{stepName.input.propertyName}}) in context of the workflowRequest of type Vapi::JsonSchema, as a Hash - # * :type (Vapi::JsonSchemaType) - # * :items (Hash{String => Object}) - # * :properties (Hash{String => Object}) - # * :description (String) - # * :required (Array) - # @param output_schema [Hash] This is the output schema for the block. This is the output the block will - # return to the workflow (`{{stepName.output}}`). - # These are accessible as variables: - # - ({{output.propertyName}}) in context of the block execution (step) - # - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) - # - ({{blockName.output.propertyName}}) in context of the workflow (read caveat - # #2) - # Caveats: - # 1. a workflow can execute a step multiple times. example, if a loop is used in - # the graph. {{stepName.output.propertyName}} will reference the latest usage of - # the step. - # 2. a workflow can execute a block multiple times. example, if a step is called - # multiple times or if a block is used in multiple steps. - # {{blockName.output.propertyName}} will reference the latest usage of the block. - # this liquid variable is just provided for convenience when creating blocks - # outside of a workflow with steps.Request of type Vapi::JsonSchema, as a Hash - # * :type (Vapi::JsonSchemaType) - # * :items (Hash{String => Object}) - # * :properties (Hash{String => Object}) - # * :description (String) - # * :required (Array) - # @param tool [Vapi::Blocks::UpdateBlockDtoTool] This is the tool that the block will call. To use an existing tool, use - # `toolId`. - # @param steps [Array] These are the steps in the workflow.Request of type Array, as a Hash - # @param name [String] This is the name of the block. This is just for your reference. - # @param instruction [String] This is the instruction to the model. - # You can reference any variable in the context of the current block execution - # (step): - # - "{{input.your-property-name}}" for the current step's input - # - "{{your-step-name.output.your-property-name}}" for another step's output (in - # the same workflow; read caveat #1) - # - "{{your-step-name.input.your-property-name}}" for another step's input (in the - # same workflow; read caveat #1) - # - "{{your-block-name.output.your-property-name}}" for another block's output (in - # the same workflow; read caveat #2) - # - "{{your-block-name.input.your-property-name}}" for another block's input (in - # the same workflow; read caveat #2) - # - "{{workflow.input.your-property-name}}" for the current workflow's input - # - "{{global.your-property-name}}" for the global context - # This can be as simple or as complex as you want it to be. - # - "say hello and ask the user about their day!" - # - "collect the user's first and last name" - # - "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. - # ask them about their salary and if they might be interested in buying a house. - # we offer {{input.offer}}" - # Caveats: - # 1. a workflow can execute a step multiple times. example, if a loop is used in - # the graph. {{stepName.output/input.propertyName}} will reference the latest - # usage of the step. - # 2. a workflow can execute a block multiple times. example, if a step is called - # multiple times or if a block is used in multiple steps. - # {{blockName.output/input.propertyName}} will reference the latest usage of the - # block. this liquid variable is just provided for convenience when creating - # blocks outside of a workflow with steps. - # @param tool_id [String] This is the id of the tool that the block will call. To use a transient tool, - # use `tool`. + # @param request [Vapi::Blocks::BlocksUpdateRequest] # @param request_options [Vapi::RequestOptions] # @return [Vapi::Blocks::BlocksUpdateResponse] # @example @@ -248,8 +178,7 @@ def delete(id:, request_options: nil) # token: "YOUR_AUTH_TOKEN" # ) # api.blocks.update(id: "id") - def update(id:, messages: nil, input_schema: nil, output_schema: nil, tool: nil, steps: nil, name: nil, - instruction: nil, tool_id: nil, request_options: nil) + def update(id:, request:, request_options: nil) response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.token unless request_options&.token.nil? @@ -261,17 +190,7 @@ def update(id:, messages: nil, input_schema: nil, output_schema: nil, tool: nil, unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end - req.body = { - **(request_options&.additional_body_parameters || {}), - messages: messages, - inputSchema: input_schema, - outputSchema: output_schema, - tool: tool, - steps: steps, - name: name, - instruction: instruction, - toolId: tool_id - }.compact + req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(request_options: request_options)}/block/#{id}" end Vapi::Blocks::BlocksUpdateResponse.from_json(json_object: response.body) @@ -441,74 +360,7 @@ def delete(id:, request_options: nil) end # @param id [String] - # @param messages [Array] These are the pre-configured messages that will be spoken to the user while the - # block is running.Request of type Array, as a Hash - # @param input_schema [Hash] This is the input schema for the block. This is the input the block needs to - # run. It's given to the block as `steps[0].input` - # These are accessible as variables: - # - ({{input.propertyName}}) in context of the block execution (step) - # - ({{stepName.input.propertyName}}) in context of the workflowRequest of type Vapi::JsonSchema, as a Hash - # * :type (Vapi::JsonSchemaType) - # * :items (Hash{String => Object}) - # * :properties (Hash{String => Object}) - # * :description (String) - # * :required (Array) - # @param output_schema [Hash] This is the output schema for the block. This is the output the block will - # return to the workflow (`{{stepName.output}}`). - # These are accessible as variables: - # - ({{output.propertyName}}) in context of the block execution (step) - # - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) - # - ({{blockName.output.propertyName}}) in context of the workflow (read caveat - # #2) - # Caveats: - # 1. a workflow can execute a step multiple times. example, if a loop is used in - # the graph. {{stepName.output.propertyName}} will reference the latest usage of - # the step. - # 2. a workflow can execute a block multiple times. example, if a step is called - # multiple times or if a block is used in multiple steps. - # {{blockName.output.propertyName}} will reference the latest usage of the block. - # this liquid variable is just provided for convenience when creating blocks - # outside of a workflow with steps.Request of type Vapi::JsonSchema, as a Hash - # * :type (Vapi::JsonSchemaType) - # * :items (Hash{String => Object}) - # * :properties (Hash{String => Object}) - # * :description (String) - # * :required (Array) - # @param tool [Vapi::Blocks::UpdateBlockDtoTool] This is the tool that the block will call. To use an existing tool, use - # `toolId`. - # @param steps [Array] These are the steps in the workflow.Request of type Array, as a Hash - # @param name [String] This is the name of the block. This is just for your reference. - # @param instruction [String] This is the instruction to the model. - # You can reference any variable in the context of the current block execution - # (step): - # - "{{input.your-property-name}}" for the current step's input - # - "{{your-step-name.output.your-property-name}}" for another step's output (in - # the same workflow; read caveat #1) - # - "{{your-step-name.input.your-property-name}}" for another step's input (in the - # same workflow; read caveat #1) - # - "{{your-block-name.output.your-property-name}}" for another block's output (in - # the same workflow; read caveat #2) - # - "{{your-block-name.input.your-property-name}}" for another block's input (in - # the same workflow; read caveat #2) - # - "{{workflow.input.your-property-name}}" for the current workflow's input - # - "{{global.your-property-name}}" for the global context - # This can be as simple or as complex as you want it to be. - # - "say hello and ask the user about their day!" - # - "collect the user's first and last name" - # - "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. - # ask them about their salary and if they might be interested in buying a house. - # we offer {{input.offer}}" - # Caveats: - # 1. a workflow can execute a step multiple times. example, if a loop is used in - # the graph. {{stepName.output/input.propertyName}} will reference the latest - # usage of the step. - # 2. a workflow can execute a block multiple times. example, if a step is called - # multiple times or if a block is used in multiple steps. - # {{blockName.output/input.propertyName}} will reference the latest usage of the - # block. this liquid variable is just provided for convenience when creating - # blocks outside of a workflow with steps. - # @param tool_id [String] This is the id of the tool that the block will call. To use a transient tool, - # use `tool`. + # @param request [Vapi::Blocks::BlocksUpdateRequest] # @param request_options [Vapi::RequestOptions] # @return [Vapi::Blocks::BlocksUpdateResponse] # @example @@ -518,8 +370,7 @@ def delete(id:, request_options: nil) # token: "YOUR_AUTH_TOKEN" # ) # api.blocks.update(id: "id") - def update(id:, messages: nil, input_schema: nil, output_schema: nil, tool: nil, steps: nil, name: nil, - instruction: nil, tool_id: nil, request_options: nil) + def update(id:, request:, request_options: nil) Async do response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? @@ -532,17 +383,7 @@ def update(id:, messages: nil, input_schema: nil, output_schema: nil, tool: nil, unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end - req.body = { - **(request_options&.additional_body_parameters || {}), - messages: messages, - inputSchema: input_schema, - outputSchema: output_schema, - tool: tool, - steps: steps, - name: name, - instruction: instruction, - toolId: tool_id - }.compact + req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(request_options: request_options)}/block/#{id}" end Vapi::Blocks::BlocksUpdateResponse.from_json(json_object: response.body) diff --git a/lib/vapi_server_sdk/blocks/types/blocks_update_request.rb b/lib/vapi_server_sdk/blocks/types/blocks_update_request.rb new file mode 100644 index 0000000..9cd3310 --- /dev/null +++ b/lib/vapi_server_sdk/blocks/types/blocks_update_request.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +require "json" +require_relative "../../types/update_conversation_block_dto" +require_relative "../../types/update_tool_call_block_dto" +require_relative "../../types/update_workflow_block_dto" + +module Vapi + class Blocks + class BlocksUpdateRequest + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::Blocks::BlocksUpdateRequest] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of BlocksUpdateRequest + # + # @param json_object [String] + # @return [Vapi::Blocks::BlocksUpdateRequest] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "conversation" + Vapi::UpdateConversationBlockDto.from_json(json_object: json_object) + when "tool-call" + Vapi::UpdateToolCallBlockDto.from_json(json_object: json_object) + when "workflow" + Vapi::UpdateWorkflowBlockDto.from_json(json_object: json_object) + else + Vapi::UpdateConversationBlockDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "conversation" + { **@member.to_json, type: @discriminant }.to_json + when "tool-call" + { **@member.to_json, type: @discriminant }.to_json + when "workflow" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "conversation" + Vapi::UpdateConversationBlockDto.validate_raw(obj: obj) + when "tool-call" + Vapi::UpdateToolCallBlockDto.validate_raw(obj: obj) + when "workflow" + Vapi::UpdateWorkflowBlockDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::UpdateConversationBlockDto] + # @return [Vapi::Blocks::BlocksUpdateRequest] + def self.conversation(member:) + new(member: member, discriminant: "conversation") + end + + # @param member [Vapi::UpdateToolCallBlockDto] + # @return [Vapi::Blocks::BlocksUpdateRequest] + def self.tool_call(member:) + new(member: member, discriminant: "tool-call") + end + + # @param member [Vapi::UpdateWorkflowBlockDto] + # @return [Vapi::Blocks::BlocksUpdateRequest] + def self.workflow(member:) + new(member: member, discriminant: "workflow") + end + end + end +end diff --git a/lib/vapi_server_sdk/blocks/types/update_block_dto_messages_item.rb b/lib/vapi_server_sdk/blocks/types/update_block_dto_messages_item.rb deleted file mode 100644 index 2b2dfd4..0000000 --- a/lib/vapi_server_sdk/blocks/types/update_block_dto_messages_item.rb +++ /dev/null @@ -1,96 +0,0 @@ -# frozen_string_literal: true - -require "json" -require_relative "../../types/block_start_message" -require_relative "../../types/block_complete_message" - -module Vapi - class Blocks - class UpdateBlockDtoMessagesItem - # @return [Object] - attr_reader :member - # @return [String] - attr_reader :discriminant - - private_class_method :new - alias kind_of? is_a? - - # @param member [Object] - # @param discriminant [String] - # @return [Vapi::Blocks::UpdateBlockDtoMessagesItem] - def initialize(member:, discriminant:) - @member = member - @discriminant = discriminant - end - - # Deserialize a JSON object to an instance of UpdateBlockDtoMessagesItem - # - # @param json_object [String] - # @return [Vapi::Blocks::UpdateBlockDtoMessagesItem] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - member = case struct.type - when "block-start" - Vapi::BlockStartMessage.from_json(json_object: json_object) - when "block-complete" - Vapi::BlockCompleteMessage.from_json(json_object: json_object) - else - Vapi::BlockStartMessage.from_json(json_object: json_object) - end - new(member: member, discriminant: struct.type) - end - - # For Union Types, to_json functionality is delegated to the wrapped member. - # - # @return [String] - def to_json(*_args) - case @discriminant - when "block-start" - { **@member.to_json, type: @discriminant }.to_json - when "block-complete" - { **@member.to_json, type: @discriminant }.to_json - else - { "type": @discriminant, value: @member }.to_json - end - @member.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - case obj.type - when "block-start" - Vapi::BlockStartMessage.validate_raw(obj: obj) - when "block-complete" - Vapi::BlockCompleteMessage.validate_raw(obj: obj) - else - raise("Passed value matched no type within the union, validation failed.") - end - end - - # For Union Types, is_a? functionality is delegated to the wrapped member. - # - # @param obj [Object] - # @return [Boolean] - def is_a?(obj) - @member.is_a?(obj) - end - - # @param member [Vapi::BlockStartMessage] - # @return [Vapi::Blocks::UpdateBlockDtoMessagesItem] - def self.block_start(member:) - new(member: member, discriminant: "block-start") - end - - # @param member [Vapi::BlockCompleteMessage] - # @return [Vapi::Blocks::UpdateBlockDtoMessagesItem] - def self.block_complete(member:) - new(member: member, discriminant: "block-complete") - end - end - end -end diff --git a/lib/vapi_server_sdk/blocks/types/update_block_dto_steps_item.rb b/lib/vapi_server_sdk/blocks/types/update_block_dto_steps_item.rb deleted file mode 100644 index 8dc2036..0000000 --- a/lib/vapi_server_sdk/blocks/types/update_block_dto_steps_item.rb +++ /dev/null @@ -1,96 +0,0 @@ -# frozen_string_literal: true - -require "json" -require_relative "../../types/handoff_step" -require_relative "../../types/callback_step" - -module Vapi - class Blocks - class UpdateBlockDtoStepsItem - # @return [Object] - attr_reader :member - # @return [String] - attr_reader :discriminant - - private_class_method :new - alias kind_of? is_a? - - # @param member [Object] - # @param discriminant [String] - # @return [Vapi::Blocks::UpdateBlockDtoStepsItem] - def initialize(member:, discriminant:) - @member = member - @discriminant = discriminant - end - - # Deserialize a JSON object to an instance of UpdateBlockDtoStepsItem - # - # @param json_object [String] - # @return [Vapi::Blocks::UpdateBlockDtoStepsItem] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - member = case struct.type - when "handoff" - Vapi::HandoffStep.from_json(json_object: json_object) - when "callback" - Vapi::CallbackStep.from_json(json_object: json_object) - else - Vapi::HandoffStep.from_json(json_object: json_object) - end - new(member: member, discriminant: struct.type) - end - - # For Union Types, to_json functionality is delegated to the wrapped member. - # - # @return [String] - def to_json(*_args) - case @discriminant - when "handoff" - { **@member.to_json, type: @discriminant }.to_json - when "callback" - { **@member.to_json, type: @discriminant }.to_json - else - { "type": @discriminant, value: @member }.to_json - end - @member.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - case obj.type - when "handoff" - Vapi::HandoffStep.validate_raw(obj: obj) - when "callback" - Vapi::CallbackStep.validate_raw(obj: obj) - else - raise("Passed value matched no type within the union, validation failed.") - end - end - - # For Union Types, is_a? functionality is delegated to the wrapped member. - # - # @param obj [Object] - # @return [Boolean] - def is_a?(obj) - @member.is_a?(obj) - end - - # @param member [Vapi::HandoffStep] - # @return [Vapi::Blocks::UpdateBlockDtoStepsItem] - def self.handoff(member:) - new(member: member, discriminant: "handoff") - end - - # @param member [Vapi::CallbackStep] - # @return [Vapi::Blocks::UpdateBlockDtoStepsItem] - def self.callback(member:) - new(member: member, discriminant: "callback") - end - end - end -end diff --git a/lib/vapi_server_sdk/blocks/types/update_block_dto_tool.rb b/lib/vapi_server_sdk/blocks/types/update_block_dto_tool.rb deleted file mode 100644 index e2cb319..0000000 --- a/lib/vapi_server_sdk/blocks/types/update_block_dto_tool.rb +++ /dev/null @@ -1,163 +0,0 @@ -# frozen_string_literal: true - -require "json" -require_relative "../../types/create_dtmf_tool_dto" -require_relative "../../types/create_end_call_tool_dto" -require_relative "../../types/create_voicemail_tool_dto" -require_relative "../../types/create_function_tool_dto" -require_relative "../../types/create_ghl_tool_dto" -require_relative "../../types/create_make_tool_dto" -require_relative "../../types/create_transfer_call_tool_dto" - -module Vapi - class Blocks - # This is the tool that the block will call. To use an existing tool, use - # `toolId`. - class UpdateBlockDtoTool - # @return [Object] - attr_reader :member - # @return [String] - attr_reader :discriminant - - private_class_method :new - alias kind_of? is_a? - - # @param member [Object] - # @param discriminant [String] - # @return [Vapi::Blocks::UpdateBlockDtoTool] - def initialize(member:, discriminant:) - @member = member - @discriminant = discriminant - end - - # Deserialize a JSON object to an instance of UpdateBlockDtoTool - # - # @param json_object [String] - # @return [Vapi::Blocks::UpdateBlockDtoTool] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - member = case struct.type - when "dtmf" - Vapi::CreateDtmfToolDto.from_json(json_object: json_object) - when "endCall" - Vapi::CreateEndCallToolDto.from_json(json_object: json_object) - when "voicemail" - Vapi::CreateVoicemailToolDto.from_json(json_object: json_object) - when "function" - Vapi::CreateFunctionToolDto.from_json(json_object: json_object) - when "ghl" - Vapi::CreateGhlToolDto.from_json(json_object: json_object) - when "make" - Vapi::CreateMakeToolDto.from_json(json_object: json_object) - when "transferCall" - Vapi::CreateTransferCallToolDto.from_json(json_object: json_object) - else - Vapi::CreateDtmfToolDto.from_json(json_object: json_object) - end - new(member: member, discriminant: struct.type) - end - - # For Union Types, to_json functionality is delegated to the wrapped member. - # - # @return [String] - def to_json(*_args) - case @discriminant - when "dtmf" - { **@member.to_json, type: @discriminant }.to_json - when "endCall" - { **@member.to_json, type: @discriminant }.to_json - when "voicemail" - { **@member.to_json, type: @discriminant }.to_json - when "function" - { **@member.to_json, type: @discriminant }.to_json - when "ghl" - { **@member.to_json, type: @discriminant }.to_json - when "make" - { **@member.to_json, type: @discriminant }.to_json - when "transferCall" - { **@member.to_json, type: @discriminant }.to_json - else - { "type": @discriminant, value: @member }.to_json - end - @member.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - case obj.type - when "dtmf" - Vapi::CreateDtmfToolDto.validate_raw(obj: obj) - when "endCall" - Vapi::CreateEndCallToolDto.validate_raw(obj: obj) - when "voicemail" - Vapi::CreateVoicemailToolDto.validate_raw(obj: obj) - when "function" - Vapi::CreateFunctionToolDto.validate_raw(obj: obj) - when "ghl" - Vapi::CreateGhlToolDto.validate_raw(obj: obj) - when "make" - Vapi::CreateMakeToolDto.validate_raw(obj: obj) - when "transferCall" - Vapi::CreateTransferCallToolDto.validate_raw(obj: obj) - else - raise("Passed value matched no type within the union, validation failed.") - end - end - - # For Union Types, is_a? functionality is delegated to the wrapped member. - # - # @param obj [Object] - # @return [Boolean] - def is_a?(obj) - @member.is_a?(obj) - end - - # @param member [Vapi::CreateDtmfToolDto] - # @return [Vapi::Blocks::UpdateBlockDtoTool] - def self.dtmf(member:) - new(member: member, discriminant: "dtmf") - end - - # @param member [Vapi::CreateEndCallToolDto] - # @return [Vapi::Blocks::UpdateBlockDtoTool] - def self.end_call(member:) - new(member: member, discriminant: "endCall") - end - - # @param member [Vapi::CreateVoicemailToolDto] - # @return [Vapi::Blocks::UpdateBlockDtoTool] - def self.voicemail(member:) - new(member: member, discriminant: "voicemail") - end - - # @param member [Vapi::CreateFunctionToolDto] - # @return [Vapi::Blocks::UpdateBlockDtoTool] - def self.function(member:) - new(member: member, discriminant: "function") - end - - # @param member [Vapi::CreateGhlToolDto] - # @return [Vapi::Blocks::UpdateBlockDtoTool] - def self.ghl(member:) - new(member: member, discriminant: "ghl") - end - - # @param member [Vapi::CreateMakeToolDto] - # @return [Vapi::Blocks::UpdateBlockDtoTool] - def self.make(member:) - new(member: member, discriminant: "make") - end - - # @param member [Vapi::CreateTransferCallToolDto] - # @return [Vapi::Blocks::UpdateBlockDtoTool] - def self.transfer_call(member:) - new(member: member, discriminant: "transferCall") - end - end - end -end diff --git a/lib/vapi_server_sdk/calls/client.rb b/lib/vapi_server_sdk/calls/client.rb index bcbeb41..bf791a9 100644 --- a/lib/vapi_server_sdk/calls/client.rb +++ b/lib/vapi_server_sdk/calls/client.rb @@ -105,6 +105,7 @@ def list(id: nil, assistant_id: nil, phone_number_id: nil, limit: nil, created_a # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :name (String) # * :voicemail_detection (Hash) # * :provider (String) @@ -187,6 +188,7 @@ def list(id: nil, assistant_id: nil, phone_number_id: nil, limit: nil, created_a # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :variable_values (Hash{String => Object}) # * :name (String) # * :voicemail_detection (Hash) @@ -275,6 +277,7 @@ def list(id: nil, assistant_id: nil, phone_number_id: nil, limit: nil, created_a # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :variable_values (Hash{String => Object}) # * :name (String) # * :voicemail_detection (Hash) @@ -355,8 +358,11 @@ def list(id: nil, assistant_id: nil, phone_number_id: nil, limit: nil, created_a # * :name (String) # * :assistant_id (String) # * :squad_id (String) - # * :server_url (String) - # * :server_url_secret (String) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param customer_id [String] This is the customer that will be called. To call a transient customer , use # `customer` instead. # Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type. @@ -593,6 +599,7 @@ def list(id: nil, assistant_id: nil, phone_number_id: nil, limit: nil, created_a # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :name (String) # * :voicemail_detection (Hash) # * :provider (String) @@ -675,6 +682,7 @@ def list(id: nil, assistant_id: nil, phone_number_id: nil, limit: nil, created_a # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :variable_values (Hash{String => Object}) # * :name (String) # * :voicemail_detection (Hash) @@ -763,6 +771,7 @@ def list(id: nil, assistant_id: nil, phone_number_id: nil, limit: nil, created_a # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :variable_values (Hash{String => Object}) # * :name (String) # * :voicemail_detection (Hash) @@ -843,8 +852,11 @@ def list(id: nil, assistant_id: nil, phone_number_id: nil, limit: nil, created_a # * :name (String) # * :assistant_id (String) # * :squad_id (String) - # * :server_url (String) - # * :server_url_secret (String) + # * :server (Hash) + # * :timeout_seconds (Float) + # * :url (String) + # * :secret (String) + # * :headers (Hash{String => Object}) # @param customer_id [String] This is the customer that will be called. To call a transient customer , use # `customer` instead. # Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type. diff --git a/lib/vapi_server_sdk/knowledge_bases/client.rb b/lib/vapi_server_sdk/knowledge_bases/client.rb index 6741499..e51d3f6 100644 --- a/lib/vapi_server_sdk/knowledge_bases/client.rb +++ b/lib/vapi_server_sdk/knowledge_bases/client.rb @@ -8,6 +8,7 @@ require_relative "types/knowledge_bases_create_response" require_relative "types/knowledge_bases_get_response" require_relative "types/knowledge_bases_delete_response" +require_relative "types/knowledge_bases_update_request" require_relative "types/knowledge_bases_update_response" require "async" @@ -167,6 +168,7 @@ def delete(id:, request_options: nil) end # @param id [String] + # @param request [Vapi::KnowledgeBases::KnowledgeBasesUpdateRequest] # @param request_options [Vapi::RequestOptions] # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse] # @example @@ -176,7 +178,7 @@ def delete(id:, request_options: nil) # token: "YOUR_AUTH_TOKEN" # ) # api.knowledge_bases.update(id: "id") - def update(id:, request_options: nil) + def update(id:, request:, request_options: nil) response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.token unless request_options&.token.nil? @@ -188,9 +190,7 @@ def update(id:, request_options: nil) unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end - unless request_options.nil? || request_options&.additional_body_parameters.nil? - req.body = { **(request_options&.additional_body_parameters || {}) }.compact - end + req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base/#{id}" end Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse.from_json(json_object: response.body) @@ -360,6 +360,7 @@ def delete(id:, request_options: nil) end # @param id [String] + # @param request [Vapi::KnowledgeBases::KnowledgeBasesUpdateRequest] # @param request_options [Vapi::RequestOptions] # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse] # @example @@ -369,7 +370,7 @@ def delete(id:, request_options: nil) # token: "YOUR_AUTH_TOKEN" # ) # api.knowledge_bases.update(id: "id") - def update(id:, request_options: nil) + def update(id:, request:, request_options: nil) Async do response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? @@ -382,9 +383,7 @@ def update(id:, request_options: nil) unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end - unless request_options.nil? || request_options&.additional_body_parameters.nil? - req.body = { **(request_options&.additional_body_parameters || {}) }.compact - end + req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(request_options: request_options)}/knowledge-base/#{id}" end Vapi::KnowledgeBases::KnowledgeBasesUpdateResponse.from_json(json_object: response.body) diff --git a/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_request.rb b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_request.rb new file mode 100644 index 0000000..b0ddcb5 --- /dev/null +++ b/lib/vapi_server_sdk/knowledge_bases/types/knowledge_bases_update_request.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require "json" +require_relative "../../types/update_trieve_knowledge_base_dto" +require_relative "../../types/update_custom_knowledge_base_dto" + +module Vapi + class KnowledgeBases + class KnowledgeBasesUpdateRequest + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateRequest] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of KnowledgeBasesUpdateRequest + # + # @param json_object [String] + # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateRequest] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "trieve" + Vapi::UpdateTrieveKnowledgeBaseDto.from_json(json_object: json_object) + when "custom-knowledge-base" + Vapi::UpdateCustomKnowledgeBaseDto.from_json(json_object: json_object) + else + Vapi::UpdateTrieveKnowledgeBaseDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "trieve" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-knowledge-base" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "trieve" + Vapi::UpdateTrieveKnowledgeBaseDto.validate_raw(obj: obj) + when "custom-knowledge-base" + Vapi::UpdateCustomKnowledgeBaseDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::UpdateTrieveKnowledgeBaseDto] + # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateRequest] + def self.trieve(member:) + new(member: member, discriminant: "trieve") + end + + # @param member [Vapi::UpdateCustomKnowledgeBaseDto] + # @return [Vapi::KnowledgeBases::KnowledgeBasesUpdateRequest] + def self.custom_knowledge_base(member:) + new(member: member, discriminant: "custom-knowledge-base") + end + end + end +end diff --git a/lib/vapi_server_sdk/logs/client.rb b/lib/vapi_server_sdk/logs/client.rb index dca8343..7c64d28 100644 --- a/lib/vapi_server_sdk/logs/client.rb +++ b/lib/vapi_server_sdk/logs/client.rb @@ -89,6 +89,47 @@ def get(org_id: nil, type: nil, webhook_type: nil, assistant_id: nil, phone_numb end Vapi::LogsPaginatedResponse.from_json(json_object: response.body) end + + # @param org_id [String] This is the unique identifier for the org that this log belongs to. + # @param assistant_id [String] This is the ID of the assistant. + # @param phone_number_id [String] This is the ID of the phone number. + # @param customer_id [String] This is the ID of the customer. + # @param squad_id [String] This is the ID of the squad. + # @param call_id [String] This is the ID of the call. + # @param request_options [Vapi::RequestOptions] + # @return [Void] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.logs.logging_controller_logs_delete_query + def logging_controller_logs_delete_query(org_id: nil, assistant_id: nil, phone_number_id: nil, customer_id: nil, + squad_id: nil, call_id: nil, request_options: nil) + @request_client.conn.delete do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + req.params = { + **(request_options&.additional_query_parameters || {}), + "orgId": org_id, + "assistantId": assistant_id, + "phoneNumberId": phone_number_id, + "customerId": customer_id, + "squadId": squad_id, + "callId": call_id + }.compact + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end + req.url "#{@request_client.get_url(request_options: request_options)}/logs" + end + end end class AsyncLogsClient @@ -174,5 +215,48 @@ def get(org_id: nil, type: nil, webhook_type: nil, assistant_id: nil, phone_numb Vapi::LogsPaginatedResponse.from_json(json_object: response.body) end end + + # @param org_id [String] This is the unique identifier for the org that this log belongs to. + # @param assistant_id [String] This is the ID of the assistant. + # @param phone_number_id [String] This is the ID of the phone number. + # @param customer_id [String] This is the ID of the customer. + # @param squad_id [String] This is the ID of the squad. + # @param call_id [String] This is the ID of the call. + # @param request_options [Vapi::RequestOptions] + # @return [Void] + # @example + # api = Vapi::Client.new( + # base_url: "https://api.example.com", + # environment: Vapi::Environment::DEFAULT, + # token: "YOUR_AUTH_TOKEN" + # ) + # api.logs.logging_controller_logs_delete_query + def logging_controller_logs_delete_query(org_id: nil, assistant_id: nil, phone_number_id: nil, customer_id: nil, + squad_id: nil, call_id: nil, request_options: nil) + Async do + @request_client.conn.delete do |req| + req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? + req.headers["Authorization"] = request_options.token unless request_options&.token.nil? + req.headers = { + **(req.headers || {}), + **@request_client.get_headers, + **(request_options&.additional_headers || {}) + }.compact + req.params = { + **(request_options&.additional_query_parameters || {}), + "orgId": org_id, + "assistantId": assistant_id, + "phoneNumberId": phone_number_id, + "customerId": customer_id, + "squadId": squad_id, + "callId": call_id + }.compact + unless request_options.nil? || request_options&.additional_body_parameters.nil? + req.body = { **(request_options&.additional_body_parameters || {}) }.compact + end + req.url "#{@request_client.get_url(request_options: request_options)}/logs" + end + end + end end end diff --git a/lib/vapi_server_sdk/phone_numbers/client.rb b/lib/vapi_server_sdk/phone_numbers/client.rb index 91a862a..87a023d 100644 --- a/lib/vapi_server_sdk/phone_numbers/client.rb +++ b/lib/vapi_server_sdk/phone_numbers/client.rb @@ -8,7 +8,7 @@ require_relative "types/phone_numbers_create_response" require_relative "types/phone_numbers_get_response" require_relative "types/phone_numbers_delete_response" -require_relative "types/update_phone_number_dto_fallback_destination" +require_relative "types/phone_numbers_update_request" require_relative "types/phone_numbers_update_response" require "async" @@ -168,29 +168,7 @@ def delete(id:, request_options: nil) end # @param id [String] - # @param fallback_destination [Vapi::PhoneNumbers::UpdatePhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if: - # 1. `assistantId` is not set - # 2. `squadId` is not set - # 3. and, `assistant-request` message to the `serverUrl` fails - # If this is not set and above conditions are met, the inbound call is hung up - # with an error message. - # @param name [String] This is the name of the phone number. This is just for your own reference. - # @param assistant_id [String] This is the assistant that will be used for incoming calls to this phone number. - # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent - # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the - # shape of the message and response that is expected. - # @param squad_id [String] This is the squad that will be used for incoming calls to this phone number. - # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent - # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the - # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param request [Vapi::PhoneNumbers::PhoneNumbersUpdateRequest] # @param request_options [Vapi::RequestOptions] # @return [Vapi::PhoneNumbers::PhoneNumbersUpdateResponse] # @example @@ -200,8 +178,7 @@ def delete(id:, request_options: nil) # token: "YOUR_AUTH_TOKEN" # ) # api.phone_numbers.update(id: "id") - def update(id:, fallback_destination: nil, name: nil, assistant_id: nil, squad_id: nil, server_url: nil, - server_url_secret: nil, request_options: nil) + def update(id:, request:, request_options: nil) response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.token unless request_options&.token.nil? @@ -213,15 +190,7 @@ def update(id:, fallback_destination: nil, name: nil, assistant_id: nil, squad_i unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end - req.body = { - **(request_options&.additional_body_parameters || {}), - fallbackDestination: fallback_destination, - name: name, - assistantId: assistant_id, - squadId: squad_id, - serverUrl: server_url, - serverUrlSecret: server_url_secret - }.compact + req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(request_options: request_options)}/phone-number/#{id}" end Vapi::PhoneNumbers::PhoneNumbersUpdateResponse.from_json(json_object: response.body) @@ -391,29 +360,7 @@ def delete(id:, request_options: nil) end # @param id [String] - # @param fallback_destination [Vapi::PhoneNumbers::UpdatePhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if: - # 1. `assistantId` is not set - # 2. `squadId` is not set - # 3. and, `assistant-request` message to the `serverUrl` fails - # If this is not set and above conditions are met, the inbound call is hung up - # with an error message. - # @param name [String] This is the name of the phone number. This is just for your own reference. - # @param assistant_id [String] This is the assistant that will be used for incoming calls to this phone number. - # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent - # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the - # shape of the message and response that is expected. - # @param squad_id [String] This is the squad that will be used for incoming calls to this phone number. - # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent - # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the - # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param request [Vapi::PhoneNumbers::PhoneNumbersUpdateRequest] # @param request_options [Vapi::RequestOptions] # @return [Vapi::PhoneNumbers::PhoneNumbersUpdateResponse] # @example @@ -423,8 +370,7 @@ def delete(id:, request_options: nil) # token: "YOUR_AUTH_TOKEN" # ) # api.phone_numbers.update(id: "id") - def update(id:, fallback_destination: nil, name: nil, assistant_id: nil, squad_id: nil, server_url: nil, - server_url_secret: nil, request_options: nil) + def update(id:, request:, request_options: nil) Async do response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? @@ -437,15 +383,7 @@ def update(id:, fallback_destination: nil, name: nil, assistant_id: nil, squad_i unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end - req.body = { - **(request_options&.additional_body_parameters || {}), - fallbackDestination: fallback_destination, - name: name, - assistantId: assistant_id, - squadId: squad_id, - serverUrl: server_url, - serverUrlSecret: server_url_secret - }.compact + req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(request_options: request_options)}/phone-number/#{id}" end Vapi::PhoneNumbers::PhoneNumbersUpdateResponse.from_json(json_object: response.body) diff --git a/lib/vapi_server_sdk/phone_numbers/types/phone_numbers_update_request.rb b/lib/vapi_server_sdk/phone_numbers/types/phone_numbers_update_request.rb new file mode 100644 index 0000000..b13b6ae --- /dev/null +++ b/lib/vapi_server_sdk/phone_numbers/types/phone_numbers_update_request.rb @@ -0,0 +1,122 @@ +# frozen_string_literal: true + +require "json" +require_relative "../../types/update_byo_phone_number_dto" +require_relative "../../types/update_twilio_phone_number_dto" +require_relative "../../types/update_vonage_phone_number_dto" +require_relative "../../types/update_vapi_phone_number_dto" + +module Vapi + class PhoneNumbers + class PhoneNumbersUpdateRequest + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::PhoneNumbers::PhoneNumbersUpdateRequest] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of PhoneNumbersUpdateRequest + # + # @param json_object [String] + # @return [Vapi::PhoneNumbers::PhoneNumbersUpdateRequest] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "byo-phone-number" + Vapi::UpdateByoPhoneNumberDto.from_json(json_object: json_object) + when "twilio" + Vapi::UpdateTwilioPhoneNumberDto.from_json(json_object: json_object) + when "vonage" + Vapi::UpdateVonagePhoneNumberDto.from_json(json_object: json_object) + when "vapi" + Vapi::UpdateVapiPhoneNumberDto.from_json(json_object: json_object) + else + Vapi::UpdateByoPhoneNumberDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "byo-phone-number" + { **@member.to_json, provider: @discriminant }.to_json + when "twilio" + { **@member.to_json, provider: @discriminant }.to_json + when "vonage" + { **@member.to_json, provider: @discriminant }.to_json + when "vapi" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "byo-phone-number" + Vapi::UpdateByoPhoneNumberDto.validate_raw(obj: obj) + when "twilio" + Vapi::UpdateTwilioPhoneNumberDto.validate_raw(obj: obj) + when "vonage" + Vapi::UpdateVonagePhoneNumberDto.validate_raw(obj: obj) + when "vapi" + Vapi::UpdateVapiPhoneNumberDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::UpdateByoPhoneNumberDto] + # @return [Vapi::PhoneNumbers::PhoneNumbersUpdateRequest] + def self.byo_phone_number(member:) + new(member: member, discriminant: "byo-phone-number") + end + + # @param member [Vapi::UpdateTwilioPhoneNumberDto] + # @return [Vapi::PhoneNumbers::PhoneNumbersUpdateRequest] + def self.twilio(member:) + new(member: member, discriminant: "twilio") + end + + # @param member [Vapi::UpdateVonagePhoneNumberDto] + # @return [Vapi::PhoneNumbers::PhoneNumbersUpdateRequest] + def self.vonage(member:) + new(member: member, discriminant: "vonage") + end + + # @param member [Vapi::UpdateVapiPhoneNumberDto] + # @return [Vapi::PhoneNumbers::PhoneNumbersUpdateRequest] + def self.vapi(member:) + new(member: member, discriminant: "vapi") + end + end + end +end diff --git a/lib/vapi_server_sdk/phone_numbers/types/update_phone_number_dto_fallback_destination.rb b/lib/vapi_server_sdk/phone_numbers/types/update_phone_number_dto_fallback_destination.rb deleted file mode 100644 index 5187287..0000000 --- a/lib/vapi_server_sdk/phone_numbers/types/update_phone_number_dto_fallback_destination.rb +++ /dev/null @@ -1,103 +0,0 @@ -# frozen_string_literal: true - -require "json" -require_relative "../../types/transfer_destination_number" -require_relative "../../types/transfer_destination_sip" - -module Vapi - class PhoneNumbers - # This is the fallback destination an inbound call will be transferred to if: - # 1. `assistantId` is not set - # 2. `squadId` is not set - # 3. and, `assistant-request` message to the `serverUrl` fails - # If this is not set and above conditions are met, the inbound call is hung up - # with an error message. - class UpdatePhoneNumberDtoFallbackDestination - # @return [Object] - attr_reader :member - # @return [String] - attr_reader :discriminant - - private_class_method :new - alias kind_of? is_a? - - # @param member [Object] - # @param discriminant [String] - # @return [Vapi::PhoneNumbers::UpdatePhoneNumberDtoFallbackDestination] - def initialize(member:, discriminant:) - @member = member - @discriminant = discriminant - end - - # Deserialize a JSON object to an instance of - # UpdatePhoneNumberDtoFallbackDestination - # - # @param json_object [String] - # @return [Vapi::PhoneNumbers::UpdatePhoneNumberDtoFallbackDestination] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - member = case struct.type - when "number" - Vapi::TransferDestinationNumber.from_json(json_object: json_object) - when "sip" - Vapi::TransferDestinationSip.from_json(json_object: json_object) - else - Vapi::TransferDestinationNumber.from_json(json_object: json_object) - end - new(member: member, discriminant: struct.type) - end - - # For Union Types, to_json functionality is delegated to the wrapped member. - # - # @return [String] - def to_json(*_args) - case @discriminant - when "number" - { **@member.to_json, type: @discriminant }.to_json - when "sip" - { **@member.to_json, type: @discriminant }.to_json - else - { "type": @discriminant, value: @member }.to_json - end - @member.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - case obj.type - when "number" - Vapi::TransferDestinationNumber.validate_raw(obj: obj) - when "sip" - Vapi::TransferDestinationSip.validate_raw(obj: obj) - else - raise("Passed value matched no type within the union, validation failed.") - end - end - - # For Union Types, is_a? functionality is delegated to the wrapped member. - # - # @param obj [Object] - # @return [Boolean] - def is_a?(obj) - @member.is_a?(obj) - end - - # @param member [Vapi::TransferDestinationNumber] - # @return [Vapi::PhoneNumbers::UpdatePhoneNumberDtoFallbackDestination] - def self.number(member:) - new(member: member, discriminant: "number") - end - - # @param member [Vapi::TransferDestinationSip] - # @return [Vapi::PhoneNumbers::UpdatePhoneNumberDtoFallbackDestination] - def self.sip(member:) - new(member: member, discriminant: "sip") - end - end - end -end diff --git a/lib/vapi_server_sdk/squads/client.rb b/lib/vapi_server_sdk/squads/client.rb index dfd0b6a..26bf799 100644 --- a/lib/vapi_server_sdk/squads/client.rb +++ b/lib/vapi_server_sdk/squads/client.rb @@ -94,6 +94,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :variable_values (Hash{String => Object}) # * :name (String) # * :voicemail_detection (Hash) @@ -268,6 +269,7 @@ def delete(id:, request_options: nil) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :name (String) # * :voicemail_detection (Hash) # * :provider (String) @@ -349,6 +351,7 @@ def delete(id:, request_options: nil) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :variable_values (Hash{String => Object}) # * :name (String) # * :voicemail_detection (Hash) @@ -436,6 +439,7 @@ def delete(id:, request_options: nil) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :variable_values (Hash{String => Object}) # * :name (String) # * :voicemail_detection (Hash) @@ -622,6 +626,7 @@ def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :variable_values (Hash{String => Object}) # * :name (String) # * :voicemail_detection (Hash) @@ -802,6 +807,7 @@ def delete(id:, request_options: nil) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :name (String) # * :voicemail_detection (Hash) # * :provider (String) @@ -883,6 +889,7 @@ def delete(id:, request_options: nil) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :variable_values (Hash{String => Object}) # * :name (String) # * :voicemail_detection (Hash) @@ -970,6 +977,7 @@ def delete(id:, request_options: nil) # * :background_denoising_enabled (Boolean) # * :model_output_in_messages_enabled (Boolean) # * :transport_configurations (Array) + # * :credentials (Array) # * :variable_values (Hash{String => Object}) # * :name (String) # * :voicemail_detection (Hash) diff --git a/lib/vapi_server_sdk/tools/client.rb b/lib/vapi_server_sdk/tools/client.rb index f17ea2a..6ff0363 100644 --- a/lib/vapi_server_sdk/tools/client.rb +++ b/lib/vapi_server_sdk/tools/client.rb @@ -8,9 +8,7 @@ require_relative "types/tools_create_response" require_relative "types/tools_get_response" require_relative "types/tools_delete_response" -require_relative "types/update_tool_dto_messages_item" -require_relative "../types/open_ai_function" -require_relative "../types/server" +require_relative "types/tools_update_request" require_relative "types/tools_update_response" require "async" @@ -170,42 +168,7 @@ def delete(id:, request_options: nil) end # @param id [String] - # @param async [Boolean] This determines if the tool is async. - # If async, the assistant will move forward without waiting for your server to - # respond. This is useful if you just want to trigger something on your server. - # If sync, the assistant will wait for your server to respond. This is useful if - # want assistant to respond with the result from your server. - # Defaults to synchronous (`false`). - # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. - # For some tools, this is auto-filled based on special fields like - # `tool.destinations`. For others like the function tool, these can be custom - # configured.Request of type Array, as a Hash - # @param function [Hash] This is the function definition of the tool. - # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on - # tool-specific fields like `tool.destinations`. But, even in those cases, you can - # provide a custom function definition for advanced use cases. - # An example of an advanced use case is if you want to customize the message - # that's spoken for `endCall` tool. You can specify a function where it returns an - # argument "reason". Then, in `messages` array, you can have many - # "request-complete" messages. One of these messages will be triggered if the - # `messages[].conditions` matches the "reason" argument.Request of type Vapi::OpenAiFunction, as a Hash - # * :strict (Boolean) - # * :name (String) - # * :description (String) - # * :parameters (Hash) - # * :type (String) - # * :properties (Hash{String => Vapi::JsonSchema}) - # * :required (Array) - # @param server [Hash] This is the server that will be hit when this tool is requested by the model. - # All requests will be sent with the call object among other things. You can find - # more details in the Server URL documentation. - # This overrides the serverUrl set on the org and the phoneNumber. Order of - # precedence: highest tool.server.url, then assistant.serverUrl, then - # phoneNumber.serverUrl, then org.serverUrl.Request of type Vapi::Server, as a Hash - # * :timeout_seconds (Float) - # * :url (String) - # * :secret (String) - # * :headers (Hash{String => Object}) + # @param request [Vapi::Tools::ToolsUpdateRequest] # @param request_options [Vapi::RequestOptions] # @return [Vapi::Tools::ToolsUpdateResponse] # @example @@ -215,7 +178,7 @@ def delete(id:, request_options: nil) # token: "YOUR_AUTH_TOKEN" # ) # api.tools.update(id: "id") - def update(id:, async: nil, messages: nil, function: nil, server: nil, request_options: nil) + def update(id:, request:, request_options: nil) response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.token unless request_options&.token.nil? @@ -227,13 +190,7 @@ def update(id:, async: nil, messages: nil, function: nil, server: nil, request_o unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end - req.body = { - **(request_options&.additional_body_parameters || {}), - async: async, - messages: messages, - function: function, - server: server - }.compact + req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(request_options: request_options)}/tool/#{id}" end Vapi::Tools::ToolsUpdateResponse.from_json(json_object: response.body) @@ -403,42 +360,7 @@ def delete(id:, request_options: nil) end # @param id [String] - # @param async [Boolean] This determines if the tool is async. - # If async, the assistant will move forward without waiting for your server to - # respond. This is useful if you just want to trigger something on your server. - # If sync, the assistant will wait for your server to respond. This is useful if - # want assistant to respond with the result from your server. - # Defaults to synchronous (`false`). - # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. - # For some tools, this is auto-filled based on special fields like - # `tool.destinations`. For others like the function tool, these can be custom - # configured.Request of type Array, as a Hash - # @param function [Hash] This is the function definition of the tool. - # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on - # tool-specific fields like `tool.destinations`. But, even in those cases, you can - # provide a custom function definition for advanced use cases. - # An example of an advanced use case is if you want to customize the message - # that's spoken for `endCall` tool. You can specify a function where it returns an - # argument "reason". Then, in `messages` array, you can have many - # "request-complete" messages. One of these messages will be triggered if the - # `messages[].conditions` matches the "reason" argument.Request of type Vapi::OpenAiFunction, as a Hash - # * :strict (Boolean) - # * :name (String) - # * :description (String) - # * :parameters (Hash) - # * :type (String) - # * :properties (Hash{String => Vapi::JsonSchema}) - # * :required (Array) - # @param server [Hash] This is the server that will be hit when this tool is requested by the model. - # All requests will be sent with the call object among other things. You can find - # more details in the Server URL documentation. - # This overrides the serverUrl set on the org and the phoneNumber. Order of - # precedence: highest tool.server.url, then assistant.serverUrl, then - # phoneNumber.serverUrl, then org.serverUrl.Request of type Vapi::Server, as a Hash - # * :timeout_seconds (Float) - # * :url (String) - # * :secret (String) - # * :headers (Hash{String => Object}) + # @param request [Vapi::Tools::ToolsUpdateRequest] # @param request_options [Vapi::RequestOptions] # @return [Vapi::Tools::ToolsUpdateResponse] # @example @@ -448,7 +370,7 @@ def delete(id:, request_options: nil) # token: "YOUR_AUTH_TOKEN" # ) # api.tools.update(id: "id") - def update(id:, async: nil, messages: nil, function: nil, server: nil, request_options: nil) + def update(id:, request:, request_options: nil) Async do response = @request_client.conn.patch do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? @@ -461,13 +383,7 @@ def update(id:, async: nil, messages: nil, function: nil, server: nil, request_o unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end - req.body = { - **(request_options&.additional_body_parameters || {}), - async: async, - messages: messages, - function: function, - server: server - }.compact + req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(request_options: request_options)}/tool/#{id}" end Vapi::Tools::ToolsUpdateResponse.from_json(json_object: response.body) diff --git a/lib/vapi_server_sdk/tools/types/tools_update_request.rb b/lib/vapi_server_sdk/tools/types/tools_update_request.rb new file mode 100644 index 0000000..3e1321b --- /dev/null +++ b/lib/vapi_server_sdk/tools/types/tools_update_request.rb @@ -0,0 +1,200 @@ +# frozen_string_literal: true + +require "json" +require_relative "../../types/update_dtmf_tool_dto" +require_relative "../../types/update_end_call_tool_dto" +require_relative "../../types/update_function_tool_dto" +require_relative "../../types/update_ghl_tool_dto" +require_relative "../../types/update_make_tool_dto" +require_relative "../../types/update_transfer_call_tool_dto" +require_relative "../../types/update_output_tool_dto" +require_relative "../../types/update_bash_tool_dto" +require_relative "../../types/update_computer_tool_dto" +require_relative "../../types/update_text_editor_tool_dto" + +module Vapi + class Tools + class ToolsUpdateRequest + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::Tools::ToolsUpdateRequest] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of ToolsUpdateRequest + # + # @param json_object [String] + # @return [Vapi::Tools::ToolsUpdateRequest] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "dtmf" + Vapi::UpdateDtmfToolDto.from_json(json_object: json_object) + when "endCall" + Vapi::UpdateEndCallToolDto.from_json(json_object: json_object) + when "function" + Vapi::UpdateFunctionToolDto.from_json(json_object: json_object) + when "ghl" + Vapi::UpdateGhlToolDto.from_json(json_object: json_object) + when "make" + Vapi::UpdateMakeToolDto.from_json(json_object: json_object) + when "transferCall" + Vapi::UpdateTransferCallToolDto.from_json(json_object: json_object) + when "output" + Vapi::UpdateOutputToolDto.from_json(json_object: json_object) + when "bash" + Vapi::UpdateBashToolDto.from_json(json_object: json_object) + when "computer" + Vapi::UpdateComputerToolDto.from_json(json_object: json_object) + when "textEditor" + Vapi::UpdateTextEditorToolDto.from_json(json_object: json_object) + else + Vapi::UpdateDtmfToolDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "dtmf" + { **@member.to_json, type: @discriminant }.to_json + when "endCall" + { **@member.to_json, type: @discriminant }.to_json + when "function" + { **@member.to_json, type: @discriminant }.to_json + when "ghl" + { **@member.to_json, type: @discriminant }.to_json + when "make" + { **@member.to_json, type: @discriminant }.to_json + when "transferCall" + { **@member.to_json, type: @discriminant }.to_json + when "output" + { **@member.to_json, type: @discriminant }.to_json + when "bash" + { **@member.to_json, type: @discriminant }.to_json + when "computer" + { **@member.to_json, type: @discriminant }.to_json + when "textEditor" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "dtmf" + Vapi::UpdateDtmfToolDto.validate_raw(obj: obj) + when "endCall" + Vapi::UpdateEndCallToolDto.validate_raw(obj: obj) + when "function" + Vapi::UpdateFunctionToolDto.validate_raw(obj: obj) + when "ghl" + Vapi::UpdateGhlToolDto.validate_raw(obj: obj) + when "make" + Vapi::UpdateMakeToolDto.validate_raw(obj: obj) + when "transferCall" + Vapi::UpdateTransferCallToolDto.validate_raw(obj: obj) + when "output" + Vapi::UpdateOutputToolDto.validate_raw(obj: obj) + when "bash" + Vapi::UpdateBashToolDto.validate_raw(obj: obj) + when "computer" + Vapi::UpdateComputerToolDto.validate_raw(obj: obj) + when "textEditor" + Vapi::UpdateTextEditorToolDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::UpdateDtmfToolDto] + # @return [Vapi::Tools::ToolsUpdateRequest] + def self.dtmf(member:) + new(member: member, discriminant: "dtmf") + end + + # @param member [Vapi::UpdateEndCallToolDto] + # @return [Vapi::Tools::ToolsUpdateRequest] + def self.end_call(member:) + new(member: member, discriminant: "endCall") + end + + # @param member [Vapi::UpdateFunctionToolDto] + # @return [Vapi::Tools::ToolsUpdateRequest] + def self.function(member:) + new(member: member, discriminant: "function") + end + + # @param member [Vapi::UpdateGhlToolDto] + # @return [Vapi::Tools::ToolsUpdateRequest] + def self.ghl(member:) + new(member: member, discriminant: "ghl") + end + + # @param member [Vapi::UpdateMakeToolDto] + # @return [Vapi::Tools::ToolsUpdateRequest] + def self.make(member:) + new(member: member, discriminant: "make") + end + + # @param member [Vapi::UpdateTransferCallToolDto] + # @return [Vapi::Tools::ToolsUpdateRequest] + def self.transfer_call(member:) + new(member: member, discriminant: "transferCall") + end + + # @param member [Vapi::UpdateOutputToolDto] + # @return [Vapi::Tools::ToolsUpdateRequest] + def self.output(member:) + new(member: member, discriminant: "output") + end + + # @param member [Vapi::UpdateBashToolDto] + # @return [Vapi::Tools::ToolsUpdateRequest] + def self.bash(member:) + new(member: member, discriminant: "bash") + end + + # @param member [Vapi::UpdateComputerToolDto] + # @return [Vapi::Tools::ToolsUpdateRequest] + def self.computer(member:) + new(member: member, discriminant: "computer") + end + + # @param member [Vapi::UpdateTextEditorToolDto] + # @return [Vapi::Tools::ToolsUpdateRequest] + def self.text_editor(member:) + new(member: member, discriminant: "textEditor") + end + end + end +end diff --git a/lib/vapi_server_sdk/tools/types/update_tool_dto_messages_item.rb b/lib/vapi_server_sdk/tools/types/update_tool_dto_messages_item.rb deleted file mode 100644 index 7581031..0000000 --- a/lib/vapi_server_sdk/tools/types/update_tool_dto_messages_item.rb +++ /dev/null @@ -1,122 +0,0 @@ -# frozen_string_literal: true - -require "json" -require_relative "../../types/tool_message_start" -require_relative "../../types/tool_message_complete" -require_relative "../../types/tool_message_failed" -require_relative "../../types/tool_message_delayed" - -module Vapi - class Tools - class UpdateToolDtoMessagesItem - # @return [Object] - attr_reader :member - # @return [String] - attr_reader :discriminant - - private_class_method :new - alias kind_of? is_a? - - # @param member [Object] - # @param discriminant [String] - # @return [Vapi::Tools::UpdateToolDtoMessagesItem] - def initialize(member:, discriminant:) - @member = member - @discriminant = discriminant - end - - # Deserialize a JSON object to an instance of UpdateToolDtoMessagesItem - # - # @param json_object [String] - # @return [Vapi::Tools::UpdateToolDtoMessagesItem] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - member = case struct.type - when "request-start" - Vapi::ToolMessageStart.from_json(json_object: json_object) - when "request-complete" - Vapi::ToolMessageComplete.from_json(json_object: json_object) - when "request-failed" - Vapi::ToolMessageFailed.from_json(json_object: json_object) - when "request-response-delayed" - Vapi::ToolMessageDelayed.from_json(json_object: json_object) - else - Vapi::ToolMessageStart.from_json(json_object: json_object) - end - new(member: member, discriminant: struct.type) - end - - # For Union Types, to_json functionality is delegated to the wrapped member. - # - # @return [String] - def to_json(*_args) - case @discriminant - when "request-start" - { **@member.to_json, type: @discriminant }.to_json - when "request-complete" - { **@member.to_json, type: @discriminant }.to_json - when "request-failed" - { **@member.to_json, type: @discriminant }.to_json - when "request-response-delayed" - { **@member.to_json, type: @discriminant }.to_json - else - { "type": @discriminant, value: @member }.to_json - end - @member.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - case obj.type - when "request-start" - Vapi::ToolMessageStart.validate_raw(obj: obj) - when "request-complete" - Vapi::ToolMessageComplete.validate_raw(obj: obj) - when "request-failed" - Vapi::ToolMessageFailed.validate_raw(obj: obj) - when "request-response-delayed" - Vapi::ToolMessageDelayed.validate_raw(obj: obj) - else - raise("Passed value matched no type within the union, validation failed.") - end - end - - # For Union Types, is_a? functionality is delegated to the wrapped member. - # - # @param obj [Object] - # @return [Boolean] - def is_a?(obj) - @member.is_a?(obj) - end - - # @param member [Vapi::ToolMessageStart] - # @return [Vapi::Tools::UpdateToolDtoMessagesItem] - def self.request_start(member:) - new(member: member, discriminant: "request-start") - end - - # @param member [Vapi::ToolMessageComplete] - # @return [Vapi::Tools::UpdateToolDtoMessagesItem] - def self.request_complete(member:) - new(member: member, discriminant: "request-complete") - end - - # @param member [Vapi::ToolMessageFailed] - # @return [Vapi::Tools::UpdateToolDtoMessagesItem] - def self.request_failed(member:) - new(member: member, discriminant: "request-failed") - end - - # @param member [Vapi::ToolMessageDelayed] - # @return [Vapi::Tools::UpdateToolDtoMessagesItem] - def self.request_response_delayed(member:) - new(member: member, discriminant: "request-response-delayed") - end - end - end -end diff --git a/lib/vapi_server_sdk/types/assistant.rb b/lib/vapi_server_sdk/types/assistant.rb index ff25823..ee0dfa2 100644 --- a/lib/vapi_server_sdk/types/assistant.rb +++ b/lib/vapi_server_sdk/types/assistant.rb @@ -8,6 +8,7 @@ require_relative "assistant_server_messages_item" require_relative "assistant_background_sound" require_relative "transport_configuration_twilio" +require_relative "assistant_credentials_item" require_relative "twilio_voicemail_detection" require_relative "analysis_plan" require_relative "artifact_plan" @@ -80,6 +81,11 @@ class Assistant # different transport providers. For a call, only the configuration matching the # call transport provider is used. attr_reader :transport_configurations + # @return [Array] These are dynamic credentials that will be used for the assistant calls. By + # default, all the credentials are available for use in the call but you can + # supplement an additional credentials using this. Dynamic credentials override + # existing credentials. + attr_reader :credentials # @return [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. attr_reader :name @@ -215,6 +221,10 @@ class Assistant # assistant's calls, like Twilio. You can store multiple configurations for # different transport providers. For a call, only the configuration matching the # call transport provider is used. + # @param credentials [Array] These are dynamic credentials that will be used for the assistant calls. By + # default, all the credentials are available for use in the call but you can + # supplement an additional credentials using this. Dynamic credentials override + # existing credentials. # @param name [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. # @param voicemail_detection [Vapi::TwilioVoicemailDetection] These are the settings to configure or disable voicemail detection. @@ -283,7 +293,7 @@ class Assistant # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::Assistant] def initialize(id:, org_id:, created_at:, updated_at:, transcriber: OMIT, model: OMIT, voice: OMIT, first_message: OMIT, first_message_mode: OMIT, - hipaa_enabled: OMIT, client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, name: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, server: OMIT, additional_properties: nil) + hipaa_enabled: OMIT, client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, credentials: OMIT, name: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, server: OMIT, additional_properties: nil) @transcriber = transcriber if transcriber != OMIT @model = model if model != OMIT @voice = voice if voice != OMIT @@ -298,6 +308,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, transcriber: OMIT, model: @background_denoising_enabled = background_denoising_enabled if background_denoising_enabled != OMIT @model_output_in_messages_enabled = model_output_in_messages_enabled if model_output_in_messages_enabled != OMIT @transport_configurations = transport_configurations if transport_configurations != OMIT + @credentials = credentials if credentials != OMIT @name = name if name != OMIT @voicemail_detection = voicemail_detection if voicemail_detection != OMIT @voicemail_message = voicemail_message if voicemail_message != OMIT @@ -332,6 +343,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, transcriber: OMIT, model: "backgroundDenoisingEnabled": background_denoising_enabled, "modelOutputInMessagesEnabled": model_output_in_messages_enabled, "transportConfigurations": transport_configurations, + "credentials": credentials, "name": name, "voicemailDetection": voicemail_detection, "voicemailMessage": voicemail_message, @@ -394,6 +406,10 @@ def self.from_json(json_object:) item = item.to_json Vapi::TransportConfigurationTwilio.from_json(json_object: item) end + credentials = parsed_json["credentials"]&.map do |item| + item = item.to_json + Vapi::AssistantCredentialsItem.from_json(json_object: item) + end name = parsed_json["name"] if parsed_json["voicemailDetection"].nil? voicemail_detection = nil @@ -467,6 +483,7 @@ def self.from_json(json_object:) background_denoising_enabled: background_denoising_enabled, model_output_in_messages_enabled: model_output_in_messages_enabled, transport_configurations: transport_configurations, + credentials: credentials, name: name, voicemail_detection: voicemail_detection, voicemail_message: voicemail_message, @@ -517,6 +534,7 @@ def self.validate_raw(obj:) obj.background_denoising_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.background_denoising_enabled is not the expected type, validation failed.") obj.model_output_in_messages_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.model_output_in_messages_enabled is not the expected type, validation failed.") obj.transport_configurations&.is_a?(Array) != false || raise("Passed value for field obj.transport_configurations is not the expected type, validation failed.") + obj.credentials&.is_a?(Array) != false || raise("Passed value for field obj.credentials is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.voicemail_detection.nil? || Vapi::TwilioVoicemailDetection.validate_raw(obj: obj.voicemail_detection) obj.voicemail_message&.is_a?(String) != false || raise("Passed value for field obj.voicemail_message is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/assistant_credentials_item.rb b/lib/vapi_server_sdk/types/assistant_credentials_item.rb new file mode 100644 index 0000000..89446d1 --- /dev/null +++ b/lib/vapi_server_sdk/types/assistant_credentials_item.rb @@ -0,0 +1,510 @@ +# frozen_string_literal: true + +require "json" +require_relative "create_anthropic_credential_dto" +require_relative "create_anyscale_credential_dto" +require_relative "create_assembly_ai_credential_dto" +require_relative "create_azure_open_ai_credential_dto" +require_relative "create_azure_credential_dto" +require_relative "create_byo_sip_trunk_credential_dto" +require_relative "create_cartesia_credential_dto" +require_relative "create_cloudflare_credential_dto" +require_relative "create_custom_llm_credential_dto" +require_relative "create_deepgram_credential_dto" +require_relative "create_deep_infra_credential_dto" +require_relative "create_deep_seek_credential_dto" +require_relative "create_eleven_labs_credential_dto" +require_relative "create_gcp_credential_dto" +require_relative "create_gladia_credential_dto" +require_relative "create_go_high_level_credential_dto" +require_relative "create_groq_credential_dto" +require_relative "create_langfuse_credential_dto" +require_relative "create_lmnt_credential_dto" +require_relative "create_make_credential_dto" +require_relative "create_open_ai_credential_dto" +require_relative "create_open_router_credential_dto" +require_relative "create_perplexity_ai_credential_dto" +require_relative "create_play_ht_credential_dto" +require_relative "create_rime_ai_credential_dto" +require_relative "create_runpod_credential_dto" +require_relative "create_s_3_credential_dto" +require_relative "create_smallest_ai_credential_dto" +require_relative "create_tavus_credential_dto" +require_relative "create_together_ai_credential_dto" +require_relative "create_twilio_credential_dto" +require_relative "create_vonage_credential_dto" +require_relative "create_webhook_credential_dto" +require_relative "create_x_ai_credential_dto" + +module Vapi + class AssistantCredentialsItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::AssistantCredentialsItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of AssistantCredentialsItem + # + # @param json_object [String] + # @return [Vapi::AssistantCredentialsItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "anthropic" + Vapi::CreateAnthropicCredentialDto.from_json(json_object: json_object) + when "anyscale" + Vapi::CreateAnyscaleCredentialDto.from_json(json_object: json_object) + when "assembly-ai" + Vapi::CreateAssemblyAiCredentialDto.from_json(json_object: json_object) + when "azure-openai" + Vapi::CreateAzureOpenAiCredentialDto.from_json(json_object: json_object) + when "azure" + Vapi::CreateAzureCredentialDto.from_json(json_object: json_object) + when "byo-sip-trunk" + Vapi::CreateByoSipTrunkCredentialDto.from_json(json_object: json_object) + when "cartesia" + Vapi::CreateCartesiaCredentialDto.from_json(json_object: json_object) + when "cloudflare" + Vapi::CreateCloudflareCredentialDto.from_json(json_object: json_object) + when "custom-llm" + Vapi::CreateCustomLlmCredentialDto.from_json(json_object: json_object) + when "deepgram" + Vapi::CreateDeepgramCredentialDto.from_json(json_object: json_object) + when "deepinfra" + Vapi::CreateDeepInfraCredentialDto.from_json(json_object: json_object) + when "deep-seek" + Vapi::CreateDeepSeekCredentialDto.from_json(json_object: json_object) + when "11labs" + Vapi::CreateElevenLabsCredentialDto.from_json(json_object: json_object) + when "gcp" + Vapi::CreateGcpCredentialDto.from_json(json_object: json_object) + when "gladia" + Vapi::CreateGladiaCredentialDto.from_json(json_object: json_object) + when "gohighlevel" + Vapi::CreateGoHighLevelCredentialDto.from_json(json_object: json_object) + when "groq" + Vapi::CreateGroqCredentialDto.from_json(json_object: json_object) + when "langfuse" + Vapi::CreateLangfuseCredentialDto.from_json(json_object: json_object) + when "lmnt" + Vapi::CreateLmntCredentialDto.from_json(json_object: json_object) + when "make" + Vapi::CreateMakeCredentialDto.from_json(json_object: json_object) + when "openai" + Vapi::CreateOpenAiCredentialDto.from_json(json_object: json_object) + when "openrouter" + Vapi::CreateOpenRouterCredentialDto.from_json(json_object: json_object) + when "perplexity-ai" + Vapi::CreatePerplexityAiCredentialDto.from_json(json_object: json_object) + when "playht" + Vapi::CreatePlayHtCredentialDto.from_json(json_object: json_object) + when "rime-ai" + Vapi::CreateRimeAiCredentialDto.from_json(json_object: json_object) + when "runpod" + Vapi::CreateRunpodCredentialDto.from_json(json_object: json_object) + when "s3" + Vapi::CreateS3CredentialDto.from_json(json_object: json_object) + when "smallest-ai" + Vapi::CreateSmallestAiCredentialDto.from_json(json_object: json_object) + when "tavus" + Vapi::CreateTavusCredentialDto.from_json(json_object: json_object) + when "together-ai" + Vapi::CreateTogetherAiCredentialDto.from_json(json_object: json_object) + when "twilio" + Vapi::CreateTwilioCredentialDto.from_json(json_object: json_object) + when "vonage" + Vapi::CreateVonageCredentialDto.from_json(json_object: json_object) + when "webhook" + Vapi::CreateWebhookCredentialDto.from_json(json_object: json_object) + when "xai" + Vapi::CreateXAiCredentialDto.from_json(json_object: json_object) + else + Vapi::CreateAnthropicCredentialDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "anthropic" + { **@member.to_json, provider: @discriminant }.to_json + when "anyscale" + { **@member.to_json, provider: @discriminant }.to_json + when "assembly-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "azure-openai" + { **@member.to_json, provider: @discriminant }.to_json + when "azure" + { **@member.to_json, provider: @discriminant }.to_json + when "byo-sip-trunk" + { **@member.to_json, provider: @discriminant }.to_json + when "cartesia" + { **@member.to_json, provider: @discriminant }.to_json + when "cloudflare" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-llm" + { **@member.to_json, provider: @discriminant }.to_json + when "deepgram" + { **@member.to_json, provider: @discriminant }.to_json + when "deepinfra" + { **@member.to_json, provider: @discriminant }.to_json + when "deep-seek" + { **@member.to_json, provider: @discriminant }.to_json + when "11labs" + { **@member.to_json, provider: @discriminant }.to_json + when "gcp" + { **@member.to_json, provider: @discriminant }.to_json + when "gladia" + { **@member.to_json, provider: @discriminant }.to_json + when "gohighlevel" + { **@member.to_json, provider: @discriminant }.to_json + when "groq" + { **@member.to_json, provider: @discriminant }.to_json + when "langfuse" + { **@member.to_json, provider: @discriminant }.to_json + when "lmnt" + { **@member.to_json, provider: @discriminant }.to_json + when "make" + { **@member.to_json, provider: @discriminant }.to_json + when "openai" + { **@member.to_json, provider: @discriminant }.to_json + when "openrouter" + { **@member.to_json, provider: @discriminant }.to_json + when "perplexity-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "playht" + { **@member.to_json, provider: @discriminant }.to_json + when "rime-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "runpod" + { **@member.to_json, provider: @discriminant }.to_json + when "s3" + { **@member.to_json, provider: @discriminant }.to_json + when "smallest-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "tavus" + { **@member.to_json, provider: @discriminant }.to_json + when "together-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "twilio" + { **@member.to_json, provider: @discriminant }.to_json + when "vonage" + { **@member.to_json, provider: @discriminant }.to_json + when "webhook" + { **@member.to_json, provider: @discriminant }.to_json + when "xai" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "anthropic" + Vapi::CreateAnthropicCredentialDto.validate_raw(obj: obj) + when "anyscale" + Vapi::CreateAnyscaleCredentialDto.validate_raw(obj: obj) + when "assembly-ai" + Vapi::CreateAssemblyAiCredentialDto.validate_raw(obj: obj) + when "azure-openai" + Vapi::CreateAzureOpenAiCredentialDto.validate_raw(obj: obj) + when "azure" + Vapi::CreateAzureCredentialDto.validate_raw(obj: obj) + when "byo-sip-trunk" + Vapi::CreateByoSipTrunkCredentialDto.validate_raw(obj: obj) + when "cartesia" + Vapi::CreateCartesiaCredentialDto.validate_raw(obj: obj) + when "cloudflare" + Vapi::CreateCloudflareCredentialDto.validate_raw(obj: obj) + when "custom-llm" + Vapi::CreateCustomLlmCredentialDto.validate_raw(obj: obj) + when "deepgram" + Vapi::CreateDeepgramCredentialDto.validate_raw(obj: obj) + when "deepinfra" + Vapi::CreateDeepInfraCredentialDto.validate_raw(obj: obj) + when "deep-seek" + Vapi::CreateDeepSeekCredentialDto.validate_raw(obj: obj) + when "11labs" + Vapi::CreateElevenLabsCredentialDto.validate_raw(obj: obj) + when "gcp" + Vapi::CreateGcpCredentialDto.validate_raw(obj: obj) + when "gladia" + Vapi::CreateGladiaCredentialDto.validate_raw(obj: obj) + when "gohighlevel" + Vapi::CreateGoHighLevelCredentialDto.validate_raw(obj: obj) + when "groq" + Vapi::CreateGroqCredentialDto.validate_raw(obj: obj) + when "langfuse" + Vapi::CreateLangfuseCredentialDto.validate_raw(obj: obj) + when "lmnt" + Vapi::CreateLmntCredentialDto.validate_raw(obj: obj) + when "make" + Vapi::CreateMakeCredentialDto.validate_raw(obj: obj) + when "openai" + Vapi::CreateOpenAiCredentialDto.validate_raw(obj: obj) + when "openrouter" + Vapi::CreateOpenRouterCredentialDto.validate_raw(obj: obj) + when "perplexity-ai" + Vapi::CreatePerplexityAiCredentialDto.validate_raw(obj: obj) + when "playht" + Vapi::CreatePlayHtCredentialDto.validate_raw(obj: obj) + when "rime-ai" + Vapi::CreateRimeAiCredentialDto.validate_raw(obj: obj) + when "runpod" + Vapi::CreateRunpodCredentialDto.validate_raw(obj: obj) + when "s3" + Vapi::CreateS3CredentialDto.validate_raw(obj: obj) + when "smallest-ai" + Vapi::CreateSmallestAiCredentialDto.validate_raw(obj: obj) + when "tavus" + Vapi::CreateTavusCredentialDto.validate_raw(obj: obj) + when "together-ai" + Vapi::CreateTogetherAiCredentialDto.validate_raw(obj: obj) + when "twilio" + Vapi::CreateTwilioCredentialDto.validate_raw(obj: obj) + when "vonage" + Vapi::CreateVonageCredentialDto.validate_raw(obj: obj) + when "webhook" + Vapi::CreateWebhookCredentialDto.validate_raw(obj: obj) + when "xai" + Vapi::CreateXAiCredentialDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::CreateAnthropicCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.anthropic(member:) + new(member: member, discriminant: "anthropic") + end + + # @param member [Vapi::CreateAnyscaleCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.anyscale(member:) + new(member: member, discriminant: "anyscale") + end + + # @param member [Vapi::CreateAssemblyAiCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.assembly_ai(member:) + new(member: member, discriminant: "assembly-ai") + end + + # @param member [Vapi::CreateAzureOpenAiCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.azure_openai(member:) + new(member: member, discriminant: "azure-openai") + end + + # @param member [Vapi::CreateAzureCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.azure(member:) + new(member: member, discriminant: "azure") + end + + # @param member [Vapi::CreateByoSipTrunkCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.byo_sip_trunk(member:) + new(member: member, discriminant: "byo-sip-trunk") + end + + # @param member [Vapi::CreateCartesiaCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.cartesia(member:) + new(member: member, discriminant: "cartesia") + end + + # @param member [Vapi::CreateCloudflareCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.cloudflare(member:) + new(member: member, discriminant: "cloudflare") + end + + # @param member [Vapi::CreateCustomLlmCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.custom_llm(member:) + new(member: member, discriminant: "custom-llm") + end + + # @param member [Vapi::CreateDeepgramCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.deepgram(member:) + new(member: member, discriminant: "deepgram") + end + + # @param member [Vapi::CreateDeepInfraCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.deepinfra(member:) + new(member: member, discriminant: "deepinfra") + end + + # @param member [Vapi::CreateDeepSeekCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.deep_seek(member:) + new(member: member, discriminant: "deep-seek") + end + + # @param member [Vapi::CreateElevenLabsCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self._11_labs(member:) + new(member: member, discriminant: "11labs") + end + + # @param member [Vapi::CreateGcpCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.gcp(member:) + new(member: member, discriminant: "gcp") + end + + # @param member [Vapi::CreateGladiaCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.gladia(member:) + new(member: member, discriminant: "gladia") + end + + # @param member [Vapi::CreateGoHighLevelCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.gohighlevel(member:) + new(member: member, discriminant: "gohighlevel") + end + + # @param member [Vapi::CreateGroqCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.groq(member:) + new(member: member, discriminant: "groq") + end + + # @param member [Vapi::CreateLangfuseCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.langfuse(member:) + new(member: member, discriminant: "langfuse") + end + + # @param member [Vapi::CreateLmntCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.lmnt(member:) + new(member: member, discriminant: "lmnt") + end + + # @param member [Vapi::CreateMakeCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.make(member:) + new(member: member, discriminant: "make") + end + + # @param member [Vapi::CreateOpenAiCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.openai(member:) + new(member: member, discriminant: "openai") + end + + # @param member [Vapi::CreateOpenRouterCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.openrouter(member:) + new(member: member, discriminant: "openrouter") + end + + # @param member [Vapi::CreatePerplexityAiCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.perplexity_ai(member:) + new(member: member, discriminant: "perplexity-ai") + end + + # @param member [Vapi::CreatePlayHtCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.playht(member:) + new(member: member, discriminant: "playht") + end + + # @param member [Vapi::CreateRimeAiCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.rime_ai(member:) + new(member: member, discriminant: "rime-ai") + end + + # @param member [Vapi::CreateRunpodCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.runpod(member:) + new(member: member, discriminant: "runpod") + end + + # @param member [Vapi::CreateS3CredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.s_3(member:) + new(member: member, discriminant: "s3") + end + + # @param member [Vapi::CreateSmallestAiCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.smallest_ai(member:) + new(member: member, discriminant: "smallest-ai") + end + + # @param member [Vapi::CreateTavusCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.tavus(member:) + new(member: member, discriminant: "tavus") + end + + # @param member [Vapi::CreateTogetherAiCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.together_ai(member:) + new(member: member, discriminant: "together-ai") + end + + # @param member [Vapi::CreateTwilioCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.twilio(member:) + new(member: member, discriminant: "twilio") + end + + # @param member [Vapi::CreateVonageCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.vonage(member:) + new(member: member, discriminant: "vonage") + end + + # @param member [Vapi::CreateWebhookCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.webhook(member:) + new(member: member, discriminant: "webhook") + end + + # @param member [Vapi::CreateXAiCredentialDto] + # @return [Vapi::AssistantCredentialsItem] + def self.xai(member:) + new(member: member, discriminant: "xai") + end + end +end diff --git a/lib/vapi_server_sdk/types/assistant_model.rb b/lib/vapi_server_sdk/types/assistant_model.rb index 8c611f9..5173a3c 100644 --- a/lib/vapi_server_sdk/types/assistant_model.rb +++ b/lib/vapi_server_sdk/types/assistant_model.rb @@ -8,6 +8,7 @@ require_relative "google_model" require_relative "groq_model" require_relative "inflection_ai_model" +require_relative "deep_seek_model" require_relative "open_ai_model" require_relative "open_router_model" require_relative "perplexity_ai_model" @@ -55,6 +56,8 @@ def self.from_json(json_object:) Vapi::GroqModel.from_json(json_object: json_object) when "inflection-ai" Vapi::InflectionAiModel.from_json(json_object: json_object) + when "deep-seek" + Vapi::DeepSeekModel.from_json(json_object: json_object) when "openai" Vapi::OpenAiModel.from_json(json_object: json_object) when "openrouter" @@ -92,6 +95,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "inflection-ai" { **@member.to_json, provider: @discriminant }.to_json + when "deep-seek" + { **@member.to_json, provider: @discriminant }.to_json when "openai" { **@member.to_json, provider: @discriminant }.to_json when "openrouter" @@ -132,6 +137,8 @@ def self.validate_raw(obj:) Vapi::GroqModel.validate_raw(obj: obj) when "inflection-ai" Vapi::InflectionAiModel.validate_raw(obj: obj) + when "deep-seek" + Vapi::DeepSeekModel.validate_raw(obj: obj) when "openai" Vapi::OpenAiModel.validate_raw(obj: obj) when "openrouter" @@ -199,6 +206,12 @@ def self.inflection_ai(member:) new(member: member, discriminant: "inflection-ai") end + # @param member [Vapi::DeepSeekModel] + # @return [Vapi::AssistantModel] + def self.deep_seek(member:) + new(member: member, discriminant: "deep-seek") + end + # @param member [Vapi::OpenAiModel] # @return [Vapi::AssistantModel] def self.openai(member:) diff --git a/lib/vapi_server_sdk/types/assistant_overrides.rb b/lib/vapi_server_sdk/types/assistant_overrides.rb index e2fec5f..4ba2f9e 100644 --- a/lib/vapi_server_sdk/types/assistant_overrides.rb +++ b/lib/vapi_server_sdk/types/assistant_overrides.rb @@ -8,6 +8,7 @@ require_relative "assistant_overrides_server_messages_item" require_relative "assistant_overrides_background_sound" require_relative "transport_configuration_twilio" +require_relative "assistant_overrides_credentials_item" require_relative "twilio_voicemail_detection" require_relative "analysis_plan" require_relative "artifact_plan" @@ -79,6 +80,11 @@ class AssistantOverrides # different transport providers. For a call, only the configuration matching the # call transport provider is used. attr_reader :transport_configurations + # @return [Array] These are dynamic credentials that will be used for the assistant calls. By + # default, all the credentials are available for use in the call but you can + # supplement an additional credentials using this. Dynamic credentials override + # existing credentials. + attr_reader :credentials # @return [Hash{String => Object}] These are values that will be used to replace the template variables in the # assistant messages and other text-based fields. # This uses LiquidJS syntax. https://liquidjs.com/tutorials/intro-to-liquid.html @@ -216,6 +222,10 @@ class AssistantOverrides # assistant's calls, like Twilio. You can store multiple configurations for # different transport providers. For a call, only the configuration matching the # call transport provider is used. + # @param credentials [Array] These are dynamic credentials that will be used for the assistant calls. By + # default, all the credentials are available for use in the call but you can + # supplement an additional credentials using this. Dynamic credentials override + # existing credentials. # @param variable_values [Hash{String => Object}] These are values that will be used to replace the template variables in the # assistant messages and other text-based fields. # This uses LiquidJS syntax. https://liquidjs.com/tutorials/intro-to-liquid.html @@ -289,7 +299,7 @@ class AssistantOverrides # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::AssistantOverrides] def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message: OMIT, first_message_mode: OMIT, - hipaa_enabled: OMIT, client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, variable_values: OMIT, name: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, server: OMIT, additional_properties: nil) + hipaa_enabled: OMIT, client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, credentials: OMIT, variable_values: OMIT, name: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, server: OMIT, additional_properties: nil) @transcriber = transcriber if transcriber != OMIT @model = model if model != OMIT @voice = voice if voice != OMIT @@ -304,6 +314,7 @@ def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message: OMIT, @background_denoising_enabled = background_denoising_enabled if background_denoising_enabled != OMIT @model_output_in_messages_enabled = model_output_in_messages_enabled if model_output_in_messages_enabled != OMIT @transport_configurations = transport_configurations if transport_configurations != OMIT + @credentials = credentials if credentials != OMIT @variable_values = variable_values if variable_values != OMIT @name = name if name != OMIT @voicemail_detection = voicemail_detection if voicemail_detection != OMIT @@ -335,6 +346,7 @@ def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message: OMIT, "backgroundDenoisingEnabled": background_denoising_enabled, "modelOutputInMessagesEnabled": model_output_in_messages_enabled, "transportConfigurations": transport_configurations, + "credentials": credentials, "variableValues": variable_values, "name": name, "voicemailDetection": voicemail_detection, @@ -394,6 +406,10 @@ def self.from_json(json_object:) item = item.to_json Vapi::TransportConfigurationTwilio.from_json(json_object: item) end + credentials = parsed_json["credentials"]&.map do |item| + item = item.to_json + Vapi::AssistantOverridesCredentialsItem.from_json(json_object: item) + end variable_values = parsed_json["variableValues"] name = parsed_json["name"] if parsed_json["voicemailDetection"].nil? @@ -464,6 +480,7 @@ def self.from_json(json_object:) background_denoising_enabled: background_denoising_enabled, model_output_in_messages_enabled: model_output_in_messages_enabled, transport_configurations: transport_configurations, + credentials: credentials, variable_values: variable_values, name: name, voicemail_detection: voicemail_detection, @@ -511,6 +528,7 @@ def self.validate_raw(obj:) obj.background_denoising_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.background_denoising_enabled is not the expected type, validation failed.") obj.model_output_in_messages_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.model_output_in_messages_enabled is not the expected type, validation failed.") obj.transport_configurations&.is_a?(Array) != false || raise("Passed value for field obj.transport_configurations is not the expected type, validation failed.") + obj.credentials&.is_a?(Array) != false || raise("Passed value for field obj.credentials is not the expected type, validation failed.") obj.variable_values&.is_a?(Hash) != false || raise("Passed value for field obj.variable_values is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.voicemail_detection.nil? || Vapi::TwilioVoicemailDetection.validate_raw(obj: obj.voicemail_detection) diff --git a/lib/vapi_server_sdk/types/assistant_overrides_credentials_item.rb b/lib/vapi_server_sdk/types/assistant_overrides_credentials_item.rb new file mode 100644 index 0000000..94ba3ba --- /dev/null +++ b/lib/vapi_server_sdk/types/assistant_overrides_credentials_item.rb @@ -0,0 +1,510 @@ +# frozen_string_literal: true + +require "json" +require_relative "create_anthropic_credential_dto" +require_relative "create_anyscale_credential_dto" +require_relative "create_assembly_ai_credential_dto" +require_relative "create_azure_open_ai_credential_dto" +require_relative "create_azure_credential_dto" +require_relative "create_byo_sip_trunk_credential_dto" +require_relative "create_cartesia_credential_dto" +require_relative "create_cloudflare_credential_dto" +require_relative "create_custom_llm_credential_dto" +require_relative "create_deepgram_credential_dto" +require_relative "create_deep_infra_credential_dto" +require_relative "create_deep_seek_credential_dto" +require_relative "create_eleven_labs_credential_dto" +require_relative "create_gcp_credential_dto" +require_relative "create_gladia_credential_dto" +require_relative "create_go_high_level_credential_dto" +require_relative "create_groq_credential_dto" +require_relative "create_langfuse_credential_dto" +require_relative "create_lmnt_credential_dto" +require_relative "create_make_credential_dto" +require_relative "create_open_ai_credential_dto" +require_relative "create_open_router_credential_dto" +require_relative "create_perplexity_ai_credential_dto" +require_relative "create_play_ht_credential_dto" +require_relative "create_rime_ai_credential_dto" +require_relative "create_runpod_credential_dto" +require_relative "create_s_3_credential_dto" +require_relative "create_smallest_ai_credential_dto" +require_relative "create_tavus_credential_dto" +require_relative "create_together_ai_credential_dto" +require_relative "create_twilio_credential_dto" +require_relative "create_vonage_credential_dto" +require_relative "create_webhook_credential_dto" +require_relative "create_x_ai_credential_dto" + +module Vapi + class AssistantOverridesCredentialsItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::AssistantOverridesCredentialsItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of AssistantOverridesCredentialsItem + # + # @param json_object [String] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "anthropic" + Vapi::CreateAnthropicCredentialDto.from_json(json_object: json_object) + when "anyscale" + Vapi::CreateAnyscaleCredentialDto.from_json(json_object: json_object) + when "assembly-ai" + Vapi::CreateAssemblyAiCredentialDto.from_json(json_object: json_object) + when "azure-openai" + Vapi::CreateAzureOpenAiCredentialDto.from_json(json_object: json_object) + when "azure" + Vapi::CreateAzureCredentialDto.from_json(json_object: json_object) + when "byo-sip-trunk" + Vapi::CreateByoSipTrunkCredentialDto.from_json(json_object: json_object) + when "cartesia" + Vapi::CreateCartesiaCredentialDto.from_json(json_object: json_object) + when "cloudflare" + Vapi::CreateCloudflareCredentialDto.from_json(json_object: json_object) + when "custom-llm" + Vapi::CreateCustomLlmCredentialDto.from_json(json_object: json_object) + when "deepgram" + Vapi::CreateDeepgramCredentialDto.from_json(json_object: json_object) + when "deepinfra" + Vapi::CreateDeepInfraCredentialDto.from_json(json_object: json_object) + when "deep-seek" + Vapi::CreateDeepSeekCredentialDto.from_json(json_object: json_object) + when "11labs" + Vapi::CreateElevenLabsCredentialDto.from_json(json_object: json_object) + when "gcp" + Vapi::CreateGcpCredentialDto.from_json(json_object: json_object) + when "gladia" + Vapi::CreateGladiaCredentialDto.from_json(json_object: json_object) + when "gohighlevel" + Vapi::CreateGoHighLevelCredentialDto.from_json(json_object: json_object) + when "groq" + Vapi::CreateGroqCredentialDto.from_json(json_object: json_object) + when "langfuse" + Vapi::CreateLangfuseCredentialDto.from_json(json_object: json_object) + when "lmnt" + Vapi::CreateLmntCredentialDto.from_json(json_object: json_object) + when "make" + Vapi::CreateMakeCredentialDto.from_json(json_object: json_object) + when "openai" + Vapi::CreateOpenAiCredentialDto.from_json(json_object: json_object) + when "openrouter" + Vapi::CreateOpenRouterCredentialDto.from_json(json_object: json_object) + when "perplexity-ai" + Vapi::CreatePerplexityAiCredentialDto.from_json(json_object: json_object) + when "playht" + Vapi::CreatePlayHtCredentialDto.from_json(json_object: json_object) + when "rime-ai" + Vapi::CreateRimeAiCredentialDto.from_json(json_object: json_object) + when "runpod" + Vapi::CreateRunpodCredentialDto.from_json(json_object: json_object) + when "s3" + Vapi::CreateS3CredentialDto.from_json(json_object: json_object) + when "smallest-ai" + Vapi::CreateSmallestAiCredentialDto.from_json(json_object: json_object) + when "tavus" + Vapi::CreateTavusCredentialDto.from_json(json_object: json_object) + when "together-ai" + Vapi::CreateTogetherAiCredentialDto.from_json(json_object: json_object) + when "twilio" + Vapi::CreateTwilioCredentialDto.from_json(json_object: json_object) + when "vonage" + Vapi::CreateVonageCredentialDto.from_json(json_object: json_object) + when "webhook" + Vapi::CreateWebhookCredentialDto.from_json(json_object: json_object) + when "xai" + Vapi::CreateXAiCredentialDto.from_json(json_object: json_object) + else + Vapi::CreateAnthropicCredentialDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "anthropic" + { **@member.to_json, provider: @discriminant }.to_json + when "anyscale" + { **@member.to_json, provider: @discriminant }.to_json + when "assembly-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "azure-openai" + { **@member.to_json, provider: @discriminant }.to_json + when "azure" + { **@member.to_json, provider: @discriminant }.to_json + when "byo-sip-trunk" + { **@member.to_json, provider: @discriminant }.to_json + when "cartesia" + { **@member.to_json, provider: @discriminant }.to_json + when "cloudflare" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-llm" + { **@member.to_json, provider: @discriminant }.to_json + when "deepgram" + { **@member.to_json, provider: @discriminant }.to_json + when "deepinfra" + { **@member.to_json, provider: @discriminant }.to_json + when "deep-seek" + { **@member.to_json, provider: @discriminant }.to_json + when "11labs" + { **@member.to_json, provider: @discriminant }.to_json + when "gcp" + { **@member.to_json, provider: @discriminant }.to_json + when "gladia" + { **@member.to_json, provider: @discriminant }.to_json + when "gohighlevel" + { **@member.to_json, provider: @discriminant }.to_json + when "groq" + { **@member.to_json, provider: @discriminant }.to_json + when "langfuse" + { **@member.to_json, provider: @discriminant }.to_json + when "lmnt" + { **@member.to_json, provider: @discriminant }.to_json + when "make" + { **@member.to_json, provider: @discriminant }.to_json + when "openai" + { **@member.to_json, provider: @discriminant }.to_json + when "openrouter" + { **@member.to_json, provider: @discriminant }.to_json + when "perplexity-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "playht" + { **@member.to_json, provider: @discriminant }.to_json + when "rime-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "runpod" + { **@member.to_json, provider: @discriminant }.to_json + when "s3" + { **@member.to_json, provider: @discriminant }.to_json + when "smallest-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "tavus" + { **@member.to_json, provider: @discriminant }.to_json + when "together-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "twilio" + { **@member.to_json, provider: @discriminant }.to_json + when "vonage" + { **@member.to_json, provider: @discriminant }.to_json + when "webhook" + { **@member.to_json, provider: @discriminant }.to_json + when "xai" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "anthropic" + Vapi::CreateAnthropicCredentialDto.validate_raw(obj: obj) + when "anyscale" + Vapi::CreateAnyscaleCredentialDto.validate_raw(obj: obj) + when "assembly-ai" + Vapi::CreateAssemblyAiCredentialDto.validate_raw(obj: obj) + when "azure-openai" + Vapi::CreateAzureOpenAiCredentialDto.validate_raw(obj: obj) + when "azure" + Vapi::CreateAzureCredentialDto.validate_raw(obj: obj) + when "byo-sip-trunk" + Vapi::CreateByoSipTrunkCredentialDto.validate_raw(obj: obj) + when "cartesia" + Vapi::CreateCartesiaCredentialDto.validate_raw(obj: obj) + when "cloudflare" + Vapi::CreateCloudflareCredentialDto.validate_raw(obj: obj) + when "custom-llm" + Vapi::CreateCustomLlmCredentialDto.validate_raw(obj: obj) + when "deepgram" + Vapi::CreateDeepgramCredentialDto.validate_raw(obj: obj) + when "deepinfra" + Vapi::CreateDeepInfraCredentialDto.validate_raw(obj: obj) + when "deep-seek" + Vapi::CreateDeepSeekCredentialDto.validate_raw(obj: obj) + when "11labs" + Vapi::CreateElevenLabsCredentialDto.validate_raw(obj: obj) + when "gcp" + Vapi::CreateGcpCredentialDto.validate_raw(obj: obj) + when "gladia" + Vapi::CreateGladiaCredentialDto.validate_raw(obj: obj) + when "gohighlevel" + Vapi::CreateGoHighLevelCredentialDto.validate_raw(obj: obj) + when "groq" + Vapi::CreateGroqCredentialDto.validate_raw(obj: obj) + when "langfuse" + Vapi::CreateLangfuseCredentialDto.validate_raw(obj: obj) + when "lmnt" + Vapi::CreateLmntCredentialDto.validate_raw(obj: obj) + when "make" + Vapi::CreateMakeCredentialDto.validate_raw(obj: obj) + when "openai" + Vapi::CreateOpenAiCredentialDto.validate_raw(obj: obj) + when "openrouter" + Vapi::CreateOpenRouterCredentialDto.validate_raw(obj: obj) + when "perplexity-ai" + Vapi::CreatePerplexityAiCredentialDto.validate_raw(obj: obj) + when "playht" + Vapi::CreatePlayHtCredentialDto.validate_raw(obj: obj) + when "rime-ai" + Vapi::CreateRimeAiCredentialDto.validate_raw(obj: obj) + when "runpod" + Vapi::CreateRunpodCredentialDto.validate_raw(obj: obj) + when "s3" + Vapi::CreateS3CredentialDto.validate_raw(obj: obj) + when "smallest-ai" + Vapi::CreateSmallestAiCredentialDto.validate_raw(obj: obj) + when "tavus" + Vapi::CreateTavusCredentialDto.validate_raw(obj: obj) + when "together-ai" + Vapi::CreateTogetherAiCredentialDto.validate_raw(obj: obj) + when "twilio" + Vapi::CreateTwilioCredentialDto.validate_raw(obj: obj) + when "vonage" + Vapi::CreateVonageCredentialDto.validate_raw(obj: obj) + when "webhook" + Vapi::CreateWebhookCredentialDto.validate_raw(obj: obj) + when "xai" + Vapi::CreateXAiCredentialDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::CreateAnthropicCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.anthropic(member:) + new(member: member, discriminant: "anthropic") + end + + # @param member [Vapi::CreateAnyscaleCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.anyscale(member:) + new(member: member, discriminant: "anyscale") + end + + # @param member [Vapi::CreateAssemblyAiCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.assembly_ai(member:) + new(member: member, discriminant: "assembly-ai") + end + + # @param member [Vapi::CreateAzureOpenAiCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.azure_openai(member:) + new(member: member, discriminant: "azure-openai") + end + + # @param member [Vapi::CreateAzureCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.azure(member:) + new(member: member, discriminant: "azure") + end + + # @param member [Vapi::CreateByoSipTrunkCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.byo_sip_trunk(member:) + new(member: member, discriminant: "byo-sip-trunk") + end + + # @param member [Vapi::CreateCartesiaCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.cartesia(member:) + new(member: member, discriminant: "cartesia") + end + + # @param member [Vapi::CreateCloudflareCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.cloudflare(member:) + new(member: member, discriminant: "cloudflare") + end + + # @param member [Vapi::CreateCustomLlmCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.custom_llm(member:) + new(member: member, discriminant: "custom-llm") + end + + # @param member [Vapi::CreateDeepgramCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.deepgram(member:) + new(member: member, discriminant: "deepgram") + end + + # @param member [Vapi::CreateDeepInfraCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.deepinfra(member:) + new(member: member, discriminant: "deepinfra") + end + + # @param member [Vapi::CreateDeepSeekCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.deep_seek(member:) + new(member: member, discriminant: "deep-seek") + end + + # @param member [Vapi::CreateElevenLabsCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self._11_labs(member:) + new(member: member, discriminant: "11labs") + end + + # @param member [Vapi::CreateGcpCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.gcp(member:) + new(member: member, discriminant: "gcp") + end + + # @param member [Vapi::CreateGladiaCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.gladia(member:) + new(member: member, discriminant: "gladia") + end + + # @param member [Vapi::CreateGoHighLevelCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.gohighlevel(member:) + new(member: member, discriminant: "gohighlevel") + end + + # @param member [Vapi::CreateGroqCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.groq(member:) + new(member: member, discriminant: "groq") + end + + # @param member [Vapi::CreateLangfuseCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.langfuse(member:) + new(member: member, discriminant: "langfuse") + end + + # @param member [Vapi::CreateLmntCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.lmnt(member:) + new(member: member, discriminant: "lmnt") + end + + # @param member [Vapi::CreateMakeCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.make(member:) + new(member: member, discriminant: "make") + end + + # @param member [Vapi::CreateOpenAiCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.openai(member:) + new(member: member, discriminant: "openai") + end + + # @param member [Vapi::CreateOpenRouterCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.openrouter(member:) + new(member: member, discriminant: "openrouter") + end + + # @param member [Vapi::CreatePerplexityAiCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.perplexity_ai(member:) + new(member: member, discriminant: "perplexity-ai") + end + + # @param member [Vapi::CreatePlayHtCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.playht(member:) + new(member: member, discriminant: "playht") + end + + # @param member [Vapi::CreateRimeAiCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.rime_ai(member:) + new(member: member, discriminant: "rime-ai") + end + + # @param member [Vapi::CreateRunpodCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.runpod(member:) + new(member: member, discriminant: "runpod") + end + + # @param member [Vapi::CreateS3CredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.s_3(member:) + new(member: member, discriminant: "s3") + end + + # @param member [Vapi::CreateSmallestAiCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.smallest_ai(member:) + new(member: member, discriminant: "smallest-ai") + end + + # @param member [Vapi::CreateTavusCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.tavus(member:) + new(member: member, discriminant: "tavus") + end + + # @param member [Vapi::CreateTogetherAiCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.together_ai(member:) + new(member: member, discriminant: "together-ai") + end + + # @param member [Vapi::CreateTwilioCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.twilio(member:) + new(member: member, discriminant: "twilio") + end + + # @param member [Vapi::CreateVonageCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.vonage(member:) + new(member: member, discriminant: "vonage") + end + + # @param member [Vapi::CreateWebhookCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.webhook(member:) + new(member: member, discriminant: "webhook") + end + + # @param member [Vapi::CreateXAiCredentialDto] + # @return [Vapi::AssistantOverridesCredentialsItem] + def self.xai(member:) + new(member: member, discriminant: "xai") + end + end +end diff --git a/lib/vapi_server_sdk/types/assistant_overrides_model.rb b/lib/vapi_server_sdk/types/assistant_overrides_model.rb index f1afec0..12a0044 100644 --- a/lib/vapi_server_sdk/types/assistant_overrides_model.rb +++ b/lib/vapi_server_sdk/types/assistant_overrides_model.rb @@ -8,6 +8,7 @@ require_relative "google_model" require_relative "groq_model" require_relative "inflection_ai_model" +require_relative "deep_seek_model" require_relative "open_ai_model" require_relative "open_router_model" require_relative "perplexity_ai_model" @@ -55,6 +56,8 @@ def self.from_json(json_object:) Vapi::GroqModel.from_json(json_object: json_object) when "inflection-ai" Vapi::InflectionAiModel.from_json(json_object: json_object) + when "deep-seek" + Vapi::DeepSeekModel.from_json(json_object: json_object) when "openai" Vapi::OpenAiModel.from_json(json_object: json_object) when "openrouter" @@ -92,6 +95,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "inflection-ai" { **@member.to_json, provider: @discriminant }.to_json + when "deep-seek" + { **@member.to_json, provider: @discriminant }.to_json when "openai" { **@member.to_json, provider: @discriminant }.to_json when "openrouter" @@ -132,6 +137,8 @@ def self.validate_raw(obj:) Vapi::GroqModel.validate_raw(obj: obj) when "inflection-ai" Vapi::InflectionAiModel.validate_raw(obj: obj) + when "deep-seek" + Vapi::DeepSeekModel.validate_raw(obj: obj) when "openai" Vapi::OpenAiModel.validate_raw(obj: obj) when "openrouter" @@ -199,6 +206,12 @@ def self.inflection_ai(member:) new(member: member, discriminant: "inflection-ai") end + # @param member [Vapi::DeepSeekModel] + # @return [Vapi::AssistantOverridesModel] + def self.deep_seek(member:) + new(member: member, discriminant: "deep-seek") + end + # @param member [Vapi::OpenAiModel] # @return [Vapi::AssistantOverridesModel] def self.openai(member:) diff --git a/lib/vapi_server_sdk/types/assistant_overrides_transcriber.rb b/lib/vapi_server_sdk/types/assistant_overrides_transcriber.rb index 7ca038b..f0412af 100644 --- a/lib/vapi_server_sdk/types/assistant_overrides_transcriber.rb +++ b/lib/vapi_server_sdk/types/assistant_overrides_transcriber.rb @@ -2,6 +2,7 @@ require "json" require_relative "assembly_ai_transcriber" +require_relative "azure_speech_transcriber" require_relative "custom_transcriber" require_relative "deepgram_transcriber" require_relative "gladia_transcriber" @@ -35,6 +36,8 @@ def self.from_json(json_object:) member = case struct.provider when "assembly-ai" Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) + when "azure" + Vapi::AzureSpeechTranscriber.from_json(json_object: json_object) when "custom-transcriber" Vapi::CustomTranscriber.from_json(json_object: json_object) when "deepgram" @@ -56,6 +59,8 @@ def to_json(*_args) case @discriminant when "assembly-ai" { **@member.to_json, provider: @discriminant }.to_json + when "azure" + { **@member.to_json, provider: @discriminant }.to_json when "custom-transcriber" { **@member.to_json, provider: @discriminant }.to_json when "deepgram" @@ -80,6 +85,8 @@ def self.validate_raw(obj:) case obj.provider when "assembly-ai" Vapi::AssemblyAiTranscriber.validate_raw(obj: obj) + when "azure" + Vapi::AzureSpeechTranscriber.validate_raw(obj: obj) when "custom-transcriber" Vapi::CustomTranscriber.validate_raw(obj: obj) when "deepgram" @@ -107,6 +114,12 @@ def self.assembly_ai(member:) new(member: member, discriminant: "assembly-ai") end + # @param member [Vapi::AzureSpeechTranscriber] + # @return [Vapi::AssistantOverridesTranscriber] + def self.azure(member:) + new(member: member, discriminant: "azure") + end + # @param member [Vapi::CustomTranscriber] # @return [Vapi::AssistantOverridesTranscriber] def self.custom_transcriber(member:) diff --git a/lib/vapi_server_sdk/types/assistant_overrides_voice.rb b/lib/vapi_server_sdk/types/assistant_overrides_voice.rb index 52a71c1..7cdfb1b 100644 --- a/lib/vapi_server_sdk/types/assistant_overrides_voice.rb +++ b/lib/vapi_server_sdk/types/assistant_overrides_voice.rb @@ -11,6 +11,7 @@ require_relative "open_ai_voice" require_relative "play_ht_voice" require_relative "rime_ai_voice" +require_relative "smallest_ai_voice" require_relative "tavus_voice" module Vapi @@ -59,6 +60,8 @@ def self.from_json(json_object:) Vapi::PlayHtVoice.from_json(json_object: json_object) when "rime-ai" Vapi::RimeAiVoice.from_json(json_object: json_object) + when "smallest-ai" + Vapi::SmallestAiVoice.from_json(json_object: json_object) when "tavus" Vapi::TavusVoice.from_json(json_object: json_object) else @@ -92,6 +95,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "rime-ai" { **@member.to_json, provider: @discriminant }.to_json + when "smallest-ai" + { **@member.to_json, provider: @discriminant }.to_json when "tavus" { **@member.to_json, provider: @discriminant }.to_json else @@ -128,6 +133,8 @@ def self.validate_raw(obj:) Vapi::PlayHtVoice.validate_raw(obj: obj) when "rime-ai" Vapi::RimeAiVoice.validate_raw(obj: obj) + when "smallest-ai" + Vapi::SmallestAiVoice.validate_raw(obj: obj) when "tavus" Vapi::TavusVoice.validate_raw(obj: obj) else @@ -203,6 +210,12 @@ def self.rime_ai(member:) new(member: member, discriminant: "rime-ai") end + # @param member [Vapi::SmallestAiVoice] + # @return [Vapi::AssistantOverridesVoice] + def self.smallest_ai(member:) + new(member: member, discriminant: "smallest-ai") + end + # @param member [Vapi::TavusVoice] # @return [Vapi::AssistantOverridesVoice] def self.tavus(member:) diff --git a/lib/vapi_server_sdk/types/assistant_transcriber.rb b/lib/vapi_server_sdk/types/assistant_transcriber.rb index af40540..b53e04a 100644 --- a/lib/vapi_server_sdk/types/assistant_transcriber.rb +++ b/lib/vapi_server_sdk/types/assistant_transcriber.rb @@ -2,6 +2,7 @@ require "json" require_relative "assembly_ai_transcriber" +require_relative "azure_speech_transcriber" require_relative "custom_transcriber" require_relative "deepgram_transcriber" require_relative "gladia_transcriber" @@ -35,6 +36,8 @@ def self.from_json(json_object:) member = case struct.provider when "assembly-ai" Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) + when "azure" + Vapi::AzureSpeechTranscriber.from_json(json_object: json_object) when "custom-transcriber" Vapi::CustomTranscriber.from_json(json_object: json_object) when "deepgram" @@ -56,6 +59,8 @@ def to_json(*_args) case @discriminant when "assembly-ai" { **@member.to_json, provider: @discriminant }.to_json + when "azure" + { **@member.to_json, provider: @discriminant }.to_json when "custom-transcriber" { **@member.to_json, provider: @discriminant }.to_json when "deepgram" @@ -80,6 +85,8 @@ def self.validate_raw(obj:) case obj.provider when "assembly-ai" Vapi::AssemblyAiTranscriber.validate_raw(obj: obj) + when "azure" + Vapi::AzureSpeechTranscriber.validate_raw(obj: obj) when "custom-transcriber" Vapi::CustomTranscriber.validate_raw(obj: obj) when "deepgram" @@ -107,6 +114,12 @@ def self.assembly_ai(member:) new(member: member, discriminant: "assembly-ai") end + # @param member [Vapi::AzureSpeechTranscriber] + # @return [Vapi::AssistantTranscriber] + def self.azure(member:) + new(member: member, discriminant: "azure") + end + # @param member [Vapi::CustomTranscriber] # @return [Vapi::AssistantTranscriber] def self.custom_transcriber(member:) diff --git a/lib/vapi_server_sdk/types/assistant_voice.rb b/lib/vapi_server_sdk/types/assistant_voice.rb index 3cf78fe..5d29e91 100644 --- a/lib/vapi_server_sdk/types/assistant_voice.rb +++ b/lib/vapi_server_sdk/types/assistant_voice.rb @@ -11,6 +11,7 @@ require_relative "open_ai_voice" require_relative "play_ht_voice" require_relative "rime_ai_voice" +require_relative "smallest_ai_voice" require_relative "tavus_voice" module Vapi @@ -59,6 +60,8 @@ def self.from_json(json_object:) Vapi::PlayHtVoice.from_json(json_object: json_object) when "rime-ai" Vapi::RimeAiVoice.from_json(json_object: json_object) + when "smallest-ai" + Vapi::SmallestAiVoice.from_json(json_object: json_object) when "tavus" Vapi::TavusVoice.from_json(json_object: json_object) else @@ -92,6 +95,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "rime-ai" { **@member.to_json, provider: @discriminant }.to_json + when "smallest-ai" + { **@member.to_json, provider: @discriminant }.to_json when "tavus" { **@member.to_json, provider: @discriminant }.to_json else @@ -128,6 +133,8 @@ def self.validate_raw(obj:) Vapi::PlayHtVoice.validate_raw(obj: obj) when "rime-ai" Vapi::RimeAiVoice.validate_raw(obj: obj) + when "smallest-ai" + Vapi::SmallestAiVoice.validate_raw(obj: obj) when "tavus" Vapi::TavusVoice.validate_raw(obj: obj) else @@ -203,6 +210,12 @@ def self.rime_ai(member:) new(member: member, discriminant: "rime-ai") end + # @param member [Vapi::SmallestAiVoice] + # @return [Vapi::AssistantVoice] + def self.smallest_ai(member:) + new(member: member, discriminant: "smallest-ai") + end + # @param member [Vapi::TavusVoice] # @return [Vapi::AssistantVoice] def self.tavus(member:) diff --git a/lib/vapi_server_sdk/types/auto_reload_plan_dto.rb b/lib/vapi_server_sdk/types/auto_reload_plan_dto.rb deleted file mode 100644 index fc1b2f8..0000000 --- a/lib/vapi_server_sdk/types/auto_reload_plan_dto.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require_relative "auto_reload_plan" -require "ostruct" -require "json" - -module Vapi - class AutoReloadPlanDto - # @return [Vapi::AutoReloadPlan] This is the auto reload plan to be configured for the subscription. - # It can be null if no auto reload plan is set. - attr_reader :auto_reload_plan - # @return [OpenStruct] Additional properties unmapped to the current class definition - attr_reader :additional_properties - # @return [Object] - attr_reader :_field_set - protected :_field_set - - OMIT = Object.new - - # @param auto_reload_plan [Vapi::AutoReloadPlan] This is the auto reload plan to be configured for the subscription. - # It can be null if no auto reload plan is set. - # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::AutoReloadPlanDto] - def initialize(auto_reload_plan: OMIT, additional_properties: nil) - @auto_reload_plan = auto_reload_plan if auto_reload_plan != OMIT - @additional_properties = additional_properties - @_field_set = { "autoReloadPlan": auto_reload_plan }.reject do |_k, v| - v == OMIT - end - end - - # Deserialize a JSON object to an instance of AutoReloadPlanDto - # - # @param json_object [String] - # @return [Vapi::AutoReloadPlanDto] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - parsed_json = JSON.parse(json_object) - if parsed_json["autoReloadPlan"].nil? - auto_reload_plan = nil - else - auto_reload_plan = parsed_json["autoReloadPlan"].to_json - auto_reload_plan = Vapi::AutoReloadPlan.from_json(json_object: auto_reload_plan) - end - new(auto_reload_plan: auto_reload_plan, additional_properties: struct) - end - - # Serialize an instance of AutoReloadPlanDto to a JSON object - # - # @return [String] - def to_json(*_args) - @_field_set&.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - obj.auto_reload_plan.nil? || Vapi::AutoReloadPlan.validate_raw(obj: obj.auto_reload_plan) - end - end -end diff --git a/lib/vapi_server_sdk/types/azure_blob_storage_bucket_plan.rb b/lib/vapi_server_sdk/types/azure_blob_storage_bucket_plan.rb new file mode 100644 index 0000000..ad65960 --- /dev/null +++ b/lib/vapi_server_sdk/types/azure_blob_storage_bucket_plan.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class AzureBlobStorageBucketPlan + # @return [String] This is the blob storage connection string for the Azure resource. + attr_reader :connection_string + # @return [String] This is the container name for the Azure blob storage. + attr_reader :container_name + # @return [String] This is the path where call artifacts will be stored. + # Usage: + # - To store call artifacts in a specific folder, set this to the full path. Eg. + # "/folder-name1/folder-name2". + # - To store call artifacts in the root of the bucket, leave this blank. + # @default "/" + attr_reader :path + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param connection_string [String] This is the blob storage connection string for the Azure resource. + # @param container_name [String] This is the container name for the Azure blob storage. + # @param path [String] This is the path where call artifacts will be stored. + # Usage: + # - To store call artifacts in a specific folder, set this to the full path. Eg. + # "/folder-name1/folder-name2". + # - To store call artifacts in the root of the bucket, leave this blank. + # @default "/" + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::AzureBlobStorageBucketPlan] + def initialize(connection_string:, container_name:, path: OMIT, additional_properties: nil) + @connection_string = connection_string + @container_name = container_name + @path = path if path != OMIT + @additional_properties = additional_properties + @_field_set = { + "connectionString": connection_string, + "containerName": container_name, + "path": path + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of AzureBlobStorageBucketPlan + # + # @param json_object [String] + # @return [Vapi::AzureBlobStorageBucketPlan] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + connection_string = parsed_json["connectionString"] + container_name = parsed_json["containerName"] + path = parsed_json["path"] + new( + connection_string: connection_string, + container_name: container_name, + path: path, + additional_properties: struct + ) + end + + # Serialize an instance of AzureBlobStorageBucketPlan to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.connection_string.is_a?(String) != false || raise("Passed value for field obj.connection_string is not the expected type, validation failed.") + obj.container_name.is_a?(String) != false || raise("Passed value for field obj.container_name is not the expected type, validation failed.") + obj.path&.is_a?(String) != false || raise("Passed value for field obj.path is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/azure_credential.rb b/lib/vapi_server_sdk/types/azure_credential.rb index 60456e6..1f9e1df 100644 --- a/lib/vapi_server_sdk/types/azure_credential.rb +++ b/lib/vapi_server_sdk/types/azure_credential.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true +require_relative "azure_credential_service" require_relative "azure_credential_region" require "date" +require_relative "azure_blob_storage_bucket_plan" require "ostruct" require "json" @@ -9,7 +11,7 @@ module Vapi class AzureCredential # @return [String] attr_reader :provider - # @return [String] This is the service being used in Azure. + # @return [Vapi::AzureCredentialService] This is the service being used in Azure. attr_reader :service # @return [Vapi::AzureCredentialRegion] This is the region of the Azure resource. attr_reader :region @@ -25,6 +27,9 @@ class AzureCredential attr_reader :updated_at # @return [String] This is the name of credential. This is just for your reference. attr_reader :name + # @return [Vapi::AzureBlobStorageBucketPlan] This is the bucket plan that can be provided to store call artifacts in Azure + # Blob Storage. + attr_reader :bucket_plan # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -34,7 +39,7 @@ class AzureCredential OMIT = Object.new # @param provider [String] - # @param service [String] This is the service being used in Azure. + # @param service [Vapi::AzureCredentialService] This is the service being used in Azure. # @param region [Vapi::AzureCredentialRegion] This is the region of the Azure resource. # @param api_key [String] This is not returned in the API. # @param id [String] This is the unique identifier for the credential. @@ -42,10 +47,12 @@ class AzureCredential # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. # @param name [String] This is the name of credential. This is just for your reference. + # @param bucket_plan [Vapi::AzureBlobStorageBucketPlan] This is the bucket plan that can be provided to store call artifacts in Azure + # Blob Storage. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::AzureCredential] def initialize(provider:, service:, id:, org_id:, created_at:, updated_at:, region: OMIT, api_key: OMIT, - name: OMIT, additional_properties: nil) + name: OMIT, bucket_plan: OMIT, additional_properties: nil) @provider = provider @service = service @region = region if region != OMIT @@ -55,6 +62,7 @@ def initialize(provider:, service:, id:, org_id:, created_at:, updated_at:, regi @created_at = created_at @updated_at = updated_at @name = name if name != OMIT + @bucket_plan = bucket_plan if bucket_plan != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, @@ -65,7 +73,8 @@ def initialize(provider:, service:, id:, org_id:, created_at:, updated_at:, regi "orgId": org_id, "createdAt": created_at, "updatedAt": updated_at, - "name": name + "name": name, + "bucketPlan": bucket_plan }.reject do |_k, v| v == OMIT end @@ -87,6 +96,12 @@ def self.from_json(json_object:) created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) name = parsed_json["name"] + if parsed_json["bucketPlan"].nil? + bucket_plan = nil + else + bucket_plan = parsed_json["bucketPlan"].to_json + bucket_plan = Vapi::AzureBlobStorageBucketPlan.from_json(json_object: bucket_plan) + end new( provider: provider, service: service, @@ -97,6 +112,7 @@ def self.from_json(json_object:) created_at: created_at, updated_at: updated_at, name: name, + bucket_plan: bucket_plan, additional_properties: struct ) end @@ -116,7 +132,7 @@ def to_json(*_args) # @return [Void] def self.validate_raw(obj:) obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.service.is_a?(String) != false || raise("Passed value for field obj.service is not the expected type, validation failed.") + obj.service.is_a?(Vapi::AzureCredentialService) != false || raise("Passed value for field obj.service is not the expected type, validation failed.") obj.region&.is_a?(Vapi::AzureCredentialRegion) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") @@ -124,6 +140,7 @@ def self.validate_raw(obj:) obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.bucket_plan.nil? || Vapi::AzureBlobStorageBucketPlan.validate_raw(obj: obj.bucket_plan) end end end diff --git a/lib/vapi_server_sdk/types/azure_credential_region.rb b/lib/vapi_server_sdk/types/azure_credential_region.rb index 09f0928..52f5c42 100644 --- a/lib/vapi_server_sdk/types/azure_credential_region.rb +++ b/lib/vapi_server_sdk/types/azure_credential_region.rb @@ -14,7 +14,7 @@ class AzureCredentialRegion NORTHCENTRALUS = "northcentralus" NORWAY = "norway" SOUTHCENTRALUS = "southcentralus" - SWEDEN = "sweden" + SWEDENCENTRAL = "swedencentral" SWITZERLAND = "switzerland" UK = "uk" WESTUS = "westus" diff --git a/lib/vapi_server_sdk/types/azure_credential_service.rb b/lib/vapi_server_sdk/types/azure_credential_service.rb new file mode 100644 index 0000000..4c920ae --- /dev/null +++ b/lib/vapi_server_sdk/types/azure_credential_service.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Vapi + # This is the service being used in Azure. + class AzureCredentialService + SPEECH = "speech" + BLOB_STORAGE = "blob_storage" + end +end diff --git a/lib/vapi_server_sdk/types/azure_open_ai_credential.rb b/lib/vapi_server_sdk/types/azure_open_ai_credential.rb index d66cb4d..7bb0abf 100644 --- a/lib/vapi_server_sdk/types/azure_open_ai_credential.rb +++ b/lib/vapi_server_sdk/types/azure_open_ai_credential.rb @@ -16,6 +16,8 @@ class AzureOpenAiCredential attr_reader :models # @return [String] This is not returned in the API. attr_reader :open_ai_key + # @return [String] This is not returned in the API. + attr_reader :ocp_apim_subscription_key # @return [String] This is the unique identifier for the credential. attr_reader :id # @return [String] This is the unique identifier for the org that this credential belongs to. @@ -40,6 +42,7 @@ class AzureOpenAiCredential # @param region [Vapi::AzureOpenAiCredentialRegion] # @param models [Array] # @param open_ai_key [String] This is not returned in the API. + # @param ocp_apim_subscription_key [String] This is not returned in the API. # @param id [String] This is the unique identifier for the credential. # @param org_id [String] This is the unique identifier for the org that this credential belongs to. # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. @@ -49,11 +52,12 @@ class AzureOpenAiCredential # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::AzureOpenAiCredential] def initialize(provider:, region:, models:, open_ai_key:, id:, org_id:, created_at:, updated_at:, - open_ai_endpoint:, name: OMIT, additional_properties: nil) + open_ai_endpoint:, ocp_apim_subscription_key: OMIT, name: OMIT, additional_properties: nil) @provider = provider @region = region @models = models @open_ai_key = open_ai_key + @ocp_apim_subscription_key = ocp_apim_subscription_key if ocp_apim_subscription_key != OMIT @id = id @org_id = org_id @created_at = created_at @@ -66,6 +70,7 @@ def initialize(provider:, region:, models:, open_ai_key:, id:, org_id:, created_ "region": region, "models": models, "openAIKey": open_ai_key, + "ocpApimSubscriptionKey": ocp_apim_subscription_key, "id": id, "orgId": org_id, "createdAt": created_at, @@ -88,6 +93,7 @@ def self.from_json(json_object:) region = parsed_json["region"] models = parsed_json["models"] open_ai_key = parsed_json["openAIKey"] + ocp_apim_subscription_key = parsed_json["ocpApimSubscriptionKey"] id = parsed_json["id"] org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) @@ -99,6 +105,7 @@ def self.from_json(json_object:) region: region, models: models, open_ai_key: open_ai_key, + ocp_apim_subscription_key: ocp_apim_subscription_key, id: id, org_id: org_id, created_at: created_at, @@ -127,6 +134,7 @@ def self.validate_raw(obj:) obj.region.is_a?(Vapi::AzureOpenAiCredentialRegion) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") obj.models.is_a?(Array) != false || raise("Passed value for field obj.models is not the expected type, validation failed.") obj.open_ai_key.is_a?(String) != false || raise("Passed value for field obj.open_ai_key is not the expected type, validation failed.") + obj.ocp_apim_subscription_key&.is_a?(String) != false || raise("Passed value for field obj.ocp_apim_subscription_key is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb b/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb index f403521..0e4e0e3 100644 --- a/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb +++ b/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb @@ -13,7 +13,7 @@ class AzureOpenAiCredentialRegion NORTHCENTRALUS = "northcentralus" NORWAY = "norway" SOUTHCENTRALUS = "southcentralus" - SWEDEN = "sweden" + SWEDENCENTRAL = "swedencentral" SWITZERLAND = "switzerland" UK = "uk" WESTUS = "westus" diff --git a/lib/vapi_server_sdk/types/azure_speech_transcriber.rb b/lib/vapi_server_sdk/types/azure_speech_transcriber.rb new file mode 100644 index 0000000..ed61fc5 --- /dev/null +++ b/lib/vapi_server_sdk/types/azure_speech_transcriber.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +require_relative "azure_speech_transcriber_language" +require "ostruct" +require "json" + +module Vapi + class AzureSpeechTranscriber + # @return [Vapi::AzureSpeechTranscriberLanguage] This is the language that will be set for the transcription. The list of + # languages Azure supports can be found here: + # n.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=stt + attr_reader :language + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param language [Vapi::AzureSpeechTranscriberLanguage] This is the language that will be set for the transcription. The list of + # languages Azure supports can be found here: + # n.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=stt + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::AzureSpeechTranscriber] + def initialize(language: OMIT, additional_properties: nil) + @language = language if language != OMIT + @additional_properties = additional_properties + @_field_set = { "language": language }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of AzureSpeechTranscriber + # + # @param json_object [String] + # @return [Vapi::AzureSpeechTranscriber] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + language = parsed_json["language"] + new(language: language, additional_properties: struct) + end + + # Serialize an instance of AzureSpeechTranscriber to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.language&.is_a?(Vapi::AzureSpeechTranscriberLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/azure_speech_transcriber_language.rb b/lib/vapi_server_sdk/types/azure_speech_transcriber_language.rb new file mode 100644 index 0000000..aeff9d8 --- /dev/null +++ b/lib/vapi_server_sdk/types/azure_speech_transcriber_language.rb @@ -0,0 +1,152 @@ +# frozen_string_literal: true + +module Vapi + # This is the language that will be set for the transcription. The list of + # languages Azure supports can be found here: + # n.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=stt + class AzureSpeechTranscriberLanguage + AF_ZA = "af-ZA" + AM_ET = "am-ET" + AR_AE = "ar-AE" + AR_BH = "ar-BH" + AR_DZ = "ar-DZ" + AR_EG = "ar-EG" + AR_IL = "ar-IL" + AR_IQ = "ar-IQ" + AR_JO = "ar-JO" + AR_KW = "ar-KW" + AR_LB = "ar-LB" + AR_LY = "ar-LY" + AR_MA = "ar-MA" + AR_OM = "ar-OM" + AR_PS = "ar-PS" + AR_QA = "ar-QA" + AR_SA = "ar-SA" + AR_SY = "ar-SY" + AR_TN = "ar-TN" + AR_YE = "ar-YE" + AZ_AZ = "az-AZ" + BG_BG = "bg-BG" + BN_IN = "bn-IN" + BS_BA = "bs-BA" + CA_ES = "ca-ES" + CS_CZ = "cs-CZ" + CY_GB = "cy-GB" + DA_DK = "da-DK" + DE_AT = "de-AT" + DE_CH = "de-CH" + DE_DE = "de-DE" + EL_GR = "el-GR" + EN_AU = "en-AU" + EN_CA = "en-CA" + EN_GB = "en-GB" + EN_GH = "en-GH" + EN_HK = "en-HK" + EN_IE = "en-IE" + EN_IN = "en-IN" + EN_KE = "en-KE" + EN_NG = "en-NG" + EN_NZ = "en-NZ" + EN_PH = "en-PH" + EN_SG = "en-SG" + EN_TZ = "en-TZ" + EN_US = "en-US" + EN_ZA = "en-ZA" + ES_AR = "es-AR" + ES_BO = "es-BO" + ES_CL = "es-CL" + ES_CO = "es-CO" + ES_CR = "es-CR" + ES_CU = "es-CU" + ES_DO = "es-DO" + ES_EC = "es-EC" + ES_ES = "es-ES" + ES_GQ = "es-GQ" + ES_GT = "es-GT" + ES_HN = "es-HN" + ES_MX = "es-MX" + ES_NI = "es-NI" + ES_PA = "es-PA" + ES_PE = "es-PE" + ES_PR = "es-PR" + ES_PY = "es-PY" + ES_SV = "es-SV" + ES_US = "es-US" + ES_UY = "es-UY" + ES_VE = "es-VE" + ET_EE = "et-EE" + EU_ES = "eu-ES" + FA_IR = "fa-IR" + FI_FI = "fi-FI" + FIL_PH = "fil-PH" + FR_BE = "fr-BE" + FR_CA = "fr-CA" + FR_CH = "fr-CH" + FR_FR = "fr-FR" + GA_IE = "ga-IE" + GL_ES = "gl-ES" + GU_IN = "gu-IN" + HE_IL = "he-IL" + HI_IN = "hi-IN" + HR_HR = "hr-HR" + HU_HU = "hu-HU" + HY_AM = "hy-AM" + ID_ID = "id-ID" + IS_IS = "is-IS" + IT_CH = "it-CH" + IT_IT = "it-IT" + JA_JP = "ja-JP" + JV_ID = "jv-ID" + KA_GE = "ka-GE" + KK_KZ = "kk-KZ" + KM_KH = "km-KH" + KN_IN = "kn-IN" + KO_KR = "ko-KR" + LO_LA = "lo-LA" + LT_LT = "lt-LT" + LV_LV = "lv-LV" + MK_MK = "mk-MK" + ML_IN = "ml-IN" + MN_MN = "mn-MN" + MR_IN = "mr-IN" + MS_MY = "ms-MY" + MT_MT = "mt-MT" + MY_MM = "my-MM" + NB_NO = "nb-NO" + NE_NP = "ne-NP" + NL_BE = "nl-BE" + NL_NL = "nl-NL" + PA_IN = "pa-IN" + PL_PL = "pl-PL" + PS_AF = "ps-AF" + PT_BR = "pt-BR" + PT_PT = "pt-PT" + RO_RO = "ro-RO" + RU_RU = "ru-RU" + SI_LK = "si-LK" + SK_SK = "sk-SK" + SL_SI = "sl-SI" + SO_SO = "so-SO" + SQ_AL = "sq-AL" + SR_RS = "sr-RS" + SV_SE = "sv-SE" + SW_KE = "sw-KE" + SW_TZ = "sw-TZ" + TA_IN = "ta-IN" + TE_IN = "te-IN" + TH_TH = "th-TH" + TR_TR = "tr-TR" + UK_UA = "uk-UA" + UR_IN = "ur-IN" + UZ_UZ = "uz-UZ" + VI_VN = "vi-VN" + WUU_CN = "wuu-CN" + YUE_CN = "yue-CN" + ZH_CN = "zh-CN" + ZH_CN_SHANDONG = "zh-CN-shandong" + ZH_CN_SICHUAN = "zh-CN-sichuan" + ZH_HK = "zh-HK" + ZH_TW = "zh-TW" + ZU_ZA = "zu-ZA" + end +end diff --git a/lib/vapi_server_sdk/types/buy_phone_number_dto.rb b/lib/vapi_server_sdk/types/buy_phone_number_dto.rb index 4f13681..1600662 100644 --- a/lib/vapi_server_sdk/types/buy_phone_number_dto.rb +++ b/lib/vapi_server_sdk/types/buy_phone_number_dto.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "buy_phone_number_dto_fallback_destination" +require_relative "server" require "ostruct" require "json" @@ -27,16 +28,13 @@ class BuyPhoneNumberDto # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. attr_reader :squad_id - # @return [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - attr_reader :server_url - # @return [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -61,25 +59,22 @@ class BuyPhoneNumberDto # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::BuyPhoneNumberDto] def initialize(area_code:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, - server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) + server: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @area_code = area_code @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, @@ -87,8 +82,7 @@ def initialize(area_code:, fallback_destination: OMIT, name: OMIT, assistant_id: "name": name, "assistantId": assistant_id, "squadId": squad_id, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret + "server": server }.reject do |_k, v| v == OMIT end @@ -111,16 +105,19 @@ def self.from_json(json_object:) name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end new( fallback_destination: fallback_destination, area_code: area_code, name: name, assistant_id: assistant_id, squad_id: squad_id, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, additional_properties: struct ) end @@ -144,8 +141,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) end end end diff --git a/lib/vapi_server_sdk/types/byo_phone_number.rb b/lib/vapi_server_sdk/types/byo_phone_number.rb index a1192db..724f926 100644 --- a/lib/vapi_server_sdk/types/byo_phone_number.rb +++ b/lib/vapi_server_sdk/types/byo_phone_number.rb @@ -2,6 +2,7 @@ require_relative "byo_phone_number_fallback_destination" require "date" +require_relative "server" require "ostruct" require "json" @@ -45,16 +46,13 @@ class ByoPhoneNumber # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. attr_reader :squad_id - # @return [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - attr_reader :server_url - # @return [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [String] This is the number of the customer. attr_reader :number # @return [String] This is the credential of your own SIP trunk or Carrier (type `byo-sip-trunk`) @@ -99,14 +97,12 @@ class ByoPhoneNumber # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param number [String] This is the number of the customer. # @param credential_id [String] This is the credential of your own SIP trunk or Carrier (type `byo-sip-trunk`) # which can be used to make calls to this phone number. @@ -115,7 +111,7 @@ class ByoPhoneNumber # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ByoPhoneNumber] def initialize(id:, org_id:, created_at:, updated_at:, credential_id:, fallback_destination: OMIT, - number_e_164_check_enabled: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, number: OMIT, additional_properties: nil) + number_e_164_check_enabled: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, number: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @number_e_164_check_enabled = number_e_164_check_enabled if number_e_164_check_enabled != OMIT @id = id @@ -125,8 +121,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, credential_id:, fallback_ @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @number = number if number != OMIT @credential_id = credential_id @additional_properties = additional_properties @@ -140,8 +135,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, credential_id:, fallback_ "name": name, "assistantId": assistant_id, "squadId": squad_id, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret, + "server": server, "number": number, "credentialId": credential_id }.reject do |_k, v| @@ -170,8 +164,12 @@ def self.from_json(json_object:) name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end number = parsed_json["number"] credential_id = parsed_json["credentialId"] new( @@ -184,8 +182,7 @@ def self.from_json(json_object:) name: name, assistant_id: assistant_id, squad_id: squad_id, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, number: number, credential_id: credential_id, additional_properties: struct @@ -215,8 +212,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.number&.is_a?(String) != false || raise("Passed value for field obj.number is not the expected type, validation failed.") obj.credential_id.is_a?(String) != false || raise("Passed value for field obj.credential_id is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/call_ended_reason.rb b/lib/vapi_server_sdk/types/call_ended_reason.rb index 331c201..9e2775b 100644 --- a/lib/vapi_server_sdk/types/call_ended_reason.rb +++ b/lib/vapi_server_sdk/types/call_ended_reason.rb @@ -3,6 +3,30 @@ module Vapi # This is the explanation for how the call ended. class CallEndedReason + ASSISTANT_NOT_INVALID = "assistant-not-invalid" + ASSISTANT_NOT_PROVIDED = "assistant-not-provided" + CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET = "call-start-error-neither-assistant-nor-server-set" + ASSISTANT_REQUEST_FAILED = "assistant-request-failed" + ASSISTANT_REQUEST_RETURNED_ERROR = "assistant-request-returned-error" + ASSISTANT_REQUEST_RETURNED_UNSPEAKABLE_ERROR = "assistant-request-returned-unspeakable-error" + ASSISTANT_REQUEST_RETURNED_INVALID_ASSISTANT = "assistant-request-returned-invalid-assistant" + ASSISTANT_REQUEST_RETURNED_NO_ASSISTANT = "assistant-request-returned-no-assistant" + ASSISTANT_REQUEST_RETURNED_FORWARDING_PHONE_NUMBER = "assistant-request-returned-forwarding-phone-number" + ASSISTANT_ENDED_CALL = "assistant-ended-call" + ASSISTANT_SAID_END_CALL_PHRASE = "assistant-said-end-call-phrase" + ASSISTANT_FORWARDED_CALL = "assistant-forwarded-call" + ASSISTANT_JOIN_TIMED_OUT = "assistant-join-timed-out" + CUSTOMER_BUSY = "customer-busy" + CUSTOMER_ENDED_CALL = "customer-ended-call" + CUSTOMER_DID_NOT_ANSWER = "customer-did-not-answer" + CUSTOMER_DID_NOT_GIVE_MICROPHONE_PERMISSION = "customer-did-not-give-microphone-permission" + ASSISTANT_SAID_MESSAGE_WITH_END_CALL_ENABLED = "assistant-said-message-with-end-call-enabled" + EXCEEDED_MAX_DURATION = "exceeded-max-duration" + MANUALLY_CANCELED = "manually-canceled" + PHONE_CALL_PROVIDER_CLOSED_WEBSOCKET = "phone-call-provider-closed-websocket" + DB_ERROR = "db-error" + ASSISTANT_NOT_FOUND = "assistant-not-found" + LICENSE_CHECK_FAILED = "license-check-failed" PIPELINE_ERROR_OPENAI_VOICE_FAILED = "pipeline-error-openai-voice-failed" PIPELINE_ERROR_CARTESIA_VOICE_FAILED = "pipeline-error-cartesia-voice-failed" PIPELINE_ERROR_DEEPGRAM_VOICE_FAILED = "pipeline-error-deepgram-voice-failed" @@ -12,9 +36,12 @@ class CallEndedReason PIPELINE_ERROR_AZURE_VOICE_FAILED = "pipeline-error-azure-voice-failed" PIPELINE_ERROR_RIME_AI_VOICE_FAILED = "pipeline-error-rime-ai-voice-failed" PIPELINE_ERROR_NEETS_VOICE_FAILED = "pipeline-error-neets-voice-failed" - DB_ERROR = "db-error" - ASSISTANT_NOT_FOUND = "assistant-not-found" - LICENSE_CHECK_FAILED = "license-check-failed" + PIPELINE_ERROR_SMALLEST_AI_VOICE_FAILED = "pipeline-error-smallest-ai-voice-failed" + PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" + PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" + PIPELINE_ERROR_ASSEMBLY_AI_TRANSCRIBER_FAILED = "pipeline-error-assembly-ai-transcriber-failed" + PIPELINE_ERROR_TALKSCRIBER_TRANSCRIBER_FAILED = "pipeline-error-talkscriber-transcriber-failed" + PIPELINE_ERROR_AZURE_SPEECH_TRANSCRIBER_FAILED = "pipeline-error-azure-speech-transcriber-failed" PIPELINE_ERROR_VAPI_LLM_FAILED = "pipeline-error-vapi-llm-failed" PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-vapi-400-bad-request-validation-failed" PIPELINE_ERROR_VAPI_401_UNAUTHORIZED = "pipeline-error-vapi-401-unauthorized" @@ -34,36 +61,14 @@ class CallEndedReason VAPIFAULT_WEB_CALL_WORKER_SETUP_FAILED = "vapifault-web-call-worker-setup-failed" VAPIFAULT_TRANSPORT_CONNECTED_BUT_CALL_NOT_ACTIVE = "vapifault-transport-connected-but-call-not-active" VAPIFAULT_CALL_STARTED_BUT_CONNECTION_TO_TRANSPORT_MISSING = "vapifault-call-started-but-connection-to-transport-missing" - PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" - PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" - PIPELINE_ERROR_ASSEMBLY_AI_TRANSCRIBER_FAILED = "pipeline-error-assembly-ai-transcriber-failed" PIPELINE_ERROR_OPENAI_LLM_FAILED = "pipeline-error-openai-llm-failed" PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED = "pipeline-error-azure-openai-llm-failed" PIPELINE_ERROR_GROQ_LLM_FAILED = "pipeline-error-groq-llm-failed" PIPELINE_ERROR_GOOGLE_LLM_FAILED = "pipeline-error-google-llm-failed" PIPELINE_ERROR_XAI_LLM_FAILED = "pipeline-error-xai-llm-failed" PIPELINE_ERROR_INFLECTION_AI_LLM_FAILED = "pipeline-error-inflection-ai-llm-failed" - ASSISTANT_NOT_INVALID = "assistant-not-invalid" - ASSISTANT_NOT_PROVIDED = "assistant-not-provided" - CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET = "call-start-error-neither-assistant-nor-server-set" - ASSISTANT_REQUEST_FAILED = "assistant-request-failed" - ASSISTANT_REQUEST_RETURNED_ERROR = "assistant-request-returned-error" - ASSISTANT_REQUEST_RETURNED_UNSPEAKABLE_ERROR = "assistant-request-returned-unspeakable-error" - ASSISTANT_REQUEST_RETURNED_INVALID_ASSISTANT = "assistant-request-returned-invalid-assistant" - ASSISTANT_REQUEST_RETURNED_NO_ASSISTANT = "assistant-request-returned-no-assistant" - ASSISTANT_REQUEST_RETURNED_FORWARDING_PHONE_NUMBER = "assistant-request-returned-forwarding-phone-number" - ASSISTANT_ENDED_CALL = "assistant-ended-call" - ASSISTANT_SAID_END_CALL_PHRASE = "assistant-said-end-call-phrase" - ASSISTANT_FORWARDED_CALL = "assistant-forwarded-call" - ASSISTANT_JOIN_TIMED_OUT = "assistant-join-timed-out" - CUSTOMER_BUSY = "customer-busy" - CUSTOMER_ENDED_CALL = "customer-ended-call" - CUSTOMER_DID_NOT_ANSWER = "customer-did-not-answer" - CUSTOMER_DID_NOT_GIVE_MICROPHONE_PERMISSION = "customer-did-not-give-microphone-permission" - ASSISTANT_SAID_MESSAGE_WITH_END_CALL_ENABLED = "assistant-said-message-with-end-call-enabled" - EXCEEDED_MAX_DURATION = "exceeded-max-duration" - MANUALLY_CANCELED = "manually-canceled" - PHONE_CALL_PROVIDER_CLOSED_WEBSOCKET = "phone-call-provider-closed-websocket" + PIPELINE_ERROR_CEREBRAS_LLM_FAILED = "pipeline-error-cerebras-llm-failed" + PIPELINE_ERROR_DEEP_SEEK_LLM_FAILED = "pipeline-error-deep-seek-llm-failed" PIPELINE_ERROR_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-openai-400-bad-request-validation-failed" PIPELINE_ERROR_OPENAI_401_UNAUTHORIZED = "pipeline-error-openai-401-unauthorized" PIPELINE_ERROR_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-openai-403-model-access-denied" @@ -84,6 +89,11 @@ class CallEndedReason PIPELINE_ERROR_INFLECTION_AI_403_MODEL_ACCESS_DENIED = "pipeline-error-inflection-ai-403-model-access-denied" PIPELINE_ERROR_INFLECTION_AI_429_EXCEEDED_QUOTA = "pipeline-error-inflection-ai-429-exceeded-quota" PIPELINE_ERROR_INFLECTION_AI_500_SERVER_ERROR = "pipeline-error-inflection-ai-500-server-error" + PIPELINE_ERROR_DEEP_SEEK_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-deep-seek-400-bad-request-validation-failed" + PIPELINE_ERROR_DEEP_SEEK_401_UNAUTHORIZED = "pipeline-error-deep-seek-401-unauthorized" + PIPELINE_ERROR_DEEP_SEEK_403_MODEL_ACCESS_DENIED = "pipeline-error-deep-seek-403-model-access-denied" + PIPELINE_ERROR_DEEP_SEEK_429_EXCEEDED_QUOTA = "pipeline-error-deep-seek-429-exceeded-quota" + PIPELINE_ERROR_DEEP_SEEK_500_SERVER_ERROR = "pipeline-error-deep-seek-500-server-error" PIPELINE_ERROR_AZURE_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-azure-openai-400-bad-request-validation-failed" PIPELINE_ERROR_AZURE_OPENAI_401_UNAUTHORIZED = "pipeline-error-azure-openai-401-unauthorized" PIPELINE_ERROR_AZURE_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-azure-openai-403-model-access-denied" @@ -94,6 +104,11 @@ class CallEndedReason PIPELINE_ERROR_GROQ_403_MODEL_ACCESS_DENIED = "pipeline-error-groq-403-model-access-denied" PIPELINE_ERROR_GROQ_429_EXCEEDED_QUOTA = "pipeline-error-groq-429-exceeded-quota" PIPELINE_ERROR_GROQ_500_SERVER_ERROR = "pipeline-error-groq-500-server-error" + PIPELINE_ERROR_CEREBRAS_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-cerebras-400-bad-request-validation-failed" + PIPELINE_ERROR_CEREBRAS_401_UNAUTHORIZED = "pipeline-error-cerebras-401-unauthorized" + PIPELINE_ERROR_CEREBRAS_403_MODEL_ACCESS_DENIED = "pipeline-error-cerebras-403-model-access-denied" + PIPELINE_ERROR_CEREBRAS_429_EXCEEDED_QUOTA = "pipeline-error-cerebras-429-exceeded-quota" + PIPELINE_ERROR_CEREBRAS_500_SERVER_ERROR = "pipeline-error-cerebras-500-server-error" PIPELINE_ERROR_ANTHROPIC_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-anthropic-400-bad-request-validation-failed" PIPELINE_ERROR_ANTHROPIC_401_UNAUTHORIZED = "pipeline-error-anthropic-401-unauthorized" PIPELINE_ERROR_ANTHROPIC_403_MODEL_ACCESS_DENIED = "pipeline-error-anthropic-403-model-access-denied" @@ -181,6 +196,8 @@ class CallEndedReason PIPELINE_ERROR_PLAYHT_429_EXCEEDED_QUOTA = "pipeline-error-playht-429-exceeded-quota" PIPELINE_ERROR_PLAYHT_502_GATEWAY_ERROR = "pipeline-error-playht-502-gateway-error" PIPELINE_ERROR_PLAYHT_504_GATEWAY_ERROR = "pipeline-error-playht-504-gateway-error" + PIPELINE_ERROR_TAVUS_VIDEO_FAILED = "pipeline-error-tavus-video-failed" + PIPELINE_ERROR_CUSTOM_TRANSCRIBER_FAILED = "pipeline-error-custom-transcriber-failed" PIPELINE_ERROR_DEEPGRAM_RETURNING_403_MODEL_ACCESS_DENIED = "pipeline-error-deepgram-returning-403-model-access-denied" PIPELINE_ERROR_DEEPGRAM_RETURNING_401_INVALID_CREDENTIALS = "pipeline-error-deepgram-returning-401-invalid-credentials" PIPELINE_ERROR_DEEPGRAM_RETURNING_404_NOT_FOUND = "pipeline-error-deepgram-returning-404-not-found" @@ -188,8 +205,6 @@ class CallEndedReason PIPELINE_ERROR_DEEPGRAM_RETURNING_500_INVALID_JSON = "pipeline-error-deepgram-returning-500-invalid-json" PIPELINE_ERROR_DEEPGRAM_RETURNING_502_NETWORK_ERROR = "pipeline-error-deepgram-returning-502-network-error" PIPELINE_ERROR_DEEPGRAM_RETURNING_502_BAD_GATEWAY_EHOSTUNREACH = "pipeline-error-deepgram-returning-502-bad-gateway-ehostunreach" - PIPELINE_ERROR_TAVUS_VIDEO_FAILED = "pipeline-error-tavus-video-failed" - PIPELINE_ERROR_CUSTOM_TRANSCRIBER_FAILED = "pipeline-error-custom-transcriber-failed" SILENCE_TIMED_OUT = "silence-timed-out" SIP_GATEWAY_FAILED_TO_CONNECT_CALL = "sip-gateway-failed-to-connect-call" TWILIO_FAILED_TO_CONNECT_CALL = "twilio-failed-to-connect-call" diff --git a/lib/vapi_server_sdk/types/cartesia_voice_model.rb b/lib/vapi_server_sdk/types/cartesia_voice_model.rb index ec95db2..423022a 100644 --- a/lib/vapi_server_sdk/types/cartesia_voice_model.rb +++ b/lib/vapi_server_sdk/types/cartesia_voice_model.rb @@ -6,5 +6,7 @@ module Vapi class CartesiaVoiceModel SONIC_ENGLISH = "sonic-english" SONIC_MULTILINGUAL = "sonic-multilingual" + SONIC_PREVIEW = "sonic-preview" + SONIC = "sonic" end end diff --git a/lib/vapi_server_sdk/types/cerebras_credential.rb b/lib/vapi_server_sdk/types/cerebras_credential.rb new file mode 100644 index 0000000..6815abc --- /dev/null +++ b/lib/vapi_server_sdk/types/cerebras_credential.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +require "date" +require "ostruct" +require "json" + +module Vapi + class CerebrasCredential + # @return [String] + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param api_key [String] This is not returned in the API. + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CerebrasCredential] + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "apiKey": api_key, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CerebrasCredential + # + # @param json_object [String] + # @return [Vapi::CerebrasCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CerebrasCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/chat_dto.rb b/lib/vapi_server_sdk/types/chat_dto.rb new file mode 100644 index 0000000..c9a1de5 --- /dev/null +++ b/lib/vapi_server_sdk/types/chat_dto.rb @@ -0,0 +1,103 @@ +# frozen_string_literal: true + +require_relative "open_ai_message" +require_relative "create_assistant_dto" +require_relative "assistant_overrides" +require "ostruct" +require "json" + +module Vapi + class ChatDto + # @return [Array] + attr_reader :messages + # @return [String] + attr_reader :assistant_id + # @return [Vapi::CreateAssistantDto] + attr_reader :assistant + # @return [Vapi::AssistantOverrides] + attr_reader :assistant_overrides + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param messages [Array] + # @param assistant_id [String] + # @param assistant [Vapi::CreateAssistantDto] + # @param assistant_overrides [Vapi::AssistantOverrides] + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::ChatDto] + def initialize(messages:, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, + additional_properties: nil) + @messages = messages + @assistant_id = assistant_id if assistant_id != OMIT + @assistant = assistant if assistant != OMIT + @assistant_overrides = assistant_overrides if assistant_overrides != OMIT + @additional_properties = additional_properties + @_field_set = { + "messages": messages, + "assistantId": assistant_id, + "assistant": assistant, + "assistantOverrides": assistant_overrides + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of ChatDto + # + # @param json_object [String] + # @return [Vapi::ChatDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::OpenAiMessage.from_json(json_object: item) + end + assistant_id = parsed_json["assistantId"] + if parsed_json["assistant"].nil? + assistant = nil + else + assistant = parsed_json["assistant"].to_json + assistant = Vapi::CreateAssistantDto.from_json(json_object: assistant) + end + if parsed_json["assistantOverrides"].nil? + assistant_overrides = nil + else + assistant_overrides = parsed_json["assistantOverrides"].to_json + assistant_overrides = Vapi::AssistantOverrides.from_json(json_object: assistant_overrides) + end + new( + messages: messages, + assistant_id: assistant_id, + assistant: assistant, + assistant_overrides: assistant_overrides, + additional_properties: struct + ) + end + + # Serialize an instance of ChatDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.messages.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") + obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant) + obj.assistant_overrides.nil? || Vapi::AssistantOverrides.validate_raw(obj: obj.assistant_overrides) + end + end +end diff --git a/lib/vapi_server_sdk/types/credits_buy_dto.rb b/lib/vapi_server_sdk/types/chat_service_response.rb similarity index 53% rename from lib/vapi_server_sdk/types/credits_buy_dto.rb rename to lib/vapi_server_sdk/types/chat_service_response.rb index 6ef1079..6a1dfc1 100644 --- a/lib/vapi_server_sdk/types/credits_buy_dto.rb +++ b/lib/vapi_server_sdk/types/chat_service_response.rb @@ -4,9 +4,7 @@ require "json" module Vapi - class CreditsBuyDto - # @return [Float] This is the number of credits to add to the subscription. - attr_reader :credits + class ChatServiceResponse # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -15,27 +13,23 @@ class CreditsBuyDto OMIT = Object.new - # @param credits [Float] This is the number of credits to add to the subscription. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::CreditsBuyDto] - def initialize(credits:, additional_properties: nil) - @credits = credits + # @return [Vapi::ChatServiceResponse] + def initialize(additional_properties: nil) @additional_properties = additional_properties - @_field_set = { "credits": credits } + @_field_set = {} end - # Deserialize a JSON object to an instance of CreditsBuyDto + # Deserialize a JSON object to an instance of ChatServiceResponse # # @param json_object [String] - # @return [Vapi::CreditsBuyDto] + # @return [Vapi::ChatServiceResponse] def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) - parsed_json = JSON.parse(json_object) - credits = parsed_json["credits"] - new(credits: credits, additional_properties: struct) + new(additional_properties: struct) end - # Serialize an instance of CreditsBuyDto to a JSON object + # Serialize an instance of ChatServiceResponse to a JSON object # # @return [String] def to_json(*_args) @@ -48,8 +42,6 @@ def to_json(*_args) # # @param obj [Object] # @return [Void] - def self.validate_raw(obj:) - obj.credits.is_a?(Float) != false || raise("Passed value for field obj.credits is not the expected type, validation failed.") - end + def self.validate_raw(obj:); end end end diff --git a/lib/vapi_server_sdk/types/cloudflare_credential.rb b/lib/vapi_server_sdk/types/cloudflare_credential.rb new file mode 100644 index 0000000..453cf24 --- /dev/null +++ b/lib/vapi_server_sdk/types/cloudflare_credential.rb @@ -0,0 +1,142 @@ +# frozen_string_literal: true + +require "date" +require_relative "cloudflare_r_2_bucket_plan" +require "ostruct" +require "json" + +module Vapi + class CloudflareCredential + # @return [String] Credential provider. Only allowed value is cloudflare + attr_reader :provider + # @return [String] Cloudflare Account Id. + attr_reader :account_id + # @return [String] Cloudflare API Key / Token. + attr_reader :api_key + # @return [String] Cloudflare Account Email. + attr_reader :account_email + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [Vapi::CloudflareR2BucketPlan] This is the bucket plan that can be provided to store call artifacts in R2 + attr_reader :bucket_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] Credential provider. Only allowed value is cloudflare + # @param account_id [String] Cloudflare Account Id. + # @param api_key [String] Cloudflare API Key / Token. + # @param account_email [String] Cloudflare Account Email. + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. + # @param bucket_plan [Vapi::CloudflareR2BucketPlan] This is the bucket plan that can be provided to store call artifacts in R2 + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CloudflareCredential] + def initialize(provider:, id:, org_id:, created_at:, updated_at:, account_id: OMIT, api_key: OMIT, + account_email: OMIT, name: OMIT, bucket_plan: OMIT, additional_properties: nil) + @provider = provider + @account_id = account_id if account_id != OMIT + @api_key = api_key if api_key != OMIT + @account_email = account_email if account_email != OMIT + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @name = name if name != OMIT + @bucket_plan = bucket_plan if bucket_plan != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "accountId": account_id, + "apiKey": api_key, + "accountEmail": account_email, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "name": name, + "bucketPlan": bucket_plan + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CloudflareCredential + # + # @param json_object [String] + # @return [Vapi::CloudflareCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + account_id = parsed_json["accountId"] + api_key = parsed_json["apiKey"] + account_email = parsed_json["accountEmail"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] + if parsed_json["bucketPlan"].nil? + bucket_plan = nil + else + bucket_plan = parsed_json["bucketPlan"].to_json + bucket_plan = Vapi::CloudflareR2BucketPlan.from_json(json_object: bucket_plan) + end + new( + provider: provider, + account_id: account_id, + api_key: api_key, + account_email: account_email, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + name: name, + bucket_plan: bucket_plan, + additional_properties: struct + ) + end + + # Serialize an instance of CloudflareCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.account_id&.is_a?(String) != false || raise("Passed value for field obj.account_id is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.account_email&.is_a?(String) != false || raise("Passed value for field obj.account_email is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.bucket_plan.nil? || Vapi::CloudflareR2BucketPlan.validate_raw(obj: obj.bucket_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb b/lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb new file mode 100644 index 0000000..32f925a --- /dev/null +++ b/lib/vapi_server_sdk/types/cloudflare_r_2_bucket_plan.rb @@ -0,0 +1,105 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class CloudflareR2BucketPlan + # @return [String] Cloudflare R2 Access key ID. + attr_reader :access_key_id + # @return [String] Cloudflare R2 access key secret. This is not returned in the API. + attr_reader :secret_access_key + # @return [String] Cloudflare R2 base url. + attr_reader :url + # @return [String] This is the name of the bucket. + attr_reader :name + # @return [String] This is the path where call artifacts will be stored. + # Usage: + # - To store call artifacts in a specific folder, set this to the full path. Eg. + # "/folder-name1/folder-name2". + # - To store call artifacts in the root of the bucket, leave this blank. + # @default "/" + attr_reader :path + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param access_key_id [String] Cloudflare R2 Access key ID. + # @param secret_access_key [String] Cloudflare R2 access key secret. This is not returned in the API. + # @param url [String] Cloudflare R2 base url. + # @param name [String] This is the name of the bucket. + # @param path [String] This is the path where call artifacts will be stored. + # Usage: + # - To store call artifacts in a specific folder, set this to the full path. Eg. + # "/folder-name1/folder-name2". + # - To store call artifacts in the root of the bucket, leave this blank. + # @default "/" + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CloudflareR2BucketPlan] + def initialize(name:, access_key_id: OMIT, secret_access_key: OMIT, url: OMIT, path: OMIT, + additional_properties: nil) + @access_key_id = access_key_id if access_key_id != OMIT + @secret_access_key = secret_access_key if secret_access_key != OMIT + @url = url if url != OMIT + @name = name + @path = path if path != OMIT + @additional_properties = additional_properties + @_field_set = { + "accessKeyId": access_key_id, + "secretAccessKey": secret_access_key, + "url": url, + "name": name, + "path": path + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CloudflareR2BucketPlan + # + # @param json_object [String] + # @return [Vapi::CloudflareR2BucketPlan] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + access_key_id = parsed_json["accessKeyId"] + secret_access_key = parsed_json["secretAccessKey"] + url = parsed_json["url"] + name = parsed_json["name"] + path = parsed_json["path"] + new( + access_key_id: access_key_id, + secret_access_key: secret_access_key, + url: url, + name: name, + path: path, + additional_properties: struct + ) + end + + # Serialize an instance of CloudflareR2BucketPlan to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.access_key_id&.is_a?(String) != false || raise("Passed value for field obj.access_key_id is not the expected type, validation failed.") + obj.secret_access_key&.is_a?(String) != false || raise("Passed value for field obj.secret_access_key is not the expected type, validation failed.") + obj.url&.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.") + obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.path&.is_a?(String) != false || raise("Passed value for field obj.path is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_anthropic_credential_dto.rb b/lib/vapi_server_sdk/types/create_anthropic_credential_dto.rb index 8019457..82abd9c 100644 --- a/lib/vapi_server_sdk/types/create_anthropic_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_anthropic_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateAnthropicCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateAnthropicCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateAnthropicCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_anyscale_credential_dto.rb b/lib/vapi_server_sdk/types/create_anyscale_credential_dto.rb index 200ed6f..a1a7f3f 100644 --- a/lib/vapi_server_sdk/types/create_anyscale_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_anyscale_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateAnyscaleCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateAnyscaleCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateAnyscaleCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_assembly_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_assembly_ai_credential_dto.rb index 367f7c4..09b11d7 100644 --- a/lib/vapi_server_sdk/types/create_assembly_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_assembly_ai_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateAssemblyAiCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateAssemblyAiCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateAssemblyAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_assistant_dto.rb b/lib/vapi_server_sdk/types/create_assistant_dto.rb index bab52bb..2d958ac 100644 --- a/lib/vapi_server_sdk/types/create_assistant_dto.rb +++ b/lib/vapi_server_sdk/types/create_assistant_dto.rb @@ -8,6 +8,7 @@ require_relative "create_assistant_dto_server_messages_item" require_relative "create_assistant_dto_background_sound" require_relative "transport_configuration_twilio" +require_relative "create_assistant_dto_credentials_item" require_relative "twilio_voicemail_detection" require_relative "analysis_plan" require_relative "artifact_plan" @@ -79,6 +80,11 @@ class CreateAssistantDto # different transport providers. For a call, only the configuration matching the # call transport provider is used. attr_reader :transport_configurations + # @return [Array] These are dynamic credentials that will be used for the assistant calls. By + # default, all the credentials are available for use in the call but you can + # supplement an additional credentials using this. Dynamic credentials override + # existing credentials. + attr_reader :credentials # @return [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. attr_reader :name @@ -206,6 +212,10 @@ class CreateAssistantDto # assistant's calls, like Twilio. You can store multiple configurations for # different transport providers. For a call, only the configuration matching the # call transport provider is used. + # @param credentials [Array] These are dynamic credentials that will be used for the assistant calls. By + # default, all the credentials are available for use in the call but you can + # supplement an additional credentials using this. Dynamic credentials override + # existing credentials. # @param name [String] This is the name of the assistant. # This is required when you want to transfer between assistants in a call. # @param voicemail_detection [Vapi::TwilioVoicemailDetection] These are the settings to configure or disable voicemail detection. @@ -270,7 +280,7 @@ class CreateAssistantDto # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateAssistantDto] def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message: OMIT, first_message_mode: OMIT, - hipaa_enabled: OMIT, client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, name: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, server: OMIT, additional_properties: nil) + hipaa_enabled: OMIT, client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, credentials: OMIT, name: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, server: OMIT, additional_properties: nil) @transcriber = transcriber if transcriber != OMIT @model = model if model != OMIT @voice = voice if voice != OMIT @@ -285,6 +295,7 @@ def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message: OMIT, @background_denoising_enabled = background_denoising_enabled if background_denoising_enabled != OMIT @model_output_in_messages_enabled = model_output_in_messages_enabled if model_output_in_messages_enabled != OMIT @transport_configurations = transport_configurations if transport_configurations != OMIT + @credentials = credentials if credentials != OMIT @name = name if name != OMIT @voicemail_detection = voicemail_detection if voicemail_detection != OMIT @voicemail_message = voicemail_message if voicemail_message != OMIT @@ -315,6 +326,7 @@ def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message: OMIT, "backgroundDenoisingEnabled": background_denoising_enabled, "modelOutputInMessagesEnabled": model_output_in_messages_enabled, "transportConfigurations": transport_configurations, + "credentials": credentials, "name": name, "voicemailDetection": voicemail_detection, "voicemailMessage": voicemail_message, @@ -373,6 +385,10 @@ def self.from_json(json_object:) item = item.to_json Vapi::TransportConfigurationTwilio.from_json(json_object: item) end + credentials = parsed_json["credentials"]&.map do |item| + item = item.to_json + Vapi::CreateAssistantDtoCredentialsItem.from_json(json_object: item) + end name = parsed_json["name"] if parsed_json["voicemailDetection"].nil? voicemail_detection = nil @@ -442,6 +458,7 @@ def self.from_json(json_object:) background_denoising_enabled: background_denoising_enabled, model_output_in_messages_enabled: model_output_in_messages_enabled, transport_configurations: transport_configurations, + credentials: credentials, name: name, voicemail_detection: voicemail_detection, voicemail_message: voicemail_message, @@ -488,6 +505,7 @@ def self.validate_raw(obj:) obj.background_denoising_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.background_denoising_enabled is not the expected type, validation failed.") obj.model_output_in_messages_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.model_output_in_messages_enabled is not the expected type, validation failed.") obj.transport_configurations&.is_a?(Array) != false || raise("Passed value for field obj.transport_configurations is not the expected type, validation failed.") + obj.credentials&.is_a?(Array) != false || raise("Passed value for field obj.credentials is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.voicemail_detection.nil? || Vapi::TwilioVoicemailDetection.validate_raw(obj: obj.voicemail_detection) obj.voicemail_message&.is_a?(String) != false || raise("Passed value for field obj.voicemail_message is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_assistant_dto_credentials_item.rb b/lib/vapi_server_sdk/types/create_assistant_dto_credentials_item.rb new file mode 100644 index 0000000..308ac1a --- /dev/null +++ b/lib/vapi_server_sdk/types/create_assistant_dto_credentials_item.rb @@ -0,0 +1,510 @@ +# frozen_string_literal: true + +require "json" +require_relative "create_anthropic_credential_dto" +require_relative "create_anyscale_credential_dto" +require_relative "create_assembly_ai_credential_dto" +require_relative "create_azure_open_ai_credential_dto" +require_relative "create_azure_credential_dto" +require_relative "create_byo_sip_trunk_credential_dto" +require_relative "create_cartesia_credential_dto" +require_relative "create_cloudflare_credential_dto" +require_relative "create_custom_llm_credential_dto" +require_relative "create_deepgram_credential_dto" +require_relative "create_deep_infra_credential_dto" +require_relative "create_deep_seek_credential_dto" +require_relative "create_eleven_labs_credential_dto" +require_relative "create_gcp_credential_dto" +require_relative "create_gladia_credential_dto" +require_relative "create_go_high_level_credential_dto" +require_relative "create_groq_credential_dto" +require_relative "create_langfuse_credential_dto" +require_relative "create_lmnt_credential_dto" +require_relative "create_make_credential_dto" +require_relative "create_open_ai_credential_dto" +require_relative "create_open_router_credential_dto" +require_relative "create_perplexity_ai_credential_dto" +require_relative "create_play_ht_credential_dto" +require_relative "create_rime_ai_credential_dto" +require_relative "create_runpod_credential_dto" +require_relative "create_s_3_credential_dto" +require_relative "create_smallest_ai_credential_dto" +require_relative "create_tavus_credential_dto" +require_relative "create_together_ai_credential_dto" +require_relative "create_twilio_credential_dto" +require_relative "create_vonage_credential_dto" +require_relative "create_webhook_credential_dto" +require_relative "create_x_ai_credential_dto" + +module Vapi + class CreateAssistantDtoCredentialsItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of CreateAssistantDtoCredentialsItem + # + # @param json_object [String] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.provider + when "anthropic" + Vapi::CreateAnthropicCredentialDto.from_json(json_object: json_object) + when "anyscale" + Vapi::CreateAnyscaleCredentialDto.from_json(json_object: json_object) + when "assembly-ai" + Vapi::CreateAssemblyAiCredentialDto.from_json(json_object: json_object) + when "azure-openai" + Vapi::CreateAzureOpenAiCredentialDto.from_json(json_object: json_object) + when "azure" + Vapi::CreateAzureCredentialDto.from_json(json_object: json_object) + when "byo-sip-trunk" + Vapi::CreateByoSipTrunkCredentialDto.from_json(json_object: json_object) + when "cartesia" + Vapi::CreateCartesiaCredentialDto.from_json(json_object: json_object) + when "cloudflare" + Vapi::CreateCloudflareCredentialDto.from_json(json_object: json_object) + when "custom-llm" + Vapi::CreateCustomLlmCredentialDto.from_json(json_object: json_object) + when "deepgram" + Vapi::CreateDeepgramCredentialDto.from_json(json_object: json_object) + when "deepinfra" + Vapi::CreateDeepInfraCredentialDto.from_json(json_object: json_object) + when "deep-seek" + Vapi::CreateDeepSeekCredentialDto.from_json(json_object: json_object) + when "11labs" + Vapi::CreateElevenLabsCredentialDto.from_json(json_object: json_object) + when "gcp" + Vapi::CreateGcpCredentialDto.from_json(json_object: json_object) + when "gladia" + Vapi::CreateGladiaCredentialDto.from_json(json_object: json_object) + when "gohighlevel" + Vapi::CreateGoHighLevelCredentialDto.from_json(json_object: json_object) + when "groq" + Vapi::CreateGroqCredentialDto.from_json(json_object: json_object) + when "langfuse" + Vapi::CreateLangfuseCredentialDto.from_json(json_object: json_object) + when "lmnt" + Vapi::CreateLmntCredentialDto.from_json(json_object: json_object) + when "make" + Vapi::CreateMakeCredentialDto.from_json(json_object: json_object) + when "openai" + Vapi::CreateOpenAiCredentialDto.from_json(json_object: json_object) + when "openrouter" + Vapi::CreateOpenRouterCredentialDto.from_json(json_object: json_object) + when "perplexity-ai" + Vapi::CreatePerplexityAiCredentialDto.from_json(json_object: json_object) + when "playht" + Vapi::CreatePlayHtCredentialDto.from_json(json_object: json_object) + when "rime-ai" + Vapi::CreateRimeAiCredentialDto.from_json(json_object: json_object) + when "runpod" + Vapi::CreateRunpodCredentialDto.from_json(json_object: json_object) + when "s3" + Vapi::CreateS3CredentialDto.from_json(json_object: json_object) + when "smallest-ai" + Vapi::CreateSmallestAiCredentialDto.from_json(json_object: json_object) + when "tavus" + Vapi::CreateTavusCredentialDto.from_json(json_object: json_object) + when "together-ai" + Vapi::CreateTogetherAiCredentialDto.from_json(json_object: json_object) + when "twilio" + Vapi::CreateTwilioCredentialDto.from_json(json_object: json_object) + when "vonage" + Vapi::CreateVonageCredentialDto.from_json(json_object: json_object) + when "webhook" + Vapi::CreateWebhookCredentialDto.from_json(json_object: json_object) + when "xai" + Vapi::CreateXAiCredentialDto.from_json(json_object: json_object) + else + Vapi::CreateAnthropicCredentialDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.provider) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "anthropic" + { **@member.to_json, provider: @discriminant }.to_json + when "anyscale" + { **@member.to_json, provider: @discriminant }.to_json + when "assembly-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "azure-openai" + { **@member.to_json, provider: @discriminant }.to_json + when "azure" + { **@member.to_json, provider: @discriminant }.to_json + when "byo-sip-trunk" + { **@member.to_json, provider: @discriminant }.to_json + when "cartesia" + { **@member.to_json, provider: @discriminant }.to_json + when "cloudflare" + { **@member.to_json, provider: @discriminant }.to_json + when "custom-llm" + { **@member.to_json, provider: @discriminant }.to_json + when "deepgram" + { **@member.to_json, provider: @discriminant }.to_json + when "deepinfra" + { **@member.to_json, provider: @discriminant }.to_json + when "deep-seek" + { **@member.to_json, provider: @discriminant }.to_json + when "11labs" + { **@member.to_json, provider: @discriminant }.to_json + when "gcp" + { **@member.to_json, provider: @discriminant }.to_json + when "gladia" + { **@member.to_json, provider: @discriminant }.to_json + when "gohighlevel" + { **@member.to_json, provider: @discriminant }.to_json + when "groq" + { **@member.to_json, provider: @discriminant }.to_json + when "langfuse" + { **@member.to_json, provider: @discriminant }.to_json + when "lmnt" + { **@member.to_json, provider: @discriminant }.to_json + when "make" + { **@member.to_json, provider: @discriminant }.to_json + when "openai" + { **@member.to_json, provider: @discriminant }.to_json + when "openrouter" + { **@member.to_json, provider: @discriminant }.to_json + when "perplexity-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "playht" + { **@member.to_json, provider: @discriminant }.to_json + when "rime-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "runpod" + { **@member.to_json, provider: @discriminant }.to_json + when "s3" + { **@member.to_json, provider: @discriminant }.to_json + when "smallest-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "tavus" + { **@member.to_json, provider: @discriminant }.to_json + when "together-ai" + { **@member.to_json, provider: @discriminant }.to_json + when "twilio" + { **@member.to_json, provider: @discriminant }.to_json + when "vonage" + { **@member.to_json, provider: @discriminant }.to_json + when "webhook" + { **@member.to_json, provider: @discriminant }.to_json + when "xai" + { **@member.to_json, provider: @discriminant }.to_json + else + { "provider": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.provider + when "anthropic" + Vapi::CreateAnthropicCredentialDto.validate_raw(obj: obj) + when "anyscale" + Vapi::CreateAnyscaleCredentialDto.validate_raw(obj: obj) + when "assembly-ai" + Vapi::CreateAssemblyAiCredentialDto.validate_raw(obj: obj) + when "azure-openai" + Vapi::CreateAzureOpenAiCredentialDto.validate_raw(obj: obj) + when "azure" + Vapi::CreateAzureCredentialDto.validate_raw(obj: obj) + when "byo-sip-trunk" + Vapi::CreateByoSipTrunkCredentialDto.validate_raw(obj: obj) + when "cartesia" + Vapi::CreateCartesiaCredentialDto.validate_raw(obj: obj) + when "cloudflare" + Vapi::CreateCloudflareCredentialDto.validate_raw(obj: obj) + when "custom-llm" + Vapi::CreateCustomLlmCredentialDto.validate_raw(obj: obj) + when "deepgram" + Vapi::CreateDeepgramCredentialDto.validate_raw(obj: obj) + when "deepinfra" + Vapi::CreateDeepInfraCredentialDto.validate_raw(obj: obj) + when "deep-seek" + Vapi::CreateDeepSeekCredentialDto.validate_raw(obj: obj) + when "11labs" + Vapi::CreateElevenLabsCredentialDto.validate_raw(obj: obj) + when "gcp" + Vapi::CreateGcpCredentialDto.validate_raw(obj: obj) + when "gladia" + Vapi::CreateGladiaCredentialDto.validate_raw(obj: obj) + when "gohighlevel" + Vapi::CreateGoHighLevelCredentialDto.validate_raw(obj: obj) + when "groq" + Vapi::CreateGroqCredentialDto.validate_raw(obj: obj) + when "langfuse" + Vapi::CreateLangfuseCredentialDto.validate_raw(obj: obj) + when "lmnt" + Vapi::CreateLmntCredentialDto.validate_raw(obj: obj) + when "make" + Vapi::CreateMakeCredentialDto.validate_raw(obj: obj) + when "openai" + Vapi::CreateOpenAiCredentialDto.validate_raw(obj: obj) + when "openrouter" + Vapi::CreateOpenRouterCredentialDto.validate_raw(obj: obj) + when "perplexity-ai" + Vapi::CreatePerplexityAiCredentialDto.validate_raw(obj: obj) + when "playht" + Vapi::CreatePlayHtCredentialDto.validate_raw(obj: obj) + when "rime-ai" + Vapi::CreateRimeAiCredentialDto.validate_raw(obj: obj) + when "runpod" + Vapi::CreateRunpodCredentialDto.validate_raw(obj: obj) + when "s3" + Vapi::CreateS3CredentialDto.validate_raw(obj: obj) + when "smallest-ai" + Vapi::CreateSmallestAiCredentialDto.validate_raw(obj: obj) + when "tavus" + Vapi::CreateTavusCredentialDto.validate_raw(obj: obj) + when "together-ai" + Vapi::CreateTogetherAiCredentialDto.validate_raw(obj: obj) + when "twilio" + Vapi::CreateTwilioCredentialDto.validate_raw(obj: obj) + when "vonage" + Vapi::CreateVonageCredentialDto.validate_raw(obj: obj) + when "webhook" + Vapi::CreateWebhookCredentialDto.validate_raw(obj: obj) + when "xai" + Vapi::CreateXAiCredentialDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::CreateAnthropicCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.anthropic(member:) + new(member: member, discriminant: "anthropic") + end + + # @param member [Vapi::CreateAnyscaleCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.anyscale(member:) + new(member: member, discriminant: "anyscale") + end + + # @param member [Vapi::CreateAssemblyAiCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.assembly_ai(member:) + new(member: member, discriminant: "assembly-ai") + end + + # @param member [Vapi::CreateAzureOpenAiCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.azure_openai(member:) + new(member: member, discriminant: "azure-openai") + end + + # @param member [Vapi::CreateAzureCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.azure(member:) + new(member: member, discriminant: "azure") + end + + # @param member [Vapi::CreateByoSipTrunkCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.byo_sip_trunk(member:) + new(member: member, discriminant: "byo-sip-trunk") + end + + # @param member [Vapi::CreateCartesiaCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.cartesia(member:) + new(member: member, discriminant: "cartesia") + end + + # @param member [Vapi::CreateCloudflareCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.cloudflare(member:) + new(member: member, discriminant: "cloudflare") + end + + # @param member [Vapi::CreateCustomLlmCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.custom_llm(member:) + new(member: member, discriminant: "custom-llm") + end + + # @param member [Vapi::CreateDeepgramCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.deepgram(member:) + new(member: member, discriminant: "deepgram") + end + + # @param member [Vapi::CreateDeepInfraCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.deepinfra(member:) + new(member: member, discriminant: "deepinfra") + end + + # @param member [Vapi::CreateDeepSeekCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.deep_seek(member:) + new(member: member, discriminant: "deep-seek") + end + + # @param member [Vapi::CreateElevenLabsCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self._11_labs(member:) + new(member: member, discriminant: "11labs") + end + + # @param member [Vapi::CreateGcpCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.gcp(member:) + new(member: member, discriminant: "gcp") + end + + # @param member [Vapi::CreateGladiaCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.gladia(member:) + new(member: member, discriminant: "gladia") + end + + # @param member [Vapi::CreateGoHighLevelCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.gohighlevel(member:) + new(member: member, discriminant: "gohighlevel") + end + + # @param member [Vapi::CreateGroqCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.groq(member:) + new(member: member, discriminant: "groq") + end + + # @param member [Vapi::CreateLangfuseCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.langfuse(member:) + new(member: member, discriminant: "langfuse") + end + + # @param member [Vapi::CreateLmntCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.lmnt(member:) + new(member: member, discriminant: "lmnt") + end + + # @param member [Vapi::CreateMakeCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.make(member:) + new(member: member, discriminant: "make") + end + + # @param member [Vapi::CreateOpenAiCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.openai(member:) + new(member: member, discriminant: "openai") + end + + # @param member [Vapi::CreateOpenRouterCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.openrouter(member:) + new(member: member, discriminant: "openrouter") + end + + # @param member [Vapi::CreatePerplexityAiCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.perplexity_ai(member:) + new(member: member, discriminant: "perplexity-ai") + end + + # @param member [Vapi::CreatePlayHtCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.playht(member:) + new(member: member, discriminant: "playht") + end + + # @param member [Vapi::CreateRimeAiCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.rime_ai(member:) + new(member: member, discriminant: "rime-ai") + end + + # @param member [Vapi::CreateRunpodCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.runpod(member:) + new(member: member, discriminant: "runpod") + end + + # @param member [Vapi::CreateS3CredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.s_3(member:) + new(member: member, discriminant: "s3") + end + + # @param member [Vapi::CreateSmallestAiCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.smallest_ai(member:) + new(member: member, discriminant: "smallest-ai") + end + + # @param member [Vapi::CreateTavusCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.tavus(member:) + new(member: member, discriminant: "tavus") + end + + # @param member [Vapi::CreateTogetherAiCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.together_ai(member:) + new(member: member, discriminant: "together-ai") + end + + # @param member [Vapi::CreateTwilioCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.twilio(member:) + new(member: member, discriminant: "twilio") + end + + # @param member [Vapi::CreateVonageCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.vonage(member:) + new(member: member, discriminant: "vonage") + end + + # @param member [Vapi::CreateWebhookCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.webhook(member:) + new(member: member, discriminant: "webhook") + end + + # @param member [Vapi::CreateXAiCredentialDto] + # @return [Vapi::CreateAssistantDtoCredentialsItem] + def self.xai(member:) + new(member: member, discriminant: "xai") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_assistant_dto_model.rb b/lib/vapi_server_sdk/types/create_assistant_dto_model.rb index a4d26b4..5dc863f 100644 --- a/lib/vapi_server_sdk/types/create_assistant_dto_model.rb +++ b/lib/vapi_server_sdk/types/create_assistant_dto_model.rb @@ -8,6 +8,7 @@ require_relative "google_model" require_relative "groq_model" require_relative "inflection_ai_model" +require_relative "deep_seek_model" require_relative "open_ai_model" require_relative "open_router_model" require_relative "perplexity_ai_model" @@ -55,6 +56,8 @@ def self.from_json(json_object:) Vapi::GroqModel.from_json(json_object: json_object) when "inflection-ai" Vapi::InflectionAiModel.from_json(json_object: json_object) + when "deep-seek" + Vapi::DeepSeekModel.from_json(json_object: json_object) when "openai" Vapi::OpenAiModel.from_json(json_object: json_object) when "openrouter" @@ -92,6 +95,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "inflection-ai" { **@member.to_json, provider: @discriminant }.to_json + when "deep-seek" + { **@member.to_json, provider: @discriminant }.to_json when "openai" { **@member.to_json, provider: @discriminant }.to_json when "openrouter" @@ -132,6 +137,8 @@ def self.validate_raw(obj:) Vapi::GroqModel.validate_raw(obj: obj) when "inflection-ai" Vapi::InflectionAiModel.validate_raw(obj: obj) + when "deep-seek" + Vapi::DeepSeekModel.validate_raw(obj: obj) when "openai" Vapi::OpenAiModel.validate_raw(obj: obj) when "openrouter" @@ -199,6 +206,12 @@ def self.inflection_ai(member:) new(member: member, discriminant: "inflection-ai") end + # @param member [Vapi::DeepSeekModel] + # @return [Vapi::CreateAssistantDtoModel] + def self.deep_seek(member:) + new(member: member, discriminant: "deep-seek") + end + # @param member [Vapi::OpenAiModel] # @return [Vapi::CreateAssistantDtoModel] def self.openai(member:) diff --git a/lib/vapi_server_sdk/types/create_assistant_dto_transcriber.rb b/lib/vapi_server_sdk/types/create_assistant_dto_transcriber.rb index 785f4a9..c300eb3 100644 --- a/lib/vapi_server_sdk/types/create_assistant_dto_transcriber.rb +++ b/lib/vapi_server_sdk/types/create_assistant_dto_transcriber.rb @@ -2,6 +2,7 @@ require "json" require_relative "assembly_ai_transcriber" +require_relative "azure_speech_transcriber" require_relative "custom_transcriber" require_relative "deepgram_transcriber" require_relative "gladia_transcriber" @@ -35,6 +36,8 @@ def self.from_json(json_object:) member = case struct.provider when "assembly-ai" Vapi::AssemblyAiTranscriber.from_json(json_object: json_object) + when "azure" + Vapi::AzureSpeechTranscriber.from_json(json_object: json_object) when "custom-transcriber" Vapi::CustomTranscriber.from_json(json_object: json_object) when "deepgram" @@ -56,6 +59,8 @@ def to_json(*_args) case @discriminant when "assembly-ai" { **@member.to_json, provider: @discriminant }.to_json + when "azure" + { **@member.to_json, provider: @discriminant }.to_json when "custom-transcriber" { **@member.to_json, provider: @discriminant }.to_json when "deepgram" @@ -80,6 +85,8 @@ def self.validate_raw(obj:) case obj.provider when "assembly-ai" Vapi::AssemblyAiTranscriber.validate_raw(obj: obj) + when "azure" + Vapi::AzureSpeechTranscriber.validate_raw(obj: obj) when "custom-transcriber" Vapi::CustomTranscriber.validate_raw(obj: obj) when "deepgram" @@ -107,6 +114,12 @@ def self.assembly_ai(member:) new(member: member, discriminant: "assembly-ai") end + # @param member [Vapi::AzureSpeechTranscriber] + # @return [Vapi::CreateAssistantDtoTranscriber] + def self.azure(member:) + new(member: member, discriminant: "azure") + end + # @param member [Vapi::CustomTranscriber] # @return [Vapi::CreateAssistantDtoTranscriber] def self.custom_transcriber(member:) diff --git a/lib/vapi_server_sdk/types/create_assistant_dto_voice.rb b/lib/vapi_server_sdk/types/create_assistant_dto_voice.rb index 5b2e357..ef35fe8 100644 --- a/lib/vapi_server_sdk/types/create_assistant_dto_voice.rb +++ b/lib/vapi_server_sdk/types/create_assistant_dto_voice.rb @@ -11,6 +11,7 @@ require_relative "open_ai_voice" require_relative "play_ht_voice" require_relative "rime_ai_voice" +require_relative "smallest_ai_voice" require_relative "tavus_voice" module Vapi @@ -59,6 +60,8 @@ def self.from_json(json_object:) Vapi::PlayHtVoice.from_json(json_object: json_object) when "rime-ai" Vapi::RimeAiVoice.from_json(json_object: json_object) + when "smallest-ai" + Vapi::SmallestAiVoice.from_json(json_object: json_object) when "tavus" Vapi::TavusVoice.from_json(json_object: json_object) else @@ -92,6 +95,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "rime-ai" { **@member.to_json, provider: @discriminant }.to_json + when "smallest-ai" + { **@member.to_json, provider: @discriminant }.to_json when "tavus" { **@member.to_json, provider: @discriminant }.to_json else @@ -128,6 +133,8 @@ def self.validate_raw(obj:) Vapi::PlayHtVoice.validate_raw(obj: obj) when "rime-ai" Vapi::RimeAiVoice.validate_raw(obj: obj) + when "smallest-ai" + Vapi::SmallestAiVoice.validate_raw(obj: obj) when "tavus" Vapi::TavusVoice.validate_raw(obj: obj) else @@ -203,6 +210,12 @@ def self.rime_ai(member:) new(member: member, discriminant: "rime-ai") end + # @param member [Vapi::SmallestAiVoice] + # @return [Vapi::CreateAssistantDtoVoice] + def self.smallest_ai(member:) + new(member: member, discriminant: "smallest-ai") + end + # @param member [Vapi::TavusVoice] # @return [Vapi::CreateAssistantDtoVoice] def self.tavus(member:) diff --git a/lib/vapi_server_sdk/types/create_azure_credential_dto.rb b/lib/vapi_server_sdk/types/create_azure_credential_dto.rb index ae99190..00d5382 100644 --- a/lib/vapi_server_sdk/types/create_azure_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_azure_credential_dto.rb @@ -1,19 +1,22 @@ # frozen_string_literal: true +require_relative "create_azure_credential_dto_service" require_relative "create_azure_credential_dto_region" +require_relative "azure_blob_storage_bucket_plan" require "ostruct" require "json" module Vapi class CreateAzureCredentialDto - # @return [String] - attr_reader :provider - # @return [String] This is the service being used in Azure. + # @return [Vapi::CreateAzureCredentialDtoService] This is the service being used in Azure. attr_reader :service # @return [Vapi::CreateAzureCredentialDtoRegion] This is the region of the Azure resource. attr_reader :region # @return [String] This is not returned in the API. attr_reader :api_key + # @return [Vapi::AzureBlobStorageBucketPlan] This is the bucket plan that can be provided to store call artifacts in Azure + # Blob Storage. + attr_reader :bucket_plan # @return [String] This is the name of credential. This is just for your reference. attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition @@ -24,25 +27,26 @@ class CreateAzureCredentialDto OMIT = Object.new - # @param provider [String] - # @param service [String] This is the service being used in Azure. + # @param service [Vapi::CreateAzureCredentialDtoService] This is the service being used in Azure. # @param region [Vapi::CreateAzureCredentialDtoRegion] This is the region of the Azure resource. # @param api_key [String] This is not returned in the API. + # @param bucket_plan [Vapi::AzureBlobStorageBucketPlan] This is the bucket plan that can be provided to store call artifacts in Azure + # Blob Storage. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateAzureCredentialDto] - def initialize(provider:, service:, region: OMIT, api_key: OMIT, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(service:, region: OMIT, api_key: OMIT, bucket_plan: OMIT, name: OMIT, additional_properties: nil) @service = service @region = region if region != OMIT @api_key = api_key if api_key != OMIT + @bucket_plan = bucket_plan if bucket_plan != OMIT @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { - "provider": provider, "service": service, "region": region, "apiKey": api_key, + "bucketPlan": bucket_plan, "name": name }.reject do |_k, v| v == OMIT @@ -56,16 +60,21 @@ def initialize(provider:, service:, region: OMIT, api_key: OMIT, name: OMIT, add def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] service = parsed_json["service"] region = parsed_json["region"] api_key = parsed_json["apiKey"] + if parsed_json["bucketPlan"].nil? + bucket_plan = nil + else + bucket_plan = parsed_json["bucketPlan"].to_json + bucket_plan = Vapi::AzureBlobStorageBucketPlan.from_json(json_object: bucket_plan) + end name = parsed_json["name"] new( - provider: provider, service: service, region: region, api_key: api_key, + bucket_plan: bucket_plan, name: name, additional_properties: struct ) @@ -85,10 +94,10 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.service.is_a?(String) != false || raise("Passed value for field obj.service is not the expected type, validation failed.") + obj.service.is_a?(Vapi::CreateAzureCredentialDtoService) != false || raise("Passed value for field obj.service is not the expected type, validation failed.") obj.region&.is_a?(Vapi::CreateAzureCredentialDtoRegion) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.bucket_plan.nil? || Vapi::AzureBlobStorageBucketPlan.validate_raw(obj: obj.bucket_plan) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb b/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb index fc733fc..89f4748 100644 --- a/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb +++ b/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb @@ -14,7 +14,7 @@ class CreateAzureCredentialDtoRegion NORTHCENTRALUS = "northcentralus" NORWAY = "norway" SOUTHCENTRALUS = "southcentralus" - SWEDEN = "sweden" + SWEDENCENTRAL = "swedencentral" SWITZERLAND = "switzerland" UK = "uk" WESTUS = "westus" diff --git a/lib/vapi_server_sdk/types/create_azure_credential_dto_service.rb b/lib/vapi_server_sdk/types/create_azure_credential_dto_service.rb new file mode 100644 index 0000000..e5e719c --- /dev/null +++ b/lib/vapi_server_sdk/types/create_azure_credential_dto_service.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Vapi + # This is the service being used in Azure. + class CreateAzureCredentialDtoService + SPEECH = "speech" + BLOB_STORAGE = "blob_storage" + end +end diff --git a/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto.rb index 0ed3b38..f5e45c0 100644 --- a/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto.rb @@ -7,14 +7,14 @@ module Vapi class CreateAzureOpenAiCredentialDto - # @return [String] - attr_reader :provider # @return [Vapi::CreateAzureOpenAiCredentialDtoRegion] attr_reader :region # @return [Array] attr_reader :models # @return [String] This is not returned in the API. attr_reader :open_ai_key + # @return [String] This is not returned in the API. + attr_reader :ocp_apim_subscription_key # @return [String] attr_reader :open_ai_endpoint # @return [String] This is the name of credential. This is just for your reference. @@ -27,27 +27,28 @@ class CreateAzureOpenAiCredentialDto OMIT = Object.new - # @param provider [String] # @param region [Vapi::CreateAzureOpenAiCredentialDtoRegion] # @param models [Array] # @param open_ai_key [String] This is not returned in the API. + # @param ocp_apim_subscription_key [String] This is not returned in the API. # @param open_ai_endpoint [String] # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateAzureOpenAiCredentialDto] - def initialize(provider:, region:, models:, open_ai_key:, open_ai_endpoint:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(region:, models:, open_ai_key:, open_ai_endpoint:, ocp_apim_subscription_key: OMIT, name: OMIT, + additional_properties: nil) @region = region @models = models @open_ai_key = open_ai_key + @ocp_apim_subscription_key = ocp_apim_subscription_key if ocp_apim_subscription_key != OMIT @open_ai_endpoint = open_ai_endpoint @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { - "provider": provider, "region": region, "models": models, "openAIKey": open_ai_key, + "ocpApimSubscriptionKey": ocp_apim_subscription_key, "openAIEndpoint": open_ai_endpoint, "name": name }.reject do |_k, v| @@ -62,17 +63,17 @@ def initialize(provider:, region:, models:, open_ai_key:, open_ai_endpoint:, nam def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] region = parsed_json["region"] models = parsed_json["models"] open_ai_key = parsed_json["openAIKey"] + ocp_apim_subscription_key = parsed_json["ocpApimSubscriptionKey"] open_ai_endpoint = parsed_json["openAIEndpoint"] name = parsed_json["name"] new( - provider: provider, region: region, models: models, open_ai_key: open_ai_key, + ocp_apim_subscription_key: ocp_apim_subscription_key, open_ai_endpoint: open_ai_endpoint, name: name, additional_properties: struct @@ -93,10 +94,10 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.region.is_a?(Vapi::CreateAzureOpenAiCredentialDtoRegion) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") obj.models.is_a?(Array) != false || raise("Passed value for field obj.models is not the expected type, validation failed.") obj.open_ai_key.is_a?(String) != false || raise("Passed value for field obj.open_ai_key is not the expected type, validation failed.") + obj.ocp_apim_subscription_key&.is_a?(String) != false || raise("Passed value for field obj.ocp_apim_subscription_key is not the expected type, validation failed.") obj.open_ai_endpoint.is_a?(String) != false || raise("Passed value for field obj.open_ai_endpoint is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb b/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb index efbfd9e..fca02c7 100644 --- a/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb +++ b/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb @@ -13,7 +13,7 @@ class CreateAzureOpenAiCredentialDtoRegion NORTHCENTRALUS = "northcentralus" NORWAY = "norway" SOUTHCENTRALUS = "southcentralus" - SWEDEN = "sweden" + SWEDENCENTRAL = "swedencentral" SWITZERLAND = "switzerland" UK = "uk" WESTUS = "westus" diff --git a/lib/vapi_server_sdk/types/create_byo_phone_number_dto.rb b/lib/vapi_server_sdk/types/create_byo_phone_number_dto.rb index 0bf3306..fd19442 100644 --- a/lib/vapi_server_sdk/types/create_byo_phone_number_dto.rb +++ b/lib/vapi_server_sdk/types/create_byo_phone_number_dto.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "create_byo_phone_number_dto_fallback_destination" +require_relative "server" require "ostruct" require "json" @@ -43,16 +44,13 @@ class CreateByoPhoneNumberDto # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. attr_reader :squad_id - # @return [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - attr_reader :server_url - # @return [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -91,18 +89,16 @@ class CreateByoPhoneNumberDto # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateByoPhoneNumberDto] def initialize(credential_id:, fallback_destination: OMIT, number_e_164_check_enabled: OMIT, number: OMIT, - name: OMIT, assistant_id: OMIT, squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) + name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @number_e_164_check_enabled = number_e_164_check_enabled if number_e_164_check_enabled != OMIT @number = number if number != OMIT @@ -110,8 +106,7 @@ def initialize(credential_id:, fallback_destination: OMIT, number_e_164_check_en @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, @@ -121,8 +116,7 @@ def initialize(credential_id:, fallback_destination: OMIT, number_e_164_check_en "name": name, "assistantId": assistant_id, "squadId": squad_id, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret + "server": server }.reject do |_k, v| v == OMIT end @@ -147,8 +141,12 @@ def self.from_json(json_object:) name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end new( fallback_destination: fallback_destination, number_e_164_check_enabled: number_e_164_check_enabled, @@ -157,8 +155,7 @@ def self.from_json(json_object:) name: name, assistant_id: assistant_id, squad_id: squad_id, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, additional_properties: struct ) end @@ -184,8 +181,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) end end end diff --git a/lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb b/lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb index 5ed4521..ea4d56e 100644 --- a/lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_byo_sip_trunk_credential_dto.rb @@ -8,8 +8,6 @@ module Vapi class CreateByoSipTrunkCredentialDto - # @return [String] This can be used to bring your own SIP trunks or to connect to a Carrier. - attr_reader :provider # @return [Array] This is the list of SIP trunk's gateways. attr_reader :gateways # @return [Vapi::SipTrunkOutboundAuthenticationPlan] This can be used to configure the outbound authentication if required by the SIP @@ -41,7 +39,6 @@ class CreateByoSipTrunkCredentialDto OMIT = Object.new - # @param provider [String] This can be used to bring your own SIP trunks or to connect to a Carrier. # @param gateways [Array] This is the list of SIP trunk's gateways. # @param outbound_authentication_plan [Vapi::SipTrunkOutboundAuthenticationPlan] This can be used to configure the outbound authentication if required by the SIP # trunk. @@ -60,9 +57,8 @@ class CreateByoSipTrunkCredentialDto # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateByoSipTrunkCredentialDto] - def initialize(gateways:, provider: OMIT, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, + def initialize(gateways:, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, tech_prefix: OMIT, sip_diversion_header: OMIT, sbc_configuration: OMIT, name: OMIT, additional_properties: nil) - @provider = provider if provider != OMIT @gateways = gateways @outbound_authentication_plan = outbound_authentication_plan if outbound_authentication_plan != OMIT @outbound_leading_plus_enabled = outbound_leading_plus_enabled if outbound_leading_plus_enabled != OMIT @@ -72,7 +68,6 @@ def initialize(gateways:, provider: OMIT, outbound_authentication_plan: OMIT, ou @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { - "provider": provider, "gateways": gateways, "outboundAuthenticationPlan": outbound_authentication_plan, "outboundLeadingPlusEnabled": outbound_leading_plus_enabled, @@ -92,7 +87,6 @@ def initialize(gateways:, provider: OMIT, outbound_authentication_plan: OMIT, ou def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] gateways = parsed_json["gateways"]&.map do |item| item = item.to_json Vapi::SipTrunkGateway.from_json(json_object: item) @@ -114,7 +108,6 @@ def self.from_json(json_object:) end name = parsed_json["name"] new( - provider: provider, gateways: gateways, outbound_authentication_plan: outbound_authentication_plan, outbound_leading_plus_enabled: outbound_leading_plus_enabled, @@ -140,7 +133,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider&.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.gateways.is_a?(Array) != false || raise("Passed value for field obj.gateways is not the expected type, validation failed.") obj.outbound_authentication_plan.nil? || Vapi::SipTrunkOutboundAuthenticationPlan.validate_raw(obj: obj.outbound_authentication_plan) obj.outbound_leading_plus_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.outbound_leading_plus_enabled is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_cartesia_credential_dto.rb b/lib/vapi_server_sdk/types/create_cartesia_credential_dto.rb index 32fc17b..45c8ef2 100644 --- a/lib/vapi_server_sdk/types/create_cartesia_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_cartesia_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateCartesiaCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateCartesiaCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateCartesiaCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_cerebras_credential_dto.rb b/lib/vapi_server_sdk/types/create_cerebras_credential_dto.rb new file mode 100644 index 0000000..88020e2 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_cerebras_credential_dto.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class CreateCerebrasCredentialDto + # @return [String] + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateCerebrasCredentialDto] + def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateCerebrasCredentialDto + # + # @param json_object [String] + # @return [Vapi::CreateCerebrasCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CreateCerebrasCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_cloudflare_credential_dto.rb b/lib/vapi_server_sdk/types/create_cloudflare_credential_dto.rb new file mode 100644 index 0000000..d214ad0 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_cloudflare_credential_dto.rb @@ -0,0 +1,101 @@ +# frozen_string_literal: true + +require_relative "cloudflare_r_2_bucket_plan" +require "ostruct" +require "json" + +module Vapi + class CreateCloudflareCredentialDto + # @return [String] Cloudflare Account Id. + attr_reader :account_id + # @return [String] Cloudflare API Key / Token. + attr_reader :api_key + # @return [String] Cloudflare Account Email. + attr_reader :account_email + # @return [Vapi::CloudflareR2BucketPlan] This is the bucket plan that can be provided to store call artifacts in R2 + attr_reader :bucket_plan + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param account_id [String] Cloudflare Account Id. + # @param api_key [String] Cloudflare API Key / Token. + # @param account_email [String] Cloudflare Account Email. + # @param bucket_plan [Vapi::CloudflareR2BucketPlan] This is the bucket plan that can be provided to store call artifacts in R2 + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateCloudflareCredentialDto] + def initialize(account_id: OMIT, api_key: OMIT, account_email: OMIT, bucket_plan: OMIT, name: OMIT, + additional_properties: nil) + @account_id = account_id if account_id != OMIT + @api_key = api_key if api_key != OMIT + @account_email = account_email if account_email != OMIT + @bucket_plan = bucket_plan if bucket_plan != OMIT + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "accountId": account_id, + "apiKey": api_key, + "accountEmail": account_email, + "bucketPlan": bucket_plan, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateCloudflareCredentialDto + # + # @param json_object [String] + # @return [Vapi::CreateCloudflareCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + account_id = parsed_json["accountId"] + api_key = parsed_json["apiKey"] + account_email = parsed_json["accountEmail"] + if parsed_json["bucketPlan"].nil? + bucket_plan = nil + else + bucket_plan = parsed_json["bucketPlan"].to_json + bucket_plan = Vapi::CloudflareR2BucketPlan.from_json(json_object: bucket_plan) + end + name = parsed_json["name"] + new( + account_id: account_id, + api_key: api_key, + account_email: account_email, + bucket_plan: bucket_plan, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CreateCloudflareCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.account_id&.is_a?(String) != false || raise("Passed value for field obj.account_id is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.account_email&.is_a?(String) != false || raise("Passed value for field obj.account_email is not the expected type, validation failed.") + obj.bucket_plan.nil? || Vapi::CloudflareR2BucketPlan.validate_raw(obj: obj.bucket_plan) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_custom_llm_credential_dto.rb b/lib/vapi_server_sdk/types/create_custom_llm_credential_dto.rb index 4e35ed0..1378b3e 100644 --- a/lib/vapi_server_sdk/types/create_custom_llm_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_custom_llm_credential_dto.rb @@ -6,8 +6,6 @@ module Vapi class CreateCustomLlmCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. To use @@ -23,25 +21,18 @@ class CreateCustomLlmCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param authentication_plan [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. To use # Bearer authentication, use apiKey # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateCustomLlmCredentialDto] - def initialize(provider:, api_key:, authentication_plan: OMIT, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, authentication_plan: OMIT, name: OMIT, additional_properties: nil) @api_key = api_key @authentication_plan = authentication_plan if authentication_plan != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "apiKey": api_key, - "authenticationPlan": authentication_plan, - "name": name - }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "authenticationPlan": authentication_plan, "name": name }.reject do |_k, v| v == OMIT end end @@ -53,7 +44,6 @@ def initialize(provider:, api_key:, authentication_plan: OMIT, name: OMIT, addit def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] if parsed_json["authenticationPlan"].nil? authentication_plan = nil @@ -63,7 +53,6 @@ def self.from_json(json_object:) end name = parsed_json["name"] new( - provider: provider, api_key: api_key, authentication_plan: authentication_plan, name: name, @@ -85,7 +74,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.authentication_plan.nil? || Vapi::OAuth2AuthenticationPlan.validate_raw(obj: obj.authentication_plan) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_deep_infra_credential_dto.rb b/lib/vapi_server_sdk/types/create_deep_infra_credential_dto.rb index e36f32f..83624d9 100644 --- a/lib/vapi_server_sdk/types/create_deep_infra_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_deep_infra_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateDeepInfraCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateDeepInfraCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateDeepInfraCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_deep_seek_credential_dto.rb b/lib/vapi_server_sdk/types/create_deep_seek_credential_dto.rb new file mode 100644 index 0000000..5a463f1 --- /dev/null +++ b/lib/vapi_server_sdk/types/create_deep_seek_credential_dto.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class CreateDeepSeekCredentialDto + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateDeepSeekCredentialDto] + def initialize(api_key:, name: OMIT, additional_properties: nil) + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateDeepSeekCredentialDto + # + # @param json_object [String] + # @return [Vapi::CreateDeepSeekCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CreateDeepSeekCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_deepgram_credential_dto.rb b/lib/vapi_server_sdk/types/create_deepgram_credential_dto.rb index 5a109fc..2c76a1f 100644 --- a/lib/vapi_server_sdk/types/create_deepgram_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_deepgram_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateDeepgramCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This can be used to point to an onprem Deepgram instance. Defaults to @@ -22,20 +20,18 @@ class CreateDeepgramCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param api_url [String] This can be used to point to an onprem Deepgram instance. Defaults to # api.deepgram.com. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateDeepgramCredentialDto] - def initialize(provider:, api_key:, api_url: OMIT, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, api_url: OMIT, name: OMIT, additional_properties: nil) @api_key = api_key @api_url = api_url if api_url != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "apiUrl": api_url, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "apiUrl": api_url, "name": name }.reject do |_k, v| v == OMIT end end @@ -47,12 +43,10 @@ def initialize(provider:, api_key:, api_url: OMIT, name: OMIT, additional_proper def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] api_url = parsed_json["apiUrl"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, api_url: api_url, name: name, @@ -74,7 +68,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.api_url&.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_eleven_labs_credential_dto.rb b/lib/vapi_server_sdk/types/create_eleven_labs_credential_dto.rb index 65a38af..ca1a066 100644 --- a/lib/vapi_server_sdk/types/create_eleven_labs_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_eleven_labs_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateElevenLabsCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateElevenLabsCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateElevenLabsCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_gcp_credential_dto.rb b/lib/vapi_server_sdk/types/create_gcp_credential_dto.rb index 05f29d0..64731a2 100644 --- a/lib/vapi_server_sdk/types/create_gcp_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_gcp_credential_dto.rb @@ -7,8 +7,6 @@ module Vapi class CreateGcpCredentialDto - # @return [String] - attr_reader :provider # @return [Vapi::GcpKey] This is the GCP key. This is the JSON that can be generated in the Google Cloud # Console at # le.cloud.google.com/iam-admin/serviceaccounts/details//keys. @@ -26,7 +24,6 @@ class CreateGcpCredentialDto OMIT = Object.new - # @param provider [String] # @param gcp_key [Vapi::GcpKey] This is the GCP key. This is the JSON that can be generated in the Google Cloud # Console at # le.cloud.google.com/iam-admin/serviceaccounts/details//keys. @@ -35,18 +32,12 @@ class CreateGcpCredentialDto # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateGcpCredentialDto] - def initialize(provider:, gcp_key:, bucket_plan: OMIT, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(gcp_key:, bucket_plan: OMIT, name: OMIT, additional_properties: nil) @gcp_key = gcp_key @bucket_plan = bucket_plan if bucket_plan != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "gcpKey": gcp_key, - "bucketPlan": bucket_plan, - "name": name - }.reject do |_k, v| + @_field_set = { "gcpKey": gcp_key, "bucketPlan": bucket_plan, "name": name }.reject do |_k, v| v == OMIT end end @@ -58,7 +49,6 @@ def initialize(provider:, gcp_key:, bucket_plan: OMIT, name: OMIT, additional_pr def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] if parsed_json["gcpKey"].nil? gcp_key = nil else @@ -73,7 +63,6 @@ def self.from_json(json_object:) end name = parsed_json["name"] new( - provider: provider, gcp_key: gcp_key, bucket_plan: bucket_plan, name: name, @@ -95,7 +84,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") Vapi::GcpKey.validate_raw(obj: obj.gcp_key) obj.bucket_plan.nil? || Vapi::BucketPlan.validate_raw(obj: obj.bucket_plan) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_gladia_credential_dto.rb b/lib/vapi_server_sdk/types/create_gladia_credential_dto.rb index f5a12ef..9877335 100644 --- a/lib/vapi_server_sdk/types/create_gladia_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_gladia_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateGladiaCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateGladiaCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateGladiaCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_go_high_level_credential_dto.rb b/lib/vapi_server_sdk/types/create_go_high_level_credential_dto.rb index 7c920cd..d1e69ea 100644 --- a/lib/vapi_server_sdk/types/create_go_high_level_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_go_high_level_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateGoHighLevelCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateGoHighLevelCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateGoHighLevelCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_groq_credential_dto.rb b/lib/vapi_server_sdk/types/create_groq_credential_dto.rb index 3820091..d66d254 100644 --- a/lib/vapi_server_sdk/types/create_groq_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_groq_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateGroqCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateGroqCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateGroqCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_langfuse_credential_dto.rb b/lib/vapi_server_sdk/types/create_langfuse_credential_dto.rb index 358c82a..c50121e 100644 --- a/lib/vapi_server_sdk/types/create_langfuse_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_langfuse_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateLangfuseCredentialDto - # @return [String] - attr_reader :provider # @return [String] The public key for Langfuse project. Eg: pk-lf-... attr_reader :public_key # @return [String] The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the @@ -24,7 +22,6 @@ class CreateLangfuseCredentialDto OMIT = Object.new - # @param provider [String] # @param public_key [String] The public key for Langfuse project. Eg: pk-lf-... # @param api_key [String] The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the # API. @@ -32,20 +29,13 @@ class CreateLangfuseCredentialDto # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateLangfuseCredentialDto] - def initialize(provider:, public_key:, api_key:, api_url:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(public_key:, api_key:, api_url:, name: OMIT, additional_properties: nil) @public_key = public_key @api_key = api_key @api_url = api_url @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "publicKey": public_key, - "apiKey": api_key, - "apiUrl": api_url, - "name": name - }.reject do |_k, v| + @_field_set = { "publicKey": public_key, "apiKey": api_key, "apiUrl": api_url, "name": name }.reject do |_k, v| v == OMIT end end @@ -57,13 +47,11 @@ def initialize(provider:, public_key:, api_key:, api_url:, name: OMIT, additiona def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] public_key = parsed_json["publicKey"] api_key = parsed_json["apiKey"] api_url = parsed_json["apiUrl"] name = parsed_json["name"] new( - provider: provider, public_key: public_key, api_key: api_key, api_url: api_url, @@ -86,7 +74,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.public_key.is_a?(String) != false || raise("Passed value for field obj.public_key is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.api_url.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_lmnt_credential_dto.rb b/lib/vapi_server_sdk/types/create_lmnt_credential_dto.rb index b14b664..30e0594 100644 --- a/lib/vapi_server_sdk/types/create_lmnt_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_lmnt_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateLmntCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateLmntCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateLmntCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_make_credential_dto.rb b/lib/vapi_server_sdk/types/create_make_credential_dto.rb index 30366ab..05ccf55 100644 --- a/lib/vapi_server_sdk/types/create_make_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_make_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateMakeCredentialDto - # @return [String] - attr_reader :provider # @return [String] Team ID attr_reader :team_id # @return [String] Region of your application. For example: eu1, eu2, us1, us2 @@ -23,27 +21,19 @@ class CreateMakeCredentialDto OMIT = Object.new - # @param provider [String] # @param team_id [String] Team ID # @param region [String] Region of your application. For example: eu1, eu2, us1, us2 # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateMakeCredentialDto] - def initialize(provider:, team_id:, region:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(team_id:, region:, api_key:, name: OMIT, additional_properties: nil) @team_id = team_id @region = region @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "teamId": team_id, - "region": region, - "apiKey": api_key, - "name": name - }.reject do |_k, v| + @_field_set = { "teamId": team_id, "region": region, "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -55,13 +45,11 @@ def initialize(provider:, team_id:, region:, api_key:, name: OMIT, additional_pr def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] team_id = parsed_json["teamId"] region = parsed_json["region"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, team_id: team_id, region: region, api_key: api_key, @@ -84,7 +72,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.team_id.is_a?(String) != false || raise("Passed value for field obj.team_id is not the expected type, validation failed.") obj.region.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_open_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_open_ai_credential_dto.rb index a4b977c..f5bdaf7 100644 --- a/lib/vapi_server_sdk/types/create_open_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_open_ai_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateOpenAiCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateOpenAiCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateOpenAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_open_router_credential_dto.rb b/lib/vapi_server_sdk/types/create_open_router_credential_dto.rb index 19bde02..9bb4fb1 100644 --- a/lib/vapi_server_sdk/types/create_open_router_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_open_router_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateOpenRouterCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateOpenRouterCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateOpenRouterCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_org_dto.rb b/lib/vapi_server_sdk/types/create_org_dto.rb index d61f8a6..5b6e728 100644 --- a/lib/vapi_server_sdk/types/create_org_dto.rb +++ b/lib/vapi_server_sdk/types/create_org_dto.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "create_org_dto_channel" +require_relative "server" require "ostruct" require "json" @@ -24,14 +25,13 @@ class CreateOrgDto # @return [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. attr_reader :billing_limit - # @return [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - attr_reader :server_url - # @return [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [Float] This is the concurrency limit for the org. This is the maximum number of calls # that can be active at any given time. To go beyond 10, please contact us at # support@vapi.ai. @@ -57,26 +57,25 @@ class CreateOrgDto # will be directed. # @param billing_limit [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. - # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # @param server_url_secret [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param concurrency_limit [Float] This is the concurrency limit for the org. This is the maximum number of calls # that can be active at any given time. To go beyond 10, please contact us at # support@vapi.ai. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateOrgDto] def initialize(hipaa_enabled: OMIT, subscription_id: OMIT, name: OMIT, channel: OMIT, billing_limit: OMIT, - server_url: OMIT, server_url_secret: OMIT, concurrency_limit: OMIT, additional_properties: nil) + server: OMIT, concurrency_limit: OMIT, additional_properties: nil) @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT @subscription_id = subscription_id if subscription_id != OMIT @name = name if name != OMIT @channel = channel if channel != OMIT @billing_limit = billing_limit if billing_limit != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @concurrency_limit = concurrency_limit if concurrency_limit != OMIT @additional_properties = additional_properties @_field_set = { @@ -85,8 +84,7 @@ def initialize(hipaa_enabled: OMIT, subscription_id: OMIT, name: OMIT, channel: "name": name, "channel": channel, "billingLimit": billing_limit, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret, + "server": server, "concurrencyLimit": concurrency_limit }.reject do |_k, v| v == OMIT @@ -105,8 +103,12 @@ def self.from_json(json_object:) name = parsed_json["name"] channel = parsed_json["channel"] billing_limit = parsed_json["billingLimit"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end concurrency_limit = parsed_json["concurrencyLimit"] new( hipaa_enabled: hipaa_enabled, @@ -114,8 +116,7 @@ def self.from_json(json_object:) name: name, channel: channel, billing_limit: billing_limit, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, concurrency_limit: concurrency_limit, additional_properties: struct ) @@ -140,8 +141,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.channel&.is_a?(Vapi::CreateOrgDtoChannel) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.billing_limit&.is_a?(Float) != false || raise("Passed value for field obj.billing_limit is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.concurrency_limit&.is_a?(Float) != false || raise("Passed value for field obj.concurrency_limit is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/create_perplexity_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_perplexity_ai_credential_dto.rb index 4a33fd8..347be7c 100644 --- a/lib/vapi_server_sdk/types/create_perplexity_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_perplexity_ai_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreatePerplexityAiCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreatePerplexityAiCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreatePerplexityAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_play_ht_credential_dto.rb b/lib/vapi_server_sdk/types/create_play_ht_credential_dto.rb index 171a225..34c29f4 100644 --- a/lib/vapi_server_sdk/types/create_play_ht_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_play_ht_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreatePlayHtCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] @@ -21,19 +19,17 @@ class CreatePlayHtCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param user_id [String] # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreatePlayHtCredentialDto] - def initialize(provider:, api_key:, user_id:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, user_id:, name: OMIT, additional_properties: nil) @api_key = api_key @user_id = user_id @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "userId": user_id, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "userId": user_id, "name": name }.reject do |_k, v| v == OMIT end end @@ -45,12 +41,10 @@ def initialize(provider:, api_key:, user_id:, name: OMIT, additional_properties: def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] user_id = parsed_json["userId"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, user_id: user_id, name: name, @@ -72,7 +66,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_rime_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_rime_ai_credential_dto.rb index 90c5ee3..3db0b9e 100644 --- a/lib/vapi_server_sdk/types/create_rime_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_rime_ai_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateRimeAiCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateRimeAiCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateRimeAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_runpod_credential_dto.rb b/lib/vapi_server_sdk/types/create_runpod_credential_dto.rb index 3978a94..f76ffc8 100644 --- a/lib/vapi_server_sdk/types/create_runpod_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_runpod_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateRunpodCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateRunpodCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateRunpodCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_s_3_credential_dto.rb b/lib/vapi_server_sdk/types/create_s_3_credential_dto.rb index 2484d6c..4bbbbcc 100644 --- a/lib/vapi_server_sdk/types/create_s_3_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_s_3_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateS3CredentialDto - # @return [String] Credential provider. Only allowed value is s3 - attr_reader :provider # @return [String] AWS access key ID. attr_reader :aws_access_key_id # @return [String] AWS access key secret. This is not returned in the API. @@ -27,7 +25,6 @@ class CreateS3CredentialDto OMIT = Object.new - # @param provider [String] Credential provider. Only allowed value is s3 # @param aws_access_key_id [String] AWS access key ID. # @param aws_secret_access_key [String] AWS access key secret. This is not returned in the API. # @param region [String] AWS region in which the S3 bucket is located. @@ -36,9 +33,8 @@ class CreateS3CredentialDto # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateS3CredentialDto] - def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s_3_bucket_name:, s_3_path_prefix:, - name: OMIT, additional_properties: nil) - @provider = provider + def initialize(aws_access_key_id:, aws_secret_access_key:, region:, s_3_bucket_name:, s_3_path_prefix:, name: OMIT, + additional_properties: nil) @aws_access_key_id = aws_access_key_id @aws_secret_access_key = aws_secret_access_key @region = region @@ -47,7 +43,6 @@ def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { - "provider": provider, "awsAccessKeyId": aws_access_key_id, "awsSecretAccessKey": aws_secret_access_key, "region": region, @@ -66,7 +61,6 @@ def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] aws_access_key_id = parsed_json["awsAccessKeyId"] aws_secret_access_key = parsed_json["awsSecretAccessKey"] region = parsed_json["region"] @@ -74,7 +68,6 @@ def self.from_json(json_object:) s_3_path_prefix = parsed_json["s3PathPrefix"] name = parsed_json["name"] new( - provider: provider, aws_access_key_id: aws_access_key_id, aws_secret_access_key: aws_secret_access_key, region: region, @@ -99,7 +92,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.aws_access_key_id.is_a?(String) != false || raise("Passed value for field obj.aws_access_key_id is not the expected type, validation failed.") obj.aws_secret_access_key.is_a?(String) != false || raise("Passed value for field obj.aws_secret_access_key is not the expected type, validation failed.") obj.region.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_smallest_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_smallest_ai_credential_dto.rb new file mode 100644 index 0000000..67da4da --- /dev/null +++ b/lib/vapi_server_sdk/types/create_smallest_ai_credential_dto.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class CreateSmallestAiCredentialDto + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::CreateSmallestAiCredentialDto] + def initialize(api_key:, name: OMIT, additional_properties: nil) + @api_key = api_key + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of CreateSmallestAiCredentialDto + # + # @param json_object [String] + # @return [Vapi::CreateSmallestAiCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of CreateSmallestAiCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/create_tavus_credential_dto.rb b/lib/vapi_server_sdk/types/create_tavus_credential_dto.rb index b02d1a6..3ab2a59 100644 --- a/lib/vapi_server_sdk/types/create_tavus_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_tavus_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateTavusCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateTavusCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateTavusCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_together_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_together_ai_credential_dto.rb index cc69880..e863e62 100644 --- a/lib/vapi_server_sdk/types/create_together_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_together_ai_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateTogetherAiCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class CreateTogetherAiCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateTogetherAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_twilio_credential_dto.rb b/lib/vapi_server_sdk/types/create_twilio_credential_dto.rb index fcb0286..037f93c 100644 --- a/lib/vapi_server_sdk/types/create_twilio_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_twilio_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateTwilioCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :auth_token # @return [String] @@ -21,24 +19,17 @@ class CreateTwilioCredentialDto OMIT = Object.new - # @param provider [String] # @param auth_token [String] This is not returned in the API. # @param account_sid [String] # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateTwilioCredentialDto] - def initialize(provider:, auth_token:, account_sid:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(auth_token:, account_sid:, name: OMIT, additional_properties: nil) @auth_token = auth_token @account_sid = account_sid @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "authToken": auth_token, - "accountSid": account_sid, - "name": name - }.reject do |_k, v| + @_field_set = { "authToken": auth_token, "accountSid": account_sid, "name": name }.reject do |_k, v| v == OMIT end end @@ -50,12 +41,10 @@ def initialize(provider:, auth_token:, account_sid:, name: OMIT, additional_prop def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] auth_token = parsed_json["authToken"] account_sid = parsed_json["accountSid"] name = parsed_json["name"] new( - provider: provider, auth_token: auth_token, account_sid: account_sid, name: name, @@ -77,7 +66,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.auth_token.is_a?(String) != false || raise("Passed value for field obj.auth_token is not the expected type, validation failed.") obj.account_sid.is_a?(String) != false || raise("Passed value for field obj.account_sid is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb b/lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb index 5a36610..61dfc4d 100644 --- a/lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb +++ b/lib/vapi_server_sdk/types/create_twilio_phone_number_dto.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "create_twilio_phone_number_dto_fallback_destination" +require_relative "server" require "ostruct" require "json" @@ -31,16 +32,13 @@ class CreateTwilioPhoneNumberDto # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. attr_reader :squad_id - # @return [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - attr_reader :server_url - # @return [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -67,18 +65,16 @@ class CreateTwilioPhoneNumberDto # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateTwilioPhoneNumberDto] def initialize(number:, twilio_account_sid:, twilio_auth_token:, fallback_destination: OMIT, name: OMIT, - assistant_id: OMIT, squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) + assistant_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @number = number @twilio_account_sid = twilio_account_sid @@ -86,8 +82,7 @@ def initialize(number:, twilio_account_sid:, twilio_auth_token:, fallback_destin @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, @@ -97,8 +92,7 @@ def initialize(number:, twilio_account_sid:, twilio_auth_token:, fallback_destin "name": name, "assistantId": assistant_id, "squadId": squad_id, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret + "server": server }.reject do |_k, v| v == OMIT end @@ -123,8 +117,12 @@ def self.from_json(json_object:) name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end new( fallback_destination: fallback_destination, number: number, @@ -133,8 +131,7 @@ def self.from_json(json_object:) name: name, assistant_id: assistant_id, squad_id: squad_id, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, additional_properties: struct ) end @@ -160,8 +157,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) end end end diff --git a/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb b/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb index edc6e05..46f2fa1 100644 --- a/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb +++ b/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb @@ -2,6 +2,7 @@ require_relative "create_vapi_phone_number_dto_fallback_destination" require_relative "sip_authentication" +require_relative "server" require "ostruct" require "json" @@ -34,16 +35,13 @@ class CreateVapiPhoneNumberDto # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. attr_reader :squad_id - # @return [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - attr_reader :server_url - # @return [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -73,26 +71,23 @@ class CreateVapiPhoneNumberDto # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateVapiPhoneNumberDto] def initialize(sip_uri:, fallback_destination: OMIT, authentication: OMIT, name: OMIT, assistant_id: OMIT, - squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) + squad_id: OMIT, server: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @sip_uri = sip_uri @authentication = authentication if authentication != OMIT @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, @@ -101,8 +96,7 @@ def initialize(sip_uri:, fallback_destination: OMIT, authentication: OMIT, name: "name": name, "assistantId": assistant_id, "squadId": squad_id, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret + "server": server }.reject do |_k, v| v == OMIT end @@ -131,8 +125,12 @@ def self.from_json(json_object:) name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end new( fallback_destination: fallback_destination, sip_uri: sip_uri, @@ -140,8 +138,7 @@ def self.from_json(json_object:) name: name, assistant_id: assistant_id, squad_id: squad_id, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, additional_properties: struct ) end @@ -166,8 +163,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) end end end diff --git a/lib/vapi_server_sdk/types/create_vonage_credential_dto.rb b/lib/vapi_server_sdk/types/create_vonage_credential_dto.rb index eb0bff6..9e0255e 100644 --- a/lib/vapi_server_sdk/types/create_vonage_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_vonage_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class CreateVonageCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_secret # @return [String] @@ -21,24 +19,17 @@ class CreateVonageCredentialDto OMIT = Object.new - # @param provider [String] # @param api_secret [String] This is not returned in the API. # @param api_key [String] # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateVonageCredentialDto] - def initialize(provider:, api_secret:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_secret:, api_key:, name: OMIT, additional_properties: nil) @api_secret = api_secret @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "apiSecret": api_secret, - "apiKey": api_key, - "name": name - }.reject do |_k, v| + @_field_set = { "apiSecret": api_secret, "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -50,12 +41,10 @@ def initialize(provider:, api_secret:, api_key:, name: OMIT, additional_properti def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_secret = parsed_json["apiSecret"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_secret: api_secret, api_key: api_key, name: name, @@ -77,7 +66,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_secret.is_a?(String) != false || raise("Passed value for field obj.api_secret is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/create_vonage_phone_number_dto.rb b/lib/vapi_server_sdk/types/create_vonage_phone_number_dto.rb index 75f437f..165ed1a 100644 --- a/lib/vapi_server_sdk/types/create_vonage_phone_number_dto.rb +++ b/lib/vapi_server_sdk/types/create_vonage_phone_number_dto.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "create_vonage_phone_number_dto_fallback_destination" +require_relative "server" require "ostruct" require "json" @@ -30,16 +31,13 @@ class CreateVonagePhoneNumberDto # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. attr_reader :squad_id - # @return [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - attr_reader :server_url - # @return [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -66,26 +64,23 @@ class CreateVonagePhoneNumberDto # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateVonagePhoneNumberDto] def initialize(number:, credential_id:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, - server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) + server: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @number = number @credential_id = credential_id @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, @@ -94,8 +89,7 @@ def initialize(number:, credential_id:, fallback_destination: OMIT, name: OMIT, "name": name, "assistantId": assistant_id, "squadId": squad_id, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret + "server": server }.reject do |_k, v| v == OMIT end @@ -119,8 +113,12 @@ def self.from_json(json_object:) name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end new( fallback_destination: fallback_destination, number: number, @@ -128,8 +126,7 @@ def self.from_json(json_object:) name: name, assistant_id: assistant_id, squad_id: squad_id, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, additional_properties: struct ) end @@ -154,8 +151,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) end end end diff --git a/lib/vapi_server_sdk/types/create_webhook_credential_dto.rb b/lib/vapi_server_sdk/types/create_webhook_credential_dto.rb index 549270c..aeda5f4 100644 --- a/lib/vapi_server_sdk/types/create_webhook_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_webhook_credential_dto.rb @@ -6,8 +6,6 @@ module Vapi class CreateWebhookCredentialDto - # @return [String] - attr_reader :provider # @return [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. attr_reader :authentication_plan # @return [String] This is the name of credential. This is just for your reference. @@ -20,21 +18,15 @@ class CreateWebhookCredentialDto OMIT = Object.new - # @param provider [String] # @param authentication_plan [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateWebhookCredentialDto] - def initialize(provider:, authentication_plan:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(authentication_plan:, name: OMIT, additional_properties: nil) @authentication_plan = authentication_plan @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "authenticationPlan": authentication_plan, - "name": name - }.reject do |_k, v| + @_field_set = { "authenticationPlan": authentication_plan, "name": name }.reject do |_k, v| v == OMIT end end @@ -46,7 +38,6 @@ def initialize(provider:, authentication_plan:, name: OMIT, additional_propertie def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] if parsed_json["authenticationPlan"].nil? authentication_plan = nil else @@ -55,7 +46,6 @@ def self.from_json(json_object:) end name = parsed_json["name"] new( - provider: provider, authentication_plan: authentication_plan, name: name, additional_properties: struct @@ -76,7 +66,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") Vapi::OAuth2AuthenticationPlan.validate_raw(obj: obj.authentication_plan) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/create_x_ai_credential_dto.rb b/lib/vapi_server_sdk/types/create_x_ai_credential_dto.rb index 65a418e..688832d 100644 --- a/lib/vapi_server_sdk/types/create_x_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/create_x_ai_credential_dto.rb @@ -5,9 +5,6 @@ module Vapi class CreateXAiCredentialDto - # @return [String] This is the api key for Grok in XAi's console. Get it from here: - # https://console.x.ai - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -20,18 +17,15 @@ class CreateXAiCredentialDto OMIT = Object.new - # @param provider [String] This is the api key for Grok in XAi's console. Get it from here: - # https://console.x.ai # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::CreateXAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider + def initialize(api_key:, name: OMIT, additional_properties: nil) @api_key = api_key @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -43,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -68,7 +60,6 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/deep_seek_credential.rb b/lib/vapi_server_sdk/types/deep_seek_credential.rb new file mode 100644 index 0000000..687a414 --- /dev/null +++ b/lib/vapi_server_sdk/types/deep_seek_credential.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +require "date" +require "ostruct" +require "json" + +module Vapi + class DeepSeekCredential + # @return [String] + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param api_key [String] This is not returned in the API. + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::DeepSeekCredential] + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "apiKey": api_key, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of DeepSeekCredential + # + # @param json_object [String] + # @return [Vapi::DeepSeekCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of DeepSeekCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/deep_seek_model.rb b/lib/vapi_server_sdk/types/deep_seek_model.rb new file mode 100644 index 0000000..919f534 --- /dev/null +++ b/lib/vapi_server_sdk/types/deep_seek_model.rb @@ -0,0 +1,177 @@ +# frozen_string_literal: true + +require_relative "open_ai_message" +require_relative "deep_seek_model_tools_item" +require_relative "create_custom_knowledge_base_dto" +require "ostruct" +require "json" + +module Vapi + class DeepSeekModel + # @return [Array] This is the starting state for the conversation. + attr_reader :messages + # @return [Array] These are the tools that the assistant can use during the call. To use existing + # tools, use `toolIds`. + # Both `tools` and `toolIds` can be used together. + attr_reader :tools + # @return [Array] These are the tools that the assistant can use during the call. To use transient + # tools, use `tools`. + # Both `tools` and `toolIds` can be used together. + attr_reader :tool_ids + # @return [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + attr_reader :knowledge_base + # @return [String] This is the ID of the knowledge base the model will use. + attr_reader :knowledge_base_id + # @return [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + attr_reader :model + # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage + # caching for lower latency. + attr_reader :temperature + # @return [Float] This is the max number of tokens that the assistant will be allowed to generate + # in each turn of the conversation. Default is 250. + attr_reader :max_tokens + # @return [Boolean] This determines whether we detect user's emotion while they speak and send it as + # an additional info to model. + # Default `false` because the model is usually are good at understanding the + # user's emotion from text. + # @default false + attr_reader :emotion_recognition_enabled + # @return [Float] This sets how many turns at the start of the conversation to use a smaller, + # faster model from the same provider before switching to the primary model. + # Example, gpt-3.5-turbo if provider is openai. + # Default is 0. + # @default 0 + attr_reader :num_fast_turns + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param messages [Array] This is the starting state for the conversation. + # @param tools [Array] These are the tools that the assistant can use during the call. To use existing + # tools, use `toolIds`. + # Both `tools` and `toolIds` can be used together. + # @param tool_ids [Array] These are the tools that the assistant can use during the call. To use transient + # tools, use `tools`. + # Both `tools` and `toolIds` can be used together. + # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. + # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. + # @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage + # caching for lower latency. + # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate + # in each turn of the conversation. Default is 250. + # @param emotion_recognition_enabled [Boolean] This determines whether we detect user's emotion while they speak and send it as + # an additional info to model. + # Default `false` because the model is usually are good at understanding the + # user's emotion from text. + # @default false + # @param num_fast_turns [Float] This sets how many turns at the start of the conversation to use a smaller, + # faster model from the same provider before switching to the primary model. + # Example, gpt-3.5-turbo if provider is openai. + # Default is 0. + # @default 0 + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::DeepSeekModel] + def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, + temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + @messages = messages if messages != OMIT + @tools = tools if tools != OMIT + @tool_ids = tool_ids if tool_ids != OMIT + @knowledge_base = knowledge_base if knowledge_base != OMIT + @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT + @model = model + @temperature = temperature if temperature != OMIT + @max_tokens = max_tokens if max_tokens != OMIT + @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT + @num_fast_turns = num_fast_turns if num_fast_turns != OMIT + @additional_properties = additional_properties + @_field_set = { + "messages": messages, + "tools": tools, + "toolIds": tool_ids, + "knowledgeBase": knowledge_base, + "knowledgeBaseId": knowledge_base_id, + "model": model, + "temperature": temperature, + "maxTokens": max_tokens, + "emotionRecognitionEnabled": emotion_recognition_enabled, + "numFastTurns": num_fast_turns + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of DeepSeekModel + # + # @param json_object [String] + # @return [Vapi::DeepSeekModel] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::OpenAiMessage.from_json(json_object: item) + end + tools = parsed_json["tools"]&.map do |item| + item = item.to_json + Vapi::DeepSeekModelToolsItem.from_json(json_object: item) + end + tool_ids = parsed_json["toolIds"] + if parsed_json["knowledgeBase"].nil? + knowledge_base = nil + else + knowledge_base = parsed_json["knowledgeBase"].to_json + knowledge_base = Vapi::CreateCustomKnowledgeBaseDto.from_json(json_object: knowledge_base) + end + knowledge_base_id = parsed_json["knowledgeBaseId"] + model = parsed_json["model"] + temperature = parsed_json["temperature"] + max_tokens = parsed_json["maxTokens"] + emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] + num_fast_turns = parsed_json["numFastTurns"] + new( + messages: messages, + tools: tools, + tool_ids: tool_ids, + knowledge_base: knowledge_base, + knowledge_base_id: knowledge_base_id, + model: model, + temperature: temperature, + max_tokens: max_tokens, + emotion_recognition_enabled: emotion_recognition_enabled, + num_fast_turns: num_fast_turns, + additional_properties: struct + ) + end + + # Serialize an instance of DeepSeekModel to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.tools&.is_a?(Array) != false || raise("Passed value for field obj.tools is not the expected type, validation failed.") + obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.") + obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) + obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") + obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") + obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") + obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") + obj.num_fast_turns&.is_a?(Float) != false || raise("Passed value for field obj.num_fast_turns is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/deep_seek_model_tools_item.rb b/lib/vapi_server_sdk/types/deep_seek_model_tools_item.rb new file mode 100644 index 0000000..2e3f729 --- /dev/null +++ b/lib/vapi_server_sdk/types/deep_seek_model_tools_item.rb @@ -0,0 +1,159 @@ +# frozen_string_literal: true + +require "json" +require_relative "create_dtmf_tool_dto" +require_relative "create_end_call_tool_dto" +require_relative "create_voicemail_tool_dto" +require_relative "create_function_tool_dto" +require_relative "create_ghl_tool_dto" +require_relative "create_make_tool_dto" +require_relative "create_transfer_call_tool_dto" + +module Vapi + class DeepSeekModelToolsItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::DeepSeekModelToolsItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of DeepSeekModelToolsItem + # + # @param json_object [String] + # @return [Vapi::DeepSeekModelToolsItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "dtmf" + Vapi::CreateDtmfToolDto.from_json(json_object: json_object) + when "endCall" + Vapi::CreateEndCallToolDto.from_json(json_object: json_object) + when "voicemail" + Vapi::CreateVoicemailToolDto.from_json(json_object: json_object) + when "function" + Vapi::CreateFunctionToolDto.from_json(json_object: json_object) + when "ghl" + Vapi::CreateGhlToolDto.from_json(json_object: json_object) + when "make" + Vapi::CreateMakeToolDto.from_json(json_object: json_object) + when "transferCall" + Vapi::CreateTransferCallToolDto.from_json(json_object: json_object) + else + Vapi::CreateDtmfToolDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "dtmf" + { **@member.to_json, type: @discriminant }.to_json + when "endCall" + { **@member.to_json, type: @discriminant }.to_json + when "voicemail" + { **@member.to_json, type: @discriminant }.to_json + when "function" + { **@member.to_json, type: @discriminant }.to_json + when "ghl" + { **@member.to_json, type: @discriminant }.to_json + when "make" + { **@member.to_json, type: @discriminant }.to_json + when "transferCall" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "dtmf" + Vapi::CreateDtmfToolDto.validate_raw(obj: obj) + when "endCall" + Vapi::CreateEndCallToolDto.validate_raw(obj: obj) + when "voicemail" + Vapi::CreateVoicemailToolDto.validate_raw(obj: obj) + when "function" + Vapi::CreateFunctionToolDto.validate_raw(obj: obj) + when "ghl" + Vapi::CreateGhlToolDto.validate_raw(obj: obj) + when "make" + Vapi::CreateMakeToolDto.validate_raw(obj: obj) + when "transferCall" + Vapi::CreateTransferCallToolDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::CreateDtmfToolDto] + # @return [Vapi::DeepSeekModelToolsItem] + def self.dtmf(member:) + new(member: member, discriminant: "dtmf") + end + + # @param member [Vapi::CreateEndCallToolDto] + # @return [Vapi::DeepSeekModelToolsItem] + def self.end_call(member:) + new(member: member, discriminant: "endCall") + end + + # @param member [Vapi::CreateVoicemailToolDto] + # @return [Vapi::DeepSeekModelToolsItem] + def self.voicemail(member:) + new(member: member, discriminant: "voicemail") + end + + # @param member [Vapi::CreateFunctionToolDto] + # @return [Vapi::DeepSeekModelToolsItem] + def self.function(member:) + new(member: member, discriminant: "function") + end + + # @param member [Vapi::CreateGhlToolDto] + # @return [Vapi::DeepSeekModelToolsItem] + def self.ghl(member:) + new(member: member, discriminant: "ghl") + end + + # @param member [Vapi::CreateMakeToolDto] + # @return [Vapi::DeepSeekModelToolsItem] + def self.make(member:) + new(member: member, discriminant: "make") + end + + # @param member [Vapi::CreateTransferCallToolDto] + # @return [Vapi::DeepSeekModelToolsItem] + def self.transfer_call(member:) + new(member: member, discriminant: "transferCall") + end + end +end diff --git a/lib/vapi_server_sdk/types/eleven_labs_voice_model.rb b/lib/vapi_server_sdk/types/eleven_labs_voice_model.rb index a468eaa..604adca 100644 --- a/lib/vapi_server_sdk/types/eleven_labs_voice_model.rb +++ b/lib/vapi_server_sdk/types/eleven_labs_voice_model.rb @@ -7,6 +7,8 @@ class ElevenLabsVoiceModel ELEVEN_MULTILINGUAL_V_2 = "eleven_multilingual_v2" ELEVEN_TURBO_V_2 = "eleven_turbo_v2" ELEVEN_TURBO_V_2_5 = "eleven_turbo_v2_5" + ELEVEN_FLASH_V_2 = "eleven_flash_v2" + ELEVEN_FLASH_V_2_5 = "eleven_flash_v2_5" ELEVEN_MONOLINGUAL_V_1 = "eleven_monolingual_v1" end end diff --git a/lib/vapi_server_sdk/types/fallback_cartesia_voice_model.rb b/lib/vapi_server_sdk/types/fallback_cartesia_voice_model.rb index 462a8e4..2e83475 100644 --- a/lib/vapi_server_sdk/types/fallback_cartesia_voice_model.rb +++ b/lib/vapi_server_sdk/types/fallback_cartesia_voice_model.rb @@ -6,5 +6,7 @@ module Vapi class FallbackCartesiaVoiceModel SONIC_ENGLISH = "sonic-english" SONIC_MULTILINGUAL = "sonic-multilingual" + SONIC_PREVIEW = "sonic-preview" + SONIC = "sonic" end end diff --git a/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_model.rb b/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_model.rb index 31e38bd..5f070dd 100644 --- a/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_model.rb +++ b/lib/vapi_server_sdk/types/fallback_eleven_labs_voice_model.rb @@ -7,6 +7,8 @@ class FallbackElevenLabsVoiceModel ELEVEN_MULTILINGUAL_V_2 = "eleven_multilingual_v2" ELEVEN_TURBO_V_2 = "eleven_turbo_v2" ELEVEN_TURBO_V_2_5 = "eleven_turbo_v2_5" + ELEVEN_FLASH_V_2 = "eleven_flash_v2" + ELEVEN_FLASH_V_2_5 = "eleven_flash_v2_5" ELEVEN_MONOLINGUAL_V_1 = "eleven_monolingual_v1" end end diff --git a/lib/vapi_server_sdk/types/fallback_open_ai_voice.rb b/lib/vapi_server_sdk/types/fallback_open_ai_voice.rb index 3fa63ae..5b2e7b3 100644 --- a/lib/vapi_server_sdk/types/fallback_open_ai_voice.rb +++ b/lib/vapi_server_sdk/types/fallback_open_ai_voice.rb @@ -8,8 +8,8 @@ module Vapi class FallbackOpenAiVoice # @return [Vapi::FallbackOpenAiVoiceId] This is the provider-specific ID that will be used. - # Please note that ash, ballad, coral, sage, and verse may only be used with the - # `gpt-4o-realtime-preview-2024-10-01` model. + # Please note that ash, ballad, coral, sage, and verse may only be used with + # realtime models. attr_reader :voice_id # @return [Float] This is the speed multiplier that will be used. attr_reader :speed @@ -25,8 +25,8 @@ class FallbackOpenAiVoice OMIT = Object.new # @param voice_id [Vapi::FallbackOpenAiVoiceId] This is the provider-specific ID that will be used. - # Please note that ash, ballad, coral, sage, and verse may only be used with the - # `gpt-4o-realtime-preview-2024-10-01` model. + # Please note that ash, ballad, coral, sage, and verse may only be used with + # realtime models. # @param speed [Float] This is the speed multiplier that will be used. # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. diff --git a/lib/vapi_server_sdk/types/fallback_open_ai_voice_id.rb b/lib/vapi_server_sdk/types/fallback_open_ai_voice_id.rb index 1ea2fd5..1acedf4 100644 --- a/lib/vapi_server_sdk/types/fallback_open_ai_voice_id.rb +++ b/lib/vapi_server_sdk/types/fallback_open_ai_voice_id.rb @@ -2,8 +2,8 @@ module Vapi # This is the provider-specific ID that will be used. - # Please note that ash, ballad, coral, sage, and verse may only be used with the - # `gpt-4o-realtime-preview-2024-10-01` model. + # Please note that ash, ballad, coral, sage, and verse may only be used with + # realtime models. class FallbackOpenAiVoiceId ALLOY = "alloy" ECHO = "echo" diff --git a/lib/vapi_server_sdk/types/fallback_plan_voices_item.rb b/lib/vapi_server_sdk/types/fallback_plan_voices_item.rb index f8a3a54..cf6badb 100644 --- a/lib/vapi_server_sdk/types/fallback_plan_voices_item.rb +++ b/lib/vapi_server_sdk/types/fallback_plan_voices_item.rb @@ -11,6 +11,7 @@ require_relative "fallback_open_ai_voice" require_relative "fallback_play_ht_voice" require_relative "fallback_rime_ai_voice" +require_relative "fallback_smallest_ai_voice" require_relative "fallback_tavus_voice" module Vapi @@ -58,6 +59,8 @@ def self.from_json(json_object:) Vapi::FallbackPlayHtVoice.from_json(json_object: json_object) when "rime-ai" Vapi::FallbackRimeAiVoice.from_json(json_object: json_object) + when "smallest-ai" + Vapi::FallbackSmallestAiVoice.from_json(json_object: json_object) when "tavus" Vapi::FallbackTavusVoice.from_json(json_object: json_object) else @@ -91,6 +94,8 @@ def to_json(*_args) { **@member.to_json, provider: @discriminant }.to_json when "rime-ai" { **@member.to_json, provider: @discriminant }.to_json + when "smallest-ai" + { **@member.to_json, provider: @discriminant }.to_json when "tavus" { **@member.to_json, provider: @discriminant }.to_json else @@ -127,6 +132,8 @@ def self.validate_raw(obj:) Vapi::FallbackPlayHtVoice.validate_raw(obj: obj) when "rime-ai" Vapi::FallbackRimeAiVoice.validate_raw(obj: obj) + when "smallest-ai" + Vapi::FallbackSmallestAiVoice.validate_raw(obj: obj) when "tavus" Vapi::FallbackTavusVoice.validate_raw(obj: obj) else @@ -202,6 +209,12 @@ def self.rime_ai(member:) new(member: member, discriminant: "rime-ai") end + # @param member [Vapi::FallbackSmallestAiVoice] + # @return [Vapi::FallbackPlanVoicesItem] + def self.smallest_ai(member:) + new(member: member, discriminant: "smallest-ai") + end + # @param member [Vapi::FallbackTavusVoice] # @return [Vapi::FallbackPlanVoicesItem] def self.tavus(member:) diff --git a/lib/vapi_server_sdk/types/fallback_smallest_ai_voice.rb b/lib/vapi_server_sdk/types/fallback_smallest_ai_voice.rb new file mode 100644 index 0000000..d56ef3e --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_smallest_ai_voice.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +require_relative "fallback_smallest_ai_voice_id" +require_relative "chunk_plan" +require "ostruct" +require "json" + +module Vapi + class FallbackSmallestAiVoice + # @return [Vapi::FallbackSmallestAiVoiceId] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [String] Smallest AI voice model to use. Defaults to 'lightning' when not specified. + attr_reader :model + # @return [Float] This is the speed multiplier that will be used. + attr_reader :speed + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::FallbackSmallestAiVoiceId] This is the provider-specific ID that will be used. + # @param model [String] Smallest AI voice model to use. Defaults to 'lightning' when not specified. + # @param speed [Float] This is the speed multiplier that will be used. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::FallbackSmallestAiVoice] + def initialize(voice_id:, model: OMIT, speed: OMIT, chunk_plan: OMIT, additional_properties: nil) + @voice_id = voice_id + @model = model if model != OMIT + @speed = speed if speed != OMIT + @chunk_plan = chunk_plan if chunk_plan != OMIT + @additional_properties = additional_properties + @_field_set = { "voiceId": voice_id, "model": model, "speed": speed, "chunkPlan": chunk_plan }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of FallbackSmallestAiVoice + # + # @param json_object [String] + # @return [Vapi::FallbackSmallestAiVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceId"].nil? + voice_id = nil + else + voice_id = parsed_json["voiceId"].to_json + voice_id = Vapi::FallbackSmallestAiVoiceId.from_json(json_object: voice_id) + end + model = parsed_json["model"] + speed = parsed_json["speed"] + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + new( + voice_id: voice_id, + model: model, + speed: speed, + chunk_plan: chunk_plan, + additional_properties: struct + ) + end + + # Serialize an instance of FallbackSmallestAiVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::FallbackSmallestAiVoiceId.validate_raw(obj: obj.voice_id) + obj.model&.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_smallest_ai_voice_id.rb b/lib/vapi_server_sdk/types/fallback_smallest_ai_voice_id.rb new file mode 100644 index 0000000..f9ca496 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_smallest_ai_voice_id.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require "json" + +module Vapi + # This is the provider-specific ID that will be used. + class FallbackSmallestAiVoiceId + # Deserialize a JSON object to an instance of FallbackSmallestAiVoiceId + # + # @param json_object [String] + # @return [Vapi::FallbackSmallestAiVoiceId] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(Vapi::FallbackSmallestAiVoiceIdEnum) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(Vapi::FallbackSmallestAiVoiceIdEnum) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/fallback_smallest_ai_voice_id_enum.rb b/lib/vapi_server_sdk/types/fallback_smallest_ai_voice_id_enum.rb new file mode 100644 index 0000000..314eed6 --- /dev/null +++ b/lib/vapi_server_sdk/types/fallback_smallest_ai_voice_id_enum.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Vapi + class FallbackSmallestAiVoiceIdEnum + EMILY = "emily" + JASMINE = "jasmine" + ARMAN = "arman" + JAMES = "james" + MITHALI = "mithali" + ARAVIND = "aravind" + RAJ = "raj" + DIYA = "diya" + RAMAN = "raman" + ANANYA = "ananya" + ISHA = "isha" + WILLIAM = "william" + AARAV = "aarav" + MONIKA = "monika" + NIHARIKA = "niharika" + DEEPIKA = "deepika" + RAGHAV = "raghav" + KAJAL = "kajal" + RADHIKA = "radhika" + MANSI = "mansi" + NISHA = "nisha" + SAURABH = "saurabh" + POOJA = "pooja" + SAINA = "saina" + SANYA = "sanya" + end +end diff --git a/lib/vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config.rb b/lib/vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config.rb new file mode 100644 index 0000000..df59dea --- /dev/null +++ b/lib/vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +require_relative "gemini_multimodal_live_prebuilt_voice_config_voice_name" +require "ostruct" +require "json" + +module Vapi + class GeminiMultimodalLivePrebuiltVoiceConfig + # @return [Vapi::GeminiMultimodalLivePrebuiltVoiceConfigVoiceName] + attr_reader :voice_name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_name [Vapi::GeminiMultimodalLivePrebuiltVoiceConfigVoiceName] + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::GeminiMultimodalLivePrebuiltVoiceConfig] + def initialize(voice_name:, additional_properties: nil) + @voice_name = voice_name + @additional_properties = additional_properties + @_field_set = { "voiceName": voice_name } + end + + # Deserialize a JSON object to an instance of + # GeminiMultimodalLivePrebuiltVoiceConfig + # + # @param json_object [String] + # @return [Vapi::GeminiMultimodalLivePrebuiltVoiceConfig] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + voice_name = parsed_json["voiceName"] + new(voice_name: voice_name, additional_properties: struct) + end + + # Serialize an instance of GeminiMultimodalLivePrebuiltVoiceConfig to a JSON + # object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.voice_name.is_a?(Vapi::GeminiMultimodalLivePrebuiltVoiceConfigVoiceName) != false || raise("Passed value for field obj.voice_name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config_voice_name.rb b/lib/vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config_voice_name.rb new file mode 100644 index 0000000..d09ae2b --- /dev/null +++ b/lib/vapi_server_sdk/types/gemini_multimodal_live_prebuilt_voice_config_voice_name.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Vapi + class GeminiMultimodalLivePrebuiltVoiceConfigVoiceName + PUCK = "Puck" + CHARON = "Charon" + KORE = "Kore" + FENRIR = "Fenrir" + AOEDE = "Aoede" + end +end diff --git a/lib/vapi_server_sdk/types/gemini_multimodal_live_speech_config.rb b/lib/vapi_server_sdk/types/gemini_multimodal_live_speech_config.rb new file mode 100644 index 0000000..e6ab1b8 --- /dev/null +++ b/lib/vapi_server_sdk/types/gemini_multimodal_live_speech_config.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +require_relative "gemini_multimodal_live_voice_config" +require "ostruct" +require "json" + +module Vapi + class GeminiMultimodalLiveSpeechConfig + # @return [Vapi::GeminiMultimodalLiveVoiceConfig] + attr_reader :voice_config + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_config [Vapi::GeminiMultimodalLiveVoiceConfig] + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::GeminiMultimodalLiveSpeechConfig] + def initialize(voice_config:, additional_properties: nil) + @voice_config = voice_config + @additional_properties = additional_properties + @_field_set = { "voiceConfig": voice_config } + end + + # Deserialize a JSON object to an instance of GeminiMultimodalLiveSpeechConfig + # + # @param json_object [String] + # @return [Vapi::GeminiMultimodalLiveSpeechConfig] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceConfig"].nil? + voice_config = nil + else + voice_config = parsed_json["voiceConfig"].to_json + voice_config = Vapi::GeminiMultimodalLiveVoiceConfig.from_json(json_object: voice_config) + end + new(voice_config: voice_config, additional_properties: struct) + end + + # Serialize an instance of GeminiMultimodalLiveSpeechConfig to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::GeminiMultimodalLiveVoiceConfig.validate_raw(obj: obj.voice_config) + end + end +end diff --git a/lib/vapi_server_sdk/types/gemini_multimodal_live_voice_config.rb b/lib/vapi_server_sdk/types/gemini_multimodal_live_voice_config.rb new file mode 100644 index 0000000..3d4a7b7 --- /dev/null +++ b/lib/vapi_server_sdk/types/gemini_multimodal_live_voice_config.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +require_relative "gemini_multimodal_live_prebuilt_voice_config" +require "ostruct" +require "json" + +module Vapi + class GeminiMultimodalLiveVoiceConfig + # @return [Vapi::GeminiMultimodalLivePrebuiltVoiceConfig] + attr_reader :prebuilt_voice_config + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param prebuilt_voice_config [Vapi::GeminiMultimodalLivePrebuiltVoiceConfig] + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::GeminiMultimodalLiveVoiceConfig] + def initialize(prebuilt_voice_config:, additional_properties: nil) + @prebuilt_voice_config = prebuilt_voice_config + @additional_properties = additional_properties + @_field_set = { "prebuiltVoiceConfig": prebuilt_voice_config } + end + + # Deserialize a JSON object to an instance of GeminiMultimodalLiveVoiceConfig + # + # @param json_object [String] + # @return [Vapi::GeminiMultimodalLiveVoiceConfig] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["prebuiltVoiceConfig"].nil? + prebuilt_voice_config = nil + else + prebuilt_voice_config = parsed_json["prebuiltVoiceConfig"].to_json + prebuilt_voice_config = Vapi::GeminiMultimodalLivePrebuiltVoiceConfig.from_json(json_object: prebuilt_voice_config) + end + new(prebuilt_voice_config: prebuilt_voice_config, additional_properties: struct) + end + + # Serialize an instance of GeminiMultimodalLiveVoiceConfig to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::GeminiMultimodalLivePrebuiltVoiceConfig.validate_raw(obj: obj.prebuilt_voice_config) + end + end +end diff --git a/lib/vapi_server_sdk/types/google_model.rb b/lib/vapi_server_sdk/types/google_model.rb index c2f7a2e..89054b7 100644 --- a/lib/vapi_server_sdk/types/google_model.rb +++ b/lib/vapi_server_sdk/types/google_model.rb @@ -4,6 +4,7 @@ require_relative "google_model_tools_item" require_relative "create_custom_knowledge_base_dto" require_relative "google_model_model" +require_relative "google_realtime_config" require "ostruct" require "json" @@ -25,6 +26,9 @@ class GoogleModel attr_reader :knowledge_base_id # @return [Vapi::GoogleModelModel] This is the Google model that will be used. attr_reader :model + # @return [Vapi::GoogleRealtimeConfig] This is the session configuration for the Gemini Flash 2.0 Multimodal Live API. + # Only applicable if the model `gemini-2.0-flash-realtime-exp` is selected. + attr_reader :realtime_config # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. attr_reader :temperature @@ -61,6 +65,8 @@ class GoogleModel # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base. # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use. # @param model [Vapi::GoogleModelModel] This is the Google model that will be used. + # @param realtime_config [Vapi::GoogleRealtimeConfig] This is the session configuration for the Gemini Flash 2.0 Multimodal Live API. + # Only applicable if the model `gemini-2.0-flash-realtime-exp` is selected. # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage # caching for lower latency. # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate @@ -78,13 +84,14 @@ class GoogleModel # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::GoogleModel] def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_base: OMIT, knowledge_base_id: OMIT, - temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) + realtime_config: OMIT, temperature: OMIT, max_tokens: OMIT, emotion_recognition_enabled: OMIT, num_fast_turns: OMIT, additional_properties: nil) @messages = messages if messages != OMIT @tools = tools if tools != OMIT @tool_ids = tool_ids if tool_ids != OMIT @knowledge_base = knowledge_base if knowledge_base != OMIT @knowledge_base_id = knowledge_base_id if knowledge_base_id != OMIT @model = model + @realtime_config = realtime_config if realtime_config != OMIT @temperature = temperature if temperature != OMIT @max_tokens = max_tokens if max_tokens != OMIT @emotion_recognition_enabled = emotion_recognition_enabled if emotion_recognition_enabled != OMIT @@ -97,6 +104,7 @@ def initialize(model:, messages: OMIT, tools: OMIT, tool_ids: OMIT, knowledge_ba "knowledgeBase": knowledge_base, "knowledgeBaseId": knowledge_base_id, "model": model, + "realtimeConfig": realtime_config, "temperature": temperature, "maxTokens": max_tokens, "emotionRecognitionEnabled": emotion_recognition_enabled, @@ -130,6 +138,12 @@ def self.from_json(json_object:) end knowledge_base_id = parsed_json["knowledgeBaseId"] model = parsed_json["model"] + if parsed_json["realtimeConfig"].nil? + realtime_config = nil + else + realtime_config = parsed_json["realtimeConfig"].to_json + realtime_config = Vapi::GoogleRealtimeConfig.from_json(json_object: realtime_config) + end temperature = parsed_json["temperature"] max_tokens = parsed_json["maxTokens"] emotion_recognition_enabled = parsed_json["emotionRecognitionEnabled"] @@ -141,6 +155,7 @@ def self.from_json(json_object:) knowledge_base: knowledge_base, knowledge_base_id: knowledge_base_id, model: model, + realtime_config: realtime_config, temperature: temperature, max_tokens: max_tokens, emotion_recognition_enabled: emotion_recognition_enabled, @@ -169,6 +184,7 @@ def self.validate_raw(obj:) obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base) obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.") obj.model.is_a?(Vapi::GoogleModelModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.realtime_config.nil? || Vapi::GoogleRealtimeConfig.validate_raw(obj: obj.realtime_config) obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/google_model_model.rb b/lib/vapi_server_sdk/types/google_model_model.rb index 01025ad..61749d3 100644 --- a/lib/vapi_server_sdk/types/google_model_model.rb +++ b/lib/vapi_server_sdk/types/google_model_model.rb @@ -3,6 +3,8 @@ module Vapi # This is the Google model that will be used. class GoogleModelModel + GEMINI_20_FLASH_EXP = "gemini-2.0-flash-exp" + GEMINI_20_FLASH_REALTIME_EXP = "gemini-2.0-flash-realtime-exp" GEMINI_15_FLASH = "gemini-1.5-flash" GEMINI_15_FLASH_002 = "gemini-1.5-flash-002" GEMINI_15_PRO = "gemini-1.5-pro" diff --git a/lib/vapi_server_sdk/types/google_realtime_config.rb b/lib/vapi_server_sdk/types/google_realtime_config.rb new file mode 100644 index 0000000..a724f4f --- /dev/null +++ b/lib/vapi_server_sdk/types/google_realtime_config.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +require_relative "gemini_multimodal_live_speech_config" +require "ostruct" +require "json" + +module Vapi + class GoogleRealtimeConfig + # @return [Float] This is the nucleus sampling parameter that controls the cumulative probability + # of tokens considered during text generation. + # Only applicable with the Gemini Flash 2.0 Multimodal Live API. + attr_reader :top_p + # @return [Float] This is the top-k sampling parameter that limits the number of highest + # probability tokens considered during text generation. + # Only applicable with the Gemini Flash 2.0 Multimodal Live API. + attr_reader :top_k + # @return [Float] This is the presence penalty parameter that influences the model's likelihood to + # repeat information by penalizing tokens based on their presence in the text. + # Only applicable with the Gemini Flash 2.0 Multimodal Live API. + attr_reader :presence_penalty + # @return [Float] This is the frequency penalty parameter that influences the model's likelihood + # to repeat tokens by penalizing them based on their frequency in the text. + # Only applicable with the Gemini Flash 2.0 Multimodal Live API. + attr_reader :frequency_penalty + # @return [Vapi::GeminiMultimodalLiveSpeechConfig] This is the speech configuration object that defines the voice settings to be + # used for the model's speech output. + # Only applicable with the Gemini Flash 2.0 Multimodal Live API. + attr_reader :speech_config + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param top_p [Float] This is the nucleus sampling parameter that controls the cumulative probability + # of tokens considered during text generation. + # Only applicable with the Gemini Flash 2.0 Multimodal Live API. + # @param top_k [Float] This is the top-k sampling parameter that limits the number of highest + # probability tokens considered during text generation. + # Only applicable with the Gemini Flash 2.0 Multimodal Live API. + # @param presence_penalty [Float] This is the presence penalty parameter that influences the model's likelihood to + # repeat information by penalizing tokens based on their presence in the text. + # Only applicable with the Gemini Flash 2.0 Multimodal Live API. + # @param frequency_penalty [Float] This is the frequency penalty parameter that influences the model's likelihood + # to repeat tokens by penalizing them based on their frequency in the text. + # Only applicable with the Gemini Flash 2.0 Multimodal Live API. + # @param speech_config [Vapi::GeminiMultimodalLiveSpeechConfig] This is the speech configuration object that defines the voice settings to be + # used for the model's speech output. + # Only applicable with the Gemini Flash 2.0 Multimodal Live API. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::GoogleRealtimeConfig] + def initialize(top_p: OMIT, top_k: OMIT, presence_penalty: OMIT, frequency_penalty: OMIT, speech_config: OMIT, + additional_properties: nil) + @top_p = top_p if top_p != OMIT + @top_k = top_k if top_k != OMIT + @presence_penalty = presence_penalty if presence_penalty != OMIT + @frequency_penalty = frequency_penalty if frequency_penalty != OMIT + @speech_config = speech_config if speech_config != OMIT + @additional_properties = additional_properties + @_field_set = { + "topP": top_p, + "topK": top_k, + "presencePenalty": presence_penalty, + "frequencyPenalty": frequency_penalty, + "speechConfig": speech_config + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of GoogleRealtimeConfig + # + # @param json_object [String] + # @return [Vapi::GoogleRealtimeConfig] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + top_p = parsed_json["topP"] + top_k = parsed_json["topK"] + presence_penalty = parsed_json["presencePenalty"] + frequency_penalty = parsed_json["frequencyPenalty"] + if parsed_json["speechConfig"].nil? + speech_config = nil + else + speech_config = parsed_json["speechConfig"].to_json + speech_config = Vapi::GeminiMultimodalLiveSpeechConfig.from_json(json_object: speech_config) + end + new( + top_p: top_p, + top_k: top_k, + presence_penalty: presence_penalty, + frequency_penalty: frequency_penalty, + speech_config: speech_config, + additional_properties: struct + ) + end + + # Serialize an instance of GoogleRealtimeConfig to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.top_p&.is_a?(Float) != false || raise("Passed value for field obj.top_p is not the expected type, validation failed.") + obj.top_k&.is_a?(Float) != false || raise("Passed value for field obj.top_k is not the expected type, validation failed.") + obj.presence_penalty&.is_a?(Float) != false || raise("Passed value for field obj.presence_penalty is not the expected type, validation failed.") + obj.frequency_penalty&.is_a?(Float) != false || raise("Passed value for field obj.frequency_penalty is not the expected type, validation failed.") + obj.speech_config.nil? || Vapi::GeminiMultimodalLiveSpeechConfig.validate_raw(obj: obj.speech_config) + end + end +end diff --git a/lib/vapi_server_sdk/types/groq_model_model.rb b/lib/vapi_server_sdk/types/groq_model_model.rb index e7b0abd..9d3eac0 100644 --- a/lib/vapi_server_sdk/types/groq_model_model.rb +++ b/lib/vapi_server_sdk/types/groq_model_model.rb @@ -3,15 +3,13 @@ module Vapi # This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b class GroqModelModel + LLAMA_3370_B_VERSATILE = "llama-3.3-70b-versatile" LLAMA_31405_B_REASONING = "llama-3.1-405b-reasoning" LLAMA_3170_B_VERSATILE = "llama-3.1-70b-versatile" LLAMA_318_B_INSTANT = "llama-3.1-8b-instant" MIXTRAL_8_X_7_B_32768 = "mixtral-8x7b-32768" LLAMA_38_B_8192 = "llama3-8b-8192" LLAMA_370_B_8192 = "llama3-70b-8192" - LLAMA_3_GROQ_8_B_8192_TOOL_USE_PREVIEW = "llama3-groq-8b-8192-tool-use-preview" - LLAMA_3_GROQ_70_B_8192_TOOL_USE_PREVIEW = "llama3-groq-70b-8192-tool-use-preview" - GEMMA_7_B_IT = "gemma-7b-it" GEMMA_29_B_IT = "gemma2-9b-it" end end diff --git a/lib/vapi_server_sdk/types/hipaa_buy_dto.rb b/lib/vapi_server_sdk/types/hipaa_buy_dto.rb deleted file mode 100644 index 96fddf3..0000000 --- a/lib/vapi_server_sdk/types/hipaa_buy_dto.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require "ostruct" -require "json" - -module Vapi - class HipaaBuyDto - # @return [String] This is the name of the recipient. - attr_reader :recipient_name - # @return [String] This is the name of the recipient organization. - attr_reader :recipient_organization - # @return [OpenStruct] Additional properties unmapped to the current class definition - attr_reader :additional_properties - # @return [Object] - attr_reader :_field_set - protected :_field_set - - OMIT = Object.new - - # @param recipient_name [String] This is the name of the recipient. - # @param recipient_organization [String] This is the name of the recipient organization. - # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::HipaaBuyDto] - def initialize(recipient_name:, recipient_organization:, additional_properties: nil) - @recipient_name = recipient_name - @recipient_organization = recipient_organization - @additional_properties = additional_properties - @_field_set = { "recipientName": recipient_name, "recipientOrganization": recipient_organization } - end - - # Deserialize a JSON object to an instance of HipaaBuyDto - # - # @param json_object [String] - # @return [Vapi::HipaaBuyDto] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - parsed_json = JSON.parse(json_object) - recipient_name = parsed_json["recipientName"] - recipient_organization = parsed_json["recipientOrganization"] - new( - recipient_name: recipient_name, - recipient_organization: recipient_organization, - additional_properties: struct - ) - end - - # Serialize an instance of HipaaBuyDto to a JSON object - # - # @return [String] - def to_json(*_args) - @_field_set&.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - obj.recipient_name.is_a?(String) != false || raise("Passed value for field obj.recipient_name is not the expected type, validation failed.") - obj.recipient_organization.is_a?(String) != false || raise("Passed value for field obj.recipient_organization is not the expected type, validation failed.") - end - end -end diff --git a/lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb b/lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb index 58b39c9..6a293b1 100644 --- a/lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb +++ b/lib/vapi_server_sdk/types/import_twilio_phone_number_dto.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "import_twilio_phone_number_dto_fallback_destination" +require_relative "server" require "ostruct" require "json" @@ -31,16 +32,13 @@ class ImportTwilioPhoneNumberDto # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. attr_reader :squad_id - # @return [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - attr_reader :server_url - # @return [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -67,18 +65,16 @@ class ImportTwilioPhoneNumberDto # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ImportTwilioPhoneNumberDto] def initialize(twilio_phone_number:, twilio_account_sid:, twilio_auth_token:, fallback_destination: OMIT, - name: OMIT, assistant_id: OMIT, squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) + name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @twilio_phone_number = twilio_phone_number @twilio_account_sid = twilio_account_sid @@ -86,8 +82,7 @@ def initialize(twilio_phone_number:, twilio_account_sid:, twilio_auth_token:, fa @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, @@ -97,8 +92,7 @@ def initialize(twilio_phone_number:, twilio_account_sid:, twilio_auth_token:, fa "name": name, "assistantId": assistant_id, "squadId": squad_id, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret + "server": server }.reject do |_k, v| v == OMIT end @@ -123,8 +117,12 @@ def self.from_json(json_object:) name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end new( fallback_destination: fallback_destination, twilio_phone_number: twilio_phone_number, @@ -133,8 +131,7 @@ def self.from_json(json_object:) name: name, assistant_id: assistant_id, squad_id: squad_id, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, additional_properties: struct ) end @@ -160,8 +157,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) end end end diff --git a/lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb b/lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb index 89d7d4e..671eb2f 100644 --- a/lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb +++ b/lib/vapi_server_sdk/types/import_vonage_phone_number_dto.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "import_vonage_phone_number_dto_fallback_destination" +require_relative "server" require "ostruct" require "json" @@ -32,16 +33,13 @@ class ImportVonagePhoneNumberDto # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. attr_reader :squad_id - # @return [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - attr_reader :server_url - # @return [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -70,26 +68,23 @@ class ImportVonagePhoneNumberDto # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ImportVonagePhoneNumberDto] def initialize(vonage_phone_number:, credential_id:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, - squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) + squad_id: OMIT, server: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @vonage_phone_number = vonage_phone_number @credential_id = credential_id @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @additional_properties = additional_properties @_field_set = { "fallbackDestination": fallback_destination, @@ -98,8 +93,7 @@ def initialize(vonage_phone_number:, credential_id:, fallback_destination: OMIT, "name": name, "assistantId": assistant_id, "squadId": squad_id, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret + "server": server }.reject do |_k, v| v == OMIT end @@ -123,8 +117,12 @@ def self.from_json(json_object:) name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end new( fallback_destination: fallback_destination, vonage_phone_number: vonage_phone_number, @@ -132,8 +130,7 @@ def self.from_json(json_object:) name: name, assistant_id: assistant_id, squad_id: squad_id, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, additional_properties: struct ) end @@ -158,8 +155,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) end end end diff --git a/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb b/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb index d67741f..7b2d447 100644 --- a/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb +++ b/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb @@ -2,7 +2,13 @@ module Vapi class OpenAiModelFallbackModelsItem + O_1_PREVIEW = "o1-preview" + O_1_PREVIEW_20240912 = "o1-preview-2024-09-12" + O_1_MINI = "o1-mini" + O_1_MINI_20240912 = "o1-mini-2024-09-12" GPT_4_O_REALTIME_PREVIEW_20241001 = "gpt-4o-realtime-preview-2024-10-01" + GPT_4_O_REALTIME_PREVIEW_20241217 = "gpt-4o-realtime-preview-2024-12-17" + GPT_4_O_MINI_REALTIME_PREVIEW_20241217 = "gpt-4o-mini-realtime-preview-2024-12-17" GPT_4_O_MINI = "gpt-4o-mini" GPT_4_O_MINI_20240718 = "gpt-4o-mini-2024-07-18" GPT_4_O = "gpt-4o" diff --git a/lib/vapi_server_sdk/types/open_ai_model_model.rb b/lib/vapi_server_sdk/types/open_ai_model_model.rb index be2bce0..6998f26 100644 --- a/lib/vapi_server_sdk/types/open_ai_model_model.rb +++ b/lib/vapi_server_sdk/types/open_ai_model_model.rb @@ -3,7 +3,13 @@ module Vapi # This is the OpenAI model that will be used. class OpenAiModelModel + O_1_PREVIEW = "o1-preview" + O_1_PREVIEW_20240912 = "o1-preview-2024-09-12" + O_1_MINI = "o1-mini" + O_1_MINI_20240912 = "o1-mini-2024-09-12" GPT_4_O_REALTIME_PREVIEW_20241001 = "gpt-4o-realtime-preview-2024-10-01" + GPT_4_O_REALTIME_PREVIEW_20241217 = "gpt-4o-realtime-preview-2024-12-17" + GPT_4_O_MINI_REALTIME_PREVIEW_20241217 = "gpt-4o-mini-realtime-preview-2024-12-17" GPT_4_O_MINI = "gpt-4o-mini" GPT_4_O_MINI_20240718 = "gpt-4o-mini-2024-07-18" GPT_4_O = "gpt-4o" diff --git a/lib/vapi_server_sdk/types/open_ai_voice.rb b/lib/vapi_server_sdk/types/open_ai_voice.rb index 16c4108..f7ed950 100644 --- a/lib/vapi_server_sdk/types/open_ai_voice.rb +++ b/lib/vapi_server_sdk/types/open_ai_voice.rb @@ -9,8 +9,8 @@ module Vapi class OpenAiVoice # @return [Vapi::OpenAiVoiceId] This is the provider-specific ID that will be used. - # Please note that ash, ballad, coral, sage, and verse may only be used with the - # `gpt-4o-realtime-preview-2024-10-01` model. + # Please note that ash, ballad, coral, sage, and verse may only be used with + # realtime models. attr_reader :voice_id # @return [Float] This is the speed multiplier that will be used. attr_reader :speed @@ -29,8 +29,8 @@ class OpenAiVoice OMIT = Object.new # @param voice_id [Vapi::OpenAiVoiceId] This is the provider-specific ID that will be used. - # Please note that ash, ballad, coral, sage, and verse may only be used with the - # `gpt-4o-realtime-preview-2024-10-01` model. + # Please note that ash, ballad, coral, sage, and verse may only be used with + # realtime models. # @param speed [Float] This is the speed multiplier that will be used. # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice # provider. diff --git a/lib/vapi_server_sdk/types/open_ai_voice_id.rb b/lib/vapi_server_sdk/types/open_ai_voice_id.rb index 3dd09b2..a8a7b90 100644 --- a/lib/vapi_server_sdk/types/open_ai_voice_id.rb +++ b/lib/vapi_server_sdk/types/open_ai_voice_id.rb @@ -2,8 +2,8 @@ module Vapi # This is the provider-specific ID that will be used. - # Please note that ash, ballad, coral, sage, and verse may only be used with the - # `gpt-4o-realtime-preview-2024-10-01` model. + # Please note that ash, ballad, coral, sage, and verse may only be used with + # realtime models. class OpenAiVoiceId ALLOY = "alloy" ECHO = "echo" diff --git a/lib/vapi_server_sdk/types/org.rb b/lib/vapi_server_sdk/types/org.rb index a4463c8..8731ac2 100644 --- a/lib/vapi_server_sdk/types/org.rb +++ b/lib/vapi_server_sdk/types/org.rb @@ -4,6 +4,7 @@ require "date" require_relative "org_plan" require_relative "org_channel" +require_relative "server" require "ostruct" require "json" @@ -47,14 +48,13 @@ class Org # @return [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. attr_reader :billing_limit - # @return [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - attr_reader :server_url - # @return [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [Float] This is the concurrency limit for the org. This is the maximum number of calls # that can be active at any given time. To go beyond 10, please contact us at # support@vapi.ai. @@ -90,19 +90,19 @@ class Org # will be directed. # @param billing_limit [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. - # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # @param server_url_secret [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param concurrency_limit [Float] This is the concurrency limit for the org. This is the maximum number of calls # that can be active at any given time. To go beyond 10, please contact us at # support@vapi.ai. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::Org] def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, subscription: OMIT, subscription_id: OMIT, - stripe_customer_id: OMIT, stripe_subscription_id: OMIT, stripe_subscription_item_id: OMIT, stripe_subscription_current_period_start: OMIT, stripe_subscription_status: OMIT, plan: OMIT, name: OMIT, channel: OMIT, billing_limit: OMIT, server_url: OMIT, server_url_secret: OMIT, concurrency_limit: OMIT, additional_properties: nil) + stripe_customer_id: OMIT, stripe_subscription_id: OMIT, stripe_subscription_item_id: OMIT, stripe_subscription_current_period_start: OMIT, stripe_subscription_status: OMIT, plan: OMIT, name: OMIT, channel: OMIT, billing_limit: OMIT, server: OMIT, concurrency_limit: OMIT, additional_properties: nil) @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT @subscription = subscription if subscription != OMIT @subscription_id = subscription_id if subscription_id != OMIT @@ -120,8 +120,7 @@ def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, subscription: @name = name if name != OMIT @channel = channel if channel != OMIT @billing_limit = billing_limit if billing_limit != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @concurrency_limit = concurrency_limit if concurrency_limit != OMIT @additional_properties = additional_properties @_field_set = { @@ -140,8 +139,7 @@ def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, subscription: "name": name, "channel": channel, "billingLimit": billing_limit, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret, + "server": server, "concurrencyLimit": concurrency_limit }.reject do |_k, v| v == OMIT @@ -182,8 +180,12 @@ def self.from_json(json_object:) name = parsed_json["name"] channel = parsed_json["channel"] billing_limit = parsed_json["billingLimit"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end concurrency_limit = parsed_json["concurrencyLimit"] new( hipaa_enabled: hipaa_enabled, @@ -201,8 +203,7 @@ def self.from_json(json_object:) name: name, channel: channel, billing_limit: billing_limit, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, concurrency_limit: concurrency_limit, additional_properties: struct ) @@ -237,8 +238,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.channel&.is_a?(Vapi::OrgChannel) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.billing_limit&.is_a?(Float) != false || raise("Passed value for field obj.billing_limit is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.concurrency_limit&.is_a?(Float) != false || raise("Passed value for field obj.concurrency_limit is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/org_with_org_user.rb b/lib/vapi_server_sdk/types/org_with_org_user.rb index 0d87bee..0f50a1f 100644 --- a/lib/vapi_server_sdk/types/org_with_org_user.rb +++ b/lib/vapi_server_sdk/types/org_with_org_user.rb @@ -4,6 +4,7 @@ require "date" require_relative "org_plan" require_relative "org_with_org_user_channel" +require_relative "server" require_relative "org_with_org_user_role" require "ostruct" require "json" @@ -48,14 +49,13 @@ class OrgWithOrgUser # @return [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. attr_reader :billing_limit - # @return [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - attr_reader :server_url - # @return [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [Float] This is the concurrency limit for the org. This is the maximum number of calls # that can be active at any given time. To go beyond 10, please contact us at # support@vapi.ai. @@ -95,12 +95,12 @@ class OrgWithOrgUser # will be directed. # @param billing_limit [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. - # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # @param server_url_secret [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param concurrency_limit [Float] This is the concurrency limit for the org. This is the maximum number of calls # that can be active at any given time. To go beyond 10, please contact us at # support@vapi.ai. @@ -109,7 +109,7 @@ class OrgWithOrgUser # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::OrgWithOrgUser] def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, subscription: OMIT, subscription_id: OMIT, - stripe_customer_id: OMIT, stripe_subscription_id: OMIT, stripe_subscription_item_id: OMIT, stripe_subscription_current_period_start: OMIT, stripe_subscription_status: OMIT, plan: OMIT, name: OMIT, channel: OMIT, billing_limit: OMIT, server_url: OMIT, server_url_secret: OMIT, concurrency_limit: OMIT, invited_by_user_id: OMIT, role: OMIT, additional_properties: nil) + stripe_customer_id: OMIT, stripe_subscription_id: OMIT, stripe_subscription_item_id: OMIT, stripe_subscription_current_period_start: OMIT, stripe_subscription_status: OMIT, plan: OMIT, name: OMIT, channel: OMIT, billing_limit: OMIT, server: OMIT, concurrency_limit: OMIT, invited_by_user_id: OMIT, role: OMIT, additional_properties: nil) @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT @subscription = subscription if subscription != OMIT @subscription_id = subscription_id if subscription_id != OMIT @@ -127,8 +127,7 @@ def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, subscription: @name = name if name != OMIT @channel = channel if channel != OMIT @billing_limit = billing_limit if billing_limit != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @concurrency_limit = concurrency_limit if concurrency_limit != OMIT @invited_by_user_id = invited_by_user_id if invited_by_user_id != OMIT @role = role if role != OMIT @@ -149,8 +148,7 @@ def initialize(id:, created_at:, updated_at:, hipaa_enabled: OMIT, subscription: "name": name, "channel": channel, "billingLimit": billing_limit, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret, + "server": server, "concurrencyLimit": concurrency_limit, "invitedByUserId": invited_by_user_id, "role": role @@ -193,8 +191,12 @@ def self.from_json(json_object:) name = parsed_json["name"] channel = parsed_json["channel"] billing_limit = parsed_json["billingLimit"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end concurrency_limit = parsed_json["concurrencyLimit"] invited_by_user_id = parsed_json["invitedByUserId"] role = parsed_json["role"] @@ -214,8 +216,7 @@ def self.from_json(json_object:) name: name, channel: channel, billing_limit: billing_limit, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, concurrency_limit: concurrency_limit, invited_by_user_id: invited_by_user_id, role: role, @@ -252,8 +253,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.channel&.is_a?(Vapi::OrgWithOrgUserChannel) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.billing_limit&.is_a?(Float) != false || raise("Passed value for field obj.billing_limit is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.concurrency_limit&.is_a?(Float) != false || raise("Passed value for field obj.concurrency_limit is not the expected type, validation failed.") obj.invited_by_user_id&.is_a?(String) != false || raise("Passed value for field obj.invited_by_user_id is not the expected type, validation failed.") obj.role&.is_a?(Vapi::OrgWithOrgUserRole) != false || raise("Passed value for field obj.role is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/payment.rb b/lib/vapi_server_sdk/types/payment.rb deleted file mode 100644 index 305c40c..0000000 --- a/lib/vapi_server_sdk/types/payment.rb +++ /dev/null @@ -1,167 +0,0 @@ -# frozen_string_literal: true - -require_relative "payment_status" -require "date" -require "ostruct" -require "json" - -module Vapi - class Payment - # @return [String] This is the id of the payment - attr_reader :id - # @return [String] This is the id of the org - attr_reader :org_id - # @return [String] This is the total cost of the payment, which is the sum of all the costs in the - # costs object. - # Note: this is a string to avoid floating point precision issues. - attr_reader :cost - # @return [Array Object}>] This is the itemized breakdown of payment amounts - attr_reader :costs - # @return [Vapi::PaymentStatus] This is the status of the payment - attr_reader :status - # @return [DateTime] This is the timestamp when the payment was created - attr_reader :created_at - # @return [DateTime] This is the timestamp when the payment was last updated - attr_reader :updated_at - # @return [Boolean] This indicates if this payment was automatically generated by the auto-reload - # feature - attr_reader :is_auto_reload - # @return [String] This is the id of the subscription the payment belongs to - attr_reader :subscription_id - # @return [String] This is the id of the call - attr_reader :call_id - # @return [String] This is the id of the purchased phone number - attr_reader :phone_number_id - # @return [String] This is the id of the associated stripe payment intent - attr_reader :stripe_payment_intent_id - # @return [String] This is the id of the associated stripe invoice - attr_reader :stripe_invoice_id - # @return [OpenStruct] Additional properties unmapped to the current class definition - attr_reader :additional_properties - # @return [Object] - attr_reader :_field_set - protected :_field_set - - OMIT = Object.new - - # @param id [String] This is the id of the payment - # @param org_id [String] This is the id of the org - # @param cost [String] This is the total cost of the payment, which is the sum of all the costs in the - # costs object. - # Note: this is a string to avoid floating point precision issues. - # @param costs [Array Object}>] This is the itemized breakdown of payment amounts - # @param status [Vapi::PaymentStatus] This is the status of the payment - # @param created_at [DateTime] This is the timestamp when the payment was created - # @param updated_at [DateTime] This is the timestamp when the payment was last updated - # @param is_auto_reload [Boolean] This indicates if this payment was automatically generated by the auto-reload - # feature - # @param subscription_id [String] This is the id of the subscription the payment belongs to - # @param call_id [String] This is the id of the call - # @param phone_number_id [String] This is the id of the purchased phone number - # @param stripe_payment_intent_id [String] This is the id of the associated stripe payment intent - # @param stripe_invoice_id [String] This is the id of the associated stripe invoice - # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::Payment] - def initialize(id:, cost:, costs:, status:, created_at:, updated_at:, is_auto_reload:, subscription_id:, - org_id: OMIT, call_id: OMIT, phone_number_id: OMIT, stripe_payment_intent_id: OMIT, stripe_invoice_id: OMIT, additional_properties: nil) - @id = id - @org_id = org_id if org_id != OMIT - @cost = cost - @costs = costs - @status = status - @created_at = created_at - @updated_at = updated_at - @is_auto_reload = is_auto_reload - @subscription_id = subscription_id - @call_id = call_id if call_id != OMIT - @phone_number_id = phone_number_id if phone_number_id != OMIT - @stripe_payment_intent_id = stripe_payment_intent_id if stripe_payment_intent_id != OMIT - @stripe_invoice_id = stripe_invoice_id if stripe_invoice_id != OMIT - @additional_properties = additional_properties - @_field_set = { - "id": id, - "orgId": org_id, - "cost": cost, - "costs": costs, - "status": status, - "createdAt": created_at, - "updatedAt": updated_at, - "isAutoReload": is_auto_reload, - "subscriptionId": subscription_id, - "callId": call_id, - "phoneNumberId": phone_number_id, - "stripePaymentIntentId": stripe_payment_intent_id, - "stripeInvoiceId": stripe_invoice_id - }.reject do |_k, v| - v == OMIT - end - end - - # Deserialize a JSON object to an instance of Payment - # - # @param json_object [String] - # @return [Vapi::Payment] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - parsed_json = JSON.parse(json_object) - id = parsed_json["id"] - org_id = parsed_json["orgId"] - cost = parsed_json["cost"] - costs = parsed_json["costs"] - status = parsed_json["status"] - created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) - updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) - is_auto_reload = parsed_json["isAutoReload"] - subscription_id = parsed_json["subscriptionId"] - call_id = parsed_json["callId"] - phone_number_id = parsed_json["phoneNumberId"] - stripe_payment_intent_id = parsed_json["stripePaymentIntentId"] - stripe_invoice_id = parsed_json["stripeInvoiceId"] - new( - id: id, - org_id: org_id, - cost: cost, - costs: costs, - status: status, - created_at: created_at, - updated_at: updated_at, - is_auto_reload: is_auto_reload, - subscription_id: subscription_id, - call_id: call_id, - phone_number_id: phone_number_id, - stripe_payment_intent_id: stripe_payment_intent_id, - stripe_invoice_id: stripe_invoice_id, - additional_properties: struct - ) - end - - # Serialize an instance of Payment to a JSON object - # - # @return [String] - def to_json(*_args) - @_field_set&.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") - obj.org_id&.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") - obj.cost.is_a?(String) != false || raise("Passed value for field obj.cost is not the expected type, validation failed.") - obj.costs.is_a?(Array) != false || raise("Passed value for field obj.costs is not the expected type, validation failed.") - obj.status.is_a?(Vapi::PaymentStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") - obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") - obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") - obj.is_auto_reload.is_a?(Boolean) != false || raise("Passed value for field obj.is_auto_reload is not the expected type, validation failed.") - obj.subscription_id.is_a?(String) != false || raise("Passed value for field obj.subscription_id is not the expected type, validation failed.") - obj.call_id&.is_a?(String) != false || raise("Passed value for field obj.call_id is not the expected type, validation failed.") - obj.phone_number_id&.is_a?(String) != false || raise("Passed value for field obj.phone_number_id is not the expected type, validation failed.") - obj.stripe_payment_intent_id&.is_a?(String) != false || raise("Passed value for field obj.stripe_payment_intent_id is not the expected type, validation failed.") - obj.stripe_invoice_id&.is_a?(String) != false || raise("Passed value for field obj.stripe_invoice_id is not the expected type, validation failed.") - end - end -end diff --git a/lib/vapi_server_sdk/types/payment_retry_dto.rb b/lib/vapi_server_sdk/types/payment_retry_dto.rb deleted file mode 100644 index 47d17b8..0000000 --- a/lib/vapi_server_sdk/types/payment_retry_dto.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -require "ostruct" -require "json" - -module Vapi - class PaymentRetryDto - # @return [String] This is the payment ID to retry. - attr_reader :payment_id - # @return [OpenStruct] Additional properties unmapped to the current class definition - attr_reader :additional_properties - # @return [Object] - attr_reader :_field_set - protected :_field_set - - OMIT = Object.new - - # @param payment_id [String] This is the payment ID to retry. - # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::PaymentRetryDto] - def initialize(payment_id:, additional_properties: nil) - @payment_id = payment_id - @additional_properties = additional_properties - @_field_set = { "paymentId": payment_id } - end - - # Deserialize a JSON object to an instance of PaymentRetryDto - # - # @param json_object [String] - # @return [Vapi::PaymentRetryDto] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - parsed_json = JSON.parse(json_object) - payment_id = parsed_json["paymentId"] - new(payment_id: payment_id, additional_properties: struct) - end - - # Serialize an instance of PaymentRetryDto to a JSON object - # - # @return [String] - def to_json(*_args) - @_field_set&.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - obj.payment_id.is_a?(String) != false || raise("Passed value for field obj.payment_id is not the expected type, validation failed.") - end - end -end diff --git a/lib/vapi_server_sdk/types/payment_status.rb b/lib/vapi_server_sdk/types/payment_status.rb deleted file mode 100644 index 48dc867..0000000 --- a/lib/vapi_server_sdk/types/payment_status.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -module Vapi - # This is the status of the payment - class PaymentStatus - PAST_DUE = "past-due" - PENDING = "pending" - FINALIZED = "finalized" - REFUNDED = "refunded" - end -end diff --git a/lib/vapi_server_sdk/types/payments_paginated_response.rb b/lib/vapi_server_sdk/types/payments_paginated_response.rb deleted file mode 100644 index c5657cf..0000000 --- a/lib/vapi_server_sdk/types/payments_paginated_response.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -require_relative "payment" -require_relative "pagination_meta" -require "ostruct" -require "json" - -module Vapi - class PaymentsPaginatedResponse - # @return [Array] - attr_reader :results - # @return [Vapi::PaginationMeta] - attr_reader :metadata - # @return [OpenStruct] Additional properties unmapped to the current class definition - attr_reader :additional_properties - # @return [Object] - attr_reader :_field_set - protected :_field_set - - OMIT = Object.new - - # @param results [Array] - # @param metadata [Vapi::PaginationMeta] - # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::PaymentsPaginatedResponse] - def initialize(results:, metadata:, additional_properties: nil) - @results = results - @metadata = metadata - @additional_properties = additional_properties - @_field_set = { "results": results, "metadata": metadata } - end - - # Deserialize a JSON object to an instance of PaymentsPaginatedResponse - # - # @param json_object [String] - # @return [Vapi::PaymentsPaginatedResponse] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - parsed_json = JSON.parse(json_object) - results = parsed_json["results"]&.map do |item| - item = item.to_json - Vapi::Payment.from_json(json_object: item) - end - if parsed_json["metadata"].nil? - metadata = nil - else - metadata = parsed_json["metadata"].to_json - metadata = Vapi::PaginationMeta.from_json(json_object: metadata) - end - new( - results: results, - metadata: metadata, - additional_properties: struct - ) - end - - # Serialize an instance of PaymentsPaginatedResponse to a JSON object - # - # @return [String] - def to_json(*_args) - @_field_set&.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.") - Vapi::PaginationMeta.validate_raw(obj: obj.metadata) - end - end -end diff --git a/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb b/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb index b166849..f6fb648 100644 --- a/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb +++ b/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb @@ -4,6 +4,30 @@ module Vapi # This is the reason the call ended. This can also be found at `call.endedReason` # on GET /call/:id. class ServerMessageEndOfCallReportEndedReason + ASSISTANT_NOT_INVALID = "assistant-not-invalid" + ASSISTANT_NOT_PROVIDED = "assistant-not-provided" + CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET = "call-start-error-neither-assistant-nor-server-set" + ASSISTANT_REQUEST_FAILED = "assistant-request-failed" + ASSISTANT_REQUEST_RETURNED_ERROR = "assistant-request-returned-error" + ASSISTANT_REQUEST_RETURNED_UNSPEAKABLE_ERROR = "assistant-request-returned-unspeakable-error" + ASSISTANT_REQUEST_RETURNED_INVALID_ASSISTANT = "assistant-request-returned-invalid-assistant" + ASSISTANT_REQUEST_RETURNED_NO_ASSISTANT = "assistant-request-returned-no-assistant" + ASSISTANT_REQUEST_RETURNED_FORWARDING_PHONE_NUMBER = "assistant-request-returned-forwarding-phone-number" + ASSISTANT_ENDED_CALL = "assistant-ended-call" + ASSISTANT_SAID_END_CALL_PHRASE = "assistant-said-end-call-phrase" + ASSISTANT_FORWARDED_CALL = "assistant-forwarded-call" + ASSISTANT_JOIN_TIMED_OUT = "assistant-join-timed-out" + CUSTOMER_BUSY = "customer-busy" + CUSTOMER_ENDED_CALL = "customer-ended-call" + CUSTOMER_DID_NOT_ANSWER = "customer-did-not-answer" + CUSTOMER_DID_NOT_GIVE_MICROPHONE_PERMISSION = "customer-did-not-give-microphone-permission" + ASSISTANT_SAID_MESSAGE_WITH_END_CALL_ENABLED = "assistant-said-message-with-end-call-enabled" + EXCEEDED_MAX_DURATION = "exceeded-max-duration" + MANUALLY_CANCELED = "manually-canceled" + PHONE_CALL_PROVIDER_CLOSED_WEBSOCKET = "phone-call-provider-closed-websocket" + DB_ERROR = "db-error" + ASSISTANT_NOT_FOUND = "assistant-not-found" + LICENSE_CHECK_FAILED = "license-check-failed" PIPELINE_ERROR_OPENAI_VOICE_FAILED = "pipeline-error-openai-voice-failed" PIPELINE_ERROR_CARTESIA_VOICE_FAILED = "pipeline-error-cartesia-voice-failed" PIPELINE_ERROR_DEEPGRAM_VOICE_FAILED = "pipeline-error-deepgram-voice-failed" @@ -13,9 +37,12 @@ class ServerMessageEndOfCallReportEndedReason PIPELINE_ERROR_AZURE_VOICE_FAILED = "pipeline-error-azure-voice-failed" PIPELINE_ERROR_RIME_AI_VOICE_FAILED = "pipeline-error-rime-ai-voice-failed" PIPELINE_ERROR_NEETS_VOICE_FAILED = "pipeline-error-neets-voice-failed" - DB_ERROR = "db-error" - ASSISTANT_NOT_FOUND = "assistant-not-found" - LICENSE_CHECK_FAILED = "license-check-failed" + PIPELINE_ERROR_SMALLEST_AI_VOICE_FAILED = "pipeline-error-smallest-ai-voice-failed" + PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" + PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" + PIPELINE_ERROR_ASSEMBLY_AI_TRANSCRIBER_FAILED = "pipeline-error-assembly-ai-transcriber-failed" + PIPELINE_ERROR_TALKSCRIBER_TRANSCRIBER_FAILED = "pipeline-error-talkscriber-transcriber-failed" + PIPELINE_ERROR_AZURE_SPEECH_TRANSCRIBER_FAILED = "pipeline-error-azure-speech-transcriber-failed" PIPELINE_ERROR_VAPI_LLM_FAILED = "pipeline-error-vapi-llm-failed" PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-vapi-400-bad-request-validation-failed" PIPELINE_ERROR_VAPI_401_UNAUTHORIZED = "pipeline-error-vapi-401-unauthorized" @@ -35,36 +62,14 @@ class ServerMessageEndOfCallReportEndedReason VAPIFAULT_WEB_CALL_WORKER_SETUP_FAILED = "vapifault-web-call-worker-setup-failed" VAPIFAULT_TRANSPORT_CONNECTED_BUT_CALL_NOT_ACTIVE = "vapifault-transport-connected-but-call-not-active" VAPIFAULT_CALL_STARTED_BUT_CONNECTION_TO_TRANSPORT_MISSING = "vapifault-call-started-but-connection-to-transport-missing" - PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" - PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" - PIPELINE_ERROR_ASSEMBLY_AI_TRANSCRIBER_FAILED = "pipeline-error-assembly-ai-transcriber-failed" PIPELINE_ERROR_OPENAI_LLM_FAILED = "pipeline-error-openai-llm-failed" PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED = "pipeline-error-azure-openai-llm-failed" PIPELINE_ERROR_GROQ_LLM_FAILED = "pipeline-error-groq-llm-failed" PIPELINE_ERROR_GOOGLE_LLM_FAILED = "pipeline-error-google-llm-failed" PIPELINE_ERROR_XAI_LLM_FAILED = "pipeline-error-xai-llm-failed" PIPELINE_ERROR_INFLECTION_AI_LLM_FAILED = "pipeline-error-inflection-ai-llm-failed" - ASSISTANT_NOT_INVALID = "assistant-not-invalid" - ASSISTANT_NOT_PROVIDED = "assistant-not-provided" - CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET = "call-start-error-neither-assistant-nor-server-set" - ASSISTANT_REQUEST_FAILED = "assistant-request-failed" - ASSISTANT_REQUEST_RETURNED_ERROR = "assistant-request-returned-error" - ASSISTANT_REQUEST_RETURNED_UNSPEAKABLE_ERROR = "assistant-request-returned-unspeakable-error" - ASSISTANT_REQUEST_RETURNED_INVALID_ASSISTANT = "assistant-request-returned-invalid-assistant" - ASSISTANT_REQUEST_RETURNED_NO_ASSISTANT = "assistant-request-returned-no-assistant" - ASSISTANT_REQUEST_RETURNED_FORWARDING_PHONE_NUMBER = "assistant-request-returned-forwarding-phone-number" - ASSISTANT_ENDED_CALL = "assistant-ended-call" - ASSISTANT_SAID_END_CALL_PHRASE = "assistant-said-end-call-phrase" - ASSISTANT_FORWARDED_CALL = "assistant-forwarded-call" - ASSISTANT_JOIN_TIMED_OUT = "assistant-join-timed-out" - CUSTOMER_BUSY = "customer-busy" - CUSTOMER_ENDED_CALL = "customer-ended-call" - CUSTOMER_DID_NOT_ANSWER = "customer-did-not-answer" - CUSTOMER_DID_NOT_GIVE_MICROPHONE_PERMISSION = "customer-did-not-give-microphone-permission" - ASSISTANT_SAID_MESSAGE_WITH_END_CALL_ENABLED = "assistant-said-message-with-end-call-enabled" - EXCEEDED_MAX_DURATION = "exceeded-max-duration" - MANUALLY_CANCELED = "manually-canceled" - PHONE_CALL_PROVIDER_CLOSED_WEBSOCKET = "phone-call-provider-closed-websocket" + PIPELINE_ERROR_CEREBRAS_LLM_FAILED = "pipeline-error-cerebras-llm-failed" + PIPELINE_ERROR_DEEP_SEEK_LLM_FAILED = "pipeline-error-deep-seek-llm-failed" PIPELINE_ERROR_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-openai-400-bad-request-validation-failed" PIPELINE_ERROR_OPENAI_401_UNAUTHORIZED = "pipeline-error-openai-401-unauthorized" PIPELINE_ERROR_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-openai-403-model-access-denied" @@ -85,6 +90,11 @@ class ServerMessageEndOfCallReportEndedReason PIPELINE_ERROR_INFLECTION_AI_403_MODEL_ACCESS_DENIED = "pipeline-error-inflection-ai-403-model-access-denied" PIPELINE_ERROR_INFLECTION_AI_429_EXCEEDED_QUOTA = "pipeline-error-inflection-ai-429-exceeded-quota" PIPELINE_ERROR_INFLECTION_AI_500_SERVER_ERROR = "pipeline-error-inflection-ai-500-server-error" + PIPELINE_ERROR_DEEP_SEEK_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-deep-seek-400-bad-request-validation-failed" + PIPELINE_ERROR_DEEP_SEEK_401_UNAUTHORIZED = "pipeline-error-deep-seek-401-unauthorized" + PIPELINE_ERROR_DEEP_SEEK_403_MODEL_ACCESS_DENIED = "pipeline-error-deep-seek-403-model-access-denied" + PIPELINE_ERROR_DEEP_SEEK_429_EXCEEDED_QUOTA = "pipeline-error-deep-seek-429-exceeded-quota" + PIPELINE_ERROR_DEEP_SEEK_500_SERVER_ERROR = "pipeline-error-deep-seek-500-server-error" PIPELINE_ERROR_AZURE_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-azure-openai-400-bad-request-validation-failed" PIPELINE_ERROR_AZURE_OPENAI_401_UNAUTHORIZED = "pipeline-error-azure-openai-401-unauthorized" PIPELINE_ERROR_AZURE_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-azure-openai-403-model-access-denied" @@ -95,6 +105,11 @@ class ServerMessageEndOfCallReportEndedReason PIPELINE_ERROR_GROQ_403_MODEL_ACCESS_DENIED = "pipeline-error-groq-403-model-access-denied" PIPELINE_ERROR_GROQ_429_EXCEEDED_QUOTA = "pipeline-error-groq-429-exceeded-quota" PIPELINE_ERROR_GROQ_500_SERVER_ERROR = "pipeline-error-groq-500-server-error" + PIPELINE_ERROR_CEREBRAS_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-cerebras-400-bad-request-validation-failed" + PIPELINE_ERROR_CEREBRAS_401_UNAUTHORIZED = "pipeline-error-cerebras-401-unauthorized" + PIPELINE_ERROR_CEREBRAS_403_MODEL_ACCESS_DENIED = "pipeline-error-cerebras-403-model-access-denied" + PIPELINE_ERROR_CEREBRAS_429_EXCEEDED_QUOTA = "pipeline-error-cerebras-429-exceeded-quota" + PIPELINE_ERROR_CEREBRAS_500_SERVER_ERROR = "pipeline-error-cerebras-500-server-error" PIPELINE_ERROR_ANTHROPIC_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-anthropic-400-bad-request-validation-failed" PIPELINE_ERROR_ANTHROPIC_401_UNAUTHORIZED = "pipeline-error-anthropic-401-unauthorized" PIPELINE_ERROR_ANTHROPIC_403_MODEL_ACCESS_DENIED = "pipeline-error-anthropic-403-model-access-denied" @@ -182,6 +197,8 @@ class ServerMessageEndOfCallReportEndedReason PIPELINE_ERROR_PLAYHT_429_EXCEEDED_QUOTA = "pipeline-error-playht-429-exceeded-quota" PIPELINE_ERROR_PLAYHT_502_GATEWAY_ERROR = "pipeline-error-playht-502-gateway-error" PIPELINE_ERROR_PLAYHT_504_GATEWAY_ERROR = "pipeline-error-playht-504-gateway-error" + PIPELINE_ERROR_TAVUS_VIDEO_FAILED = "pipeline-error-tavus-video-failed" + PIPELINE_ERROR_CUSTOM_TRANSCRIBER_FAILED = "pipeline-error-custom-transcriber-failed" PIPELINE_ERROR_DEEPGRAM_RETURNING_403_MODEL_ACCESS_DENIED = "pipeline-error-deepgram-returning-403-model-access-denied" PIPELINE_ERROR_DEEPGRAM_RETURNING_401_INVALID_CREDENTIALS = "pipeline-error-deepgram-returning-401-invalid-credentials" PIPELINE_ERROR_DEEPGRAM_RETURNING_404_NOT_FOUND = "pipeline-error-deepgram-returning-404-not-found" @@ -189,8 +206,6 @@ class ServerMessageEndOfCallReportEndedReason PIPELINE_ERROR_DEEPGRAM_RETURNING_500_INVALID_JSON = "pipeline-error-deepgram-returning-500-invalid-json" PIPELINE_ERROR_DEEPGRAM_RETURNING_502_NETWORK_ERROR = "pipeline-error-deepgram-returning-502-network-error" PIPELINE_ERROR_DEEPGRAM_RETURNING_502_BAD_GATEWAY_EHOSTUNREACH = "pipeline-error-deepgram-returning-502-bad-gateway-ehostunreach" - PIPELINE_ERROR_TAVUS_VIDEO_FAILED = "pipeline-error-tavus-video-failed" - PIPELINE_ERROR_CUSTOM_TRANSCRIBER_FAILED = "pipeline-error-custom-transcriber-failed" SILENCE_TIMED_OUT = "silence-timed-out" SIP_GATEWAY_FAILED_TO_CONNECT_CALL = "sip-gateway-failed-to-connect-call" TWILIO_FAILED_TO_CONNECT_CALL = "twilio-failed-to-connect-call" diff --git a/lib/vapi_server_sdk/types/server_message_status_update.rb b/lib/vapi_server_sdk/types/server_message_status_update.rb index dd176ae..d4fd733 100644 --- a/lib/vapi_server_sdk/types/server_message_status_update.rb +++ b/lib/vapi_server_sdk/types/server_message_status_update.rb @@ -61,6 +61,9 @@ class ServerMessageStatusUpdate # @return [String] This is the transcript of the call. This is only sent if the status is # "forwarding". attr_reader :transcript + # @return [String] This is the summary of the call. This is only sent if the status is + # "forwarding". + attr_reader :summary # @return [Hash{String => Object}] This is the inbound phone call debugging artifacts. This is only sent if the # status is "ended" and there was an error accepting the inbound phone call. # This will include any errors related to the "assistant-request" if one was made. @@ -107,13 +110,15 @@ class ServerMessageStatusUpdate # especially after the call is ended, use GET /call/:id. # @param transcript [String] This is the transcript of the call. This is only sent if the status is # "forwarding". + # @param summary [String] This is the summary of the call. This is only sent if the status is + # "forwarding". # @param inbound_phone_call_debugging_artifacts [Hash{String => Object}] This is the inbound phone call debugging artifacts. This is only sent if the # status is "ended" and there was an error accepting the inbound phone call. # This will include any errors related to the "assistant-request" if one was made. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::ServerMessageStatusUpdate] def initialize(status:, phone_number: OMIT, ended_reason: OMIT, messages: OMIT, messages_open_ai_formatted: OMIT, - destination: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, transcript: OMIT, inbound_phone_call_debugging_artifacts: OMIT, additional_properties: nil) + destination: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, transcript: OMIT, summary: OMIT, inbound_phone_call_debugging_artifacts: OMIT, additional_properties: nil) @phone_number = phone_number if phone_number != OMIT @status = status @ended_reason = ended_reason if ended_reason != OMIT @@ -126,6 +131,7 @@ def initialize(status:, phone_number: OMIT, ended_reason: OMIT, messages: OMIT, @customer = customer if customer != OMIT @call = call if call != OMIT @transcript = transcript if transcript != OMIT + @summary = summary if summary != OMIT if inbound_phone_call_debugging_artifacts != OMIT @inbound_phone_call_debugging_artifacts = inbound_phone_call_debugging_artifacts end @@ -143,6 +149,7 @@ def initialize(status:, phone_number: OMIT, ended_reason: OMIT, messages: OMIT, "customer": customer, "call": call, "transcript": transcript, + "summary": summary, "inboundPhoneCallDebuggingArtifacts": inbound_phone_call_debugging_artifacts }.reject do |_k, v| v == OMIT @@ -204,6 +211,7 @@ def self.from_json(json_object:) call = Vapi::Call.from_json(json_object: call) end transcript = parsed_json["transcript"] + summary = parsed_json["summary"] inbound_phone_call_debugging_artifacts = parsed_json["inboundPhoneCallDebuggingArtifacts"] new( phone_number: phone_number, @@ -218,6 +226,7 @@ def self.from_json(json_object:) customer: customer, call: call, transcript: transcript, + summary: summary, inbound_phone_call_debugging_artifacts: inbound_phone_call_debugging_artifacts, additional_properties: struct ) @@ -249,6 +258,7 @@ def self.validate_raw(obj:) obj.customer.nil? || Vapi::CreateCustomerDto.validate_raw(obj: obj.customer) obj.call.nil? || Vapi::Call.validate_raw(obj: obj.call) obj.transcript&.is_a?(String) != false || raise("Passed value for field obj.transcript is not the expected type, validation failed.") + obj.summary&.is_a?(String) != false || raise("Passed value for field obj.summary is not the expected type, validation failed.") obj.inbound_phone_call_debugging_artifacts&.is_a?(Hash) != false || raise("Passed value for field obj.inbound_phone_call_debugging_artifacts is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb b/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb index 19f659d..3e255f9 100644 --- a/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb +++ b/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb @@ -3,6 +3,30 @@ module Vapi # This is the reason the call ended. This is only sent if the status is "ended". class ServerMessageStatusUpdateEndedReason + ASSISTANT_NOT_INVALID = "assistant-not-invalid" + ASSISTANT_NOT_PROVIDED = "assistant-not-provided" + CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET = "call-start-error-neither-assistant-nor-server-set" + ASSISTANT_REQUEST_FAILED = "assistant-request-failed" + ASSISTANT_REQUEST_RETURNED_ERROR = "assistant-request-returned-error" + ASSISTANT_REQUEST_RETURNED_UNSPEAKABLE_ERROR = "assistant-request-returned-unspeakable-error" + ASSISTANT_REQUEST_RETURNED_INVALID_ASSISTANT = "assistant-request-returned-invalid-assistant" + ASSISTANT_REQUEST_RETURNED_NO_ASSISTANT = "assistant-request-returned-no-assistant" + ASSISTANT_REQUEST_RETURNED_FORWARDING_PHONE_NUMBER = "assistant-request-returned-forwarding-phone-number" + ASSISTANT_ENDED_CALL = "assistant-ended-call" + ASSISTANT_SAID_END_CALL_PHRASE = "assistant-said-end-call-phrase" + ASSISTANT_FORWARDED_CALL = "assistant-forwarded-call" + ASSISTANT_JOIN_TIMED_OUT = "assistant-join-timed-out" + CUSTOMER_BUSY = "customer-busy" + CUSTOMER_ENDED_CALL = "customer-ended-call" + CUSTOMER_DID_NOT_ANSWER = "customer-did-not-answer" + CUSTOMER_DID_NOT_GIVE_MICROPHONE_PERMISSION = "customer-did-not-give-microphone-permission" + ASSISTANT_SAID_MESSAGE_WITH_END_CALL_ENABLED = "assistant-said-message-with-end-call-enabled" + EXCEEDED_MAX_DURATION = "exceeded-max-duration" + MANUALLY_CANCELED = "manually-canceled" + PHONE_CALL_PROVIDER_CLOSED_WEBSOCKET = "phone-call-provider-closed-websocket" + DB_ERROR = "db-error" + ASSISTANT_NOT_FOUND = "assistant-not-found" + LICENSE_CHECK_FAILED = "license-check-failed" PIPELINE_ERROR_OPENAI_VOICE_FAILED = "pipeline-error-openai-voice-failed" PIPELINE_ERROR_CARTESIA_VOICE_FAILED = "pipeline-error-cartesia-voice-failed" PIPELINE_ERROR_DEEPGRAM_VOICE_FAILED = "pipeline-error-deepgram-voice-failed" @@ -12,9 +36,12 @@ class ServerMessageStatusUpdateEndedReason PIPELINE_ERROR_AZURE_VOICE_FAILED = "pipeline-error-azure-voice-failed" PIPELINE_ERROR_RIME_AI_VOICE_FAILED = "pipeline-error-rime-ai-voice-failed" PIPELINE_ERROR_NEETS_VOICE_FAILED = "pipeline-error-neets-voice-failed" - DB_ERROR = "db-error" - ASSISTANT_NOT_FOUND = "assistant-not-found" - LICENSE_CHECK_FAILED = "license-check-failed" + PIPELINE_ERROR_SMALLEST_AI_VOICE_FAILED = "pipeline-error-smallest-ai-voice-failed" + PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" + PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" + PIPELINE_ERROR_ASSEMBLY_AI_TRANSCRIBER_FAILED = "pipeline-error-assembly-ai-transcriber-failed" + PIPELINE_ERROR_TALKSCRIBER_TRANSCRIBER_FAILED = "pipeline-error-talkscriber-transcriber-failed" + PIPELINE_ERROR_AZURE_SPEECH_TRANSCRIBER_FAILED = "pipeline-error-azure-speech-transcriber-failed" PIPELINE_ERROR_VAPI_LLM_FAILED = "pipeline-error-vapi-llm-failed" PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-vapi-400-bad-request-validation-failed" PIPELINE_ERROR_VAPI_401_UNAUTHORIZED = "pipeline-error-vapi-401-unauthorized" @@ -34,36 +61,14 @@ class ServerMessageStatusUpdateEndedReason VAPIFAULT_WEB_CALL_WORKER_SETUP_FAILED = "vapifault-web-call-worker-setup-failed" VAPIFAULT_TRANSPORT_CONNECTED_BUT_CALL_NOT_ACTIVE = "vapifault-transport-connected-but-call-not-active" VAPIFAULT_CALL_STARTED_BUT_CONNECTION_TO_TRANSPORT_MISSING = "vapifault-call-started-but-connection-to-transport-missing" - PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed" - PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed" - PIPELINE_ERROR_ASSEMBLY_AI_TRANSCRIBER_FAILED = "pipeline-error-assembly-ai-transcriber-failed" PIPELINE_ERROR_OPENAI_LLM_FAILED = "pipeline-error-openai-llm-failed" PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED = "pipeline-error-azure-openai-llm-failed" PIPELINE_ERROR_GROQ_LLM_FAILED = "pipeline-error-groq-llm-failed" PIPELINE_ERROR_GOOGLE_LLM_FAILED = "pipeline-error-google-llm-failed" PIPELINE_ERROR_XAI_LLM_FAILED = "pipeline-error-xai-llm-failed" PIPELINE_ERROR_INFLECTION_AI_LLM_FAILED = "pipeline-error-inflection-ai-llm-failed" - ASSISTANT_NOT_INVALID = "assistant-not-invalid" - ASSISTANT_NOT_PROVIDED = "assistant-not-provided" - CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET = "call-start-error-neither-assistant-nor-server-set" - ASSISTANT_REQUEST_FAILED = "assistant-request-failed" - ASSISTANT_REQUEST_RETURNED_ERROR = "assistant-request-returned-error" - ASSISTANT_REQUEST_RETURNED_UNSPEAKABLE_ERROR = "assistant-request-returned-unspeakable-error" - ASSISTANT_REQUEST_RETURNED_INVALID_ASSISTANT = "assistant-request-returned-invalid-assistant" - ASSISTANT_REQUEST_RETURNED_NO_ASSISTANT = "assistant-request-returned-no-assistant" - ASSISTANT_REQUEST_RETURNED_FORWARDING_PHONE_NUMBER = "assistant-request-returned-forwarding-phone-number" - ASSISTANT_ENDED_CALL = "assistant-ended-call" - ASSISTANT_SAID_END_CALL_PHRASE = "assistant-said-end-call-phrase" - ASSISTANT_FORWARDED_CALL = "assistant-forwarded-call" - ASSISTANT_JOIN_TIMED_OUT = "assistant-join-timed-out" - CUSTOMER_BUSY = "customer-busy" - CUSTOMER_ENDED_CALL = "customer-ended-call" - CUSTOMER_DID_NOT_ANSWER = "customer-did-not-answer" - CUSTOMER_DID_NOT_GIVE_MICROPHONE_PERMISSION = "customer-did-not-give-microphone-permission" - ASSISTANT_SAID_MESSAGE_WITH_END_CALL_ENABLED = "assistant-said-message-with-end-call-enabled" - EXCEEDED_MAX_DURATION = "exceeded-max-duration" - MANUALLY_CANCELED = "manually-canceled" - PHONE_CALL_PROVIDER_CLOSED_WEBSOCKET = "phone-call-provider-closed-websocket" + PIPELINE_ERROR_CEREBRAS_LLM_FAILED = "pipeline-error-cerebras-llm-failed" + PIPELINE_ERROR_DEEP_SEEK_LLM_FAILED = "pipeline-error-deep-seek-llm-failed" PIPELINE_ERROR_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-openai-400-bad-request-validation-failed" PIPELINE_ERROR_OPENAI_401_UNAUTHORIZED = "pipeline-error-openai-401-unauthorized" PIPELINE_ERROR_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-openai-403-model-access-denied" @@ -84,6 +89,11 @@ class ServerMessageStatusUpdateEndedReason PIPELINE_ERROR_INFLECTION_AI_403_MODEL_ACCESS_DENIED = "pipeline-error-inflection-ai-403-model-access-denied" PIPELINE_ERROR_INFLECTION_AI_429_EXCEEDED_QUOTA = "pipeline-error-inflection-ai-429-exceeded-quota" PIPELINE_ERROR_INFLECTION_AI_500_SERVER_ERROR = "pipeline-error-inflection-ai-500-server-error" + PIPELINE_ERROR_DEEP_SEEK_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-deep-seek-400-bad-request-validation-failed" + PIPELINE_ERROR_DEEP_SEEK_401_UNAUTHORIZED = "pipeline-error-deep-seek-401-unauthorized" + PIPELINE_ERROR_DEEP_SEEK_403_MODEL_ACCESS_DENIED = "pipeline-error-deep-seek-403-model-access-denied" + PIPELINE_ERROR_DEEP_SEEK_429_EXCEEDED_QUOTA = "pipeline-error-deep-seek-429-exceeded-quota" + PIPELINE_ERROR_DEEP_SEEK_500_SERVER_ERROR = "pipeline-error-deep-seek-500-server-error" PIPELINE_ERROR_AZURE_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-azure-openai-400-bad-request-validation-failed" PIPELINE_ERROR_AZURE_OPENAI_401_UNAUTHORIZED = "pipeline-error-azure-openai-401-unauthorized" PIPELINE_ERROR_AZURE_OPENAI_403_MODEL_ACCESS_DENIED = "pipeline-error-azure-openai-403-model-access-denied" @@ -94,6 +104,11 @@ class ServerMessageStatusUpdateEndedReason PIPELINE_ERROR_GROQ_403_MODEL_ACCESS_DENIED = "pipeline-error-groq-403-model-access-denied" PIPELINE_ERROR_GROQ_429_EXCEEDED_QUOTA = "pipeline-error-groq-429-exceeded-quota" PIPELINE_ERROR_GROQ_500_SERVER_ERROR = "pipeline-error-groq-500-server-error" + PIPELINE_ERROR_CEREBRAS_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-cerebras-400-bad-request-validation-failed" + PIPELINE_ERROR_CEREBRAS_401_UNAUTHORIZED = "pipeline-error-cerebras-401-unauthorized" + PIPELINE_ERROR_CEREBRAS_403_MODEL_ACCESS_DENIED = "pipeline-error-cerebras-403-model-access-denied" + PIPELINE_ERROR_CEREBRAS_429_EXCEEDED_QUOTA = "pipeline-error-cerebras-429-exceeded-quota" + PIPELINE_ERROR_CEREBRAS_500_SERVER_ERROR = "pipeline-error-cerebras-500-server-error" PIPELINE_ERROR_ANTHROPIC_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-anthropic-400-bad-request-validation-failed" PIPELINE_ERROR_ANTHROPIC_401_UNAUTHORIZED = "pipeline-error-anthropic-401-unauthorized" PIPELINE_ERROR_ANTHROPIC_403_MODEL_ACCESS_DENIED = "pipeline-error-anthropic-403-model-access-denied" @@ -181,6 +196,8 @@ class ServerMessageStatusUpdateEndedReason PIPELINE_ERROR_PLAYHT_429_EXCEEDED_QUOTA = "pipeline-error-playht-429-exceeded-quota" PIPELINE_ERROR_PLAYHT_502_GATEWAY_ERROR = "pipeline-error-playht-502-gateway-error" PIPELINE_ERROR_PLAYHT_504_GATEWAY_ERROR = "pipeline-error-playht-504-gateway-error" + PIPELINE_ERROR_TAVUS_VIDEO_FAILED = "pipeline-error-tavus-video-failed" + PIPELINE_ERROR_CUSTOM_TRANSCRIBER_FAILED = "pipeline-error-custom-transcriber-failed" PIPELINE_ERROR_DEEPGRAM_RETURNING_403_MODEL_ACCESS_DENIED = "pipeline-error-deepgram-returning-403-model-access-denied" PIPELINE_ERROR_DEEPGRAM_RETURNING_401_INVALID_CREDENTIALS = "pipeline-error-deepgram-returning-401-invalid-credentials" PIPELINE_ERROR_DEEPGRAM_RETURNING_404_NOT_FOUND = "pipeline-error-deepgram-returning-404-not-found" @@ -188,8 +205,6 @@ class ServerMessageStatusUpdateEndedReason PIPELINE_ERROR_DEEPGRAM_RETURNING_500_INVALID_JSON = "pipeline-error-deepgram-returning-500-invalid-json" PIPELINE_ERROR_DEEPGRAM_RETURNING_502_NETWORK_ERROR = "pipeline-error-deepgram-returning-502-network-error" PIPELINE_ERROR_DEEPGRAM_RETURNING_502_BAD_GATEWAY_EHOSTUNREACH = "pipeline-error-deepgram-returning-502-bad-gateway-ehostunreach" - PIPELINE_ERROR_TAVUS_VIDEO_FAILED = "pipeline-error-tavus-video-failed" - PIPELINE_ERROR_CUSTOM_TRANSCRIBER_FAILED = "pipeline-error-custom-transcriber-failed" SILENCE_TIMED_OUT = "silence-timed-out" SIP_GATEWAY_FAILED_TO_CONNECT_CALL = "sip-gateway-failed-to-connect-call" TWILIO_FAILED_TO_CONNECT_CALL = "twilio-failed-to-connect-call" diff --git a/lib/vapi_server_sdk/types/smallest_ai_credential.rb b/lib/vapi_server_sdk/types/smallest_ai_credential.rb new file mode 100644 index 0000000..cf76059 --- /dev/null +++ b/lib/vapi_server_sdk/types/smallest_ai_credential.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +require "date" +require "ostruct" +require "json" + +module Vapi + class SmallestAiCredential + # @return [String] + attr_reader :provider + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the unique identifier for the credential. + attr_reader :id + # @return [String] This is the unique identifier for the org that this credential belongs to. + attr_reader :org_id + # @return [DateTime] This is the ISO 8601 date-time string of when the credential was created. + attr_reader :created_at + # @return [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + attr_reader :updated_at + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param provider [String] + # @param api_key [String] This is not returned in the API. + # @param id [String] This is the unique identifier for the credential. + # @param org_id [String] This is the unique identifier for the org that this credential belongs to. + # @param created_at [DateTime] This is the ISO 8601 date-time string of when the credential was created. + # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the assistant was last updated. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::SmallestAiCredential] + def initialize(provider:, api_key:, id:, org_id:, created_at:, updated_at:, name: OMIT, additional_properties: nil) + @provider = provider + @api_key = api_key + @id = id + @org_id = org_id + @created_at = created_at + @updated_at = updated_at + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "provider": provider, + "apiKey": api_key, + "id": id, + "orgId": org_id, + "createdAt": created_at, + "updatedAt": updated_at, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of SmallestAiCredential + # + # @param json_object [String] + # @return [Vapi::SmallestAiCredential] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + provider = parsed_json["provider"] + api_key = parsed_json["apiKey"] + id = parsed_json["id"] + org_id = parsed_json["orgId"] + created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) + updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) + name = parsed_json["name"] + new( + provider: provider, + api_key: api_key, + id: id, + org_id: org_id, + created_at: created_at, + updated_at: updated_at, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of SmallestAiCredential to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") + obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") + obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") + obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") + obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/smallest_ai_voice.rb b/lib/vapi_server_sdk/types/smallest_ai_voice.rb new file mode 100644 index 0000000..9534bb4 --- /dev/null +++ b/lib/vapi_server_sdk/types/smallest_ai_voice.rb @@ -0,0 +1,117 @@ +# frozen_string_literal: true + +require_relative "smallest_ai_voice_id" +require_relative "chunk_plan" +require_relative "fallback_plan" +require "ostruct" +require "json" + +module Vapi + class SmallestAiVoice + # @return [Vapi::SmallestAiVoiceId] This is the provider-specific ID that will be used. + attr_reader :voice_id + # @return [String] Smallest AI voice model to use. Defaults to 'lightning' when not specified. + attr_reader :model + # @return [Float] This is the speed multiplier that will be used. + attr_reader :speed + # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + attr_reader :chunk_plan + # @return [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + attr_reader :fallback_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param voice_id [Vapi::SmallestAiVoiceId] This is the provider-specific ID that will be used. + # @param model [String] Smallest AI voice model to use. Defaults to 'lightning' when not specified. + # @param speed [Float] This is the speed multiplier that will be used. + # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice + # provider. + # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary + # voice provider fails. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::SmallestAiVoice] + def initialize(voice_id:, model: OMIT, speed: OMIT, chunk_plan: OMIT, fallback_plan: OMIT, + additional_properties: nil) + @voice_id = voice_id + @model = model if model != OMIT + @speed = speed if speed != OMIT + @chunk_plan = chunk_plan if chunk_plan != OMIT + @fallback_plan = fallback_plan if fallback_plan != OMIT + @additional_properties = additional_properties + @_field_set = { + "voiceId": voice_id, + "model": model, + "speed": speed, + "chunkPlan": chunk_plan, + "fallbackPlan": fallback_plan + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of SmallestAiVoice + # + # @param json_object [String] + # @return [Vapi::SmallestAiVoice] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["voiceId"].nil? + voice_id = nil + else + voice_id = parsed_json["voiceId"].to_json + voice_id = Vapi::SmallestAiVoiceId.from_json(json_object: voice_id) + end + model = parsed_json["model"] + speed = parsed_json["speed"] + if parsed_json["chunkPlan"].nil? + chunk_plan = nil + else + chunk_plan = parsed_json["chunkPlan"].to_json + chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan) + end + if parsed_json["fallbackPlan"].nil? + fallback_plan = nil + else + fallback_plan = parsed_json["fallbackPlan"].to_json + fallback_plan = Vapi::FallbackPlan.from_json(json_object: fallback_plan) + end + new( + voice_id: voice_id, + model: model, + speed: speed, + chunk_plan: chunk_plan, + fallback_plan: fallback_plan, + additional_properties: struct + ) + end + + # Serialize an instance of SmallestAiVoice to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + Vapi::SmallestAiVoiceId.validate_raw(obj: obj.voice_id) + obj.model&.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") + obj.speed&.is_a?(Float) != false || raise("Passed value for field obj.speed is not the expected type, validation failed.") + obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan) + obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/smallest_ai_voice_id.rb b/lib/vapi_server_sdk/types/smallest_ai_voice_id.rb new file mode 100644 index 0000000..99debf7 --- /dev/null +++ b/lib/vapi_server_sdk/types/smallest_ai_voice_id.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require "json" + +module Vapi + # This is the provider-specific ID that will be used. + class SmallestAiVoiceId + # Deserialize a JSON object to an instance of SmallestAiVoiceId + # + # @param json_object [String] + # @return [Vapi::SmallestAiVoiceId] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + begin + struct.is_a?(Vapi::SmallestAiVoiceIdEnum) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + begin + struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.") + return struct unless struct.nil? + + return nil + rescue StandardError + # noop + end + struct + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + begin + return obj.is_a?(Vapi::SmallestAiVoiceIdEnum) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + begin + return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.") + rescue StandardError + # noop + end + raise("Passed value matched no type within the union, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/smallest_ai_voice_id_enum.rb b/lib/vapi_server_sdk/types/smallest_ai_voice_id_enum.rb new file mode 100644 index 0000000..88a9e1d --- /dev/null +++ b/lib/vapi_server_sdk/types/smallest_ai_voice_id_enum.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Vapi + class SmallestAiVoiceIdEnum + EMILY = "emily" + JASMINE = "jasmine" + ARMAN = "arman" + JAMES = "james" + MITHALI = "mithali" + ARAVIND = "aravind" + RAJ = "raj" + DIYA = "diya" + RAMAN = "raman" + ANANYA = "ananya" + ISHA = "isha" + WILLIAM = "william" + AARAV = "aarav" + MONIKA = "monika" + NIHARIKA = "niharika" + DEEPIKA = "deepika" + RAGHAV = "raghav" + KAJAL = "kajal" + RADHIKA = "radhika" + MANSI = "mansi" + NISHA = "nisha" + SAURABH = "saurabh" + POOJA = "pooja" + SAINA = "saina" + SANYA = "sanya" + end +end diff --git a/lib/vapi_server_sdk/types/subscription.rb b/lib/vapi_server_sdk/types/subscription.rb index e2a37c8..94765b1 100644 --- a/lib/vapi_server_sdk/types/subscription.rb +++ b/lib/vapi_server_sdk/types/subscription.rb @@ -54,7 +54,7 @@ class Subscription # @return [String] This is the Stripe fingerprint of the payment method (card). It allows us # to detect users who try to abuse our system through multiple sign-ups. attr_reader :stripe_payment_method_fingerprint - # @return [String] This is the stripe customer's email. + # @return [String] This is the customer's email on Stripe. attr_reader :stripe_customer_email # @return [String] This is the email of the referrer for the subscription. attr_reader :referred_by_email @@ -117,7 +117,7 @@ class Subscription # @param hipaa_common_paper_agreement_id [String] This is the ID for the Common Paper agreement outlining the HIPAA contract. # @param stripe_payment_method_fingerprint [String] This is the Stripe fingerprint of the payment method (card). It allows us # to detect users who try to abuse our system through multiple sign-ups. - # @param stripe_customer_email [String] This is the stripe customer's email. + # @param stripe_customer_email [String] This is the customer's email on Stripe. # @param referred_by_email [String] This is the email of the referrer for the subscription. # @param auto_reload_plan [Vapi::AutoReloadPlan] This is the auto reload plan configured for the subscription. # @param minutes_included [Float] The number of minutes included in the subscription. Enterprise only. diff --git a/lib/vapi_server_sdk/types/subscription_concurrency_line_buy_dto.rb b/lib/vapi_server_sdk/types/subscription_concurrency_line_buy_dto.rb deleted file mode 100644 index c95069c..0000000 --- a/lib/vapi_server_sdk/types/subscription_concurrency_line_buy_dto.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -require "ostruct" -require "json" - -module Vapi - class SubscriptionConcurrencyLineBuyDto - # @return [Float] This is the number of concurrency lines to purchase. - attr_reader :quantity - # @return [OpenStruct] Additional properties unmapped to the current class definition - attr_reader :additional_properties - # @return [Object] - attr_reader :_field_set - protected :_field_set - - OMIT = Object.new - - # @param quantity [Float] This is the number of concurrency lines to purchase. - # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::SubscriptionConcurrencyLineBuyDto] - def initialize(quantity:, additional_properties: nil) - @quantity = quantity - @additional_properties = additional_properties - @_field_set = { "quantity": quantity } - end - - # Deserialize a JSON object to an instance of SubscriptionConcurrencyLineBuyDto - # - # @param json_object [String] - # @return [Vapi::SubscriptionConcurrencyLineBuyDto] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - parsed_json = JSON.parse(json_object) - quantity = parsed_json["quantity"] - new(quantity: quantity, additional_properties: struct) - end - - # Serialize an instance of SubscriptionConcurrencyLineBuyDto to a JSON object - # - # @return [String] - def to_json(*_args) - @_field_set&.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - obj.quantity.is_a?(Float) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.") - end - end -end diff --git a/lib/vapi_server_sdk/types/subscription_concurrency_line_remove_dto.rb b/lib/vapi_server_sdk/types/subscription_concurrency_line_remove_dto.rb deleted file mode 100644 index 2653ed8..0000000 --- a/lib/vapi_server_sdk/types/subscription_concurrency_line_remove_dto.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -require "ostruct" -require "json" - -module Vapi - class SubscriptionConcurrencyLineRemoveDto - # @return [Float] This is the number of concurrency lines to remove. - attr_reader :quantity - # @return [OpenStruct] Additional properties unmapped to the current class definition - attr_reader :additional_properties - # @return [Object] - attr_reader :_field_set - protected :_field_set - - OMIT = Object.new - - # @param quantity [Float] This is the number of concurrency lines to remove. - # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::SubscriptionConcurrencyLineRemoveDto] - def initialize(quantity:, additional_properties: nil) - @quantity = quantity - @additional_properties = additional_properties - @_field_set = { "quantity": quantity } - end - - # Deserialize a JSON object to an instance of SubscriptionConcurrencyLineRemoveDto - # - # @param json_object [String] - # @return [Vapi::SubscriptionConcurrencyLineRemoveDto] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - parsed_json = JSON.parse(json_object) - quantity = parsed_json["quantity"] - new(quantity: quantity, additional_properties: struct) - end - - # Serialize an instance of SubscriptionConcurrencyLineRemoveDto to a JSON object - # - # @return [String] - def to_json(*_args) - @_field_set&.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - obj.quantity.is_a?(Float) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.") - end - end -end diff --git a/lib/vapi_server_sdk/types/subscription_coupon_add_dto.rb b/lib/vapi_server_sdk/types/subscription_coupon_add_dto.rb deleted file mode 100644 index 48c1b16..0000000 --- a/lib/vapi_server_sdk/types/subscription_coupon_add_dto.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -require "ostruct" -require "json" - -module Vapi - class SubscriptionCouponAddDto - # @return [String] This is the ID of the org within the subscription which the coupon will take - # effect on. - attr_reader :org_id - # @return [String] This is the code of the coupon to apply to the subscription. - attr_reader :coupon_code - # @return [OpenStruct] Additional properties unmapped to the current class definition - attr_reader :additional_properties - # @return [Object] - attr_reader :_field_set - protected :_field_set - - OMIT = Object.new - - # @param org_id [String] This is the ID of the org within the subscription which the coupon will take - # effect on. - # @param coupon_code [String] This is the code of the coupon to apply to the subscription. - # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::SubscriptionCouponAddDto] - def initialize(org_id:, coupon_code:, additional_properties: nil) - @org_id = org_id - @coupon_code = coupon_code - @additional_properties = additional_properties - @_field_set = { "orgId": org_id, "couponCode": coupon_code } - end - - # Deserialize a JSON object to an instance of SubscriptionCouponAddDto - # - # @param json_object [String] - # @return [Vapi::SubscriptionCouponAddDto] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - parsed_json = JSON.parse(json_object) - org_id = parsed_json["orgId"] - coupon_code = parsed_json["couponCode"] - new( - org_id: org_id, - coupon_code: coupon_code, - additional_properties: struct - ) - end - - # Serialize an instance of SubscriptionCouponAddDto to a JSON object - # - # @return [String] - def to_json(*_args) - @_field_set&.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") - obj.coupon_code.is_a?(String) != false || raise("Passed value for field obj.coupon_code is not the expected type, validation failed.") - end - end -end diff --git a/lib/vapi_server_sdk/types/subscription_monthly_charge.rb b/lib/vapi_server_sdk/types/subscription_monthly_charge.rb deleted file mode 100644 index 5cc3b38..0000000 --- a/lib/vapi_server_sdk/types/subscription_monthly_charge.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require "ostruct" -require "json" - -module Vapi - class SubscriptionMonthlyCharge - # @return [Float] This is the monthly charge for the subscription. - attr_reader :monthly_charge - # @return [Array Object}>] These are the different costs that make up the monthly charge. - attr_reader :costs - # @return [OpenStruct] Additional properties unmapped to the current class definition - attr_reader :additional_properties - # @return [Object] - attr_reader :_field_set - protected :_field_set - - OMIT = Object.new - - # @param monthly_charge [Float] This is the monthly charge for the subscription. - # @param costs [Array Object}>] These are the different costs that make up the monthly charge. - # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition - # @return [Vapi::SubscriptionMonthlyCharge] - def initialize(monthly_charge:, costs:, additional_properties: nil) - @monthly_charge = monthly_charge - @costs = costs - @additional_properties = additional_properties - @_field_set = { "monthlyCharge": monthly_charge, "costs": costs } - end - - # Deserialize a JSON object to an instance of SubscriptionMonthlyCharge - # - # @param json_object [String] - # @return [Vapi::SubscriptionMonthlyCharge] - def self.from_json(json_object:) - struct = JSON.parse(json_object, object_class: OpenStruct) - parsed_json = JSON.parse(json_object) - monthly_charge = parsed_json["monthlyCharge"] - costs = parsed_json["costs"] - new( - monthly_charge: monthly_charge, - costs: costs, - additional_properties: struct - ) - end - - # Serialize an instance of SubscriptionMonthlyCharge to a JSON object - # - # @return [String] - def to_json(*_args) - @_field_set&.to_json - end - - # Leveraged for Union-type generation, validate_raw attempts to parse the given - # hash and check each fields type against the current object's property - # definitions. - # - # @param obj [Object] - # @return [Void] - def self.validate_raw(obj:) - obj.monthly_charge.is_a?(Float) != false || raise("Passed value for field obj.monthly_charge is not the expected type, validation failed.") - obj.costs.is_a?(Array) != false || raise("Passed value for field obj.costs is not the expected type, validation failed.") - end - end -end diff --git a/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb b/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb index 8ccc9c2..66da09c 100644 --- a/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb +++ b/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb @@ -12,6 +12,7 @@ class SyncVoiceLibraryDtoProvidersItem OPENAI = "openai" PLAYHT = "playht" RIME_AI = "rime-ai" + SMALLEST_AI = "smallest-ai" TAVUS = "tavus" end end diff --git a/lib/vapi_server_sdk/types/transfer_plan.rb b/lib/vapi_server_sdk/types/transfer_plan.rb index f8d90bd..7968525 100644 --- a/lib/vapi_server_sdk/types/transfer_plan.rb +++ b/lib/vapi_server_sdk/types/transfer_plan.rb @@ -32,13 +32,19 @@ class TransferPlan # @return [Vapi::TransferPlanMessage] This is the message the assistant will deliver to the destination party before # connecting the customer. # Usage: - # - Used only when `mode` is `warm-transfer-say-message` or + # - Used only when `mode` is `blind-transfer-add-summary-to-sip-header`, + # `warm-transfer-say-message` or # `warm-transfer-wait-for-operator-to-speak-first-and-then-say-message`. attr_reader :message + # @return [Hash{String => Object}] This specifies the SIP verb to use while transferring the call. + # - 'refer': Uses SIP REFER to transfer the call (default) + # - 'bye': Ends current call with SIP BYE + attr_reader :sip_verb # @return [Vapi::SummaryPlan] This is the plan for generating a summary of the call to present to the # destination party. # Usage: - # - Used only when `mode` is `warm-transfer-say-summary` or + # - Used only when `mode` is `blind-transfer-add-summary-to-sip-header` or + # `warm-transfer-say-summary` or # `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`. attr_reader :summary_plan # @return [OpenStruct] Additional properties unmapped to the current class definition @@ -72,21 +78,32 @@ class TransferPlan # @param message [Vapi::TransferPlanMessage] This is the message the assistant will deliver to the destination party before # connecting the customer. # Usage: - # - Used only when `mode` is `warm-transfer-say-message` or + # - Used only when `mode` is `blind-transfer-add-summary-to-sip-header`, + # `warm-transfer-say-message` or # `warm-transfer-wait-for-operator-to-speak-first-and-then-say-message`. + # @param sip_verb [Hash{String => Object}] This specifies the SIP verb to use while transferring the call. + # - 'refer': Uses SIP REFER to transfer the call (default) + # - 'bye': Ends current call with SIP BYE # @param summary_plan [Vapi::SummaryPlan] This is the plan for generating a summary of the call to present to the # destination party. # Usage: - # - Used only when `mode` is `warm-transfer-say-summary` or + # - Used only when `mode` is `blind-transfer-add-summary-to-sip-header` or + # `warm-transfer-say-summary` or # `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::TransferPlan] - def initialize(mode:, message: OMIT, summary_plan: OMIT, additional_properties: nil) + def initialize(mode:, message: OMIT, sip_verb: OMIT, summary_plan: OMIT, additional_properties: nil) @mode = mode @message = message if message != OMIT + @sip_verb = sip_verb if sip_verb != OMIT @summary_plan = summary_plan if summary_plan != OMIT @additional_properties = additional_properties - @_field_set = { "mode": mode, "message": message, "summaryPlan": summary_plan }.reject do |_k, v| + @_field_set = { + "mode": mode, + "message": message, + "sipVerb": sip_verb, + "summaryPlan": summary_plan + }.reject do |_k, v| v == OMIT end end @@ -105,6 +122,7 @@ def self.from_json(json_object:) message = parsed_json["message"].to_json message = Vapi::TransferPlanMessage.from_json(json_object: message) end + sip_verb = parsed_json["sipVerb"] if parsed_json["summaryPlan"].nil? summary_plan = nil else @@ -114,6 +132,7 @@ def self.from_json(json_object:) new( mode: mode, message: message, + sip_verb: sip_verb, summary_plan: summary_plan, additional_properties: struct ) @@ -135,6 +154,7 @@ def to_json(*_args) def self.validate_raw(obj:) obj.mode.is_a?(Vapi::TransferPlanMode) != false || raise("Passed value for field obj.mode is not the expected type, validation failed.") obj.message.nil? || Vapi::TransferPlanMessage.validate_raw(obj: obj.message) + obj.sip_verb&.is_a?(Hash) != false || raise("Passed value for field obj.sip_verb is not the expected type, validation failed.") obj.summary_plan.nil? || Vapi::SummaryPlan.validate_raw(obj: obj.summary_plan) end end diff --git a/lib/vapi_server_sdk/types/transfer_plan_message.rb b/lib/vapi_server_sdk/types/transfer_plan_message.rb index e7b3e0d..f244760 100644 --- a/lib/vapi_server_sdk/types/transfer_plan_message.rb +++ b/lib/vapi_server_sdk/types/transfer_plan_message.rb @@ -7,7 +7,8 @@ module Vapi # This is the message the assistant will deliver to the destination party before # connecting the customer. # Usage: - # - Used only when `mode` is `warm-transfer-say-message` or + # - Used only when `mode` is `blind-transfer-add-summary-to-sip-header`, + # `warm-transfer-say-message` or # `warm-transfer-wait-for-operator-to-speak-first-and-then-say-message`. class TransferPlanMessage # Deserialize a JSON object to an instance of TransferPlanMessage diff --git a/lib/vapi_server_sdk/types/twilio_phone_number.rb b/lib/vapi_server_sdk/types/twilio_phone_number.rb index 6218833..9c97b62 100644 --- a/lib/vapi_server_sdk/types/twilio_phone_number.rb +++ b/lib/vapi_server_sdk/types/twilio_phone_number.rb @@ -2,6 +2,7 @@ require_relative "twilio_phone_number_fallback_destination" require "date" +require_relative "server" require "ostruct" require "json" @@ -34,16 +35,13 @@ class TwilioPhoneNumber # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. attr_reader :squad_id - # @return [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - attr_reader :server_url - # @return [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [String] These are the digits of the phone number you own on your Twilio. attr_reader :number # @return [String] This is the Twilio Account SID for the phone number. @@ -77,21 +75,19 @@ class TwilioPhoneNumber # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param number [String] These are the digits of the phone number you own on your Twilio. # @param twilio_account_sid [String] This is the Twilio Account SID for the phone number. # @param twilio_auth_token [String] This is the Twilio Auth Token for the phone number. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::TwilioPhoneNumber] def initialize(id:, org_id:, created_at:, updated_at:, number:, twilio_account_sid:, twilio_auth_token:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, - squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) + squad_id: OMIT, server: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @id = id @org_id = org_id @@ -100,8 +96,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, number:, twilio_account_s @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @number = number @twilio_account_sid = twilio_account_sid @twilio_auth_token = twilio_auth_token @@ -115,8 +110,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, number:, twilio_account_s "name": name, "assistantId": assistant_id, "squadId": squad_id, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret, + "server": server, "number": number, "twilioAccountSid": twilio_account_sid, "twilioAuthToken": twilio_auth_token @@ -145,8 +139,12 @@ def self.from_json(json_object:) name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end number = parsed_json["number"] twilio_account_sid = parsed_json["twilioAccountSid"] twilio_auth_token = parsed_json["twilioAuthToken"] @@ -159,8 +157,7 @@ def self.from_json(json_object:) name: name, assistant_id: assistant_id, squad_id: squad_id, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, number: number, twilio_account_sid: twilio_account_sid, twilio_auth_token: twilio_auth_token, @@ -190,8 +187,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.number.is_a?(String) != false || raise("Passed value for field obj.number is not the expected type, validation failed.") obj.twilio_account_sid.is_a?(String) != false || raise("Passed value for field obj.twilio_account_sid is not the expected type, validation failed.") obj.twilio_auth_token.is_a?(String) != false || raise("Passed value for field obj.twilio_auth_token is not the expected type, validation failed.") diff --git a/lib/vapi_server_sdk/types/update_anthropic_credential_dto.rb b/lib/vapi_server_sdk/types/update_anthropic_credential_dto.rb index 3c048be..30f29bc 100644 --- a/lib/vapi_server_sdk/types/update_anthropic_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_anthropic_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateAnthropicCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateAnthropicCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateAnthropicCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_anyscale_credential_dto.rb b/lib/vapi_server_sdk/types/update_anyscale_credential_dto.rb index 11cc2fa..05491b2 100644 --- a/lib/vapi_server_sdk/types/update_anyscale_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_anyscale_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateAnyscaleCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateAnyscaleCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateAnyscaleCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_assembly_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_assembly_ai_credential_dto.rb index 75444be..d84c011 100644 --- a/lib/vapi_server_sdk/types/update_assembly_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_assembly_ai_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateAssemblyAiCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateAssemblyAiCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateAssemblyAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_azure_credential_dto.rb b/lib/vapi_server_sdk/types/update_azure_credential_dto.rb index a9d7f04..cd23a8e 100644 --- a/lib/vapi_server_sdk/types/update_azure_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_azure_credential_dto.rb @@ -1,14 +1,14 @@ # frozen_string_literal: true +require_relative "update_azure_credential_dto_service" require_relative "update_azure_credential_dto_region" +require_relative "azure_blob_storage_bucket_plan" require "ostruct" require "json" module Vapi class UpdateAzureCredentialDto - # @return [String] - attr_reader :provider - # @return [String] This is the service being used in Azure. + # @return [Vapi::UpdateAzureCredentialDtoService] This is the service being used in Azure. attr_reader :service # @return [Vapi::UpdateAzureCredentialDtoRegion] This is the region of the Azure resource. attr_reader :region @@ -16,6 +16,9 @@ class UpdateAzureCredentialDto attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. attr_reader :name + # @return [Vapi::AzureBlobStorageBucketPlan] This is the bucket plan that can be provided to store call artifacts in Azure + # Blob Storage. + attr_reader :bucket_plan # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -24,26 +27,28 @@ class UpdateAzureCredentialDto OMIT = Object.new - # @param provider [String] - # @param service [String] This is the service being used in Azure. + # @param service [Vapi::UpdateAzureCredentialDtoService] This is the service being used in Azure. # @param region [Vapi::UpdateAzureCredentialDtoRegion] This is the region of the Azure resource. # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. + # @param bucket_plan [Vapi::AzureBlobStorageBucketPlan] This is the bucket plan that can be provided to store call artifacts in Azure + # Blob Storage. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateAzureCredentialDto] - def initialize(provider:, service:, region: OMIT, api_key: OMIT, name: OMIT, additional_properties: nil) - @provider = provider - @service = service + def initialize(service: OMIT, region: OMIT, api_key: OMIT, name: OMIT, bucket_plan: OMIT, + additional_properties: nil) + @service = service if service != OMIT @region = region if region != OMIT @api_key = api_key if api_key != OMIT @name = name if name != OMIT + @bucket_plan = bucket_plan if bucket_plan != OMIT @additional_properties = additional_properties @_field_set = { - "provider": provider, "service": service, "region": region, "apiKey": api_key, - "name": name + "name": name, + "bucketPlan": bucket_plan }.reject do |_k, v| v == OMIT end @@ -56,17 +61,22 @@ def initialize(provider:, service:, region: OMIT, api_key: OMIT, name: OMIT, add def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] service = parsed_json["service"] region = parsed_json["region"] api_key = parsed_json["apiKey"] name = parsed_json["name"] + if parsed_json["bucketPlan"].nil? + bucket_plan = nil + else + bucket_plan = parsed_json["bucketPlan"].to_json + bucket_plan = Vapi::AzureBlobStorageBucketPlan.from_json(json_object: bucket_plan) + end new( - provider: provider, service: service, region: region, api_key: api_key, name: name, + bucket_plan: bucket_plan, additional_properties: struct ) end @@ -85,11 +95,11 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.service.is_a?(String) != false || raise("Passed value for field obj.service is not the expected type, validation failed.") + obj.service&.is_a?(Vapi::UpdateAzureCredentialDtoService) != false || raise("Passed value for field obj.service is not the expected type, validation failed.") obj.region&.is_a?(Vapi::UpdateAzureCredentialDtoRegion) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.bucket_plan.nil? || Vapi::AzureBlobStorageBucketPlan.validate_raw(obj: obj.bucket_plan) end end end diff --git a/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb b/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb index 8fcc0d7..7886513 100644 --- a/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb +++ b/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb @@ -14,7 +14,7 @@ class UpdateAzureCredentialDtoRegion NORTHCENTRALUS = "northcentralus" NORWAY = "norway" SOUTHCENTRALUS = "southcentralus" - SWEDEN = "sweden" + SWEDENCENTRAL = "swedencentral" SWITZERLAND = "switzerland" UK = "uk" WESTUS = "westus" diff --git a/lib/vapi_server_sdk/types/update_azure_credential_dto_service.rb b/lib/vapi_server_sdk/types/update_azure_credential_dto_service.rb new file mode 100644 index 0000000..802348b --- /dev/null +++ b/lib/vapi_server_sdk/types/update_azure_credential_dto_service.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Vapi + # This is the service being used in Azure. + class UpdateAzureCredentialDtoService + SPEECH = "speech" + BLOB_STORAGE = "blob_storage" + end +end diff --git a/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto.rb index 2576c68..a373986 100644 --- a/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto.rb @@ -7,18 +7,18 @@ module Vapi class UpdateAzureOpenAiCredentialDto - # @return [String] - attr_reader :provider # @return [Vapi::UpdateAzureOpenAiCredentialDtoRegion] attr_reader :region # @return [Array] attr_reader :models # @return [String] This is not returned in the API. attr_reader :open_ai_key - # @return [String] - attr_reader :open_ai_endpoint + # @return [String] This is not returned in the API. + attr_reader :ocp_apim_subscription_key # @return [String] This is the name of credential. This is just for your reference. attr_reader :name + # @return [String] + attr_reader :open_ai_endpoint # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -27,29 +27,30 @@ class UpdateAzureOpenAiCredentialDto OMIT = Object.new - # @param provider [String] # @param region [Vapi::UpdateAzureOpenAiCredentialDtoRegion] # @param models [Array] # @param open_ai_key [String] This is not returned in the API. - # @param open_ai_endpoint [String] + # @param ocp_apim_subscription_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. + # @param open_ai_endpoint [String] # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateAzureOpenAiCredentialDto] - def initialize(provider:, region:, models:, open_ai_key:, open_ai_endpoint:, name: OMIT, additional_properties: nil) - @provider = provider - @region = region - @models = models - @open_ai_key = open_ai_key - @open_ai_endpoint = open_ai_endpoint + def initialize(region: OMIT, models: OMIT, open_ai_key: OMIT, ocp_apim_subscription_key: OMIT, name: OMIT, + open_ai_endpoint: OMIT, additional_properties: nil) + @region = region if region != OMIT + @models = models if models != OMIT + @open_ai_key = open_ai_key if open_ai_key != OMIT + @ocp_apim_subscription_key = ocp_apim_subscription_key if ocp_apim_subscription_key != OMIT @name = name if name != OMIT + @open_ai_endpoint = open_ai_endpoint if open_ai_endpoint != OMIT @additional_properties = additional_properties @_field_set = { - "provider": provider, "region": region, "models": models, "openAIKey": open_ai_key, - "openAIEndpoint": open_ai_endpoint, - "name": name + "ocpApimSubscriptionKey": ocp_apim_subscription_key, + "name": name, + "openAIEndpoint": open_ai_endpoint }.reject do |_k, v| v == OMIT end @@ -62,19 +63,19 @@ def initialize(provider:, region:, models:, open_ai_key:, open_ai_endpoint:, nam def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] region = parsed_json["region"] models = parsed_json["models"] open_ai_key = parsed_json["openAIKey"] - open_ai_endpoint = parsed_json["openAIEndpoint"] + ocp_apim_subscription_key = parsed_json["ocpApimSubscriptionKey"] name = parsed_json["name"] + open_ai_endpoint = parsed_json["openAIEndpoint"] new( - provider: provider, region: region, models: models, open_ai_key: open_ai_key, - open_ai_endpoint: open_ai_endpoint, + ocp_apim_subscription_key: ocp_apim_subscription_key, name: name, + open_ai_endpoint: open_ai_endpoint, additional_properties: struct ) end @@ -93,12 +94,12 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.region.is_a?(Vapi::UpdateAzureOpenAiCredentialDtoRegion) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") - obj.models.is_a?(Array) != false || raise("Passed value for field obj.models is not the expected type, validation failed.") - obj.open_ai_key.is_a?(String) != false || raise("Passed value for field obj.open_ai_key is not the expected type, validation failed.") - obj.open_ai_endpoint.is_a?(String) != false || raise("Passed value for field obj.open_ai_endpoint is not the expected type, validation failed.") + obj.region&.is_a?(Vapi::UpdateAzureOpenAiCredentialDtoRegion) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") + obj.models&.is_a?(Array) != false || raise("Passed value for field obj.models is not the expected type, validation failed.") + obj.open_ai_key&.is_a?(String) != false || raise("Passed value for field obj.open_ai_key is not the expected type, validation failed.") + obj.ocp_apim_subscription_key&.is_a?(String) != false || raise("Passed value for field obj.ocp_apim_subscription_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.open_ai_endpoint&.is_a?(String) != false || raise("Passed value for field obj.open_ai_endpoint is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb b/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb index e4bc45f..7f1b04b 100644 --- a/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb +++ b/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb @@ -13,7 +13,7 @@ class UpdateAzureOpenAiCredentialDtoRegion NORTHCENTRALUS = "northcentralus" NORWAY = "norway" SOUTHCENTRALUS = "southcentralus" - SWEDEN = "sweden" + SWEDENCENTRAL = "swedencentral" SWITZERLAND = "switzerland" UK = "uk" WESTUS = "westus" diff --git a/lib/vapi_server_sdk/types/update_bash_tool_dto.rb b/lib/vapi_server_sdk/types/update_bash_tool_dto.rb new file mode 100644 index 0000000..6a4b907 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_bash_tool_dto.rb @@ -0,0 +1,161 @@ +# frozen_string_literal: true + +require_relative "update_bash_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateBashToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [String] The sub type of tool. + attr_reader :sub_type + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [String] The name of the tool, fixed to 'bash' + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param sub_type [String] The sub type of tool. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param name [String] The name of the tool, fixed to 'bash' + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateBashToolDto] + def initialize(async: OMIT, messages: OMIT, sub_type: OMIT, function: OMIT, server: OMIT, name: OMIT, + additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @sub_type = sub_type if sub_type != OMIT + @function = function if function != OMIT + @server = server if server != OMIT + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "subType": sub_type, + "function": function, + "server": server, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateBashToolDto + # + # @param json_object [String] + # @return [Vapi::UpdateBashToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateBashToolDtoMessagesItem.from_json(json_object: item) + end + sub_type = parsed_json["subType"] + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + name = parsed_json["name"] + new( + async: async, + messages: messages, + sub_type: sub_type, + function: function, + server: server, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateBashToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.sub_type&.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_bash_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_bash_tool_dto_messages_item.rb new file mode 100644 index 0000000..7d0963f --- /dev/null +++ b/lib/vapi_server_sdk/types/update_bash_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class UpdateBashToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateBashToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateBashToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateBashToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::UpdateBashToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::UpdateBashToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::UpdateBashToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::UpdateBashToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_byo_phone_number_dto.rb b/lib/vapi_server_sdk/types/update_byo_phone_number_dto.rb new file mode 100644 index 0000000..cdb31ea --- /dev/null +++ b/lib/vapi_server_sdk/types/update_byo_phone_number_dto.rb @@ -0,0 +1,187 @@ +# frozen_string_literal: true + +require_relative "update_byo_phone_number_dto_fallback_destination" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateByoPhoneNumberDto + # @return [Vapi::UpdateByoPhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + attr_reader :fallback_destination + # @return [Boolean] This is the flag to toggle the E164 check for the `number` field. This is an + # advanced property which should be used if you know your use case requires it. + # Use cases: + # - `false`: To allow non-E164 numbers like `+001234567890`, `1234`, or `abc`. + # This is useful for dialing out to non-E164 numbers on your SIP trunks. + # - `true` (default): To allow only E164 numbers like `+14155551234`. This is + # standard for PSTN calls. + # If `false`, the `number` is still required to only contain alphanumeric + # characters (regex: `/^\+?[a-zA-Z0-9]+$/`). + # @default true (E164 check is enabled) + attr_reader :number_e_164_check_enabled + # @return [String] This is the name of the phone number. This is just for your own reference. + attr_reader :name + # @return [String] This is the assistant that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + attr_reader :assistant_id + # @return [String] This is the squad that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + attr_reader :squad_id + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server + # @return [String] This is the number of the customer. + attr_reader :number + # @return [String] This is the credential of your own SIP trunk or Carrier (type `byo-sip-trunk`) + # which can be used to make calls to this phone number. + # You can add the SIP trunk or Carrier credential in the Provider Credentials page + # on the Dashboard to get the credentialId. + attr_reader :credential_id + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param fallback_destination [Vapi::UpdateByoPhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + # @param number_e_164_check_enabled [Boolean] This is the flag to toggle the E164 check for the `number` field. This is an + # advanced property which should be used if you know your use case requires it. + # Use cases: + # - `false`: To allow non-E164 numbers like `+001234567890`, `1234`, or `abc`. + # This is useful for dialing out to non-E164 numbers on your SIP trunks. + # - `true` (default): To allow only E164 numbers like `+14155551234`. This is + # standard for PSTN calls. + # If `false`, the `number` is still required to only contain alphanumeric + # characters (regex: `/^\+?[a-zA-Z0-9]+$/`). + # @default true (E164 check is enabled) + # @param name [String] This is the name of the phone number. This is just for your own reference. + # @param assistant_id [String] This is the assistant that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + # @param squad_id [String] This is the squad that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + # @param number [String] This is the number of the customer. + # @param credential_id [String] This is the credential of your own SIP trunk or Carrier (type `byo-sip-trunk`) + # which can be used to make calls to this phone number. + # You can add the SIP trunk or Carrier credential in the Provider Credentials page + # on the Dashboard to get the credentialId. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateByoPhoneNumberDto] + def initialize(fallback_destination: OMIT, number_e_164_check_enabled: OMIT, name: OMIT, assistant_id: OMIT, + squad_id: OMIT, server: OMIT, number: OMIT, credential_id: OMIT, additional_properties: nil) + @fallback_destination = fallback_destination if fallback_destination != OMIT + @number_e_164_check_enabled = number_e_164_check_enabled if number_e_164_check_enabled != OMIT + @name = name if name != OMIT + @assistant_id = assistant_id if assistant_id != OMIT + @squad_id = squad_id if squad_id != OMIT + @server = server if server != OMIT + @number = number if number != OMIT + @credential_id = credential_id if credential_id != OMIT + @additional_properties = additional_properties + @_field_set = { + "fallbackDestination": fallback_destination, + "numberE164CheckEnabled": number_e_164_check_enabled, + "name": name, + "assistantId": assistant_id, + "squadId": squad_id, + "server": server, + "number": number, + "credentialId": credential_id + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateByoPhoneNumberDto + # + # @param json_object [String] + # @return [Vapi::UpdateByoPhoneNumberDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["fallbackDestination"].nil? + fallback_destination = nil + else + fallback_destination = parsed_json["fallbackDestination"].to_json + fallback_destination = Vapi::UpdateByoPhoneNumberDtoFallbackDestination.from_json(json_object: fallback_destination) + end + number_e_164_check_enabled = parsed_json["numberE164CheckEnabled"] + name = parsed_json["name"] + assistant_id = parsed_json["assistantId"] + squad_id = parsed_json["squadId"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + number = parsed_json["number"] + credential_id = parsed_json["credentialId"] + new( + fallback_destination: fallback_destination, + number_e_164_check_enabled: number_e_164_check_enabled, + name: name, + assistant_id: assistant_id, + squad_id: squad_id, + server: server, + number: number, + credential_id: credential_id, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateByoPhoneNumberDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.fallback_destination.nil? || Vapi::UpdateByoPhoneNumberDtoFallbackDestination.validate_raw(obj: obj.fallback_destination) + obj.number_e_164_check_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.number_e_164_check_enabled is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") + obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.number&.is_a?(String) != false || raise("Passed value for field obj.number is not the expected type, validation failed.") + obj.credential_id&.is_a?(String) != false || raise("Passed value for field obj.credential_id is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_byo_phone_number_dto_fallback_destination.rb b/lib/vapi_server_sdk/types/update_byo_phone_number_dto_fallback_destination.rb new file mode 100644 index 0000000..05d91fb --- /dev/null +++ b/lib/vapi_server_sdk/types/update_byo_phone_number_dto_fallback_destination.rb @@ -0,0 +1,101 @@ +# frozen_string_literal: true + +require "json" +require_relative "transfer_destination_number" +require_relative "transfer_destination_sip" + +module Vapi + # This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + class UpdateByoPhoneNumberDtoFallbackDestination + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateByoPhoneNumberDtoFallbackDestination] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # UpdateByoPhoneNumberDtoFallbackDestination + # + # @param json_object [String] + # @return [Vapi::UpdateByoPhoneNumberDtoFallbackDestination] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "number" + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + when "sip" + Vapi::TransferDestinationSip.from_json(json_object: json_object) + else + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "number" + { **@member.to_json, type: @discriminant }.to_json + when "sip" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "number" + Vapi::TransferDestinationNumber.validate_raw(obj: obj) + when "sip" + Vapi::TransferDestinationSip.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TransferDestinationNumber] + # @return [Vapi::UpdateByoPhoneNumberDtoFallbackDestination] + def self.number(member:) + new(member: member, discriminant: "number") + end + + # @param member [Vapi::TransferDestinationSip] + # @return [Vapi::UpdateByoPhoneNumberDtoFallbackDestination] + def self.sip(member:) + new(member: member, discriminant: "sip") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_byo_sip_trunk_credential_dto.rb b/lib/vapi_server_sdk/types/update_byo_sip_trunk_credential_dto.rb index c44cbd4..fb98bf4 100644 --- a/lib/vapi_server_sdk/types/update_byo_sip_trunk_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_byo_sip_trunk_credential_dto.rb @@ -8,8 +8,8 @@ module Vapi class UpdateByoSipTrunkCredentialDto - # @return [String] This can be used to bring your own SIP trunks or to connect to a Carrier. - attr_reader :provider + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [Array] This is the list of SIP trunk's gateways. attr_reader :gateways # @return [Vapi::SipTrunkOutboundAuthenticationPlan] This can be used to configure the outbound authentication if required by the SIP @@ -31,8 +31,6 @@ class UpdateByoSipTrunkCredentialDto # onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC # provided by Vapi. attr_reader :sbc_configuration - # @return [String] This is the name of credential. This is just for your reference. - attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -41,7 +39,7 @@ class UpdateByoSipTrunkCredentialDto OMIT = Object.new - # @param provider [String] This can be used to bring your own SIP trunks or to connect to a Carrier. + # @param name [String] This is the name of credential. This is just for your reference. # @param gateways [Array] This is the list of SIP trunk's gateways. # @param outbound_authentication_plan [Vapi::SipTrunkOutboundAuthenticationPlan] This can be used to configure the outbound authentication if required by the SIP # trunk. @@ -57,29 +55,26 @@ class UpdateByoSipTrunkCredentialDto # @param sbc_configuration [Vapi::SbcConfiguration] This is an advanced configuration for enterprise deployments. This uses the # onprem SBC to trunk into the SIP trunk's `gateways`, rather than the managed SBC # provided by Vapi. - # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateByoSipTrunkCredentialDto] - def initialize(gateways:, provider: OMIT, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, - tech_prefix: OMIT, sip_diversion_header: OMIT, sbc_configuration: OMIT, name: OMIT, additional_properties: nil) - @provider = provider if provider != OMIT - @gateways = gateways + def initialize(name: OMIT, gateways: OMIT, outbound_authentication_plan: OMIT, outbound_leading_plus_enabled: OMIT, + tech_prefix: OMIT, sip_diversion_header: OMIT, sbc_configuration: OMIT, additional_properties: nil) + @name = name if name != OMIT + @gateways = gateways if gateways != OMIT @outbound_authentication_plan = outbound_authentication_plan if outbound_authentication_plan != OMIT @outbound_leading_plus_enabled = outbound_leading_plus_enabled if outbound_leading_plus_enabled != OMIT @tech_prefix = tech_prefix if tech_prefix != OMIT @sip_diversion_header = sip_diversion_header if sip_diversion_header != OMIT @sbc_configuration = sbc_configuration if sbc_configuration != OMIT - @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { - "provider": provider, + "name": name, "gateways": gateways, "outboundAuthenticationPlan": outbound_authentication_plan, "outboundLeadingPlusEnabled": outbound_leading_plus_enabled, "techPrefix": tech_prefix, "sipDiversionHeader": sip_diversion_header, - "sbcConfiguration": sbc_configuration, - "name": name + "sbcConfiguration": sbc_configuration }.reject do |_k, v| v == OMIT end @@ -92,7 +87,7 @@ def initialize(gateways:, provider: OMIT, outbound_authentication_plan: OMIT, ou def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] + name = parsed_json["name"] gateways = parsed_json["gateways"]&.map do |item| item = item.to_json Vapi::SipTrunkGateway.from_json(json_object: item) @@ -112,16 +107,14 @@ def self.from_json(json_object:) sbc_configuration = parsed_json["sbcConfiguration"].to_json sbc_configuration = Vapi::SbcConfiguration.from_json(json_object: sbc_configuration) end - name = parsed_json["name"] new( - provider: provider, + name: name, gateways: gateways, outbound_authentication_plan: outbound_authentication_plan, outbound_leading_plus_enabled: outbound_leading_plus_enabled, tech_prefix: tech_prefix, sip_diversion_header: sip_diversion_header, sbc_configuration: sbc_configuration, - name: name, additional_properties: struct ) end @@ -140,14 +133,13 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider&.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.gateways.is_a?(Array) != false || raise("Passed value for field obj.gateways is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.gateways&.is_a?(Array) != false || raise("Passed value for field obj.gateways is not the expected type, validation failed.") obj.outbound_authentication_plan.nil? || Vapi::SipTrunkOutboundAuthenticationPlan.validate_raw(obj: obj.outbound_authentication_plan) obj.outbound_leading_plus_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.outbound_leading_plus_enabled is not the expected type, validation failed.") obj.tech_prefix&.is_a?(String) != false || raise("Passed value for field obj.tech_prefix is not the expected type, validation failed.") obj.sip_diversion_header&.is_a?(String) != false || raise("Passed value for field obj.sip_diversion_header is not the expected type, validation failed.") obj.sbc_configuration.nil? || Vapi::SbcConfiguration.validate_raw(obj: obj.sbc_configuration) - obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_cartesia_credential_dto.rb b/lib/vapi_server_sdk/types/update_cartesia_credential_dto.rb index e8aa06b..fe4b9db 100644 --- a/lib/vapi_server_sdk/types/update_cartesia_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_cartesia_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateCartesiaCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateCartesiaCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateCartesiaCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_cerebras_credential_dto.rb b/lib/vapi_server_sdk/types/update_cerebras_credential_dto.rb new file mode 100644 index 0000000..b316fe5 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_cerebras_credential_dto.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class UpdateCerebrasCredentialDto + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateCerebrasCredentialDto] + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateCerebrasCredentialDto + # + # @param json_object [String] + # @return [Vapi::UpdateCerebrasCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateCerebrasCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_cloudflare_credential_dto.rb b/lib/vapi_server_sdk/types/update_cloudflare_credential_dto.rb new file mode 100644 index 0000000..7dc94b9 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_cloudflare_credential_dto.rb @@ -0,0 +1,101 @@ +# frozen_string_literal: true + +require_relative "cloudflare_r_2_bucket_plan" +require "ostruct" +require "json" + +module Vapi + class UpdateCloudflareCredentialDto + # @return [String] Cloudflare Account Id. + attr_reader :account_id + # @return [String] Cloudflare API Key / Token. + attr_reader :api_key + # @return [String] Cloudflare Account Email. + attr_reader :account_email + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [Vapi::CloudflareR2BucketPlan] This is the bucket plan that can be provided to store call artifacts in R2 + attr_reader :bucket_plan + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param account_id [String] Cloudflare Account Id. + # @param api_key [String] Cloudflare API Key / Token. + # @param account_email [String] Cloudflare Account Email. + # @param name [String] This is the name of credential. This is just for your reference. + # @param bucket_plan [Vapi::CloudflareR2BucketPlan] This is the bucket plan that can be provided to store call artifacts in R2 + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateCloudflareCredentialDto] + def initialize(account_id: OMIT, api_key: OMIT, account_email: OMIT, name: OMIT, bucket_plan: OMIT, + additional_properties: nil) + @account_id = account_id if account_id != OMIT + @api_key = api_key if api_key != OMIT + @account_email = account_email if account_email != OMIT + @name = name if name != OMIT + @bucket_plan = bucket_plan if bucket_plan != OMIT + @additional_properties = additional_properties + @_field_set = { + "accountId": account_id, + "apiKey": api_key, + "accountEmail": account_email, + "name": name, + "bucketPlan": bucket_plan + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateCloudflareCredentialDto + # + # @param json_object [String] + # @return [Vapi::UpdateCloudflareCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + account_id = parsed_json["accountId"] + api_key = parsed_json["apiKey"] + account_email = parsed_json["accountEmail"] + name = parsed_json["name"] + if parsed_json["bucketPlan"].nil? + bucket_plan = nil + else + bucket_plan = parsed_json["bucketPlan"].to_json + bucket_plan = Vapi::CloudflareR2BucketPlan.from_json(json_object: bucket_plan) + end + new( + account_id: account_id, + api_key: api_key, + account_email: account_email, + name: name, + bucket_plan: bucket_plan, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateCloudflareCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.account_id&.is_a?(String) != false || raise("Passed value for field obj.account_id is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.account_email&.is_a?(String) != false || raise("Passed value for field obj.account_email is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.bucket_plan.nil? || Vapi::CloudflareR2BucketPlan.validate_raw(obj: obj.bucket_plan) + end + end +end diff --git a/lib/vapi_server_sdk/types/update_computer_tool_dto.rb b/lib/vapi_server_sdk/types/update_computer_tool_dto.rb new file mode 100644 index 0000000..dc63309 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_computer_tool_dto.rb @@ -0,0 +1,185 @@ +# frozen_string_literal: true + +require_relative "update_computer_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateComputerToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [String] The sub type of tool. + attr_reader :sub_type + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [String] The name of the tool, fixed to 'computer' + attr_reader :name + # @return [Float] The display width in pixels + attr_reader :display_width_px + # @return [Float] The display height in pixels + attr_reader :display_height_px + # @return [Float] Optional display number + attr_reader :display_number + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param sub_type [String] The sub type of tool. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param name [String] The name of the tool, fixed to 'computer' + # @param display_width_px [Float] The display width in pixels + # @param display_height_px [Float] The display height in pixels + # @param display_number [Float] Optional display number + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateComputerToolDto] + def initialize(async: OMIT, messages: OMIT, sub_type: OMIT, function: OMIT, server: OMIT, name: OMIT, + display_width_px: OMIT, display_height_px: OMIT, display_number: OMIT, additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @sub_type = sub_type if sub_type != OMIT + @function = function if function != OMIT + @server = server if server != OMIT + @name = name if name != OMIT + @display_width_px = display_width_px if display_width_px != OMIT + @display_height_px = display_height_px if display_height_px != OMIT + @display_number = display_number if display_number != OMIT + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "subType": sub_type, + "function": function, + "server": server, + "name": name, + "displayWidthPx": display_width_px, + "displayHeightPx": display_height_px, + "displayNumber": display_number + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateComputerToolDto + # + # @param json_object [String] + # @return [Vapi::UpdateComputerToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateComputerToolDtoMessagesItem.from_json(json_object: item) + end + sub_type = parsed_json["subType"] + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + name = parsed_json["name"] + display_width_px = parsed_json["displayWidthPx"] + display_height_px = parsed_json["displayHeightPx"] + display_number = parsed_json["displayNumber"] + new( + async: async, + messages: messages, + sub_type: sub_type, + function: function, + server: server, + name: name, + display_width_px: display_width_px, + display_height_px: display_height_px, + display_number: display_number, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateComputerToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.sub_type&.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.display_width_px&.is_a?(Float) != false || raise("Passed value for field obj.display_width_px is not the expected type, validation failed.") + obj.display_height_px&.is_a?(Float) != false || raise("Passed value for field obj.display_height_px is not the expected type, validation failed.") + obj.display_number&.is_a?(Float) != false || raise("Passed value for field obj.display_number is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_computer_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_computer_tool_dto_messages_item.rb new file mode 100644 index 0000000..0a8b9bb --- /dev/null +++ b/lib/vapi_server_sdk/types/update_computer_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class UpdateComputerToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateComputerToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateComputerToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateComputerToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::UpdateComputerToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::UpdateComputerToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::UpdateComputerToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::UpdateComputerToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_conversation_block_dto.rb b/lib/vapi_server_sdk/types/update_conversation_block_dto.rb new file mode 100644 index 0000000..842486f --- /dev/null +++ b/lib/vapi_server_sdk/types/update_conversation_block_dto.rb @@ -0,0 +1,206 @@ +# frozen_string_literal: true + +require_relative "update_conversation_block_dto_messages_item" +require_relative "json_schema" +require "ostruct" +require "json" + +module Vapi + class UpdateConversationBlockDto + # @return [Array] These are the pre-configured messages that will be spoken to the user while the + # block is running. + attr_reader :messages + # @return [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to + # run. It's given to the block as `steps[0].input` + # These are accessible as variables: + # - ({{input.propertyName}}) in context of the block execution (step) + # - ({{stepName.input.propertyName}}) in context of the workflow + attr_reader :input_schema + # @return [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will + # return to the workflow (`{{stepName.output}}`). + # These are accessible as variables: + # - ({{output.propertyName}}) in context of the block execution (step) + # - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) + # - ({{blockName.output.propertyName}}) in context of the workflow (read caveat + # #2) + # Caveats: + # 1. a workflow can execute a step multiple times. example, if a loop is used in + # the graph. {{stepName.output.propertyName}} will reference the latest usage of + # the step. + # 2. a workflow can execute a block multiple times. example, if a step is called + # multiple times or if a block is used in multiple steps. + # {{blockName.output.propertyName}} will reference the latest usage of the block. + # this liquid variable is just provided for convenience when creating blocks + # outside of a workflow with steps. + attr_reader :output_schema + # @return [String] This is the name of the block. This is just for your reference. + attr_reader :name + # @return [String] This is the instruction to the model. + # You can reference any variable in the context of the current block execution + # (step): + # - "{{input.your-property-name}}" for the current step's input + # - "{{your-step-name.output.your-property-name}}" for another step's output (in + # the same workflow; read caveat #1) + # - "{{your-step-name.input.your-property-name}}" for another step's input (in the + # same workflow; read caveat #1) + # - "{{your-block-name.output.your-property-name}}" for another block's output (in + # the same workflow; read caveat #2) + # - "{{your-block-name.input.your-property-name}}" for another block's input (in + # the same workflow; read caveat #2) + # - "{{workflow.input.your-property-name}}" for the current workflow's input + # - "{{global.your-property-name}}" for the global context + # This can be as simple or as complex as you want it to be. + # - "say hello and ask the user about their day!" + # - "collect the user's first and last name" + # - "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. + # ask them about their salary and if they might be interested in buying a house. + # we offer {{input.offer}}" + # Caveats: + # 1. a workflow can execute a step multiple times. example, if a loop is used in + # the graph. {{stepName.output/input.propertyName}} will reference the latest + # usage of the step. + # 2. a workflow can execute a block multiple times. example, if a step is called + # multiple times or if a block is used in multiple steps. + # {{blockName.output/input.propertyName}} will reference the latest usage of the + # block. this liquid variable is just provided for convenience when creating + # blocks outside of a workflow with steps. + attr_reader :instruction + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param messages [Array] These are the pre-configured messages that will be spoken to the user while the + # block is running. + # @param input_schema [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to + # run. It's given to the block as `steps[0].input` + # These are accessible as variables: + # - ({{input.propertyName}}) in context of the block execution (step) + # - ({{stepName.input.propertyName}}) in context of the workflow + # @param output_schema [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will + # return to the workflow (`{{stepName.output}}`). + # These are accessible as variables: + # - ({{output.propertyName}}) in context of the block execution (step) + # - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) + # - ({{blockName.output.propertyName}}) in context of the workflow (read caveat + # #2) + # Caveats: + # 1. a workflow can execute a step multiple times. example, if a loop is used in + # the graph. {{stepName.output.propertyName}} will reference the latest usage of + # the step. + # 2. a workflow can execute a block multiple times. example, if a step is called + # multiple times or if a block is used in multiple steps. + # {{blockName.output.propertyName}} will reference the latest usage of the block. + # this liquid variable is just provided for convenience when creating blocks + # outside of a workflow with steps. + # @param name [String] This is the name of the block. This is just for your reference. + # @param instruction [String] This is the instruction to the model. + # You can reference any variable in the context of the current block execution + # (step): + # - "{{input.your-property-name}}" for the current step's input + # - "{{your-step-name.output.your-property-name}}" for another step's output (in + # the same workflow; read caveat #1) + # - "{{your-step-name.input.your-property-name}}" for another step's input (in the + # same workflow; read caveat #1) + # - "{{your-block-name.output.your-property-name}}" for another block's output (in + # the same workflow; read caveat #2) + # - "{{your-block-name.input.your-property-name}}" for another block's input (in + # the same workflow; read caveat #2) + # - "{{workflow.input.your-property-name}}" for the current workflow's input + # - "{{global.your-property-name}}" for the global context + # This can be as simple or as complex as you want it to be. + # - "say hello and ask the user about their day!" + # - "collect the user's first and last name" + # - "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. + # ask them about their salary and if they might be interested in buying a house. + # we offer {{input.offer}}" + # Caveats: + # 1. a workflow can execute a step multiple times. example, if a loop is used in + # the graph. {{stepName.output/input.propertyName}} will reference the latest + # usage of the step. + # 2. a workflow can execute a block multiple times. example, if a step is called + # multiple times or if a block is used in multiple steps. + # {{blockName.output/input.propertyName}} will reference the latest usage of the + # block. this liquid variable is just provided for convenience when creating + # blocks outside of a workflow with steps. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateConversationBlockDto] + def initialize(messages: OMIT, input_schema: OMIT, output_schema: OMIT, name: OMIT, instruction: OMIT, + additional_properties: nil) + @messages = messages if messages != OMIT + @input_schema = input_schema if input_schema != OMIT + @output_schema = output_schema if output_schema != OMIT + @name = name if name != OMIT + @instruction = instruction if instruction != OMIT + @additional_properties = additional_properties + @_field_set = { + "messages": messages, + "inputSchema": input_schema, + "outputSchema": output_schema, + "name": name, + "instruction": instruction + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateConversationBlockDto + # + # @param json_object [String] + # @return [Vapi::UpdateConversationBlockDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateConversationBlockDtoMessagesItem.from_json(json_object: item) + end + if parsed_json["inputSchema"].nil? + input_schema = nil + else + input_schema = parsed_json["inputSchema"].to_json + input_schema = Vapi::JsonSchema.from_json(json_object: input_schema) + end + if parsed_json["outputSchema"].nil? + output_schema = nil + else + output_schema = parsed_json["outputSchema"].to_json + output_schema = Vapi::JsonSchema.from_json(json_object: output_schema) + end + name = parsed_json["name"] + instruction = parsed_json["instruction"] + new( + messages: messages, + input_schema: input_schema, + output_schema: output_schema, + name: name, + instruction: instruction, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateConversationBlockDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.input_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.input_schema) + obj.output_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.output_schema) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.instruction&.is_a?(String) != false || raise("Passed value for field obj.instruction is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_conversation_block_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_conversation_block_dto_messages_item.rb new file mode 100644 index 0000000..dc20b4c --- /dev/null +++ b/lib/vapi_server_sdk/types/update_conversation_block_dto_messages_item.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +require "json" +require_relative "block_start_message" +require_relative "block_complete_message" + +module Vapi + class UpdateConversationBlockDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateConversationBlockDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # UpdateConversationBlockDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateConversationBlockDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "block-start" + Vapi::BlockStartMessage.from_json(json_object: json_object) + when "block-complete" + Vapi::BlockCompleteMessage.from_json(json_object: json_object) + else + Vapi::BlockStartMessage.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "block-start" + { **@member.to_json, type: @discriminant }.to_json + when "block-complete" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "block-start" + Vapi::BlockStartMessage.validate_raw(obj: obj) + when "block-complete" + Vapi::BlockCompleteMessage.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::BlockStartMessage] + # @return [Vapi::UpdateConversationBlockDtoMessagesItem] + def self.block_start(member:) + new(member: member, discriminant: "block-start") + end + + # @param member [Vapi::BlockCompleteMessage] + # @return [Vapi::UpdateConversationBlockDtoMessagesItem] + def self.block_complete(member:) + new(member: member, discriminant: "block-complete") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_custom_knowledge_base_dto.rb b/lib/vapi_server_sdk/types/update_custom_knowledge_base_dto.rb new file mode 100644 index 0000000..3402b53 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_custom_knowledge_base_dto.rb @@ -0,0 +1,139 @@ +# frozen_string_literal: true + +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateCustomKnowledgeBaseDto + # @return [Vapi::Server] /** + # This is where the knowledge base request will be sent. + # Request Example: + # POST https://{server.url} + # Content-Type: application/json + # { + # "messsage": { + # "type": "knowledge-base-request", + # "messages": [ + # { + # "role": "user", + # "content": "Why is ocean blue?" + # } + # ], + # ...other metadata about the call... + # } + # } + # Response Expected: + # ``` + # { + # "message": { + # "role": "assistant", + # "content": "The ocean is blue because water absorbs everything but blue.", + # }, // YOU CAN RETURN THE EXACT RESPONSE TO SPEAK + # "documents": [ + # { + # "content": "The ocean is blue primarily because water absorbs colors in + # the red part of the light spectrum and scatters the blue light, making it more + # visible to our eyes.", + # "similarity": 1 + # }, + # { + # "content": "Blue light is scattered more by the water molecules than other + # colors, enhancing the blue appearance of the ocean.", + # "similarity": .5 + # } + # ] // OR, YOU CAN RETURN AN ARRAY OF DOCUMENTS THAT WILL BE SENT TO THE MODEL + # } + # ``` + attr_reader :server + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param server [Vapi::Server] /** + # This is where the knowledge base request will be sent. + # Request Example: + # POST https://{server.url} + # Content-Type: application/json + # { + # "messsage": { + # "type": "knowledge-base-request", + # "messages": [ + # { + # "role": "user", + # "content": "Why is ocean blue?" + # } + # ], + # ...other metadata about the call... + # } + # } + # Response Expected: + # ``` + # { + # "message": { + # "role": "assistant", + # "content": "The ocean is blue because water absorbs everything but blue.", + # }, // YOU CAN RETURN THE EXACT RESPONSE TO SPEAK + # "documents": [ + # { + # "content": "The ocean is blue primarily because water absorbs colors in + # the red part of the light spectrum and scatters the blue light, making it more + # visible to our eyes.", + # "similarity": 1 + # }, + # { + # "content": "Blue light is scattered more by the water molecules than other + # colors, enhancing the blue appearance of the ocean.", + # "similarity": .5 + # } + # ] // OR, YOU CAN RETURN AN ARRAY OF DOCUMENTS THAT WILL BE SENT TO THE MODEL + # } + # ``` + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateCustomKnowledgeBaseDto] + def initialize(server: OMIT, additional_properties: nil) + @server = server if server != OMIT + @additional_properties = additional_properties + @_field_set = { "server": server }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateCustomKnowledgeBaseDto + # + # @param json_object [String] + # @return [Vapi::UpdateCustomKnowledgeBaseDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + new(server: server, additional_properties: struct) + end + + # Serialize an instance of UpdateCustomKnowledgeBaseDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + end + end +end diff --git a/lib/vapi_server_sdk/types/update_custom_llm_credential_dto.rb b/lib/vapi_server_sdk/types/update_custom_llm_credential_dto.rb index 1e77cfc..3d7b4bf 100644 --- a/lib/vapi_server_sdk/types/update_custom_llm_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_custom_llm_credential_dto.rb @@ -6,8 +6,6 @@ module Vapi class UpdateCustomLlmCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. To use @@ -23,25 +21,18 @@ class UpdateCustomLlmCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param authentication_plan [Vapi::OAuth2AuthenticationPlan] This is the authentication plan. Currently supports OAuth2 RFC 6749. To use # Bearer authentication, use apiKey # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateCustomLlmCredentialDto] - def initialize(provider:, api_key:, authentication_plan: OMIT, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, authentication_plan: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @authentication_plan = authentication_plan if authentication_plan != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "apiKey": api_key, - "authenticationPlan": authentication_plan, - "name": name - }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "authenticationPlan": authentication_plan, "name": name }.reject do |_k, v| v == OMIT end end @@ -53,7 +44,6 @@ def initialize(provider:, api_key:, authentication_plan: OMIT, name: OMIT, addit def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] if parsed_json["authenticationPlan"].nil? authentication_plan = nil @@ -63,7 +53,6 @@ def self.from_json(json_object:) end name = parsed_json["name"] new( - provider: provider, api_key: api_key, authentication_plan: authentication_plan, name: name, @@ -85,8 +74,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.authentication_plan.nil? || Vapi::OAuth2AuthenticationPlan.validate_raw(obj: obj.authentication_plan) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end diff --git a/lib/vapi_server_sdk/types/update_deep_infra_credential_dto.rb b/lib/vapi_server_sdk/types/update_deep_infra_credential_dto.rb index 45bac0a..e7abab5 100644 --- a/lib/vapi_server_sdk/types/update_deep_infra_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_deep_infra_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateDeepInfraCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateDeepInfraCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateDeepInfraCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_deep_seek_credential_dto.rb b/lib/vapi_server_sdk/types/update_deep_seek_credential_dto.rb new file mode 100644 index 0000000..c27ca6f --- /dev/null +++ b/lib/vapi_server_sdk/types/update_deep_seek_credential_dto.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class UpdateDeepSeekCredentialDto + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateDeepSeekCredentialDto] + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateDeepSeekCredentialDto + # + # @param json_object [String] + # @return [Vapi::UpdateDeepSeekCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateDeepSeekCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_deepgram_credential_dto.rb b/lib/vapi_server_sdk/types/update_deepgram_credential_dto.rb index 6204f9f..3b27aca 100644 --- a/lib/vapi_server_sdk/types/update_deepgram_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_deepgram_credential_dto.rb @@ -5,15 +5,13 @@ module Vapi class UpdateDeepgramCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [String] This can be used to point to an onprem Deepgram instance. Defaults to # api.deepgram.com. attr_reader :api_url - # @return [String] This is the name of credential. This is just for your reference. - attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -22,20 +20,18 @@ class UpdateDeepgramCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. # @param api_url [String] This can be used to point to an onprem Deepgram instance. Defaults to # api.deepgram.com. - # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateDeepgramCredentialDto] - def initialize(provider:, api_key:, api_url: OMIT, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key - @api_url = api_url if api_url != OMIT + def initialize(api_key: OMIT, name: OMIT, api_url: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT + @api_url = api_url if api_url != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "apiUrl": api_url, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name, "apiUrl": api_url }.reject do |_k, v| v == OMIT end end @@ -47,15 +43,13 @@ def initialize(provider:, api_key:, api_url: OMIT, name: OMIT, additional_proper def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] - api_url = parsed_json["apiUrl"] name = parsed_json["name"] + api_url = parsed_json["apiUrl"] new( - provider: provider, api_key: api_key, - api_url: api_url, name: name, + api_url: api_url, additional_properties: struct ) end @@ -74,10 +68,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") - obj.api_url&.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.api_url&.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_dtmf_tool_dto.rb b/lib/vapi_server_sdk/types/update_dtmf_tool_dto.rb new file mode 100644 index 0000000..75930b9 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_dtmf_tool_dto.rb @@ -0,0 +1,139 @@ +# frozen_string_literal: true + +require_relative "update_dtmf_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateDtmfToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateDtmfToolDto] + def initialize(async: OMIT, messages: OMIT, function: OMIT, server: OMIT, additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @function = function if function != OMIT + @server = server if server != OMIT + @additional_properties = additional_properties + @_field_set = { "async": async, "messages": messages, "function": function, "server": server }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateDtmfToolDto + # + # @param json_object [String] + # @return [Vapi::UpdateDtmfToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateDtmfToolDtoMessagesItem.from_json(json_object: item) + end + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + new( + async: async, + messages: messages, + function: function, + server: server, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateDtmfToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + end + end +end diff --git a/lib/vapi_server_sdk/types/update_dtmf_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_dtmf_tool_dto_messages_item.rb new file mode 100644 index 0000000..cf97134 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_dtmf_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class UpdateDtmfToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateDtmfToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateDtmfToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateDtmfToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::UpdateDtmfToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::UpdateDtmfToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::UpdateDtmfToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::UpdateDtmfToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_eleven_labs_credential_dto.rb b/lib/vapi_server_sdk/types/update_eleven_labs_credential_dto.rb index ef1ccc0..7e4dec3 100644 --- a/lib/vapi_server_sdk/types/update_eleven_labs_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_eleven_labs_credential_dto.rb @@ -5,12 +5,12 @@ module Vapi class UpdateElevenLabsCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. attr_reader :name + # @return [String] + attr_reader :provider # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -19,17 +19,17 @@ class UpdateElevenLabsCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. + # @param provider [String] # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateElevenLabsCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, provider: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT + @provider = provider if provider != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name, "provider": provider }.reject do |_k, v| v == OMIT end end @@ -41,13 +41,13 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] + provider = parsed_json["provider"] new( - provider: provider, api_key: api_key, name: name, + provider: provider, additional_properties: struct ) end @@ -66,9 +66,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.provider&.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_end_call_tool_dto.rb b/lib/vapi_server_sdk/types/update_end_call_tool_dto.rb new file mode 100644 index 0000000..583d0c2 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_end_call_tool_dto.rb @@ -0,0 +1,139 @@ +# frozen_string_literal: true + +require_relative "update_end_call_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateEndCallToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateEndCallToolDto] + def initialize(async: OMIT, messages: OMIT, function: OMIT, server: OMIT, additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @function = function if function != OMIT + @server = server if server != OMIT + @additional_properties = additional_properties + @_field_set = { "async": async, "messages": messages, "function": function, "server": server }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateEndCallToolDto + # + # @param json_object [String] + # @return [Vapi::UpdateEndCallToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateEndCallToolDtoMessagesItem.from_json(json_object: item) + end + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + new( + async: async, + messages: messages, + function: function, + server: server, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateEndCallToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + end + end +end diff --git a/lib/vapi_server_sdk/types/update_end_call_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_end_call_tool_dto_messages_item.rb new file mode 100644 index 0000000..c45ddee --- /dev/null +++ b/lib/vapi_server_sdk/types/update_end_call_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class UpdateEndCallToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateEndCallToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateEndCallToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateEndCallToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::UpdateEndCallToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::UpdateEndCallToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::UpdateEndCallToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::UpdateEndCallToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_function_tool_dto.rb b/lib/vapi_server_sdk/types/update_function_tool_dto.rb new file mode 100644 index 0000000..21bd6f1 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_function_tool_dto.rb @@ -0,0 +1,139 @@ +# frozen_string_literal: true + +require_relative "update_function_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateFunctionToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateFunctionToolDto] + def initialize(async: OMIT, messages: OMIT, function: OMIT, server: OMIT, additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @function = function if function != OMIT + @server = server if server != OMIT + @additional_properties = additional_properties + @_field_set = { "async": async, "messages": messages, "function": function, "server": server }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateFunctionToolDto + # + # @param json_object [String] + # @return [Vapi::UpdateFunctionToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateFunctionToolDtoMessagesItem.from_json(json_object: item) + end + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + new( + async: async, + messages: messages, + function: function, + server: server, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateFunctionToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + end + end +end diff --git a/lib/vapi_server_sdk/types/update_function_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_function_tool_dto_messages_item.rb new file mode 100644 index 0000000..f9a92da --- /dev/null +++ b/lib/vapi_server_sdk/types/update_function_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class UpdateFunctionToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateFunctionToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateFunctionToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateFunctionToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::UpdateFunctionToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::UpdateFunctionToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::UpdateFunctionToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::UpdateFunctionToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_gcp_credential_dto.rb b/lib/vapi_server_sdk/types/update_gcp_credential_dto.rb index 72d1572..1bddb26 100644 --- a/lib/vapi_server_sdk/types/update_gcp_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_gcp_credential_dto.rb @@ -7,8 +7,8 @@ module Vapi class UpdateGcpCredentialDto - # @return [String] - attr_reader :provider + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name # @return [Vapi::GcpKey] This is the GCP key. This is the JSON that can be generated in the Google Cloud # Console at # le.cloud.google.com/iam-admin/serviceaccounts/details//keys. @@ -16,8 +16,6 @@ class UpdateGcpCredentialDto attr_reader :gcp_key # @return [Vapi::BucketPlan] This is the bucket plan that can be provided to store call artifacts in GCP. attr_reader :bucket_plan - # @return [String] This is the name of credential. This is just for your reference. - attr_reader :name # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -26,27 +24,20 @@ class UpdateGcpCredentialDto OMIT = Object.new - # @param provider [String] + # @param name [String] This is the name of credential. This is just for your reference. # @param gcp_key [Vapi::GcpKey] This is the GCP key. This is the JSON that can be generated in the Google Cloud # Console at # le.cloud.google.com/iam-admin/serviceaccounts/details//keys. # The schema is identical to the JSON that GCP outputs. # @param bucket_plan [Vapi::BucketPlan] This is the bucket plan that can be provided to store call artifacts in GCP. - # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateGcpCredentialDto] - def initialize(provider:, gcp_key:, bucket_plan: OMIT, name: OMIT, additional_properties: nil) - @provider = provider - @gcp_key = gcp_key - @bucket_plan = bucket_plan if bucket_plan != OMIT + def initialize(name: OMIT, gcp_key: OMIT, bucket_plan: OMIT, additional_properties: nil) @name = name if name != OMIT + @gcp_key = gcp_key if gcp_key != OMIT + @bucket_plan = bucket_plan if bucket_plan != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "gcpKey": gcp_key, - "bucketPlan": bucket_plan, - "name": name - }.reject do |_k, v| + @_field_set = { "name": name, "gcpKey": gcp_key, "bucketPlan": bucket_plan }.reject do |_k, v| v == OMIT end end @@ -58,7 +49,7 @@ def initialize(provider:, gcp_key:, bucket_plan: OMIT, name: OMIT, additional_pr def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] + name = parsed_json["name"] if parsed_json["gcpKey"].nil? gcp_key = nil else @@ -71,12 +62,10 @@ def self.from_json(json_object:) bucket_plan = parsed_json["bucketPlan"].to_json bucket_plan = Vapi::BucketPlan.from_json(json_object: bucket_plan) end - name = parsed_json["name"] new( - provider: provider, + name: name, gcp_key: gcp_key, bucket_plan: bucket_plan, - name: name, additional_properties: struct ) end @@ -95,10 +84,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - Vapi::GcpKey.validate_raw(obj: obj.gcp_key) - obj.bucket_plan.nil? || Vapi::BucketPlan.validate_raw(obj: obj.bucket_plan) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.gcp_key.nil? || Vapi::GcpKey.validate_raw(obj: obj.gcp_key) + obj.bucket_plan.nil? || Vapi::BucketPlan.validate_raw(obj: obj.bucket_plan) end end end diff --git a/lib/vapi_server_sdk/types/update_ghl_tool_dto.rb b/lib/vapi_server_sdk/types/update_ghl_tool_dto.rb new file mode 100644 index 0000000..cdf7834 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_ghl_tool_dto.rb @@ -0,0 +1,159 @@ +# frozen_string_literal: true + +require_relative "update_ghl_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require_relative "ghl_tool_metadata" +require "ostruct" +require "json" + +module Vapi + class UpdateGhlToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [Vapi::GhlToolMetadata] + attr_reader :metadata + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param metadata [Vapi::GhlToolMetadata] + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateGhlToolDto] + def initialize(async: OMIT, messages: OMIT, function: OMIT, server: OMIT, metadata: OMIT, + additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @function = function if function != OMIT + @server = server if server != OMIT + @metadata = metadata if metadata != OMIT + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "function": function, + "server": server, + "metadata": metadata + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateGhlToolDto + # + # @param json_object [String] + # @return [Vapi::UpdateGhlToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateGhlToolDtoMessagesItem.from_json(json_object: item) + end + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + if parsed_json["metadata"].nil? + metadata = nil + else + metadata = parsed_json["metadata"].to_json + metadata = Vapi::GhlToolMetadata.from_json(json_object: metadata) + end + new( + async: async, + messages: messages, + function: function, + server: server, + metadata: metadata, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateGhlToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.metadata.nil? || Vapi::GhlToolMetadata.validate_raw(obj: obj.metadata) + end + end +end diff --git a/lib/vapi_server_sdk/types/update_ghl_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_ghl_tool_dto_messages_item.rb new file mode 100644 index 0000000..dd61ca2 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_ghl_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class UpdateGhlToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateGhlToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateGhlToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateGhlToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::UpdateGhlToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::UpdateGhlToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::UpdateGhlToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::UpdateGhlToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_gladia_credential_dto.rb b/lib/vapi_server_sdk/types/update_gladia_credential_dto.rb index 3753ea9..6a0eba3 100644 --- a/lib/vapi_server_sdk/types/update_gladia_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_gladia_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateGladiaCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateGladiaCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateGladiaCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_go_high_level_credential_dto.rb b/lib/vapi_server_sdk/types/update_go_high_level_credential_dto.rb index 5570de8..19602d7 100644 --- a/lib/vapi_server_sdk/types/update_go_high_level_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_go_high_level_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateGoHighLevelCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateGoHighLevelCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateGoHighLevelCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_google_credential_dto.rb b/lib/vapi_server_sdk/types/update_google_credential_dto.rb index 41485dc..0790b50 100644 --- a/lib/vapi_server_sdk/types/update_google_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_google_credential_dto.rb @@ -5,9 +5,6 @@ module Vapi class UpdateGoogleCredentialDto - # @return [String] This is the key for Gemini in Google AI Studio. Get it from here: - # https://aistudio.google.com/app/apikey - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -20,18 +17,15 @@ class UpdateGoogleCredentialDto OMIT = Object.new - # @param provider [String] This is the key for Gemini in Google AI Studio. Get it from here: - # https://aistudio.google.com/app/apikey # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateGoogleCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -43,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -68,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_groq_credential_dto.rb b/lib/vapi_server_sdk/types/update_groq_credential_dto.rb index 79fe7f1..658c13a 100644 --- a/lib/vapi_server_sdk/types/update_groq_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_groq_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateGroqCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateGroqCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateGroqCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_inflection_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_inflection_ai_credential_dto.rb index f2ac228..c9e10fa 100644 --- a/lib/vapi_server_sdk/types/update_inflection_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_inflection_ai_credential_dto.rb @@ -5,9 +5,6 @@ module Vapi class UpdateInflectionAiCredentialDto - # @return [String] This is the api key for Pi in InflectionAI's console. Get it from here: - # https://developers.inflection.ai/keys, billing will need to be setup - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -20,18 +17,15 @@ class UpdateInflectionAiCredentialDto OMIT = Object.new - # @param provider [String] This is the api key for Pi in InflectionAI's console. Get it from here: - # https://developers.inflection.ai/keys, billing will need to be setup # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateInflectionAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -43,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -68,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_langfuse_credential_dto.rb b/lib/vapi_server_sdk/types/update_langfuse_credential_dto.rb index f82ac04..c364679 100644 --- a/lib/vapi_server_sdk/types/update_langfuse_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_langfuse_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateLangfuseCredentialDto - # @return [String] - attr_reader :provider # @return [String] The public key for Langfuse project. Eg: pk-lf-... attr_reader :public_key # @return [String] The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the @@ -24,7 +22,6 @@ class UpdateLangfuseCredentialDto OMIT = Object.new - # @param provider [String] # @param public_key [String] The public key for Langfuse project. Eg: pk-lf-... # @param api_key [String] The secret key for Langfuse project. Eg: sk-lf-... .This is not returned in the # API. @@ -32,20 +29,13 @@ class UpdateLangfuseCredentialDto # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateLangfuseCredentialDto] - def initialize(provider:, public_key:, api_key:, api_url:, name: OMIT, additional_properties: nil) - @provider = provider - @public_key = public_key - @api_key = api_key - @api_url = api_url + def initialize(public_key: OMIT, api_key: OMIT, api_url: OMIT, name: OMIT, additional_properties: nil) + @public_key = public_key if public_key != OMIT + @api_key = api_key if api_key != OMIT + @api_url = api_url if api_url != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "publicKey": public_key, - "apiKey": api_key, - "apiUrl": api_url, - "name": name - }.reject do |_k, v| + @_field_set = { "publicKey": public_key, "apiKey": api_key, "apiUrl": api_url, "name": name }.reject do |_k, v| v == OMIT end end @@ -57,13 +47,11 @@ def initialize(provider:, public_key:, api_key:, api_url:, name: OMIT, additiona def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] public_key = parsed_json["publicKey"] api_key = parsed_json["apiKey"] api_url = parsed_json["apiUrl"] name = parsed_json["name"] new( - provider: provider, public_key: public_key, api_key: api_key, api_url: api_url, @@ -86,10 +74,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.public_key.is_a?(String) != false || raise("Passed value for field obj.public_key is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") - obj.api_url.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") + obj.public_key&.is_a?(String) != false || raise("Passed value for field obj.public_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_url&.is_a?(String) != false || raise("Passed value for field obj.api_url is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_lmnt_credential_dto.rb b/lib/vapi_server_sdk/types/update_lmnt_credential_dto.rb index 1e2da63..46250a8 100644 --- a/lib/vapi_server_sdk/types/update_lmnt_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_lmnt_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateLmntCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateLmntCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateLmntCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_make_credential_dto.rb b/lib/vapi_server_sdk/types/update_make_credential_dto.rb index 38e80ac..1698e71 100644 --- a/lib/vapi_server_sdk/types/update_make_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_make_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateMakeCredentialDto - # @return [String] - attr_reader :provider # @return [String] Team ID attr_reader :team_id # @return [String] Region of your application. For example: eu1, eu2, us1, us2 @@ -23,27 +21,19 @@ class UpdateMakeCredentialDto OMIT = Object.new - # @param provider [String] # @param team_id [String] Team ID # @param region [String] Region of your application. For example: eu1, eu2, us1, us2 # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateMakeCredentialDto] - def initialize(provider:, team_id:, region:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @team_id = team_id - @region = region - @api_key = api_key + def initialize(team_id: OMIT, region: OMIT, api_key: OMIT, name: OMIT, additional_properties: nil) + @team_id = team_id if team_id != OMIT + @region = region if region != OMIT + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "teamId": team_id, - "region": region, - "apiKey": api_key, - "name": name - }.reject do |_k, v| + @_field_set = { "teamId": team_id, "region": region, "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -55,13 +45,11 @@ def initialize(provider:, team_id:, region:, api_key:, name: OMIT, additional_pr def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] team_id = parsed_json["teamId"] region = parsed_json["region"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, team_id: team_id, region: region, api_key: api_key, @@ -84,10 +72,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.team_id.is_a?(String) != false || raise("Passed value for field obj.team_id is not the expected type, validation failed.") - obj.region.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.team_id&.is_a?(String) != false || raise("Passed value for field obj.team_id is not the expected type, validation failed.") + obj.region&.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_make_tool_dto.rb b/lib/vapi_server_sdk/types/update_make_tool_dto.rb new file mode 100644 index 0000000..de5f435 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_make_tool_dto.rb @@ -0,0 +1,159 @@ +# frozen_string_literal: true + +require_relative "update_make_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require_relative "make_tool_metadata" +require "ostruct" +require "json" + +module Vapi + class UpdateMakeToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [Vapi::MakeToolMetadata] + attr_reader :metadata + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param metadata [Vapi::MakeToolMetadata] + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateMakeToolDto] + def initialize(async: OMIT, messages: OMIT, function: OMIT, server: OMIT, metadata: OMIT, + additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @function = function if function != OMIT + @server = server if server != OMIT + @metadata = metadata if metadata != OMIT + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "function": function, + "server": server, + "metadata": metadata + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateMakeToolDto + # + # @param json_object [String] + # @return [Vapi::UpdateMakeToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateMakeToolDtoMessagesItem.from_json(json_object: item) + end + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + if parsed_json["metadata"].nil? + metadata = nil + else + metadata = parsed_json["metadata"].to_json + metadata = Vapi::MakeToolMetadata.from_json(json_object: metadata) + end + new( + async: async, + messages: messages, + function: function, + server: server, + metadata: metadata, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateMakeToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.metadata.nil? || Vapi::MakeToolMetadata.validate_raw(obj: obj.metadata) + end + end +end diff --git a/lib/vapi_server_sdk/types/update_make_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_make_tool_dto_messages_item.rb new file mode 100644 index 0000000..0d1d98c --- /dev/null +++ b/lib/vapi_server_sdk/types/update_make_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class UpdateMakeToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateMakeToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateMakeToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateMakeToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::UpdateMakeToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::UpdateMakeToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::UpdateMakeToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::UpdateMakeToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_open_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_open_ai_credential_dto.rb index b40cef6..b3ebd26 100644 --- a/lib/vapi_server_sdk/types/update_open_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_open_ai_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateOpenAiCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateOpenAiCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateOpenAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_open_router_credential_dto.rb b/lib/vapi_server_sdk/types/update_open_router_credential_dto.rb index 4b6b3ce..8b52e89 100644 --- a/lib/vapi_server_sdk/types/update_open_router_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_open_router_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateOpenRouterCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateOpenRouterCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateOpenRouterCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_org_dto.rb b/lib/vapi_server_sdk/types/update_org_dto.rb index f74e6db..c504345 100644 --- a/lib/vapi_server_sdk/types/update_org_dto.rb +++ b/lib/vapi_server_sdk/types/update_org_dto.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative "update_org_dto_channel" +require_relative "server" require "ostruct" require "json" @@ -24,14 +25,13 @@ class UpdateOrgDto # @return [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. attr_reader :billing_limit - # @return [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - attr_reader :server_url - # @return [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [Float] This is the concurrency limit for the org. This is the maximum number of calls # that can be active at any given time. To go beyond 10, please contact us at # support@vapi.ai. @@ -57,26 +57,25 @@ class UpdateOrgDto # will be directed. # @param billing_limit [Float] This is the monthly billing limit for the org. To go beyond $1000/mo, please # contact us at support@vapi.ai. - # @param server_url [String] This is the URL Vapi will communicate with via HTTP GET and POST Requests. This - # is used for retrieving context, function calling, and end-of-call reports. - # All requests will be sent with the call object among other things relevant to - # that message. You can find more details in the Server URL documentation. - # @param server_url_secret [String] This is the secret you can set that Vapi will send with every request to your - # server. Will be sent as a header called x-vapi-secret. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param concurrency_limit [Float] This is the concurrency limit for the org. This is the maximum number of calls # that can be active at any given time. To go beyond 10, please contact us at # support@vapi.ai. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateOrgDto] def initialize(hipaa_enabled: OMIT, subscription_id: OMIT, name: OMIT, channel: OMIT, billing_limit: OMIT, - server_url: OMIT, server_url_secret: OMIT, concurrency_limit: OMIT, additional_properties: nil) + server: OMIT, concurrency_limit: OMIT, additional_properties: nil) @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT @subscription_id = subscription_id if subscription_id != OMIT @name = name if name != OMIT @channel = channel if channel != OMIT @billing_limit = billing_limit if billing_limit != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @concurrency_limit = concurrency_limit if concurrency_limit != OMIT @additional_properties = additional_properties @_field_set = { @@ -85,8 +84,7 @@ def initialize(hipaa_enabled: OMIT, subscription_id: OMIT, name: OMIT, channel: "name": name, "channel": channel, "billingLimit": billing_limit, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret, + "server": server, "concurrencyLimit": concurrency_limit }.reject do |_k, v| v == OMIT @@ -105,8 +103,12 @@ def self.from_json(json_object:) name = parsed_json["name"] channel = parsed_json["channel"] billing_limit = parsed_json["billingLimit"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end concurrency_limit = parsed_json["concurrencyLimit"] new( hipaa_enabled: hipaa_enabled, @@ -114,8 +116,7 @@ def self.from_json(json_object:) name: name, channel: channel, billing_limit: billing_limit, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, concurrency_limit: concurrency_limit, additional_properties: struct ) @@ -140,8 +141,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.channel&.is_a?(Vapi::UpdateOrgDtoChannel) != false || raise("Passed value for field obj.channel is not the expected type, validation failed.") obj.billing_limit&.is_a?(Float) != false || raise("Passed value for field obj.billing_limit is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.concurrency_limit&.is_a?(Float) != false || raise("Passed value for field obj.concurrency_limit is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_output_tool_dto.rb b/lib/vapi_server_sdk/types/update_output_tool_dto.rb new file mode 100644 index 0000000..924c731 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_output_tool_dto.rb @@ -0,0 +1,139 @@ +# frozen_string_literal: true + +require_relative "update_output_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateOutputToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateOutputToolDto] + def initialize(async: OMIT, messages: OMIT, function: OMIT, server: OMIT, additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @function = function if function != OMIT + @server = server if server != OMIT + @additional_properties = additional_properties + @_field_set = { "async": async, "messages": messages, "function": function, "server": server }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateOutputToolDto + # + # @param json_object [String] + # @return [Vapi::UpdateOutputToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateOutputToolDtoMessagesItem.from_json(json_object: item) + end + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + new( + async: async, + messages: messages, + function: function, + server: server, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateOutputToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + end + end +end diff --git a/lib/vapi_server_sdk/types/update_output_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_output_tool_dto_messages_item.rb new file mode 100644 index 0000000..6fe7a5f --- /dev/null +++ b/lib/vapi_server_sdk/types/update_output_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class UpdateOutputToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateOutputToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateOutputToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateOutputToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::UpdateOutputToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::UpdateOutputToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::UpdateOutputToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::UpdateOutputToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_perplexity_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_perplexity_ai_credential_dto.rb index d24fe7e..82caf9b 100644 --- a/lib/vapi_server_sdk/types/update_perplexity_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_perplexity_ai_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdatePerplexityAiCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdatePerplexityAiCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdatePerplexityAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_play_ht_credential_dto.rb b/lib/vapi_server_sdk/types/update_play_ht_credential_dto.rb index 973f271..234a55c 100644 --- a/lib/vapi_server_sdk/types/update_play_ht_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_play_ht_credential_dto.rb @@ -5,14 +5,12 @@ module Vapi class UpdatePlayHtCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key - # @return [String] - attr_reader :user_id # @return [String] This is the name of credential. This is just for your reference. attr_reader :name + # @return [String] + attr_reader :user_id # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -21,19 +19,17 @@ class UpdatePlayHtCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. - # @param user_id [String] # @param name [String] This is the name of credential. This is just for your reference. + # @param user_id [String] # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdatePlayHtCredentialDto] - def initialize(provider:, api_key:, user_id:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key - @user_id = user_id + def initialize(api_key: OMIT, name: OMIT, user_id: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT + @user_id = user_id if user_id != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "userId": user_id, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name, "userId": user_id }.reject do |_k, v| v == OMIT end end @@ -45,15 +41,13 @@ def initialize(provider:, api_key:, user_id:, name: OMIT, additional_properties: def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] - user_id = parsed_json["userId"] name = parsed_json["name"] + user_id = parsed_json["userId"] new( - provider: provider, api_key: api_key, - user_id: user_id, name: name, + user_id: user_id, additional_properties: struct ) end @@ -72,10 +66,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") - obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.user_id&.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_rime_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_rime_ai_credential_dto.rb index 1716608..10fec3c 100644 --- a/lib/vapi_server_sdk/types/update_rime_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_rime_ai_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateRimeAiCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateRimeAiCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateRimeAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_runpod_credential_dto.rb b/lib/vapi_server_sdk/types/update_runpod_credential_dto.rb index 8ee96d2..fa77b90 100644 --- a/lib/vapi_server_sdk/types/update_runpod_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_runpod_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateRunpodCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateRunpodCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateRunpodCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_s_3_credential_dto.rb b/lib/vapi_server_sdk/types/update_s_3_credential_dto.rb index 8ff6f27..9b864a7 100644 --- a/lib/vapi_server_sdk/types/update_s_3_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_s_3_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateS3CredentialDto - # @return [String] Credential provider. Only allowed value is s3 - attr_reader :provider # @return [String] AWS access key ID. attr_reader :aws_access_key_id # @return [String] AWS access key secret. This is not returned in the API. @@ -27,7 +25,6 @@ class UpdateS3CredentialDto OMIT = Object.new - # @param provider [String] Credential provider. Only allowed value is s3 # @param aws_access_key_id [String] AWS access key ID. # @param aws_secret_access_key [String] AWS access key secret. This is not returned in the API. # @param region [String] AWS region in which the S3 bucket is located. @@ -36,18 +33,16 @@ class UpdateS3CredentialDto # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateS3CredentialDto] - def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s_3_bucket_name:, s_3_path_prefix:, - name: OMIT, additional_properties: nil) - @provider = provider - @aws_access_key_id = aws_access_key_id - @aws_secret_access_key = aws_secret_access_key - @region = region - @s_3_bucket_name = s_3_bucket_name - @s_3_path_prefix = s_3_path_prefix + def initialize(aws_access_key_id: OMIT, aws_secret_access_key: OMIT, region: OMIT, s_3_bucket_name: OMIT, + s_3_path_prefix: OMIT, name: OMIT, additional_properties: nil) + @aws_access_key_id = aws_access_key_id if aws_access_key_id != OMIT + @aws_secret_access_key = aws_secret_access_key if aws_secret_access_key != OMIT + @region = region if region != OMIT + @s_3_bucket_name = s_3_bucket_name if s_3_bucket_name != OMIT + @s_3_path_prefix = s_3_path_prefix if s_3_path_prefix != OMIT @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { - "provider": provider, "awsAccessKeyId": aws_access_key_id, "awsSecretAccessKey": aws_secret_access_key, "region": region, @@ -66,7 +61,6 @@ def initialize(provider:, aws_access_key_id:, aws_secret_access_key:, region:, s def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] aws_access_key_id = parsed_json["awsAccessKeyId"] aws_secret_access_key = parsed_json["awsSecretAccessKey"] region = parsed_json["region"] @@ -74,7 +68,6 @@ def self.from_json(json_object:) s_3_path_prefix = parsed_json["s3PathPrefix"] name = parsed_json["name"] new( - provider: provider, aws_access_key_id: aws_access_key_id, aws_secret_access_key: aws_secret_access_key, region: region, @@ -99,12 +92,11 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.aws_access_key_id.is_a?(String) != false || raise("Passed value for field obj.aws_access_key_id is not the expected type, validation failed.") - obj.aws_secret_access_key.is_a?(String) != false || raise("Passed value for field obj.aws_secret_access_key is not the expected type, validation failed.") - obj.region.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") - obj.s_3_bucket_name.is_a?(String) != false || raise("Passed value for field obj.s_3_bucket_name is not the expected type, validation failed.") - obj.s_3_path_prefix.is_a?(String) != false || raise("Passed value for field obj.s_3_path_prefix is not the expected type, validation failed.") + obj.aws_access_key_id&.is_a?(String) != false || raise("Passed value for field obj.aws_access_key_id is not the expected type, validation failed.") + obj.aws_secret_access_key&.is_a?(String) != false || raise("Passed value for field obj.aws_secret_access_key is not the expected type, validation failed.") + obj.region&.is_a?(String) != false || raise("Passed value for field obj.region is not the expected type, validation failed.") + obj.s_3_bucket_name&.is_a?(String) != false || raise("Passed value for field obj.s_3_bucket_name is not the expected type, validation failed.") + obj.s_3_path_prefix&.is_a?(String) != false || raise("Passed value for field obj.s_3_path_prefix is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_smallest_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_smallest_ai_credential_dto.rb new file mode 100644 index 0000000..51051ae --- /dev/null +++ b/lib/vapi_server_sdk/types/update_smallest_ai_credential_dto.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require "ostruct" +require "json" + +module Vapi + class UpdateSmallestAiCredentialDto + # @return [String] This is not returned in the API. + attr_reader :api_key + # @return [String] This is the name of credential. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param api_key [String] This is not returned in the API. + # @param name [String] This is the name of credential. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateSmallestAiCredentialDto] + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateSmallestAiCredentialDto + # + # @param json_object [String] + # @return [Vapi::UpdateSmallestAiCredentialDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + api_key = parsed_json["apiKey"] + name = parsed_json["name"] + new( + api_key: api_key, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateSmallestAiCredentialDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_tavus_credential_dto.rb b/lib/vapi_server_sdk/types/update_tavus_credential_dto.rb index c003673..f44a5fe 100644 --- a/lib/vapi_server_sdk/types/update_tavus_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_tavus_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateTavusCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateTavusCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateTavusCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_text_editor_tool_dto.rb b/lib/vapi_server_sdk/types/update_text_editor_tool_dto.rb new file mode 100644 index 0000000..35c3d0e --- /dev/null +++ b/lib/vapi_server_sdk/types/update_text_editor_tool_dto.rb @@ -0,0 +1,161 @@ +# frozen_string_literal: true + +require_relative "update_text_editor_tool_dto_messages_item" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateTextEditorToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [String] The sub type of tool. + attr_reader :sub_type + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [String] The name of the tool, fixed to 'str_replace_editor' + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param sub_type [String] The sub type of tool. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param name [String] The name of the tool, fixed to 'str_replace_editor' + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateTextEditorToolDto] + def initialize(async: OMIT, messages: OMIT, sub_type: OMIT, function: OMIT, server: OMIT, name: OMIT, + additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @sub_type = sub_type if sub_type != OMIT + @function = function if function != OMIT + @server = server if server != OMIT + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "subType": sub_type, + "function": function, + "server": server, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateTextEditorToolDto + # + # @param json_object [String] + # @return [Vapi::UpdateTextEditorToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateTextEditorToolDtoMessagesItem.from_json(json_object: item) + end + sub_type = parsed_json["subType"] + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + name = parsed_json["name"] + new( + async: async, + messages: messages, + sub_type: sub_type, + function: function, + server: server, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateTextEditorToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.sub_type&.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_text_editor_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_text_editor_tool_dto_messages_item.rb new file mode 100644 index 0000000..cb28e59 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_text_editor_tool_dto_messages_item.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class UpdateTextEditorToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateTextEditorToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateTextEditorToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateTextEditorToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::UpdateTextEditorToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::UpdateTextEditorToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::UpdateTextEditorToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::UpdateTextEditorToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_together_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_together_ai_credential_dto.rb index a5e0e42..97e73f9 100644 --- a/lib/vapi_server_sdk/types/update_together_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_together_ai_credential_dto.rb @@ -5,8 +5,6 @@ module Vapi class UpdateTogetherAiCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -19,17 +17,15 @@ class UpdateTogetherAiCredentialDto OMIT = Object.new - # @param provider [String] # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateTogetherAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -41,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -66,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/update_token_dto.rb b/lib/vapi_server_sdk/types/update_token_dto.rb new file mode 100644 index 0000000..22fa44c --- /dev/null +++ b/lib/vapi_server_sdk/types/update_token_dto.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +require_relative "update_token_dto_tag" +require_relative "token_restrictions" +require "ostruct" +require "json" + +module Vapi + class UpdateTokenDto + # @return [Vapi::UpdateTokenDtoTag] This is the tag for the token. It represents its scope. + attr_reader :tag + # @return [String] This is the name of the token. This is just for your own reference. + attr_reader :name + # @return [Vapi::TokenRestrictions] This are the restrictions for the token. + attr_reader :restrictions + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param tag [Vapi::UpdateTokenDtoTag] This is the tag for the token. It represents its scope. + # @param name [String] This is the name of the token. This is just for your own reference. + # @param restrictions [Vapi::TokenRestrictions] This are the restrictions for the token. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateTokenDto] + def initialize(tag: OMIT, name: OMIT, restrictions: OMIT, additional_properties: nil) + @tag = tag if tag != OMIT + @name = name if name != OMIT + @restrictions = restrictions if restrictions != OMIT + @additional_properties = additional_properties + @_field_set = { "tag": tag, "name": name, "restrictions": restrictions }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateTokenDto + # + # @param json_object [String] + # @return [Vapi::UpdateTokenDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + tag = parsed_json["tag"] + name = parsed_json["name"] + if parsed_json["restrictions"].nil? + restrictions = nil + else + restrictions = parsed_json["restrictions"].to_json + restrictions = Vapi::TokenRestrictions.from_json(json_object: restrictions) + end + new( + tag: tag, + name: name, + restrictions: restrictions, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateTokenDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.tag&.is_a?(Vapi::UpdateTokenDtoTag) != false || raise("Passed value for field obj.tag is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.restrictions.nil? || Vapi::TokenRestrictions.validate_raw(obj: obj.restrictions) + end + end +end diff --git a/lib/vapi_server_sdk/types/update_token_dto_tag.rb b/lib/vapi_server_sdk/types/update_token_dto_tag.rb new file mode 100644 index 0000000..9a13b63 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_token_dto_tag.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Vapi + # This is the tag for the token. It represents its scope. + class UpdateTokenDtoTag + PRIVATE = "private" + PUBLIC = "public" + end +end diff --git a/lib/vapi_server_sdk/types/update_tool_call_block_dto.rb b/lib/vapi_server_sdk/types/update_tool_call_block_dto.rb new file mode 100644 index 0000000..1866d1e --- /dev/null +++ b/lib/vapi_server_sdk/types/update_tool_call_block_dto.rb @@ -0,0 +1,168 @@ +# frozen_string_literal: true + +require_relative "update_tool_call_block_dto_messages_item" +require_relative "json_schema" +require_relative "update_tool_call_block_dto_tool" +require "ostruct" +require "json" + +module Vapi + class UpdateToolCallBlockDto + # @return [Array] These are the pre-configured messages that will be spoken to the user while the + # block is running. + attr_reader :messages + # @return [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to + # run. It's given to the block as `steps[0].input` + # These are accessible as variables: + # - ({{input.propertyName}}) in context of the block execution (step) + # - ({{stepName.input.propertyName}}) in context of the workflow + attr_reader :input_schema + # @return [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will + # return to the workflow (`{{stepName.output}}`). + # These are accessible as variables: + # - ({{output.propertyName}}) in context of the block execution (step) + # - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) + # - ({{blockName.output.propertyName}}) in context of the workflow (read caveat + # #2) + # Caveats: + # 1. a workflow can execute a step multiple times. example, if a loop is used in + # the graph. {{stepName.output.propertyName}} will reference the latest usage of + # the step. + # 2. a workflow can execute a block multiple times. example, if a step is called + # multiple times or if a block is used in multiple steps. + # {{blockName.output.propertyName}} will reference the latest usage of the block. + # this liquid variable is just provided for convenience when creating blocks + # outside of a workflow with steps. + attr_reader :output_schema + # @return [Vapi::UpdateToolCallBlockDtoTool] This is the tool that the block will call. To use an existing tool, use + # `toolId`. + attr_reader :tool + # @return [String] This is the name of the block. This is just for your reference. + attr_reader :name + # @return [String] This is the id of the tool that the block will call. To use a transient tool, + # use `tool`. + attr_reader :tool_id + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param messages [Array] These are the pre-configured messages that will be spoken to the user while the + # block is running. + # @param input_schema [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to + # run. It's given to the block as `steps[0].input` + # These are accessible as variables: + # - ({{input.propertyName}}) in context of the block execution (step) + # - ({{stepName.input.propertyName}}) in context of the workflow + # @param output_schema [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will + # return to the workflow (`{{stepName.output}}`). + # These are accessible as variables: + # - ({{output.propertyName}}) in context of the block execution (step) + # - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) + # - ({{blockName.output.propertyName}}) in context of the workflow (read caveat + # #2) + # Caveats: + # 1. a workflow can execute a step multiple times. example, if a loop is used in + # the graph. {{stepName.output.propertyName}} will reference the latest usage of + # the step. + # 2. a workflow can execute a block multiple times. example, if a step is called + # multiple times or if a block is used in multiple steps. + # {{blockName.output.propertyName}} will reference the latest usage of the block. + # this liquid variable is just provided for convenience when creating blocks + # outside of a workflow with steps. + # @param tool [Vapi::UpdateToolCallBlockDtoTool] This is the tool that the block will call. To use an existing tool, use + # `toolId`. + # @param name [String] This is the name of the block. This is just for your reference. + # @param tool_id [String] This is the id of the tool that the block will call. To use a transient tool, + # use `tool`. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateToolCallBlockDto] + def initialize(messages: OMIT, input_schema: OMIT, output_schema: OMIT, tool: OMIT, name: OMIT, tool_id: OMIT, + additional_properties: nil) + @messages = messages if messages != OMIT + @input_schema = input_schema if input_schema != OMIT + @output_schema = output_schema if output_schema != OMIT + @tool = tool if tool != OMIT + @name = name if name != OMIT + @tool_id = tool_id if tool_id != OMIT + @additional_properties = additional_properties + @_field_set = { + "messages": messages, + "inputSchema": input_schema, + "outputSchema": output_schema, + "tool": tool, + "name": name, + "toolId": tool_id + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateToolCallBlockDto + # + # @param json_object [String] + # @return [Vapi::UpdateToolCallBlockDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateToolCallBlockDtoMessagesItem.from_json(json_object: item) + end + if parsed_json["inputSchema"].nil? + input_schema = nil + else + input_schema = parsed_json["inputSchema"].to_json + input_schema = Vapi::JsonSchema.from_json(json_object: input_schema) + end + if parsed_json["outputSchema"].nil? + output_schema = nil + else + output_schema = parsed_json["outputSchema"].to_json + output_schema = Vapi::JsonSchema.from_json(json_object: output_schema) + end + if parsed_json["tool"].nil? + tool = nil + else + tool = parsed_json["tool"].to_json + tool = Vapi::UpdateToolCallBlockDtoTool.from_json(json_object: tool) + end + name = parsed_json["name"] + tool_id = parsed_json["toolId"] + new( + messages: messages, + input_schema: input_schema, + output_schema: output_schema, + tool: tool, + name: name, + tool_id: tool_id, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateToolCallBlockDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.input_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.input_schema) + obj.output_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.output_schema) + obj.tool.nil? || Vapi::UpdateToolCallBlockDtoTool.validate_raw(obj: obj.tool) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.tool_id&.is_a?(String) != false || raise("Passed value for field obj.tool_id is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_tool_call_block_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_tool_call_block_dto_messages_item.rb new file mode 100644 index 0000000..307b516 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_tool_call_block_dto_messages_item.rb @@ -0,0 +1,94 @@ +# frozen_string_literal: true + +require "json" +require_relative "block_start_message" +require_relative "block_complete_message" + +module Vapi + class UpdateToolCallBlockDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateToolCallBlockDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateToolCallBlockDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateToolCallBlockDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "block-start" + Vapi::BlockStartMessage.from_json(json_object: json_object) + when "block-complete" + Vapi::BlockCompleteMessage.from_json(json_object: json_object) + else + Vapi::BlockStartMessage.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "block-start" + { **@member.to_json, type: @discriminant }.to_json + when "block-complete" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "block-start" + Vapi::BlockStartMessage.validate_raw(obj: obj) + when "block-complete" + Vapi::BlockCompleteMessage.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::BlockStartMessage] + # @return [Vapi::UpdateToolCallBlockDtoMessagesItem] + def self.block_start(member:) + new(member: member, discriminant: "block-start") + end + + # @param member [Vapi::BlockCompleteMessage] + # @return [Vapi::UpdateToolCallBlockDtoMessagesItem] + def self.block_complete(member:) + new(member: member, discriminant: "block-complete") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_tool_call_block_dto_tool.rb b/lib/vapi_server_sdk/types/update_tool_call_block_dto_tool.rb new file mode 100644 index 0000000..cd54af1 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_tool_call_block_dto_tool.rb @@ -0,0 +1,161 @@ +# frozen_string_literal: true + +require "json" +require_relative "create_dtmf_tool_dto" +require_relative "create_end_call_tool_dto" +require_relative "create_voicemail_tool_dto" +require_relative "create_function_tool_dto" +require_relative "create_ghl_tool_dto" +require_relative "create_make_tool_dto" +require_relative "create_transfer_call_tool_dto" + +module Vapi + # This is the tool that the block will call. To use an existing tool, use + # `toolId`. + class UpdateToolCallBlockDtoTool + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateToolCallBlockDtoTool] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateToolCallBlockDtoTool + # + # @param json_object [String] + # @return [Vapi::UpdateToolCallBlockDtoTool] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "dtmf" + Vapi::CreateDtmfToolDto.from_json(json_object: json_object) + when "endCall" + Vapi::CreateEndCallToolDto.from_json(json_object: json_object) + when "voicemail" + Vapi::CreateVoicemailToolDto.from_json(json_object: json_object) + when "function" + Vapi::CreateFunctionToolDto.from_json(json_object: json_object) + when "ghl" + Vapi::CreateGhlToolDto.from_json(json_object: json_object) + when "make" + Vapi::CreateMakeToolDto.from_json(json_object: json_object) + when "transferCall" + Vapi::CreateTransferCallToolDto.from_json(json_object: json_object) + else + Vapi::CreateDtmfToolDto.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "dtmf" + { **@member.to_json, type: @discriminant }.to_json + when "endCall" + { **@member.to_json, type: @discriminant }.to_json + when "voicemail" + { **@member.to_json, type: @discriminant }.to_json + when "function" + { **@member.to_json, type: @discriminant }.to_json + when "ghl" + { **@member.to_json, type: @discriminant }.to_json + when "make" + { **@member.to_json, type: @discriminant }.to_json + when "transferCall" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "dtmf" + Vapi::CreateDtmfToolDto.validate_raw(obj: obj) + when "endCall" + Vapi::CreateEndCallToolDto.validate_raw(obj: obj) + when "voicemail" + Vapi::CreateVoicemailToolDto.validate_raw(obj: obj) + when "function" + Vapi::CreateFunctionToolDto.validate_raw(obj: obj) + when "ghl" + Vapi::CreateGhlToolDto.validate_raw(obj: obj) + when "make" + Vapi::CreateMakeToolDto.validate_raw(obj: obj) + when "transferCall" + Vapi::CreateTransferCallToolDto.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::CreateDtmfToolDto] + # @return [Vapi::UpdateToolCallBlockDtoTool] + def self.dtmf(member:) + new(member: member, discriminant: "dtmf") + end + + # @param member [Vapi::CreateEndCallToolDto] + # @return [Vapi::UpdateToolCallBlockDtoTool] + def self.end_call(member:) + new(member: member, discriminant: "endCall") + end + + # @param member [Vapi::CreateVoicemailToolDto] + # @return [Vapi::UpdateToolCallBlockDtoTool] + def self.voicemail(member:) + new(member: member, discriminant: "voicemail") + end + + # @param member [Vapi::CreateFunctionToolDto] + # @return [Vapi::UpdateToolCallBlockDtoTool] + def self.function(member:) + new(member: member, discriminant: "function") + end + + # @param member [Vapi::CreateGhlToolDto] + # @return [Vapi::UpdateToolCallBlockDtoTool] + def self.ghl(member:) + new(member: member, discriminant: "ghl") + end + + # @param member [Vapi::CreateMakeToolDto] + # @return [Vapi::UpdateToolCallBlockDtoTool] + def self.make(member:) + new(member: member, discriminant: "make") + end + + # @param member [Vapi::CreateTransferCallToolDto] + # @return [Vapi::UpdateToolCallBlockDtoTool] + def self.transfer_call(member:) + new(member: member, discriminant: "transferCall") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_transfer_call_tool_dto.rb b/lib/vapi_server_sdk/types/update_transfer_call_tool_dto.rb new file mode 100644 index 0000000..123edca --- /dev/null +++ b/lib/vapi_server_sdk/types/update_transfer_call_tool_dto.rb @@ -0,0 +1,161 @@ +# frozen_string_literal: true + +require_relative "update_transfer_call_tool_dto_messages_item" +require_relative "update_transfer_call_tool_dto_destinations_item" +require_relative "open_ai_function" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateTransferCallToolDto + # @return [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + attr_reader :async + # @return [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + attr_reader :messages + # @return [Array] These are the destinations that the call can be transferred to. If no + # destinations are provided, server.url will be used to get the transfer + # destination once the tool is called. + attr_reader :destinations + # @return [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + attr_reader :function + # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + attr_reader :server + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param async [Boolean] This determines if the tool is async. + # If async, the assistant will move forward without waiting for your server to + # respond. This is useful if you just want to trigger something on your server. + # If sync, the assistant will wait for your server to respond. This is useful if + # want assistant to respond with the result from your server. + # Defaults to synchronous (`false`). + # @param messages [Array] These are the messages that will be spoken to the user as the tool is running. + # For some tools, this is auto-filled based on special fields like + # `tool.destinations`. For others like the function tool, these can be custom + # configured. + # @param destinations [Array] These are the destinations that the call can be transferred to. If no + # destinations are provided, server.url will be used to get the transfer + # destination once the tool is called. + # @param function [Vapi::OpenAiFunction] This is the function definition of the tool. + # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on + # tool-specific fields like `tool.destinations`. But, even in those cases, you can + # provide a custom function definition for advanced use cases. + # An example of an advanced use case is if you want to customize the message + # that's spoken for `endCall` tool. You can specify a function where it returns an + # argument "reason". Then, in `messages` array, you can have many + # "request-complete" messages. One of these messages will be triggered if the + # `messages[].conditions` matches the "reason" argument. + # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model. + # All requests will be sent with the call object among other things. You can find + # more details in the Server URL documentation. + # This overrides the serverUrl set on the org and the phoneNumber. Order of + # precedence: highest tool.server.url, then assistant.serverUrl, then + # phoneNumber.serverUrl, then org.serverUrl. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateTransferCallToolDto] + def initialize(async: OMIT, messages: OMIT, destinations: OMIT, function: OMIT, server: OMIT, + additional_properties: nil) + @async = async if async != OMIT + @messages = messages if messages != OMIT + @destinations = destinations if destinations != OMIT + @function = function if function != OMIT + @server = server if server != OMIT + @additional_properties = additional_properties + @_field_set = { + "async": async, + "messages": messages, + "destinations": destinations, + "function": function, + "server": server + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateTransferCallToolDto + # + # @param json_object [String] + # @return [Vapi::UpdateTransferCallToolDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + async = parsed_json["async"] + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateTransferCallToolDtoMessagesItem.from_json(json_object: item) + end + destinations = parsed_json["destinations"]&.map do |item| + item = item.to_json + Vapi::UpdateTransferCallToolDtoDestinationsItem.from_json(json_object: item) + end + if parsed_json["function"].nil? + function = nil + else + function = parsed_json["function"].to_json + function = Vapi::OpenAiFunction.from_json(json_object: function) + end + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + new( + async: async, + messages: messages, + destinations: destinations, + function: function, + server: server, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateTransferCallToolDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.") + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.destinations&.is_a?(Array) != false || raise("Passed value for field obj.destinations is not the expected type, validation failed.") + obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function) + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + end + end +end diff --git a/lib/vapi_server_sdk/types/update_transfer_call_tool_dto_destinations_item.rb b/lib/vapi_server_sdk/types/update_transfer_call_tool_dto_destinations_item.rb new file mode 100644 index 0000000..f6203e2 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_transfer_call_tool_dto_destinations_item.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +require "json" +require_relative "transfer_destination_assistant" +require_relative "transfer_destination_step" +require_relative "transfer_destination_number" +require_relative "transfer_destination_sip" + +module Vapi + class UpdateTransferCallToolDtoDestinationsItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateTransferCallToolDtoDestinationsItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # UpdateTransferCallToolDtoDestinationsItem + # + # @param json_object [String] + # @return [Vapi::UpdateTransferCallToolDtoDestinationsItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "assistant" + Vapi::TransferDestinationAssistant.from_json(json_object: json_object) + when "step" + Vapi::TransferDestinationStep.from_json(json_object: json_object) + when "number" + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + when "sip" + Vapi::TransferDestinationSip.from_json(json_object: json_object) + else + Vapi::TransferDestinationAssistant.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "assistant" + { **@member.to_json, type: @discriminant }.to_json + when "step" + { **@member.to_json, type: @discriminant }.to_json + when "number" + { **@member.to_json, type: @discriminant }.to_json + when "sip" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "assistant" + Vapi::TransferDestinationAssistant.validate_raw(obj: obj) + when "step" + Vapi::TransferDestinationStep.validate_raw(obj: obj) + when "number" + Vapi::TransferDestinationNumber.validate_raw(obj: obj) + when "sip" + Vapi::TransferDestinationSip.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TransferDestinationAssistant] + # @return [Vapi::UpdateTransferCallToolDtoDestinationsItem] + def self.assistant(member:) + new(member: member, discriminant: "assistant") + end + + # @param member [Vapi::TransferDestinationStep] + # @return [Vapi::UpdateTransferCallToolDtoDestinationsItem] + def self.step(member:) + new(member: member, discriminant: "step") + end + + # @param member [Vapi::TransferDestinationNumber] + # @return [Vapi::UpdateTransferCallToolDtoDestinationsItem] + def self.number(member:) + new(member: member, discriminant: "number") + end + + # @param member [Vapi::TransferDestinationSip] + # @return [Vapi::UpdateTransferCallToolDtoDestinationsItem] + def self.sip(member:) + new(member: member, discriminant: "sip") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_transfer_call_tool_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_transfer_call_tool_dto_messages_item.rb new file mode 100644 index 0000000..e9b4377 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_transfer_call_tool_dto_messages_item.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +require "json" +require_relative "tool_message_start" +require_relative "tool_message_complete" +require_relative "tool_message_failed" +require_relative "tool_message_delayed" + +module Vapi + class UpdateTransferCallToolDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateTransferCallToolDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # UpdateTransferCallToolDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateTransferCallToolDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "request-start" + Vapi::ToolMessageStart.from_json(json_object: json_object) + when "request-complete" + Vapi::ToolMessageComplete.from_json(json_object: json_object) + when "request-failed" + Vapi::ToolMessageFailed.from_json(json_object: json_object) + when "request-response-delayed" + Vapi::ToolMessageDelayed.from_json(json_object: json_object) + else + Vapi::ToolMessageStart.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "request-start" + { **@member.to_json, type: @discriminant }.to_json + when "request-complete" + { **@member.to_json, type: @discriminant }.to_json + when "request-failed" + { **@member.to_json, type: @discriminant }.to_json + when "request-response-delayed" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "request-start" + Vapi::ToolMessageStart.validate_raw(obj: obj) + when "request-complete" + Vapi::ToolMessageComplete.validate_raw(obj: obj) + when "request-failed" + Vapi::ToolMessageFailed.validate_raw(obj: obj) + when "request-response-delayed" + Vapi::ToolMessageDelayed.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::ToolMessageStart] + # @return [Vapi::UpdateTransferCallToolDtoMessagesItem] + def self.request_start(member:) + new(member: member, discriminant: "request-start") + end + + # @param member [Vapi::ToolMessageComplete] + # @return [Vapi::UpdateTransferCallToolDtoMessagesItem] + def self.request_complete(member:) + new(member: member, discriminant: "request-complete") + end + + # @param member [Vapi::ToolMessageFailed] + # @return [Vapi::UpdateTransferCallToolDtoMessagesItem] + def self.request_failed(member:) + new(member: member, discriminant: "request-failed") + end + + # @param member [Vapi::ToolMessageDelayed] + # @return [Vapi::UpdateTransferCallToolDtoMessagesItem] + def self.request_response_delayed(member:) + new(member: member, discriminant: "request-response-delayed") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto.rb b/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto.rb new file mode 100644 index 0000000..77488cb --- /dev/null +++ b/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +require_relative "trieve_knowledge_base_vector_store_search_plan" +require_relative "trieve_knowledge_base_vector_store_create_plan" +require "ostruct" +require "json" + +module Vapi + class UpdateTrieveKnowledgeBaseDto + # @return [String] This is the name of the knowledge base. + attr_reader :name + # @return [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan] This is the plan on how to search the vector store while a call is going on. + attr_reader :vector_store_search_plan + # @return [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan] This is the plan if you want us to create a new vector store on your behalf. To + # use an existing vector store from your account, use `vectoreStoreProviderId` + attr_reader :vector_store_create_plan + # @return [String] This is an vector store that you already have on your account with the provider. + # To create a new vector store, use vectorStoreCreatePlan. + # Usage: + # - To bring your own vector store from Trieve, go to https://trieve.ai + # - Create a dataset, and use the datasetId here. + attr_reader :vector_store_provider_id + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param name [String] This is the name of the knowledge base. + # @param vector_store_search_plan [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan] This is the plan on how to search the vector store while a call is going on. + # @param vector_store_create_plan [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan] This is the plan if you want us to create a new vector store on your behalf. To + # use an existing vector store from your account, use `vectoreStoreProviderId` + # @param vector_store_provider_id [String] This is an vector store that you already have on your account with the provider. + # To create a new vector store, use vectorStoreCreatePlan. + # Usage: + # - To bring your own vector store from Trieve, go to https://trieve.ai + # - Create a dataset, and use the datasetId here. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateTrieveKnowledgeBaseDto] + def initialize(name: OMIT, vector_store_search_plan: OMIT, vector_store_create_plan: OMIT, + vector_store_provider_id: OMIT, additional_properties: nil) + @name = name if name != OMIT + @vector_store_search_plan = vector_store_search_plan if vector_store_search_plan != OMIT + @vector_store_create_plan = vector_store_create_plan if vector_store_create_plan != OMIT + @vector_store_provider_id = vector_store_provider_id if vector_store_provider_id != OMIT + @additional_properties = additional_properties + @_field_set = { + "name": name, + "vectorStoreSearchPlan": vector_store_search_plan, + "vectorStoreCreatePlan": vector_store_create_plan, + "vectorStoreProviderId": vector_store_provider_id + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateTrieveKnowledgeBaseDto + # + # @param json_object [String] + # @return [Vapi::UpdateTrieveKnowledgeBaseDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + name = parsed_json["name"] + if parsed_json["vectorStoreSearchPlan"].nil? + vector_store_search_plan = nil + else + vector_store_search_plan = parsed_json["vectorStoreSearchPlan"].to_json + vector_store_search_plan = Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan.from_json(json_object: vector_store_search_plan) + end + if parsed_json["vectorStoreCreatePlan"].nil? + vector_store_create_plan = nil + else + vector_store_create_plan = parsed_json["vectorStoreCreatePlan"].to_json + vector_store_create_plan = Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan.from_json(json_object: vector_store_create_plan) + end + vector_store_provider_id = parsed_json["vectorStoreProviderId"] + new( + name: name, + vector_store_search_plan: vector_store_search_plan, + vector_store_create_plan: vector_store_create_plan, + vector_store_provider_id: vector_store_provider_id, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateTrieveKnowledgeBaseDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.vector_store_search_plan.nil? || Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan.validate_raw(obj: obj.vector_store_search_plan) + obj.vector_store_create_plan.nil? || Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan.validate_raw(obj: obj.vector_store_create_plan) + obj.vector_store_provider_id&.is_a?(String) != false || raise("Passed value for field obj.vector_store_provider_id is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_twilio_credential_dto.rb b/lib/vapi_server_sdk/types/update_twilio_credential_dto.rb index d6c166a..d67f628 100644 --- a/lib/vapi_server_sdk/types/update_twilio_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_twilio_credential_dto.rb @@ -5,14 +5,12 @@ module Vapi class UpdateTwilioCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :auth_token - # @return [String] - attr_reader :account_sid # @return [String] This is the name of credential. This is just for your reference. attr_reader :name + # @return [String] + attr_reader :account_sid # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -21,24 +19,17 @@ class UpdateTwilioCredentialDto OMIT = Object.new - # @param provider [String] # @param auth_token [String] This is not returned in the API. - # @param account_sid [String] # @param name [String] This is the name of credential. This is just for your reference. + # @param account_sid [String] # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateTwilioCredentialDto] - def initialize(provider:, auth_token:, account_sid:, name: OMIT, additional_properties: nil) - @provider = provider - @auth_token = auth_token - @account_sid = account_sid + def initialize(auth_token: OMIT, name: OMIT, account_sid: OMIT, additional_properties: nil) + @auth_token = auth_token if auth_token != OMIT @name = name if name != OMIT + @account_sid = account_sid if account_sid != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "authToken": auth_token, - "accountSid": account_sid, - "name": name - }.reject do |_k, v| + @_field_set = { "authToken": auth_token, "name": name, "accountSid": account_sid }.reject do |_k, v| v == OMIT end end @@ -50,15 +41,13 @@ def initialize(provider:, auth_token:, account_sid:, name: OMIT, additional_prop def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] auth_token = parsed_json["authToken"] - account_sid = parsed_json["accountSid"] name = parsed_json["name"] + account_sid = parsed_json["accountSid"] new( - provider: provider, auth_token: auth_token, - account_sid: account_sid, name: name, + account_sid: account_sid, additional_properties: struct ) end @@ -77,10 +66,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.auth_token.is_a?(String) != false || raise("Passed value for field obj.auth_token is not the expected type, validation failed.") - obj.account_sid.is_a?(String) != false || raise("Passed value for field obj.account_sid is not the expected type, validation failed.") + obj.auth_token&.is_a?(String) != false || raise("Passed value for field obj.auth_token is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.account_sid&.is_a?(String) != false || raise("Passed value for field obj.account_sid is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_twilio_phone_number_dto.rb b/lib/vapi_server_sdk/types/update_twilio_phone_number_dto.rb new file mode 100644 index 0000000..01bbf3b --- /dev/null +++ b/lib/vapi_server_sdk/types/update_twilio_phone_number_dto.rb @@ -0,0 +1,163 @@ +# frozen_string_literal: true + +require_relative "update_twilio_phone_number_dto_fallback_destination" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateTwilioPhoneNumberDto + # @return [Vapi::UpdateTwilioPhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + attr_reader :fallback_destination + # @return [String] This is the name of the phone number. This is just for your own reference. + attr_reader :name + # @return [String] This is the assistant that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + attr_reader :assistant_id + # @return [String] This is the squad that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + attr_reader :squad_id + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server + # @return [String] These are the digits of the phone number you own on your Twilio. + attr_reader :number + # @return [String] This is the Twilio Account SID for the phone number. + attr_reader :twilio_account_sid + # @return [String] This is the Twilio Auth Token for the phone number. + attr_reader :twilio_auth_token + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param fallback_destination [Vapi::UpdateTwilioPhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + # @param name [String] This is the name of the phone number. This is just for your own reference. + # @param assistant_id [String] This is the assistant that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + # @param squad_id [String] This is the squad that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + # @param number [String] These are the digits of the phone number you own on your Twilio. + # @param twilio_account_sid [String] This is the Twilio Account SID for the phone number. + # @param twilio_auth_token [String] This is the Twilio Auth Token for the phone number. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateTwilioPhoneNumberDto] + def initialize(fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, + number: OMIT, twilio_account_sid: OMIT, twilio_auth_token: OMIT, additional_properties: nil) + @fallback_destination = fallback_destination if fallback_destination != OMIT + @name = name if name != OMIT + @assistant_id = assistant_id if assistant_id != OMIT + @squad_id = squad_id if squad_id != OMIT + @server = server if server != OMIT + @number = number if number != OMIT + @twilio_account_sid = twilio_account_sid if twilio_account_sid != OMIT + @twilio_auth_token = twilio_auth_token if twilio_auth_token != OMIT + @additional_properties = additional_properties + @_field_set = { + "fallbackDestination": fallback_destination, + "name": name, + "assistantId": assistant_id, + "squadId": squad_id, + "server": server, + "number": number, + "twilioAccountSid": twilio_account_sid, + "twilioAuthToken": twilio_auth_token + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateTwilioPhoneNumberDto + # + # @param json_object [String] + # @return [Vapi::UpdateTwilioPhoneNumberDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["fallbackDestination"].nil? + fallback_destination = nil + else + fallback_destination = parsed_json["fallbackDestination"].to_json + fallback_destination = Vapi::UpdateTwilioPhoneNumberDtoFallbackDestination.from_json(json_object: fallback_destination) + end + name = parsed_json["name"] + assistant_id = parsed_json["assistantId"] + squad_id = parsed_json["squadId"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + number = parsed_json["number"] + twilio_account_sid = parsed_json["twilioAccountSid"] + twilio_auth_token = parsed_json["twilioAuthToken"] + new( + fallback_destination: fallback_destination, + name: name, + assistant_id: assistant_id, + squad_id: squad_id, + server: server, + number: number, + twilio_account_sid: twilio_account_sid, + twilio_auth_token: twilio_auth_token, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateTwilioPhoneNumberDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.fallback_destination.nil? || Vapi::UpdateTwilioPhoneNumberDtoFallbackDestination.validate_raw(obj: obj.fallback_destination) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") + obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.number&.is_a?(String) != false || raise("Passed value for field obj.number is not the expected type, validation failed.") + obj.twilio_account_sid&.is_a?(String) != false || raise("Passed value for field obj.twilio_account_sid is not the expected type, validation failed.") + obj.twilio_auth_token&.is_a?(String) != false || raise("Passed value for field obj.twilio_auth_token is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_twilio_phone_number_dto_fallback_destination.rb b/lib/vapi_server_sdk/types/update_twilio_phone_number_dto_fallback_destination.rb new file mode 100644 index 0000000..17f836e --- /dev/null +++ b/lib/vapi_server_sdk/types/update_twilio_phone_number_dto_fallback_destination.rb @@ -0,0 +1,101 @@ +# frozen_string_literal: true + +require "json" +require_relative "transfer_destination_number" +require_relative "transfer_destination_sip" + +module Vapi + # This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + class UpdateTwilioPhoneNumberDtoFallbackDestination + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateTwilioPhoneNumberDtoFallbackDestination] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # UpdateTwilioPhoneNumberDtoFallbackDestination + # + # @param json_object [String] + # @return [Vapi::UpdateTwilioPhoneNumberDtoFallbackDestination] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "number" + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + when "sip" + Vapi::TransferDestinationSip.from_json(json_object: json_object) + else + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "number" + { **@member.to_json, type: @discriminant }.to_json + when "sip" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "number" + Vapi::TransferDestinationNumber.validate_raw(obj: obj) + when "sip" + Vapi::TransferDestinationSip.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TransferDestinationNumber] + # @return [Vapi::UpdateTwilioPhoneNumberDtoFallbackDestination] + def self.number(member:) + new(member: member, discriminant: "number") + end + + # @param member [Vapi::TransferDestinationSip] + # @return [Vapi::UpdateTwilioPhoneNumberDtoFallbackDestination] + def self.sip(member:) + new(member: member, discriminant: "sip") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb b/lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb new file mode 100644 index 0000000..1ea67a7 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_vapi_phone_number_dto.rb @@ -0,0 +1,169 @@ +# frozen_string_literal: true + +require_relative "update_vapi_phone_number_dto_fallback_destination" +require_relative "server" +require_relative "sip_authentication" +require "ostruct" +require "json" + +module Vapi + class UpdateVapiPhoneNumberDto + # @return [Vapi::UpdateVapiPhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + attr_reader :fallback_destination + # @return [String] This is the name of the phone number. This is just for your own reference. + attr_reader :name + # @return [String] This is the assistant that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + attr_reader :assistant_id + # @return [String] This is the squad that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + attr_reader :squad_id + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server + # @return [String] This is the SIP URI of the phone number. You can SIP INVITE this. The assistant + # attached to this number will answer. + # This is case-insensitive. + attr_reader :sip_uri + # @return [Vapi::SipAuthentication] This enables authentication for incoming SIP INVITE requests to the `sipUri`. + # If not set, any username/password to the 401 challenge of the SIP INVITE will be + # accepted. + attr_reader :authentication + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param fallback_destination [Vapi::UpdateVapiPhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + # @param name [String] This is the name of the phone number. This is just for your own reference. + # @param assistant_id [String] This is the assistant that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + # @param squad_id [String] This is the squad that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + # @param sip_uri [String] This is the SIP URI of the phone number. You can SIP INVITE this. The assistant + # attached to this number will answer. + # This is case-insensitive. + # @param authentication [Vapi::SipAuthentication] This enables authentication for incoming SIP INVITE requests to the `sipUri`. + # If not set, any username/password to the 401 challenge of the SIP INVITE will be + # accepted. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateVapiPhoneNumberDto] + def initialize(fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, + sip_uri: OMIT, authentication: OMIT, additional_properties: nil) + @fallback_destination = fallback_destination if fallback_destination != OMIT + @name = name if name != OMIT + @assistant_id = assistant_id if assistant_id != OMIT + @squad_id = squad_id if squad_id != OMIT + @server = server if server != OMIT + @sip_uri = sip_uri if sip_uri != OMIT + @authentication = authentication if authentication != OMIT + @additional_properties = additional_properties + @_field_set = { + "fallbackDestination": fallback_destination, + "name": name, + "assistantId": assistant_id, + "squadId": squad_id, + "server": server, + "sipUri": sip_uri, + "authentication": authentication + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateVapiPhoneNumberDto + # + # @param json_object [String] + # @return [Vapi::UpdateVapiPhoneNumberDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["fallbackDestination"].nil? + fallback_destination = nil + else + fallback_destination = parsed_json["fallbackDestination"].to_json + fallback_destination = Vapi::UpdateVapiPhoneNumberDtoFallbackDestination.from_json(json_object: fallback_destination) + end + name = parsed_json["name"] + assistant_id = parsed_json["assistantId"] + squad_id = parsed_json["squadId"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + sip_uri = parsed_json["sipUri"] + if parsed_json["authentication"].nil? + authentication = nil + else + authentication = parsed_json["authentication"].to_json + authentication = Vapi::SipAuthentication.from_json(json_object: authentication) + end + new( + fallback_destination: fallback_destination, + name: name, + assistant_id: assistant_id, + squad_id: squad_id, + server: server, + sip_uri: sip_uri, + authentication: authentication, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateVapiPhoneNumberDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.fallback_destination.nil? || Vapi::UpdateVapiPhoneNumberDtoFallbackDestination.validate_raw(obj: obj.fallback_destination) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") + obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.sip_uri&.is_a?(String) != false || raise("Passed value for field obj.sip_uri is not the expected type, validation failed.") + obj.authentication.nil? || Vapi::SipAuthentication.validate_raw(obj: obj.authentication) + end + end +end diff --git a/lib/vapi_server_sdk/types/update_vapi_phone_number_dto_fallback_destination.rb b/lib/vapi_server_sdk/types/update_vapi_phone_number_dto_fallback_destination.rb new file mode 100644 index 0000000..d62af73 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_vapi_phone_number_dto_fallback_destination.rb @@ -0,0 +1,101 @@ +# frozen_string_literal: true + +require "json" +require_relative "transfer_destination_number" +require_relative "transfer_destination_sip" + +module Vapi + # This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + class UpdateVapiPhoneNumberDtoFallbackDestination + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateVapiPhoneNumberDtoFallbackDestination] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # UpdateVapiPhoneNumberDtoFallbackDestination + # + # @param json_object [String] + # @return [Vapi::UpdateVapiPhoneNumberDtoFallbackDestination] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "number" + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + when "sip" + Vapi::TransferDestinationSip.from_json(json_object: json_object) + else + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "number" + { **@member.to_json, type: @discriminant }.to_json + when "sip" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "number" + Vapi::TransferDestinationNumber.validate_raw(obj: obj) + when "sip" + Vapi::TransferDestinationSip.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TransferDestinationNumber] + # @return [Vapi::UpdateVapiPhoneNumberDtoFallbackDestination] + def self.number(member:) + new(member: member, discriminant: "number") + end + + # @param member [Vapi::TransferDestinationSip] + # @return [Vapi::UpdateVapiPhoneNumberDtoFallbackDestination] + def self.sip(member:) + new(member: member, discriminant: "sip") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_vonage_credential_dto.rb b/lib/vapi_server_sdk/types/update_vonage_credential_dto.rb index e74b793..30b71d7 100644 --- a/lib/vapi_server_sdk/types/update_vonage_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_vonage_credential_dto.rb @@ -5,14 +5,12 @@ module Vapi class UpdateVonageCredentialDto - # @return [String] - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_secret - # @return [String] - attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. attr_reader :name + # @return [String] + attr_reader :api_key # @return [OpenStruct] Additional properties unmapped to the current class definition attr_reader :additional_properties # @return [Object] @@ -21,24 +19,17 @@ class UpdateVonageCredentialDto OMIT = Object.new - # @param provider [String] # @param api_secret [String] This is not returned in the API. - # @param api_key [String] # @param name [String] This is the name of credential. This is just for your reference. + # @param api_key [String] # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateVonageCredentialDto] - def initialize(provider:, api_secret:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_secret = api_secret - @api_key = api_key + def initialize(api_secret: OMIT, name: OMIT, api_key: OMIT, additional_properties: nil) + @api_secret = api_secret if api_secret != OMIT @name = name if name != OMIT + @api_key = api_key if api_key != OMIT @additional_properties = additional_properties - @_field_set = { - "provider": provider, - "apiSecret": api_secret, - "apiKey": api_key, - "name": name - }.reject do |_k, v| + @_field_set = { "apiSecret": api_secret, "name": name, "apiKey": api_key }.reject do |_k, v| v == OMIT end end @@ -50,15 +41,13 @@ def initialize(provider:, api_secret:, api_key:, name: OMIT, additional_properti def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_secret = parsed_json["apiSecret"] - api_key = parsed_json["apiKey"] name = parsed_json["name"] + api_key = parsed_json["apiKey"] new( - provider: provider, api_secret: api_secret, - api_key: api_key, name: name, + api_key: api_key, additional_properties: struct ) end @@ -77,10 +66,9 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_secret.is_a?(String) != false || raise("Passed value for field obj.api_secret is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_secret&.is_a?(String) != false || raise("Passed value for field obj.api_secret is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") end end end diff --git a/lib/vapi_server_sdk/types/update_vonage_phone_number_dto.rb b/lib/vapi_server_sdk/types/update_vonage_phone_number_dto.rb new file mode 100644 index 0000000..7a67beb --- /dev/null +++ b/lib/vapi_server_sdk/types/update_vonage_phone_number_dto.rb @@ -0,0 +1,157 @@ +# frozen_string_literal: true + +require_relative "update_vonage_phone_number_dto_fallback_destination" +require_relative "server" +require "ostruct" +require "json" + +module Vapi + class UpdateVonagePhoneNumberDto + # @return [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + attr_reader :fallback_destination + # @return [String] This is the name of the phone number. This is just for your own reference. + attr_reader :name + # @return [String] This is the assistant that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + attr_reader :assistant_id + # @return [String] This is the squad that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + attr_reader :squad_id + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server + # @return [String] These are the digits of the phone number you own on your Vonage. + attr_reader :number + # @return [String] This is the credential that is used to make outgoing calls, and do operations + # like call transfer and hang up. + attr_reader :credential_id + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param fallback_destination [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination] This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + # @param name [String] This is the name of the phone number. This is just for your own reference. + # @param assistant_id [String] This is the assistant that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + # @param squad_id [String] This is the squad that will be used for incoming calls to this phone number. + # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent + # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the + # shape of the message and response that is expected. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + # @param number [String] These are the digits of the phone number you own on your Vonage. + # @param credential_id [String] This is the credential that is used to make outgoing calls, and do operations + # like call transfer and hang up. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateVonagePhoneNumberDto] + def initialize(fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, + number: OMIT, credential_id: OMIT, additional_properties: nil) + @fallback_destination = fallback_destination if fallback_destination != OMIT + @name = name if name != OMIT + @assistant_id = assistant_id if assistant_id != OMIT + @squad_id = squad_id if squad_id != OMIT + @server = server if server != OMIT + @number = number if number != OMIT + @credential_id = credential_id if credential_id != OMIT + @additional_properties = additional_properties + @_field_set = { + "fallbackDestination": fallback_destination, + "name": name, + "assistantId": assistant_id, + "squadId": squad_id, + "server": server, + "number": number, + "credentialId": credential_id + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateVonagePhoneNumberDto + # + # @param json_object [String] + # @return [Vapi::UpdateVonagePhoneNumberDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + if parsed_json["fallbackDestination"].nil? + fallback_destination = nil + else + fallback_destination = parsed_json["fallbackDestination"].to_json + fallback_destination = Vapi::UpdateVonagePhoneNumberDtoFallbackDestination.from_json(json_object: fallback_destination) + end + name = parsed_json["name"] + assistant_id = parsed_json["assistantId"] + squad_id = parsed_json["squadId"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end + number = parsed_json["number"] + credential_id = parsed_json["credentialId"] + new( + fallback_destination: fallback_destination, + name: name, + assistant_id: assistant_id, + squad_id: squad_id, + server: server, + number: number, + credential_id: credential_id, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateVonagePhoneNumberDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.fallback_destination.nil? || Vapi::UpdateVonagePhoneNumberDtoFallbackDestination.validate_raw(obj: obj.fallback_destination) + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") + obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) + obj.number&.is_a?(String) != false || raise("Passed value for field obj.number is not the expected type, validation failed.") + obj.credential_id&.is_a?(String) != false || raise("Passed value for field obj.credential_id is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_vonage_phone_number_dto_fallback_destination.rb b/lib/vapi_server_sdk/types/update_vonage_phone_number_dto_fallback_destination.rb new file mode 100644 index 0000000..c3d93f2 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_vonage_phone_number_dto_fallback_destination.rb @@ -0,0 +1,101 @@ +# frozen_string_literal: true + +require "json" +require_relative "transfer_destination_number" +require_relative "transfer_destination_sip" + +module Vapi + # This is the fallback destination an inbound call will be transferred to if: + # 1. `assistantId` is not set + # 2. `squadId` is not set + # 3. and, `assistant-request` message to the `serverUrl` fails + # If this is not set and above conditions are met, the inbound call is hung up + # with an error message. + class UpdateVonagePhoneNumberDtoFallbackDestination + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of + # UpdateVonagePhoneNumberDtoFallbackDestination + # + # @param json_object [String] + # @return [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "number" + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + when "sip" + Vapi::TransferDestinationSip.from_json(json_object: json_object) + else + Vapi::TransferDestinationNumber.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "number" + { **@member.to_json, type: @discriminant }.to_json + when "sip" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "number" + Vapi::TransferDestinationNumber.validate_raw(obj: obj) + when "sip" + Vapi::TransferDestinationSip.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::TransferDestinationNumber] + # @return [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination] + def self.number(member:) + new(member: member, discriminant: "number") + end + + # @param member [Vapi::TransferDestinationSip] + # @return [Vapi::UpdateVonagePhoneNumberDtoFallbackDestination] + def self.sip(member:) + new(member: member, discriminant: "sip") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_workflow_block_dto.rb b/lib/vapi_server_sdk/types/update_workflow_block_dto.rb new file mode 100644 index 0000000..b2f6883 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_workflow_block_dto.rb @@ -0,0 +1,154 @@ +# frozen_string_literal: true + +require_relative "update_workflow_block_dto_messages_item" +require_relative "json_schema" +require_relative "update_workflow_block_dto_steps_item" +require "ostruct" +require "json" + +module Vapi + class UpdateWorkflowBlockDto + # @return [Array] These are the pre-configured messages that will be spoken to the user while the + # block is running. + attr_reader :messages + # @return [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to + # run. It's given to the block as `steps[0].input` + # These are accessible as variables: + # - ({{input.propertyName}}) in context of the block execution (step) + # - ({{stepName.input.propertyName}}) in context of the workflow + attr_reader :input_schema + # @return [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will + # return to the workflow (`{{stepName.output}}`). + # These are accessible as variables: + # - ({{output.propertyName}}) in context of the block execution (step) + # - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) + # - ({{blockName.output.propertyName}}) in context of the workflow (read caveat + # #2) + # Caveats: + # 1. a workflow can execute a step multiple times. example, if a loop is used in + # the graph. {{stepName.output.propertyName}} will reference the latest usage of + # the step. + # 2. a workflow can execute a block multiple times. example, if a step is called + # multiple times or if a block is used in multiple steps. + # {{blockName.output.propertyName}} will reference the latest usage of the block. + # this liquid variable is just provided for convenience when creating blocks + # outside of a workflow with steps. + attr_reader :output_schema + # @return [Array] These are the steps in the workflow. + attr_reader :steps + # @return [String] This is the name of the block. This is just for your reference. + attr_reader :name + # @return [OpenStruct] Additional properties unmapped to the current class definition + attr_reader :additional_properties + # @return [Object] + attr_reader :_field_set + protected :_field_set + + OMIT = Object.new + + # @param messages [Array] These are the pre-configured messages that will be spoken to the user while the + # block is running. + # @param input_schema [Vapi::JsonSchema] This is the input schema for the block. This is the input the block needs to + # run. It's given to the block as `steps[0].input` + # These are accessible as variables: + # - ({{input.propertyName}}) in context of the block execution (step) + # - ({{stepName.input.propertyName}}) in context of the workflow + # @param output_schema [Vapi::JsonSchema] This is the output schema for the block. This is the output the block will + # return to the workflow (`{{stepName.output}}`). + # These are accessible as variables: + # - ({{output.propertyName}}) in context of the block execution (step) + # - ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1) + # - ({{blockName.output.propertyName}}) in context of the workflow (read caveat + # #2) + # Caveats: + # 1. a workflow can execute a step multiple times. example, if a loop is used in + # the graph. {{stepName.output.propertyName}} will reference the latest usage of + # the step. + # 2. a workflow can execute a block multiple times. example, if a step is called + # multiple times or if a block is used in multiple steps. + # {{blockName.output.propertyName}} will reference the latest usage of the block. + # this liquid variable is just provided for convenience when creating blocks + # outside of a workflow with steps. + # @param steps [Array] These are the steps in the workflow. + # @param name [String] This is the name of the block. This is just for your reference. + # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition + # @return [Vapi::UpdateWorkflowBlockDto] + def initialize(messages: OMIT, input_schema: OMIT, output_schema: OMIT, steps: OMIT, name: OMIT, + additional_properties: nil) + @messages = messages if messages != OMIT + @input_schema = input_schema if input_schema != OMIT + @output_schema = output_schema if output_schema != OMIT + @steps = steps if steps != OMIT + @name = name if name != OMIT + @additional_properties = additional_properties + @_field_set = { + "messages": messages, + "inputSchema": input_schema, + "outputSchema": output_schema, + "steps": steps, + "name": name + }.reject do |_k, v| + v == OMIT + end + end + + # Deserialize a JSON object to an instance of UpdateWorkflowBlockDto + # + # @param json_object [String] + # @return [Vapi::UpdateWorkflowBlockDto] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + parsed_json = JSON.parse(json_object) + messages = parsed_json["messages"]&.map do |item| + item = item.to_json + Vapi::UpdateWorkflowBlockDtoMessagesItem.from_json(json_object: item) + end + if parsed_json["inputSchema"].nil? + input_schema = nil + else + input_schema = parsed_json["inputSchema"].to_json + input_schema = Vapi::JsonSchema.from_json(json_object: input_schema) + end + if parsed_json["outputSchema"].nil? + output_schema = nil + else + output_schema = parsed_json["outputSchema"].to_json + output_schema = Vapi::JsonSchema.from_json(json_object: output_schema) + end + steps = parsed_json["steps"]&.map do |item| + item = item.to_json + Vapi::UpdateWorkflowBlockDtoStepsItem.from_json(json_object: item) + end + name = parsed_json["name"] + new( + messages: messages, + input_schema: input_schema, + output_schema: output_schema, + steps: steps, + name: name, + additional_properties: struct + ) + end + + # Serialize an instance of UpdateWorkflowBlockDto to a JSON object + # + # @return [String] + def to_json(*_args) + @_field_set&.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") + obj.input_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.input_schema) + obj.output_schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.output_schema) + obj.steps&.is_a?(Array) != false || raise("Passed value for field obj.steps is not the expected type, validation failed.") + obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_workflow_block_dto_messages_item.rb b/lib/vapi_server_sdk/types/update_workflow_block_dto_messages_item.rb new file mode 100644 index 0000000..12ae757 --- /dev/null +++ b/lib/vapi_server_sdk/types/update_workflow_block_dto_messages_item.rb @@ -0,0 +1,94 @@ +# frozen_string_literal: true + +require "json" +require_relative "block_start_message" +require_relative "block_complete_message" + +module Vapi + class UpdateWorkflowBlockDtoMessagesItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateWorkflowBlockDtoMessagesItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateWorkflowBlockDtoMessagesItem + # + # @param json_object [String] + # @return [Vapi::UpdateWorkflowBlockDtoMessagesItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "block-start" + Vapi::BlockStartMessage.from_json(json_object: json_object) + when "block-complete" + Vapi::BlockCompleteMessage.from_json(json_object: json_object) + else + Vapi::BlockStartMessage.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "block-start" + { **@member.to_json, type: @discriminant }.to_json + when "block-complete" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "block-start" + Vapi::BlockStartMessage.validate_raw(obj: obj) + when "block-complete" + Vapi::BlockCompleteMessage.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::BlockStartMessage] + # @return [Vapi::UpdateWorkflowBlockDtoMessagesItem] + def self.block_start(member:) + new(member: member, discriminant: "block-start") + end + + # @param member [Vapi::BlockCompleteMessage] + # @return [Vapi::UpdateWorkflowBlockDtoMessagesItem] + def self.block_complete(member:) + new(member: member, discriminant: "block-complete") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_workflow_block_dto_steps_item.rb b/lib/vapi_server_sdk/types/update_workflow_block_dto_steps_item.rb new file mode 100644 index 0000000..7b2ff2b --- /dev/null +++ b/lib/vapi_server_sdk/types/update_workflow_block_dto_steps_item.rb @@ -0,0 +1,94 @@ +# frozen_string_literal: true + +require "json" +require_relative "handoff_step" +require_relative "callback_step" + +module Vapi + class UpdateWorkflowBlockDtoStepsItem + # @return [Object] + attr_reader :member + # @return [String] + attr_reader :discriminant + + private_class_method :new + alias kind_of? is_a? + + # @param member [Object] + # @param discriminant [String] + # @return [Vapi::UpdateWorkflowBlockDtoStepsItem] + def initialize(member:, discriminant:) + @member = member + @discriminant = discriminant + end + + # Deserialize a JSON object to an instance of UpdateWorkflowBlockDtoStepsItem + # + # @param json_object [String] + # @return [Vapi::UpdateWorkflowBlockDtoStepsItem] + def self.from_json(json_object:) + struct = JSON.parse(json_object, object_class: OpenStruct) + member = case struct.type + when "handoff" + Vapi::HandoffStep.from_json(json_object: json_object) + when "callback" + Vapi::CallbackStep.from_json(json_object: json_object) + else + Vapi::HandoffStep.from_json(json_object: json_object) + end + new(member: member, discriminant: struct.type) + end + + # For Union Types, to_json functionality is delegated to the wrapped member. + # + # @return [String] + def to_json(*_args) + case @discriminant + when "handoff" + { **@member.to_json, type: @discriminant }.to_json + when "callback" + { **@member.to_json, type: @discriminant }.to_json + else + { "type": @discriminant, value: @member }.to_json + end + @member.to_json + end + + # Leveraged for Union-type generation, validate_raw attempts to parse the given + # hash and check each fields type against the current object's property + # definitions. + # + # @param obj [Object] + # @return [Void] + def self.validate_raw(obj:) + case obj.type + when "handoff" + Vapi::HandoffStep.validate_raw(obj: obj) + when "callback" + Vapi::CallbackStep.validate_raw(obj: obj) + else + raise("Passed value matched no type within the union, validation failed.") + end + end + + # For Union Types, is_a? functionality is delegated to the wrapped member. + # + # @param obj [Object] + # @return [Boolean] + def is_a?(obj) + @member.is_a?(obj) + end + + # @param member [Vapi::HandoffStep] + # @return [Vapi::UpdateWorkflowBlockDtoStepsItem] + def self.handoff(member:) + new(member: member, discriminant: "handoff") + end + + # @param member [Vapi::CallbackStep] + # @return [Vapi::UpdateWorkflowBlockDtoStepsItem] + def self.callback(member:) + new(member: member, discriminant: "callback") + end + end +end diff --git a/lib/vapi_server_sdk/types/update_x_ai_credential_dto.rb b/lib/vapi_server_sdk/types/update_x_ai_credential_dto.rb index 8b95dd9..cbb696d 100644 --- a/lib/vapi_server_sdk/types/update_x_ai_credential_dto.rb +++ b/lib/vapi_server_sdk/types/update_x_ai_credential_dto.rb @@ -5,9 +5,6 @@ module Vapi class UpdateXAiCredentialDto - # @return [String] This is the api key for Grok in XAi's console. Get it from here: - # https://console.x.ai - attr_reader :provider # @return [String] This is not returned in the API. attr_reader :api_key # @return [String] This is the name of credential. This is just for your reference. @@ -20,18 +17,15 @@ class UpdateXAiCredentialDto OMIT = Object.new - # @param provider [String] This is the api key for Grok in XAi's console. Get it from here: - # https://console.x.ai # @param api_key [String] This is not returned in the API. # @param name [String] This is the name of credential. This is just for your reference. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::UpdateXAiCredentialDto] - def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) - @provider = provider - @api_key = api_key + def initialize(api_key: OMIT, name: OMIT, additional_properties: nil) + @api_key = api_key if api_key != OMIT @name = name if name != OMIT @additional_properties = additional_properties - @_field_set = { "provider": provider, "apiKey": api_key, "name": name }.reject do |_k, v| + @_field_set = { "apiKey": api_key, "name": name }.reject do |_k, v| v == OMIT end end @@ -43,11 +37,9 @@ def initialize(provider:, api_key:, name: OMIT, additional_properties: nil) def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) - provider = parsed_json["provider"] api_key = parsed_json["apiKey"] name = parsed_json["name"] new( - provider: provider, api_key: api_key, name: name, additional_properties: struct @@ -68,8 +60,7 @@ def to_json(*_args) # @param obj [Object] # @return [Void] def self.validate_raw(obj:) - obj.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") - obj.api_key.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") + obj.api_key&.is_a?(String) != false || raise("Passed value for field obj.api_key is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end end diff --git a/lib/vapi_server_sdk/types/vapi_phone_number.rb b/lib/vapi_server_sdk/types/vapi_phone_number.rb index b3bd7d7..4402e6e 100644 --- a/lib/vapi_server_sdk/types/vapi_phone_number.rb +++ b/lib/vapi_server_sdk/types/vapi_phone_number.rb @@ -2,6 +2,7 @@ require_relative "vapi_phone_number_fallback_destination" require "date" +require_relative "server" require_relative "sip_authentication" require "ostruct" require "json" @@ -35,16 +36,13 @@ class VapiPhoneNumber # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. attr_reader :squad_id - # @return [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - attr_reader :server_url - # @return [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [String] This is the SIP URI of the phone number. You can SIP INVITE this. The assistant # attached to this number will answer. # This is case-insensitive. @@ -80,14 +78,12 @@ class VapiPhoneNumber # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param sip_uri [String] This is the SIP URI of the phone number. You can SIP INVITE this. The assistant # attached to this number will answer. # This is case-insensitive. @@ -97,7 +93,7 @@ class VapiPhoneNumber # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::VapiPhoneNumber] def initialize(id:, org_id:, created_at:, updated_at:, sip_uri:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, - squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, authentication: OMIT, additional_properties: nil) + squad_id: OMIT, server: OMIT, authentication: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @id = id @org_id = org_id @@ -106,8 +102,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, sip_uri:, fallback_destin @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @sip_uri = sip_uri @authentication = authentication if authentication != OMIT @additional_properties = additional_properties @@ -120,8 +115,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, sip_uri:, fallback_destin "name": name, "assistantId": assistant_id, "squadId": squad_id, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret, + "server": server, "sipUri": sip_uri, "authentication": authentication }.reject do |_k, v| @@ -149,8 +143,12 @@ def self.from_json(json_object:) name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end sip_uri = parsed_json["sipUri"] if parsed_json["authentication"].nil? authentication = nil @@ -167,8 +165,7 @@ def self.from_json(json_object:) name: name, assistant_id: assistant_id, squad_id: squad_id, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, sip_uri: sip_uri, authentication: authentication, additional_properties: struct @@ -197,8 +194,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.sip_uri.is_a?(String) != false || raise("Passed value for field obj.sip_uri is not the expected type, validation failed.") obj.authentication.nil? || Vapi::SipAuthentication.validate_raw(obj: obj.authentication) end diff --git a/lib/vapi_server_sdk/types/vonage_phone_number.rb b/lib/vapi_server_sdk/types/vonage_phone_number.rb index 05264e1..0d1f4fb 100644 --- a/lib/vapi_server_sdk/types/vonage_phone_number.rb +++ b/lib/vapi_server_sdk/types/vonage_phone_number.rb @@ -2,6 +2,7 @@ require_relative "vonage_phone_number_fallback_destination" require "date" +require_relative "server" require "ostruct" require "json" @@ -34,16 +35,13 @@ class VonagePhoneNumber # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. attr_reader :squad_id - # @return [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - attr_reader :server_url - # @return [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. - attr_reader :server_url_secret + # @return [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server + attr_reader :server # @return [String] These are the digits of the phone number you own on your Vonage. attr_reader :number # @return [String] This is the credential that is used to make outgoing calls, and do operations @@ -76,21 +74,19 @@ class VonagePhoneNumber # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent # to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the # shape of the message and response that is expected. - # @param server_url [String] This is the server URL where messages will be sent for calls on this number. - # This includes the `assistant-request` message. - # You can see the shape of the messages sent in `ServerMessage`. - # This overrides the `org.serverUrl`. Order of precedence: tool.server.url > - # assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl. - # @param server_url_secret [String] This is the secret Vapi will send with every message to your server. It's sent - # as a header called x-vapi-secret. - # Same precedence logic as serverUrl. + # @param server [Vapi::Server] This is where Vapi will send webhooks. You can find all webhooks available along + # with their shape in ServerMessage schema. + # The order of precedence is: + # 1. assistant.server + # 2. phoneNumber.server + # 3. org.server # @param number [String] These are the digits of the phone number you own on your Vonage. # @param credential_id [String] This is the credential that is used to make outgoing calls, and do operations # like call transfer and hang up. # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition # @return [Vapi::VonagePhoneNumber] def initialize(id:, org_id:, created_at:, updated_at:, number:, credential_id:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT, - squad_id: OMIT, server_url: OMIT, server_url_secret: OMIT, additional_properties: nil) + squad_id: OMIT, server: OMIT, additional_properties: nil) @fallback_destination = fallback_destination if fallback_destination != OMIT @id = id @org_id = org_id @@ -99,8 +95,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, number:, credential_id:, @name = name if name != OMIT @assistant_id = assistant_id if assistant_id != OMIT @squad_id = squad_id if squad_id != OMIT - @server_url = server_url if server_url != OMIT - @server_url_secret = server_url_secret if server_url_secret != OMIT + @server = server if server != OMIT @number = number @credential_id = credential_id @additional_properties = additional_properties @@ -113,8 +108,7 @@ def initialize(id:, org_id:, created_at:, updated_at:, number:, credential_id:, "name": name, "assistantId": assistant_id, "squadId": squad_id, - "serverUrl": server_url, - "serverUrlSecret": server_url_secret, + "server": server, "number": number, "credentialId": credential_id }.reject do |_k, v| @@ -142,8 +136,12 @@ def self.from_json(json_object:) name = parsed_json["name"] assistant_id = parsed_json["assistantId"] squad_id = parsed_json["squadId"] - server_url = parsed_json["serverUrl"] - server_url_secret = parsed_json["serverUrlSecret"] + if parsed_json["server"].nil? + server = nil + else + server = parsed_json["server"].to_json + server = Vapi::Server.from_json(json_object: server) + end number = parsed_json["number"] credential_id = parsed_json["credentialId"] new( @@ -155,8 +153,7 @@ def self.from_json(json_object:) name: name, assistant_id: assistant_id, squad_id: squad_id, - server_url: server_url, - server_url_secret: server_url_secret, + server: server, number: number, credential_id: credential_id, additional_properties: struct @@ -185,8 +182,7 @@ def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.") obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.") - obj.server_url&.is_a?(String) != false || raise("Passed value for field obj.server_url is not the expected type, validation failed.") - obj.server_url_secret&.is_a?(String) != false || raise("Passed value for field obj.server_url_secret is not the expected type, validation failed.") + obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.number.is_a?(String) != false || raise("Passed value for field obj.number is not the expected type, validation failed.") obj.credential_id.is_a?(String) != false || raise("Passed value for field obj.credential_id is not the expected type, validation failed.") end diff --git a/vapi_server_sdk.gemspec b/vapi_server_sdk.gemspec index 860e67d..078e26f 100644 --- a/vapi_server_sdk.gemspec +++ b/vapi_server_sdk.gemspec @@ -4,7 +4,7 @@ require_relative "lib/gemconfig" Gem::Specification.new do |spec| spec.name = "vapi_server_sdk" - spec.version = "0.2.0" + spec.version = "0.3.0" spec.authors = Vapi::Gemconfig::AUTHORS spec.email = Vapi::Gemconfig::EMAIL spec.summary = Vapi::Gemconfig::SUMMARY