diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetCrmConfig.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetCrmConfig.g.cs index 622a40c1..9c30cea1 100644 --- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetCrmConfig.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetCrmConfig.g.cs @@ -5,7 +5,7 @@ namespace RetellAI public partial interface IRetellAiClient { /// - /// Get the organization's CRM configuration: which CRM app is linked, the custom contact fields defined for it, and how post-call analysis data is written back to contacts. Returns an empty configuration when nothing has been set up yet. + /// Get the organization's CRM configuration: which CRM app is linked, the custom contact fields defined for it, and how Post Call Extraction data is written back to contacts. Returns an empty configuration when nothing has been set up yet. /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with @@ -14,7 +14,7 @@ public partial interface IRetellAiClient global::RetellAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// - /// Get the organization's CRM configuration: which CRM app is linked, the custom contact fields defined for it, and how post-call analysis data is written back to contacts. Returns an empty configuration when nothing has been set up yet. + /// Get the organization's CRM configuration: which CRM app is linked, the custom contact fields defined for it, and how Post Call Extraction data is written back to contacts. Returns an empty configuration when nothing has been set up yet. /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RerunCallAnalysis.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RerunCallAnalysis.g.cs index 82d4fabb..75817faf 100644 --- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RerunCallAnalysis.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RerunCallAnalysis.g.cs @@ -5,7 +5,7 @@ namespace RetellAI public partial interface IRetellAiClient { /// - /// Rerun post-call analysis for a specific call. This operation incurs charges. + /// Rerun Post Call Extraction for a specific call. This operation incurs charges. /// /// /// Example: call_119c3f8e47135a29e65947eeb34cf12d @@ -18,7 +18,7 @@ public partial interface IRetellAiClient global::RetellAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// - /// Rerun post-call analysis for a specific call. This operation incurs charges. + /// Rerun Post Call Extraction for a specific call. This operation incurs charges. /// /// /// Example: call_119c3f8e47135a29e65947eeb34cf12d diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RerunChatAnalysis.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RerunChatAnalysis.g.cs index d9201b42..32a68b26 100644 --- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RerunChatAnalysis.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RerunChatAnalysis.g.cs @@ -5,7 +5,7 @@ namespace RetellAI public partial interface IRetellAiClient { /// - /// Rerun post-chat analysis for a specific chat. This operation incurs charges. + /// Rerun Post Chat Extraction for a specific chat. This operation incurs charges. /// /// /// Example: chat_16b980523634a6dc504898cda492e939 @@ -18,7 +18,7 @@ public partial interface IRetellAiClient global::RetellAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// - /// Rerun post-chat analysis for a specific chat. This operation incurs charges. + /// Rerun Post Chat Extraction for a specific chat. This operation incurs charges. /// /// /// Example: chat_16b980523634a6dc504898cda492e939 diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateAgent.g.cs index 0f61dbb6..e8c9940e 100644 --- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateAgent.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateAgent.g.cs @@ -219,7 +219,7 @@ public partial interface IRetellAiClient /// If this option is set, the agent prompt will include call screen handling instructions for identity and call purpose questions. Set this to null to disable call screen prompt instructions. /// /// - /// Post call analysis data to extract from the call. This data will augment the pre-defined variables extracted in the call analysis. This will be available after the call ends. + /// Post Call Extraction data to extract from the call. This data will augment the pre-defined variables extracted in the call analysis. This will be available after the call ends. /// /// /// Available LLM models for agents. diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatAgent.g.cs index acc9a1a7..095538eb 100644 --- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatAgent.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatAgent.g.cs @@ -103,7 +103,7 @@ public partial interface IRetellAiClient /// Example: 86400000 /// /// - /// Post chat analysis data to extract from the chat. This data will augment the pre-defined variables extracted in the chat analysis. This will be available after the chat ends. + /// Post Chat Extraction data to extract from the chat. This data will augment the pre-defined variables extracted in the chat analysis. This will be available after the chat ends. /// /// /// Available LLM models for agents. diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AgentResponse.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AgentResponse.g.cs index f0a9255a..f55848a0 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AgentResponse.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AgentResponse.g.cs @@ -17,221 +17,48 @@ public class AgentResponseJsonConverter : global::System.Text.Json.Serialization using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.AgentResponseVariant1? agentResponseVariant1 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentResponseVariant1).Name}"); + agentResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("agent_id")) __score0++; - if (__jsonProps.Contains("assigned_tags")) __score0++; - if (__jsonProps.Contains("base_version")) __score0++; - if (__jsonProps.Contains("is_published")) __score0++; - if (__jsonProps.Contains("version")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("agent_name")) __score1++; - if (__jsonProps.Contains("allow_dtmf_interruption")) __score1++; - if (__jsonProps.Contains("allow_user_dtmf")) __score1++; - if (__jsonProps.Contains("ambient_sound")) __score1++; - if (__jsonProps.Contains("ambient_sound_volume")) __score1++; - if (__jsonProps.Contains("backchannel_frequency")) __score1++; - if (__jsonProps.Contains("backchannel_words")) __score1++; - if (__jsonProps.Contains("begin_message_delay_ms")) __score1++; - if (__jsonProps.Contains("boosted_keywords")) __score1++; - if (__jsonProps.Contains("call_screening_option")) __score1++; - if (__jsonProps.Contains("call_screening_option.agent_identity")) __score1++; - if (__jsonProps.Contains("call_screening_option.call_purpose")) __score1++; - if (__jsonProps.Contains("custom_stt_config")) __score1++; - if (__jsonProps.Contains("custom_stt_config.endpointing_ms")) __score1++; - if (__jsonProps.Contains("custom_stt_config.provider")) __score1++; - if (__jsonProps.Contains("data_storage_retention_days")) __score1++; - if (__jsonProps.Contains("data_storage_setting")) __score1++; - if (__jsonProps.Contains("denoising_mode")) __score1++; - if (__jsonProps.Contains("enable_backchannel")) __score1++; - if (__jsonProps.Contains("enable_dynamic_responsiveness")) __score1++; - if (__jsonProps.Contains("enable_dynamic_voice_speed")) __score1++; - if (__jsonProps.Contains("enable_expressive_mode")) __score1++; - if (__jsonProps.Contains("end_call_after_silence_ms")) __score1++; - if (__jsonProps.Contains("expressive_emotion_tags")) __score1++; - if (__jsonProps.Contains("expressive_mode_prompt")) __score1++; - if (__jsonProps.Contains("fallback_voice_ids")) __score1++; - if (__jsonProps.Contains("guardrail_config")) __score1++; - if (__jsonProps.Contains("guardrail_config.input_topics")) __score1++; - if (__jsonProps.Contains("guardrail_config.output_topics")) __score1++; - if (__jsonProps.Contains("handbook_config")) __score1++; - if (__jsonProps.Contains("handbook_config.ai_disclosure")) __score1++; - if (__jsonProps.Contains("handbook_config.conversational_personality")) __score1++; - if (__jsonProps.Contains("handbook_config.default_personality")) __score1++; - if (__jsonProps.Contains("handbook_config.echo_verification")) __score1++; - if (__jsonProps.Contains("handbook_config.high_empathy")) __score1++; - if (__jsonProps.Contains("handbook_config.nato_phonetic_alphabet")) __score1++; - if (__jsonProps.Contains("handbook_config.natural_filler_words")) __score1++; - if (__jsonProps.Contains("handbook_config.scope_boundaries")) __score1++; - if (__jsonProps.Contains("handbook_config.smart_matching")) __score1++; - if (__jsonProps.Contains("handbook_config.speech_normalization")) __score1++; - if (__jsonProps.Contains("interruption_sensitivity")) __score1++; - if (__jsonProps.Contains("ivr_option")) __score1++; - if (__jsonProps.Contains("ivr_option.action")) __score1++; - if (__jsonProps.Contains("ivr_option.detection_prompt")) __score1++; - if (__jsonProps.Contains("language")) __score1++; - if (__jsonProps.Contains("max_call_duration_ms")) __score1++; - if (__jsonProps.Contains("opt_in_signed_url")) __score1++; - if (__jsonProps.Contains("pii_config")) __score1++; - if (__jsonProps.Contains("pii_config.categories")) __score1++; - if (__jsonProps.Contains("pii_config.mode")) __score1++; - if (__jsonProps.Contains("post_call_analysis_data")) __score1++; - if (__jsonProps.Contains("post_call_analysis_model")) __score1++; - if (__jsonProps.Contains("pronunciation_dictionary")) __score1++; - if (__jsonProps.Contains("reminder_max_count")) __score1++; - if (__jsonProps.Contains("reminder_trigger_ms")) __score1++; - if (__jsonProps.Contains("response_engine")) __score1++; - if (__jsonProps.Contains("responsiveness")) __score1++; - if (__jsonProps.Contains("ring_duration_ms")) __score1++; - if (__jsonProps.Contains("signed_url_expiration_ms")) __score1++; - if (__jsonProps.Contains("stt_mode")) __score1++; - if (__jsonProps.Contains("timezone")) __score1++; - if (__jsonProps.Contains("user_dtmf_options")) __score1++; - if (__jsonProps.Contains("user_dtmf_options.digit_limit")) __score1++; - if (__jsonProps.Contains("user_dtmf_options.termination_key")) __score1++; - if (__jsonProps.Contains("user_dtmf_options.timeout_ms")) __score1++; - if (__jsonProps.Contains("version_description")) __score1++; - if (__jsonProps.Contains("version_title")) __score1++; - if (__jsonProps.Contains("vocab_specialization")) __score1++; - if (__jsonProps.Contains("voice_emotion")) __score1++; - if (__jsonProps.Contains("voice_id")) __score1++; - if (__jsonProps.Contains("voice_model")) __score1++; - if (__jsonProps.Contains("voice_speed")) __score1++; - if (__jsonProps.Contains("voice_temperature")) __score1++; - if (__jsonProps.Contains("voicemail_option")) __score1++; - if (__jsonProps.Contains("voicemail_option.action")) __score1++; - if (__jsonProps.Contains("voicemail_option.detection_prompt")) __score1++; - if (__jsonProps.Contains("volume")) __score1++; - if (__jsonProps.Contains("webhook_events")) __score1++; - if (__jsonProps.Contains("webhook_timeout_ms")) __score1++; - if (__jsonProps.Contains("webhook_url")) __score1++; - var __score2 = 0; - if (__jsonProps.Contains("last_modification_timestamp")) __score2++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - if (__score2 > __bestScore) { __bestScore = __score2; __bestIndex = 2; } - - global::RetellAI.AgentResponseVariant1? agentResponseVariant1 = default; global::RetellAI.AgentRequest? request = default; - global::RetellAI.AgentResponseVariant3? agentResponseVariant3 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentResponseVariant1).Name}"); - agentResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentRequest).Name}"); - request = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 2) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentResponseVariant3).Name}"); - agentResponseVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentRequest).Name}"); + request = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (agentResponseVariant1 == null && request == null && agentResponseVariant3 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentResponseVariant1).Name}"); - agentResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (agentResponseVariant1 == null && request == null && agentResponseVariant3 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentRequest).Name}"); - request = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - if (agentResponseVariant1 == null && request == null && agentResponseVariant3 == null) + global::RetellAI.AgentResponseVariant3? agentResponseVariant3 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentResponseVariant3).Name}"); + agentResponseVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentResponseVariant3).Name}"); - agentResponseVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.AgentResponse( agentResponseVariant1, @@ -252,24 +79,64 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsAgentResponseVariant1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentResponseVariant1).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.AgentResponseVariant1!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.AgentResponseVariant1!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsRequest) + if (value.IsRequest) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentRequest).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Request!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Request!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsAgentResponseVariant3) + if (value.IsAgentResponseVariant3) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentResponseVariant3).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.AgentResponseVariant3!, typeInfo); + var __element2 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.AgentResponseVariant3!, typeInfo); + if (__element2.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element2.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AgentSwapNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AgentSwapNode.g.cs index 2c37438c..8fdd7ef9 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AgentSwapNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AgentSwapNode.g.cs @@ -17,103 +17,34 @@ public class AgentSwapNodeJsonConverter : global::System.Text.Json.Serialization using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("agent_id")) __score1++; - if (__jsonProps.Contains("agent_version")) __score1++; - if (__jsonProps.Contains("edge")) __score1++; - if (__jsonProps.Contains("instruction")) __score1++; - if (__jsonProps.Contains("keep_current_language")) __score1++; - if (__jsonProps.Contains("keep_current_voice")) __score1++; - if (__jsonProps.Contains("post_call_analysis_setting")) __score1++; - if (__jsonProps.Contains("speak_during_execution")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - if (__jsonProps.Contains("webhook_setting")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.AgentSwapNodeVariant2? agentSwapNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentSwapNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentSwapNodeVariant2).Name}"); - agentSwapNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentSwapNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentSwapNodeVariant2).Name}"); + agentSwapNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && agentSwapNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && agentSwapNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentSwapNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentSwapNodeVariant2).Name}"); - agentSwapNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.AgentSwapNode( @base, @@ -132,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsAgentSwapNodeVariant2) + if (value.IsAgentSwapNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentSwapNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentSwapNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.AgentSwapNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.AgentSwapNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AllOf2.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AllOf2.g.cs index 7ce00828..da21e0f9 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AllOf2.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AllOf2.g.cs @@ -14,118 +14,36 @@ public class AllOfJsonConverter : global::System.Text.Json.Serialization options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); - using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) + + T1? value1 = default; + try { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); + value1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - var __score0 = 0; + catch (global::System.Text.Json.JsonException) { - var __ti = typeInfoResolver.GetTypeInfo(typeof(T1), options); - if (__ti != null && __ti.Kind == global::System.Text.Json.Serialization.Metadata.JsonTypeInfoKind.Object) - { - foreach (var __prop in __ti.Properties) - { - if (__jsonProps.Contains(__prop.Name)) __score0++; - } - } } - var __score1 = 0; + catch (global::System.InvalidOperationException) { - var __ti = typeInfoResolver.GetTypeInfo(typeof(T2), options); - if (__ti != null && __ti.Kind == global::System.Text.Json.Serialization.Metadata.JsonTypeInfoKind.Object) - { - foreach (var __prop in __ti.Properties) - { - if (__jsonProps.Contains(__prop.Name)) __score1++; - } - } } - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - T1? value1 = default; T2? value2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); - value1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - - else if (__bestIndex == 1) - { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); - value2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); + value2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (value1 == null && value2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); - value1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (value1 == null && value2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); - value2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.AllOf( value1, @@ -144,18 +62,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsValue1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Value1!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsValue2) + if (value.IsValue2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Value2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AlwaysEdge.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AlwaysEdge.g.cs index e637e662..09356f09 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AlwaysEdge.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.AlwaysEdge.g.cs @@ -17,106 +17,34 @@ public class AlwaysEdgeJsonConverter : global::System.Text.Json.Serialization.Js using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.NodeEdge? node = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); + node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("destination_node_id")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("transition_condition")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("transition_condition")) __score1++; - if (__jsonProps.Contains("transition_condition.prompt")) __score1++; - if (__jsonProps.Contains("transition_condition.type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeEdge? node = default; global::RetellAI.AlwaysEdgeVariant2? alwaysEdgeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AlwaysEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AlwaysEdgeVariant2).Name}"); - alwaysEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AlwaysEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AlwaysEdgeVariant2).Name}"); + alwaysEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (node == null && alwaysEdgeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (node == null && alwaysEdgeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AlwaysEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AlwaysEdgeVariant2).Name}"); - alwaysEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.AlwaysEdge( node, @@ -135,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsNode) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Node!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Node!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsAlwaysEdgeVariant2) + if (value.IsAlwaysEdgeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AlwaysEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AlwaysEdgeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.AlwaysEdgeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.AlwaysEdgeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.BranchNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.BranchNode.g.cs index 0bd47d9f..ab17820a 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.BranchNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.BranchNode.g.cs @@ -17,97 +17,34 @@ public class BranchNodeJsonConverter : global::System.Text.Json.Serialization.Js using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("edges")) __score1++; - if (__jsonProps.Contains("else_edge")) __score1++; - if (__jsonProps.Contains("finetune_transition_examples")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.BranchNodeVariant2? branchNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.BranchNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.BranchNodeVariant2).Name}"); - branchNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.BranchNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.BranchNodeVariant2).Name}"); + branchNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && branchNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && branchNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.BranchNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.BranchNodeVariant2).Name}"); - branchNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.BranchNode( @base, @@ -126,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsBranchNodeVariant2) + if (value.IsBranchNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.BranchNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.BranchNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.BranchNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.BranchNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.BridgeTransferNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.BridgeTransferNode.g.cs index 1dd6d6b0..7d4c7812 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.BridgeTransferNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.BridgeTransferNode.g.cs @@ -17,96 +17,34 @@ public class BridgeTransferNodeJsonConverter : global::System.Text.Json.Serializ using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("instruction")) __score1++; - if (__jsonProps.Contains("speak_during_execution")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.BridgeTransferNodeVariant2? bridgeTransferNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.BridgeTransferNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.BridgeTransferNodeVariant2).Name}"); - bridgeTransferNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.BridgeTransferNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.BridgeTransferNodeVariant2).Name}"); + bridgeTransferNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && bridgeTransferNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && bridgeTransferNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.BridgeTransferNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.BridgeTransferNodeVariant2).Name}"); - bridgeTransferNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.BridgeTransferNode( @base, @@ -125,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsBridgeTransferNodeVariant2) + if (value.IsBridgeTransferNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.BridgeTransferNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.BridgeTransferNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.BridgeTransferNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.BridgeTransferNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CancelTransferNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CancelTransferNode.g.cs index ac4b0ff9..8ceeb9f5 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CancelTransferNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CancelTransferNode.g.cs @@ -17,96 +17,34 @@ public class CancelTransferNodeJsonConverter : global::System.Text.Json.Serializ using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("instruction")) __score1++; - if (__jsonProps.Contains("speak_during_execution")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.CancelTransferNodeVariant2? cancelTransferNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CancelTransferNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CancelTransferNodeVariant2).Name}"); - cancelTransferNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CancelTransferNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CancelTransferNodeVariant2).Name}"); + cancelTransferNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && cancelTransferNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && cancelTransferNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CancelTransferNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CancelTransferNodeVariant2).Name}"); - cancelTransferNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.CancelTransferNode( @base, @@ -125,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsCancelTransferNodeVariant2) + if (value.IsCancelTransferNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CancelTransferNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CancelTransferNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CancelTransferNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CancelTransferNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ChatAgentResponse.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ChatAgentResponse.g.cs index 9e193175..b3f486c4 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ChatAgentResponse.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ChatAgentResponse.g.cs @@ -17,168 +17,48 @@ public class ChatAgentResponseJsonConverter : global::System.Text.Json.Serializa using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.ChatAgentResponseVariant1? chatAgentResponseVariant1 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentResponseVariant1).Name}"); + chatAgentResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("agent_id")) __score0++; - if (__jsonProps.Contains("assigned_tags")) __score0++; - if (__jsonProps.Contains("base_version")) __score0++; - if (__jsonProps.Contains("is_published")) __score0++; - if (__jsonProps.Contains("version")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("agent_name")) __score1++; - if (__jsonProps.Contains("auto_close_message")) __score1++; - if (__jsonProps.Contains("data_storage_retention_days")) __score1++; - if (__jsonProps.Contains("data_storage_setting")) __score1++; - if (__jsonProps.Contains("end_chat_after_silence_ms")) __score1++; - if (__jsonProps.Contains("guardrail_config")) __score1++; - if (__jsonProps.Contains("guardrail_config.input_topics")) __score1++; - if (__jsonProps.Contains("guardrail_config.output_topics")) __score1++; - if (__jsonProps.Contains("handbook_config")) __score1++; - if (__jsonProps.Contains("handbook_config.ai_disclosure")) __score1++; - if (__jsonProps.Contains("handbook_config.default_personality")) __score1++; - if (__jsonProps.Contains("handbook_config.high_empathy")) __score1++; - if (__jsonProps.Contains("handbook_config.scope_boundaries")) __score1++; - if (__jsonProps.Contains("language")) __score1++; - if (__jsonProps.Contains("opt_in_signed_url")) __score1++; - if (__jsonProps.Contains("pii_config")) __score1++; - if (__jsonProps.Contains("pii_config.categories")) __score1++; - if (__jsonProps.Contains("pii_config.mode")) __score1++; - if (__jsonProps.Contains("post_chat_analysis_data")) __score1++; - if (__jsonProps.Contains("post_chat_analysis_model")) __score1++; - if (__jsonProps.Contains("response_engine")) __score1++; - if (__jsonProps.Contains("signed_url_expiration_ms")) __score1++; - if (__jsonProps.Contains("timezone")) __score1++; - if (__jsonProps.Contains("version_title")) __score1++; - if (__jsonProps.Contains("webhook_events")) __score1++; - if (__jsonProps.Contains("webhook_timeout_ms")) __score1++; - if (__jsonProps.Contains("webhook_url")) __score1++; - var __score2 = 0; - if (__jsonProps.Contains("last_modification_timestamp")) __score2++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - if (__score2 > __bestScore) { __bestScore = __score2; __bestIndex = 2; } - - global::RetellAI.ChatAgentResponseVariant1? chatAgentResponseVariant1 = default; global::RetellAI.ChatAgentRequest? request = default; - global::RetellAI.ChatAgentResponseVariant3? chatAgentResponseVariant3 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentResponseVariant1).Name}"); - chatAgentResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentRequest).Name}"); - request = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 2) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentResponseVariant3).Name}"); - chatAgentResponseVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentRequest).Name}"); + request = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (chatAgentResponseVariant1 == null && request == null && chatAgentResponseVariant3 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentResponseVariant1).Name}"); - chatAgentResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (chatAgentResponseVariant1 == null && request == null && chatAgentResponseVariant3 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentRequest).Name}"); - request = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - if (chatAgentResponseVariant1 == null && request == null && chatAgentResponseVariant3 == null) + global::RetellAI.ChatAgentResponseVariant3? chatAgentResponseVariant3 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentResponseVariant3).Name}"); + chatAgentResponseVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentResponseVariant3).Name}"); - chatAgentResponseVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.ChatAgentResponse( chatAgentResponseVariant1, @@ -199,24 +79,64 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsChatAgentResponseVariant1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentResponseVariant1).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ChatAgentResponseVariant1!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ChatAgentResponseVariant1!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsRequest) + if (value.IsRequest) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentRequest).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Request!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Request!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsChatAgentResponseVariant3) + if (value.IsChatAgentResponseVariant3) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatAgentResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatAgentResponseVariant3).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ChatAgentResponseVariant3!, typeInfo); + var __element2 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ChatAgentResponseVariant3!, typeInfo); + if (__element2.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element2.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CodeNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CodeNode.g.cs index 6a9d9c56..9271be14 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CodeNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CodeNode.g.cs @@ -17,104 +17,34 @@ public class CodeNodeJsonConverter : global::System.Text.Json.Serialization.Json using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("code")) __score1++; - if (__jsonProps.Contains("edges")) __score1++; - if (__jsonProps.Contains("else_edge")) __score1++; - if (__jsonProps.Contains("enable_typing_sound")) __score1++; - if (__jsonProps.Contains("finetune_transition_examples")) __score1++; - if (__jsonProps.Contains("instruction")) __score1++; - if (__jsonProps.Contains("response_variables")) __score1++; - if (__jsonProps.Contains("speak_during_execution")) __score1++; - if (__jsonProps.Contains("timeout_ms")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - if (__jsonProps.Contains("wait_for_result")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.CodeNodeVariant2? codeNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CodeNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CodeNodeVariant2).Name}"); - codeNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CodeNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CodeNodeVariant2).Name}"); + codeNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && codeNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && codeNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CodeNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CodeNodeVariant2).Name}"); - codeNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.CodeNode( @base, @@ -133,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsCodeNodeVariant2) + if (value.IsCodeNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CodeNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CodeNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CodeNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CodeNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ComponentNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ComponentNode.g.cs index 3093e684..a6a5dc6f 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ComponentNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ComponentNode.g.cs @@ -17,117 +17,34 @@ public class ComponentNodeJsonConverter : global::System.Text.Json.Serialization using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.NodeBaseCommon? baseCommon = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseCommon), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseCommon).Name}"); + baseCommon = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("display_position")) __score0++; - if (__jsonProps.Contains("display_position.x")) __score0++; - if (__jsonProps.Contains("display_position.y")) __score0++; - if (__jsonProps.Contains("global_node_setting")) __score0++; - if (__jsonProps.Contains("global_node_setting.condition")) __score0++; - if (__jsonProps.Contains("global_node_setting.cool_down")) __score0++; - if (__jsonProps.Contains("global_node_setting.go_back_conditions")) __score0++; - if (__jsonProps.Contains("global_node_setting.negative_finetune_examples")) __score0++; - if (__jsonProps.Contains("global_node_setting.positive_finetune_examples")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("name")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("component_id")) __score1++; - if (__jsonProps.Contains("component_type")) __score1++; - if (__jsonProps.Contains("edges")) __score1++; - if (__jsonProps.Contains("else_edge")) __score1++; - if (__jsonProps.Contains("finetune_transition_examples")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBaseCommon? baseCommon = default; global::RetellAI.ComponentNodeVariant2? componentNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseCommon), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseCommon).Name}"); - baseCommon = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ComponentNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ComponentNodeVariant2).Name}"); - componentNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ComponentNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ComponentNodeVariant2).Name}"); + componentNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (baseCommon == null && componentNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseCommon), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseCommon).Name}"); - baseCommon = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (baseCommon == null && componentNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ComponentNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ComponentNodeVariant2).Name}"); - componentNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.ComponentNode( baseCommon, @@ -146,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBaseCommon) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseCommon), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseCommon).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.BaseCommon!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.BaseCommon!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsComponentNodeVariant2) + if (value.IsComponentNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ComponentNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ComponentNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ComponentNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ComponentNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlow.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlow.g.cs index cffbaa68..e79ee2b9 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlow.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlow.g.cs @@ -17,122 +17,34 @@ public class ConversationFlowJsonConverter : global::System.Text.Json.Serializat using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.ConversationFlowOverride? @override = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowOverride), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowOverride).Name}"); + @override = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("begin_after_user_silence_ms")) __score0++; - if (__jsonProps.Contains("kb_config")) __score0++; - if (__jsonProps.Contains("kb_config.filter_score")) __score0++; - if (__jsonProps.Contains("kb_config.top_k")) __score0++; - if (__jsonProps.Contains("knowledge_base_ids")) __score0++; - if (__jsonProps.Contains("model_choice")) __score0++; - if (__jsonProps.Contains("model_temperature")) __score0++; - if (__jsonProps.Contains("start_speaker")) __score0++; - if (__jsonProps.Contains("tool_call_strict_mode")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("begin_tag_display_position")) __score1++; - if (__jsonProps.Contains("begin_tag_display_position.x")) __score1++; - if (__jsonProps.Contains("begin_tag_display_position.y")) __score1++; - if (__jsonProps.Contains("components")) __score1++; - if (__jsonProps.Contains("default_dynamic_variables")) __score1++; - if (__jsonProps.Contains("flex_mode")) __score1++; - if (__jsonProps.Contains("global_prompt")) __score1++; - if (__jsonProps.Contains("is_transfer_cf")) __score1++; - if (__jsonProps.Contains("mcps")) __score1++; - if (__jsonProps.Contains("nodes")) __score1++; - if (__jsonProps.Contains("notes")) __score1++; - if (__jsonProps.Contains("start_node_id")) __score1++; - if (__jsonProps.Contains("tools")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.ConversationFlowOverride? @override = default; global::RetellAI.ConversationFlowVariant2? conversationFlowVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowOverride), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowOverride).Name}"); - @override = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowVariant2).Name}"); - conversationFlowVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowVariant2).Name}"); + conversationFlowVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@override == null && conversationFlowVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowOverride), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowOverride).Name}"); - @override = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@override == null && conversationFlowVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowVariant2).Name}"); - conversationFlowVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.ConversationFlow( @override, @@ -151,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsOverride) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowOverride), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowOverride).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Override!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Override!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsConversationFlowVariant2) + if (value.IsConversationFlowVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ConversationFlowVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ConversationFlowVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlowComponentResponse.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlowComponentResponse.g.cs index 6670653d..e927c5fd 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlowComponentResponse.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlowComponentResponse.g.cs @@ -17,96 +17,34 @@ public class ConversationFlowComponentResponseJsonConverter : global::System.Tex using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.CreateConversationFlowComponentRequest? createRequest = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CreateConversationFlowComponentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CreateConversationFlowComponentRequest).Name}"); + createRequest = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("conversation_flow_component_id")) __score1++; - if (__jsonProps.Contains("linked_conversation_flow_ids")) __score1++; - if (__jsonProps.Contains("user_modified_timestamp")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.CreateConversationFlowComponentRequest? createRequest = default; global::RetellAI.ConversationFlowComponentResponseVariant2? conversationFlowComponentResponseVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CreateConversationFlowComponentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CreateConversationFlowComponentRequest).Name}"); - createRequest = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowComponentResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowComponentResponseVariant2).Name}"); - conversationFlowComponentResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowComponentResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowComponentResponseVariant2).Name}"); + conversationFlowComponentResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (createRequest == null && conversationFlowComponentResponseVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CreateConversationFlowComponentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CreateConversationFlowComponentRequest).Name}"); - createRequest = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (createRequest == null && conversationFlowComponentResponseVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowComponentResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowComponentResponseVariant2).Name}"); - conversationFlowComponentResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.ConversationFlowComponentResponse( createRequest, @@ -125,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCreateRequest) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CreateConversationFlowComponentRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CreateConversationFlowComponentRequest).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CreateRequest!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CreateRequest!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsConversationFlowComponentResponseVariant2) + if (value.IsConversationFlowComponentResponseVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowComponentResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowComponentResponseVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ConversationFlowComponentResponseVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ConversationFlowComponentResponseVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlowResponse.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlowResponse.g.cs index cdf5422d..f1f53362 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlowResponse.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationFlowResponse.g.cs @@ -17,96 +17,34 @@ public class ConversationFlowResponseJsonConverter : global::System.Text.Json.Se using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.ConversationFlow? conversationFlow = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlow), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlow).Name}"); + conversationFlow = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("conversation_flow_id")) __score1++; - if (__jsonProps.Contains("last_modification_timestamp")) __score1++; - if (__jsonProps.Contains("version")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.ConversationFlow? conversationFlow = default; global::RetellAI.ConversationFlowResponseVariant2? conversationFlowResponseVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlow), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlow).Name}"); - conversationFlow = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowResponseVariant2).Name}"); - conversationFlowResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowResponseVariant2).Name}"); + conversationFlowResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (conversationFlow == null && conversationFlowResponseVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlow), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlow).Name}"); - conversationFlow = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (conversationFlow == null && conversationFlowResponseVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowResponseVariant2).Name}"); - conversationFlowResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.ConversationFlowResponse( conversationFlow, @@ -125,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsConversationFlow) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlow), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlow).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ConversationFlow!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ConversationFlow!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsConversationFlowResponseVariant2) + if (value.IsConversationFlowResponseVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowResponseVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ConversationFlowResponseVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ConversationFlowResponseVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationNode.g.cs index d9dabcb2..6fb8907b 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ConversationNode.g.cs @@ -17,153 +17,48 @@ public class ConversationNodeJsonConverter : global::System.Text.Json.Serializat using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("allow_dtmf_interruption")) __score1++; - if (__jsonProps.Contains("interruption_sensitivity")) __score1++; - if (__jsonProps.Contains("reminder_max_count")) __score1++; - if (__jsonProps.Contains("reminder_trigger_ms")) __score1++; - if (__jsonProps.Contains("responsiveness")) __score1++; - if (__jsonProps.Contains("voice_speed")) __score1++; - var __score2 = 0; - if (__jsonProps.Contains("always_edge")) __score2++; - if (__jsonProps.Contains("edges")) __score2++; - if (__jsonProps.Contains("else_edge")) __score2++; - if (__jsonProps.Contains("finetune_conversation_examples")) __score2++; - if (__jsonProps.Contains("finetune_transition_examples")) __score2++; - if (__jsonProps.Contains("instruction")) __score2++; - if (__jsonProps.Contains("kb_config")) __score2++; - if (__jsonProps.Contains("kb_config.filter_score")) __score2++; - if (__jsonProps.Contains("kb_config.top_k")) __score2++; - if (__jsonProps.Contains("knowledge_base_ids")) __score2++; - if (__jsonProps.Contains("skip_response_edge")) __score2++; - if (__jsonProps.Contains("type")) __score2++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - if (__score2 > __bestScore) { __bestScore = __score2; __bestIndex = 2; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.AgentOverrideConfig? agentOverrideConfig = default; - global::RetellAI.ConversationNodeVariant3? conversationNodeVariant3 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentOverrideConfig), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentOverrideConfig).Name}"); - agentOverrideConfig = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 2) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationNodeVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationNodeVariant3).Name}"); - conversationNodeVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentOverrideConfig), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentOverrideConfig).Name}"); + agentOverrideConfig = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && agentOverrideConfig == null && conversationNodeVariant3 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && agentOverrideConfig == null && conversationNodeVariant3 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentOverrideConfig), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentOverrideConfig).Name}"); - agentOverrideConfig = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - if (@base == null && agentOverrideConfig == null && conversationNodeVariant3 == null) + global::RetellAI.ConversationNodeVariant3? conversationNodeVariant3 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationNodeVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationNodeVariant3).Name}"); + conversationNodeVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationNodeVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationNodeVariant3).Name}"); - conversationNodeVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.ConversationNode( @base, @@ -184,24 +79,64 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsAgentOverrideConfig) + if (value.IsAgentOverrideConfig) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentOverrideConfig), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentOverrideConfig).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.AgentOverrideConfig!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.AgentOverrideConfig!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsConversationNodeVariant3) + if (value.IsConversationNodeVariant3) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationNodeVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationNodeVariant3).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ConversationNodeVariant3!, typeInfo); + var __element2 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ConversationNodeVariant3!, typeInfo); + if (__element2.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element2.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CreateConversationFlowComponentRequest.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CreateConversationFlowComponentRequest.g.cs index 08f6a59a..9a593d55 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CreateConversationFlowComponentRequest.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CreateConversationFlowComponentRequest.g.cs @@ -17,110 +17,34 @@ public class CreateConversationFlowComponentRequestJsonConverter : global::Syste using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.ConversationFlowComponent? conversationFlowComponent = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowComponent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowComponent).Name}"); + conversationFlowComponent = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("begin_tag_display_position")) __score0++; - if (__jsonProps.Contains("begin_tag_display_position.x")) __score0++; - if (__jsonProps.Contains("begin_tag_display_position.y")) __score0++; - if (__jsonProps.Contains("flex_mode")) __score0++; - if (__jsonProps.Contains("mcps")) __score0++; - if (__jsonProps.Contains("name")) __score0++; - if (__jsonProps.Contains("nodes")) __score0++; - if (__jsonProps.Contains("notes")) __score0++; - if (__jsonProps.Contains("start_node_id")) __score0++; - if (__jsonProps.Contains("tools")) __score0++; - var __score1 = 0; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.ConversationFlowComponent? conversationFlowComponent = default; object? createConversationFlowComponentRequestVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowComponent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowComponent).Name}"); - conversationFlowComponent = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - createConversationFlowComponentRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); + createConversationFlowComponentRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (conversationFlowComponent == null && createConversationFlowComponentRequestVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowComponent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowComponent).Name}"); - conversationFlowComponent = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (conversationFlowComponent == null && createConversationFlowComponentRequestVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - createConversationFlowComponentRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.CreateConversationFlowComponentRequest( conversationFlowComponent, @@ -139,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsConversationFlowComponent) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlowComponent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlowComponent).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ConversationFlowComponent!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ConversationFlowComponent!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsCreateConversationFlowComponentRequestVariant2) + if (value.IsCreateConversationFlowComponentRequestVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CreateConversationFlowComponentRequestVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CreateConversationFlowComponentRequestVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CreateConversationFlowRequest.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CreateConversationFlowRequest.g.cs index ef74b1e7..60b11da1 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CreateConversationFlowRequest.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CreateConversationFlowRequest.g.cs @@ -15,118 +15,36 @@ public class CreateConversationFlowRequestJsonConverter : global::System.Text.Js options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); - using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) + + global::RetellAI.ConversationFlow? conversationFlow = default; + try { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlow), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlow).Name}"); + conversationFlow = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - var __score0 = 0; + catch (global::System.Text.Json.JsonException) { - var __ti = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlow), options); - if (__ti != null && __ti.Kind == global::System.Text.Json.Serialization.Metadata.JsonTypeInfoKind.Object) - { - foreach (var __prop in __ti.Properties) - { - if (__jsonProps.Contains(__prop.Name)) __score0++; - } - } } - var __score1 = 0; + catch (global::System.InvalidOperationException) { - var __ti = typeInfoResolver.GetTypeInfo(typeof(object), options); - if (__ti != null && __ti.Kind == global::System.Text.Json.Serialization.Metadata.JsonTypeInfoKind.Object) - { - foreach (var __prop in __ti.Properties) - { - if (__jsonProps.Contains(__prop.Name)) __score1++; - } - } } - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - global::RetellAI.ConversationFlow? conversationFlow = default; object? createConversationFlowRequestVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlow), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlow).Name}"); - conversationFlow = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - - else if (__bestIndex == 1) - { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - createConversationFlowRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); + createConversationFlowRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (conversationFlow == null && createConversationFlowRequestVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlow), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlow).Name}"); - conversationFlow = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (conversationFlow == null && createConversationFlowRequestVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - createConversationFlowRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.CreateConversationFlowRequest( conversationFlow, @@ -145,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsConversationFlow) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ConversationFlow), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ConversationFlow).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ConversationFlow!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ConversationFlow!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsCreateConversationFlowRequestVariant2) + if (value.IsCreateConversationFlowRequestVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CreateConversationFlowRequestVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CreateConversationFlowRequestVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CustomFieldFilter.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CustomFieldFilter.g.cs index 8badb805..7e2be084 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CustomFieldFilter.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.CustomFieldFilter.g.cs @@ -17,94 +17,34 @@ public class CustomFieldFilterJsonConverter : global::System.Text.Json.Serializa using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.ValueFilter? value = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ValueFilter), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ValueFilter).Name}"); + value = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("key")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.ValueFilter? value = default; global::RetellAI.CustomFieldFilterVariant2? customFieldFilterVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ValueFilter), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ValueFilter).Name}"); - value = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CustomFieldFilterVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CustomFieldFilterVariant2).Name}"); - customFieldFilterVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CustomFieldFilterVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CustomFieldFilterVariant2).Name}"); + customFieldFilterVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (value == null && customFieldFilterVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ValueFilter), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ValueFilter).Name}"); - value = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (value == null && customFieldFilterVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CustomFieldFilterVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CustomFieldFilterVariant2).Name}"); - customFieldFilterVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.CustomFieldFilter( value, @@ -123,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsValue) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ValueFilter), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ValueFilter).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Value!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsCustomFieldFilterVariant2) + if (value.IsCustomFieldFilterVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CustomFieldFilterVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CustomFieldFilterVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CustomFieldFilterVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CustomFieldFilterVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ElseEdge.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ElseEdge.g.cs index 459363d2..fcbb5072 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ElseEdge.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ElseEdge.g.cs @@ -17,106 +17,34 @@ public class ElseEdgeJsonConverter : global::System.Text.Json.Serialization.Json using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.NodeEdge? node = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); + node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("destination_node_id")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("transition_condition")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("transition_condition")) __score1++; - if (__jsonProps.Contains("transition_condition.prompt")) __score1++; - if (__jsonProps.Contains("transition_condition.type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeEdge? node = default; global::RetellAI.ElseEdgeVariant2? elseEdgeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ElseEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ElseEdgeVariant2).Name}"); - elseEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ElseEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ElseEdgeVariant2).Name}"); + elseEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (node == null && elseEdgeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (node == null && elseEdgeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ElseEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ElseEdgeVariant2).Name}"); - elseEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.ElseEdge( node, @@ -135,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsNode) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Node!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Node!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsElseEdgeVariant2) + if (value.IsElseEdgeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ElseEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ElseEdgeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ElseEdgeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ElseEdgeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.EndNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.EndNode.g.cs index 321cd3fc..2fd1a3b8 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.EndNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.EndNode.g.cs @@ -17,96 +17,34 @@ public class EndNodeJsonConverter : global::System.Text.Json.Serialization.JsonC using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("instruction")) __score1++; - if (__jsonProps.Contains("speak_during_execution")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.EndNodeVariant2? endNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.EndNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.EndNodeVariant2).Name}"); - endNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.EndNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.EndNodeVariant2).Name}"); + endNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && endNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && endNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.EndNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.EndNodeVariant2).Name}"); - endNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.EndNode( @base, @@ -125,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsEndNodeVariant2) + if (value.IsEndNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.EndNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.EndNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.EndNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.EndNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ExtractDynamicVariablesNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ExtractDynamicVariablesNode.g.cs index e0f10dab..c43685c9 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ExtractDynamicVariablesNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ExtractDynamicVariablesNode.g.cs @@ -17,99 +17,34 @@ public class ExtractDynamicVariablesNodeJsonConverter : global::System.Text.Json using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("edges")) __score1++; - if (__jsonProps.Contains("else_edge")) __score1++; - if (__jsonProps.Contains("enable_typing_sound")) __score1++; - if (__jsonProps.Contains("finetune_transition_examples")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - if (__jsonProps.Contains("variables")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.ExtractDynamicVariablesNodeVariant2? extractDynamicVariablesNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ExtractDynamicVariablesNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ExtractDynamicVariablesNodeVariant2).Name}"); - extractDynamicVariablesNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ExtractDynamicVariablesNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ExtractDynamicVariablesNodeVariant2).Name}"); + extractDynamicVariablesNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && extractDynamicVariablesNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && extractDynamicVariablesNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ExtractDynamicVariablesNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ExtractDynamicVariablesNodeVariant2).Name}"); - extractDynamicVariablesNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.ExtractDynamicVariablesNode( @base, @@ -128,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsExtractDynamicVariablesNodeVariant2) + if (value.IsExtractDynamicVariablesNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ExtractDynamicVariablesNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ExtractDynamicVariablesNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ExtractDynamicVariablesNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ExtractDynamicVariablesNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.FunctionNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.FunctionNode.g.cs index 627ba3f3..8589a292 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.FunctionNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.FunctionNode.g.cs @@ -17,103 +17,34 @@ public class FunctionNodeJsonConverter : global::System.Text.Json.Serialization. using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("edges")) __score1++; - if (__jsonProps.Contains("else_edge")) __score1++; - if (__jsonProps.Contains("enable_typing_sound")) __score1++; - if (__jsonProps.Contains("finetune_transition_examples")) __score1++; - if (__jsonProps.Contains("instruction")) __score1++; - if (__jsonProps.Contains("speak_during_execution")) __score1++; - if (__jsonProps.Contains("tool_id")) __score1++; - if (__jsonProps.Contains("tool_type")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - if (__jsonProps.Contains("wait_for_result")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.FunctionNodeVariant2? functionNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.FunctionNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.FunctionNodeVariant2).Name}"); - functionNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.FunctionNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.FunctionNodeVariant2).Name}"); + functionNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && functionNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && functionNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.FunctionNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.FunctionNodeVariant2).Name}"); - functionNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.FunctionNode( @base, @@ -132,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsFunctionNodeVariant2) + if (value.IsFunctionNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.FunctionNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.FunctionNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.FunctionNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.FunctionNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.InjectedMessage.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.InjectedMessage.g.cs index 8e82577b..4be094b3 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.InjectedMessage.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.InjectedMessage.g.cs @@ -17,97 +17,34 @@ public class InjectedMessageJsonConverter : global::System.Text.Json.Serializati using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.InjectedMessageBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.InjectedMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.InjectedMessageBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("content")) __score0++; - if (__jsonProps.Contains("created_timestamp")) __score0++; - if (__jsonProps.Contains("message_id")) __score0++; - if (__jsonProps.Contains("role")) __score0++; - var __score1 = 0; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.InjectedMessageBase? @base = default; object? injectedMessageVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.InjectedMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.InjectedMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - injectedMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); + injectedMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && injectedMessageVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.InjectedMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.InjectedMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && injectedMessageVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - injectedMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.InjectedMessage( @base, @@ -126,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.InjectedMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.InjectedMessageBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsInjectedMessageVariant2) + if (value.IsInjectedMessageVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.InjectedMessageVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.InjectedMessageVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.MCPNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.MCPNode.g.cs index db3c9046..106ea5bb 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.MCPNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.MCPNode.g.cs @@ -17,104 +17,34 @@ public class MCPNodeJsonConverter : global::System.Text.Json.Serialization.JsonC using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("edges")) __score1++; - if (__jsonProps.Contains("else_edge")) __score1++; - if (__jsonProps.Contains("enable_typing_sound")) __score1++; - if (__jsonProps.Contains("finetune_transition_examples")) __score1++; - if (__jsonProps.Contains("instruction")) __score1++; - if (__jsonProps.Contains("mcp_id")) __score1++; - if (__jsonProps.Contains("mcp_tool_name")) __score1++; - if (__jsonProps.Contains("response_variables")) __score1++; - if (__jsonProps.Contains("speak_during_execution")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - if (__jsonProps.Contains("wait_for_result")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.MCPNodeVariant2? mCPNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.MCPNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.MCPNodeVariant2).Name}"); - mCPNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.MCPNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.MCPNodeVariant2).Name}"); + mCPNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && mCPNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && mCPNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.MCPNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.MCPNodeVariant2).Name}"); - mCPNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.MCPNode( @base, @@ -133,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsMCPNodeVariant2) + if (value.IsMCPNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.MCPNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.MCPNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.MCPNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.MCPNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.Message.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.Message.g.cs index 977a875f..6ff660e9 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.Message.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.Message.g.cs @@ -17,98 +17,34 @@ public class MessageJsonConverter : global::System.Text.Json.Serialization.JsonC using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.MessageBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.MessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.MessageBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("content")) __score0++; - if (__jsonProps.Contains("created_timestamp")) __score0++; - if (__jsonProps.Contains("message_id")) __score0++; - if (__jsonProps.Contains("multimedia")) __score0++; - if (__jsonProps.Contains("role")) __score0++; - var __score1 = 0; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.MessageBase? @base = default; object? messageVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.MessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.MessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - messageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); + messageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && messageVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.MessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.MessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && messageVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - messageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.Message( @base, @@ -127,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.MessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.MessageBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsMessageVariant2) + if (value.IsMessageVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.MessageVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.MessageVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeBase.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeBase.g.cs index 10311476..ed79f55a 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeBase.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeBase.g.cs @@ -17,115 +17,34 @@ public class NodeBaseJsonConverter : global::System.Text.Json.Serialization.Json using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.NodeBaseCommon? common = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseCommon), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseCommon).Name}"); + common = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("display_position")) __score0++; - if (__jsonProps.Contains("display_position.x")) __score0++; - if (__jsonProps.Contains("display_position.y")) __score0++; - if (__jsonProps.Contains("global_node_setting")) __score0++; - if (__jsonProps.Contains("global_node_setting.condition")) __score0++; - if (__jsonProps.Contains("global_node_setting.cool_down")) __score0++; - if (__jsonProps.Contains("global_node_setting.go_back_conditions")) __score0++; - if (__jsonProps.Contains("global_node_setting.negative_finetune_examples")) __score0++; - if (__jsonProps.Contains("global_node_setting.positive_finetune_examples")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("name")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("model_choice")) __score1++; - if (__jsonProps.Contains("model_choice.high_priority")) __score1++; - if (__jsonProps.Contains("model_choice.model")) __score1++; - if (__jsonProps.Contains("model_choice.type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBaseCommon? common = default; global::RetellAI.NodeBaseVariant2? nodeBaseVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseCommon), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseCommon).Name}"); - common = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseVariant2).Name}"); - nodeBaseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseVariant2).Name}"); + nodeBaseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (common == null && nodeBaseVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseCommon), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseCommon).Name}"); - common = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (common == null && nodeBaseVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseVariant2).Name}"); - nodeBaseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.NodeBase( common, @@ -144,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCommon) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseCommon), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseCommon).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Common!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Common!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsNodeBaseVariant2) + if (value.IsNodeBaseVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBaseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBaseVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.NodeBaseVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.NodeBaseVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeTool.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeTool.g.cs index d1b7a93b..b896a012 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeTool.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeTool.g.cs @@ -17,94 +17,34 @@ public class NodeToolJsonConverter : global::System.Text.Json.Serialization.Json using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.OneOf? nodeToolVariant1 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.OneOf), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.OneOf).Name}"); + nodeToolVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("tool_id")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.OneOf? nodeToolVariant1 = default; global::RetellAI.NodeToolVariant2? nodeToolVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.OneOf), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.OneOf).Name}"); - nodeToolVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeToolVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeToolVariant2).Name}"); - nodeToolVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeToolVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeToolVariant2).Name}"); + nodeToolVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (nodeToolVariant1 == null && nodeToolVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.OneOf), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.OneOf).Name}"); - nodeToolVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (nodeToolVariant1 == null && nodeToolVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeToolVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeToolVariant2).Name}"); - nodeToolVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.NodeTool( nodeToolVariant1, @@ -123,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsNodeToolVariant1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.OneOf), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo> ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.OneOf).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.NodeToolVariant1!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.NodeToolVariant1!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsNodeToolVariant2) + if (value.IsNodeToolVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeToolVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeToolVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.NodeToolVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.NodeToolVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeTransitionMessage.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeTransitionMessage.g.cs index 4f26ef37..6a9fbf99 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeTransitionMessage.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.NodeTransitionMessage.g.cs @@ -17,101 +17,34 @@ public class NodeTransitionMessageJsonConverter : global::System.Text.Json.Seria using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeTransitionMessageBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeTransitionMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeTransitionMessageBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("created_timestamp")) __score0++; - if (__jsonProps.Contains("former_node_id")) __score0++; - if (__jsonProps.Contains("former_node_name")) __score0++; - if (__jsonProps.Contains("message_id")) __score0++; - if (__jsonProps.Contains("new_node_id")) __score0++; - if (__jsonProps.Contains("new_node_name")) __score0++; - if (__jsonProps.Contains("role")) __score0++; - if (__jsonProps.Contains("transition_type")) __score0++; - var __score1 = 0; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeTransitionMessageBase? @base = default; object? nodeTransitionMessageVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeTransitionMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeTransitionMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - nodeTransitionMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); + nodeTransitionMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && nodeTransitionMessageVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeTransitionMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeTransitionMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && nodeTransitionMessageVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - nodeTransitionMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.NodeTransitionMessage( @base, @@ -130,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeTransitionMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeTransitionMessageBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsNodeTransitionMessageVariant2) + if (value.IsNodeTransitionMessageVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.NodeTransitionMessageVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.NodeTransitionMessageVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.OrganizationResponse.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.OrganizationResponse.g.cs index 3ecd4dfa..5568d5ff 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.OrganizationResponse.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.OrganizationResponse.g.cs @@ -17,130 +17,34 @@ public class OrganizationResponseJsonConverter : global::System.Text.Json.Serial using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.Organization? organization = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.Organization), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.Organization).Name}"); + organization = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("auto_credit_reload_config")) __score0++; - if (__jsonProps.Contains("auto_credit_reload_config.target_amount")) __score0++; - if (__jsonProps.Contains("auto_credit_reload_config.threshold")) __score0++; - if (__jsonProps.Contains("concurrency")) __score0++; - if (__jsonProps.Contains("concurrency_burst_enabled")) __score0++; - if (__jsonProps.Contains("conductor_overage")) __score0++; - if (__jsonProps.Contains("cps_config")) __score0++; - if (__jsonProps.Contains("cps_config.custom")) __score0++; - if (__jsonProps.Contains("cps_config.telnyx")) __score0++; - if (__jsonProps.Contains("cps_config.twilio")) __score0++; - if (__jsonProps.Contains("created_timestamp")) __score0++; - if (__jsonProps.Contains("custom_voice_ids")) __score0++; - if (__jsonProps.Contains("enterprise_id")) __score0++; - if (__jsonProps.Contains("feature_bucket")) __score0++; - if (__jsonProps.Contains("kyc_passed")) __score0++; - if (__jsonProps.Contains("max_call_duration_ms")) __score0++; - if (__jsonProps.Contains("max_token_length")) __score0++; - if (__jsonProps.Contains("orgName")) __score0++; - if (__jsonProps.Contains("org_name")) __score0++; - if (__jsonProps.Contains("outage_mode_enabled")) __score0++; - if (__jsonProps.Contains("reserved_inbound_concurrency")) __score0++; - if (__jsonProps.Contains("review_provided")) __score0++; - if (__jsonProps.Contains("skip_audit")) __score0++; - if (__jsonProps.Contains("twilio_subaccount_sid")) __score0++; - if (__jsonProps.Contains("use_stable_server")) __score0++; - if (__jsonProps.Contains("webhook_key")) __score0++; - if (__jsonProps.Contains("webhook_urls")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("enterprise_plan_end")) __score1++; - if (__jsonProps.Contains("enterprise_plan_status")) __score1++; - if (__jsonProps.Contains("org_id")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.Organization? organization = default; global::RetellAI.OrganizationResponseVariant2? organizationResponseVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.Organization), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.Organization).Name}"); - organization = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.OrganizationResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.OrganizationResponseVariant2).Name}"); - organizationResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.OrganizationResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.OrganizationResponseVariant2).Name}"); + organizationResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (organization == null && organizationResponseVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.Organization), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.Organization).Name}"); - organization = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (organization == null && organizationResponseVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.OrganizationResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.OrganizationResponseVariant2).Name}"); - organizationResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.OrganizationResponse( organization, @@ -159,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsOrganization) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.Organization), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.Organization).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Organization!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Organization!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsOrganizationResponseVariant2) + if (value.IsOrganizationResponseVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.OrganizationResponseVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.OrganizationResponseVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.OrganizationResponseVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.OrganizationResponseVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.PressDigitNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.PressDigitNode.g.cs index 6abc896e..249e54d1 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.PressDigitNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.PressDigitNode.g.cs @@ -17,108 +17,34 @@ public class PressDigitNodeJsonConverter : global::System.Text.Json.Serializatio using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("delay_ms")) __score1++; - if (__jsonProps.Contains("edges")) __score1++; - if (__jsonProps.Contains("else_edge")) __score1++; - if (__jsonProps.Contains("finetune_transition_examples")) __score1++; - if (__jsonProps.Contains("instruction")) __score1++; - if (__jsonProps.Contains("instruction.text")) __score1++; - if (__jsonProps.Contains("instruction.type")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.PressDigitNodeVariant2? pressDigitNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.PressDigitNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.PressDigitNodeVariant2).Name}"); - pressDigitNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.PressDigitNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.PressDigitNodeVariant2).Name}"); + pressDigitNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && pressDigitNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && pressDigitNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.PressDigitNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.PressDigitNodeVariant2).Name}"); - pressDigitNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.PressDigitNode( @base, @@ -137,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsPressDigitNodeVariant2) + if (value.IsPressDigitNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.PressDigitNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.PressDigitNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.PressDigitNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.PressDigitNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.PreviewCallQA.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.PreviewCallQA.g.cs index 4dfe3d18..a071f3e5 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.PreviewCallQA.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.PreviewCallQA.g.cs @@ -17,110 +17,34 @@ public class PreviewCallQAJsonConverter : global::System.Text.Json.Serialization using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.ChCallQA? ch = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChCallQA), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChCallQA).Name}"); + ch = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("calibrated")) __score0++; - if (__jsonProps.Contains("call_id")) __score0++; - if (__jsonProps.Contains("call_qa_id")) __score0++; - if (__jsonProps.Contains("call_start_time_ms")) __score0++; - if (__jsonProps.Contains("cohort_id")) __score0++; - if (__jsonProps.Contains("interruption_count")) __score0++; - if (__jsonProps.Contains("kb_recall")) __score0++; - if (__jsonProps.Contains("llm_hallucination_rate")) __score0++; - if (__jsonProps.Contains("natural_tonality_rate")) __score0++; - if (__jsonProps.Contains("passed")) __score0++; - if (__jsonProps.Contains("score")) __score0++; - if (__jsonProps.Contains("tool_call_accuracy")) __score0++; - if (__jsonProps.Contains("transition_accuracy")) __score0++; - if (__jsonProps.Contains("user_negative_sentiment_rate")) __score0++; - if (__jsonProps.Contains("user_positive_sentiment_rate")) __score0++; - if (__jsonProps.Contains("wer")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("duration_ms")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.ChCallQA? ch = default; global::RetellAI.PreviewCallQAVariant2? previewCallQAVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChCallQA), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChCallQA).Name}"); - ch = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.PreviewCallQAVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.PreviewCallQAVariant2).Name}"); - previewCallQAVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.PreviewCallQAVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.PreviewCallQAVariant2).Name}"); + previewCallQAVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (ch == null && previewCallQAVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChCallQA), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChCallQA).Name}"); - ch = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (ch == null && previewCallQAVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.PreviewCallQAVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.PreviewCallQAVariant2).Name}"); - previewCallQAVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.PreviewCallQA( ch, @@ -139,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCh) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChCallQA), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChCallQA).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Ch!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Ch!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsPreviewCallQAVariant2) + if (value.IsPreviewCallQAVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.PreviewCallQAVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.PreviewCallQAVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.PreviewCallQAVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.PreviewCallQAVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.RetellLLMResponse.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.RetellLLMResponse.g.cs index 2e93e8a1..96d941be 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.RetellLLMResponse.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.RetellLLMResponse.g.cs @@ -17,132 +17,48 @@ public class RetellLLMResponseJsonConverter : global::System.Text.Json.Serializa using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.RetellLLMResponseVariant1? retellLLMResponseVariant1 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLLMResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLLMResponseVariant1).Name}"); + retellLLMResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("is_published")) __score0++; - if (__jsonProps.Contains("llm_id")) __score0++; - if (__jsonProps.Contains("version")) __score0++; - var __score1 = 0; - var __score2 = 0; - if (__jsonProps.Contains("last_modification_timestamp")) __score2++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - if (__score2 > __bestScore) { __bestScore = __score2; __bestIndex = 2; } - - global::RetellAI.RetellLLMResponseVariant1? retellLLMResponseVariant1 = default; global::RetellAI.RetellLlmRequest? llmRequest = default; - global::RetellAI.RetellLLMResponseVariant3? retellLLMResponseVariant3 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLLMResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLLMResponseVariant1).Name}"); - retellLLMResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmRequest).Name}"); - llmRequest = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 2) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLLMResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLLMResponseVariant3).Name}"); - retellLLMResponseVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmRequest).Name}"); + llmRequest = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (retellLLMResponseVariant1 == null && llmRequest == null && retellLLMResponseVariant3 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLLMResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLLMResponseVariant1).Name}"); - retellLLMResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (retellLLMResponseVariant1 == null && llmRequest == null && retellLLMResponseVariant3 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmRequest).Name}"); - llmRequest = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - if (retellLLMResponseVariant1 == null && llmRequest == null && retellLLMResponseVariant3 == null) + global::RetellAI.RetellLLMResponseVariant3? retellLLMResponseVariant3 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLLMResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLLMResponseVariant3).Name}"); + retellLLMResponseVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLLMResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLLMResponseVariant3).Name}"); - retellLLMResponseVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.RetellLLMResponse( retellLLMResponseVariant1, @@ -163,24 +79,64 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsRetellLLMResponseVariant1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLLMResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLLMResponseVariant1).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.RetellLLMResponseVariant1!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.RetellLLMResponseVariant1!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsLlmRequest) + if (value.IsLlmRequest) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmRequest), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmRequest).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.LlmRequest!.Value, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.LlmRequest!.Value, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsRetellLLMResponseVariant3) + if (value.IsRetellLLMResponseVariant3) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLLMResponseVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLLMResponseVariant3).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.RetellLLMResponseVariant3!, typeInfo); + var __element2 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.RetellLLMResponseVariant3!, typeInfo); + if (__element2.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element2.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.RetellLlmRequest.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.RetellLlmRequest.g.cs index 2d59caf9..1e1a7c42 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.RetellLlmRequest.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.RetellLlmRequest.g.cs @@ -17,119 +17,34 @@ public class RetellLlmRequestJsonConverter : global::System.Text.Json.Serializat using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.RetellLlmOverride? @override = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmOverride), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmOverride).Name}"); + @override = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("begin_after_user_silence_ms")) __score0++; - if (__jsonProps.Contains("begin_message")) __score0++; - if (__jsonProps.Contains("kb_config")) __score0++; - if (__jsonProps.Contains("kb_config.filter_score")) __score0++; - if (__jsonProps.Contains("kb_config.top_k")) __score0++; - if (__jsonProps.Contains("knowledge_base_ids")) __score0++; - if (__jsonProps.Contains("model")) __score0++; - if (__jsonProps.Contains("model_high_priority")) __score0++; - if (__jsonProps.Contains("model_temperature")) __score0++; - if (__jsonProps.Contains("s2s_model")) __score0++; - if (__jsonProps.Contains("start_speaker")) __score0++; - if (__jsonProps.Contains("tool_call_strict_mode")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("default_dynamic_variables")) __score1++; - if (__jsonProps.Contains("general_prompt")) __score1++; - if (__jsonProps.Contains("general_tools")) __score1++; - if (__jsonProps.Contains("is_transfer_llm")) __score1++; - if (__jsonProps.Contains("mcps")) __score1++; - if (__jsonProps.Contains("starting_state")) __score1++; - if (__jsonProps.Contains("states")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.RetellLlmOverride? @override = default; global::RetellAI.RetellLlmRequestVariant2? retellLlmRequestVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmOverride), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmOverride).Name}"); - @override = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmRequestVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmRequestVariant2).Name}"); - retellLlmRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmRequestVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmRequestVariant2).Name}"); + retellLlmRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@override == null && retellLlmRequestVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmOverride), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmOverride).Name}"); - @override = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@override == null && retellLlmRequestVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmRequestVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmRequestVariant2).Name}"); - retellLlmRequestVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.RetellLlmRequest( @override, @@ -148,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsOverride) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmOverride), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmOverride).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Override!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Override!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsRetellLlmRequestVariant2) + if (value.IsRetellLlmRequestVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.RetellLlmRequestVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.RetellLlmRequestVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.RetellLlmRequestVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.RetellLlmRequestVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SkipResponseEdge.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SkipResponseEdge.g.cs index 796588f5..ea435ccc 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SkipResponseEdge.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SkipResponseEdge.g.cs @@ -17,106 +17,34 @@ public class SkipResponseEdgeJsonConverter : global::System.Text.Json.Serializat using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.NodeEdge? node = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); + node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("destination_node_id")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("transition_condition")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("transition_condition")) __score1++; - if (__jsonProps.Contains("transition_condition.prompt")) __score1++; - if (__jsonProps.Contains("transition_condition.type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeEdge? node = default; global::RetellAI.SkipResponseEdgeVariant2? skipResponseEdgeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SkipResponseEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SkipResponseEdgeVariant2).Name}"); - skipResponseEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SkipResponseEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SkipResponseEdgeVariant2).Name}"); + skipResponseEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (node == null && skipResponseEdgeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (node == null && skipResponseEdgeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SkipResponseEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SkipResponseEdgeVariant2).Name}"); - skipResponseEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.SkipResponseEdge( node, @@ -135,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsNode) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Node!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Node!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsSkipResponseEdgeVariant2) + if (value.IsSkipResponseEdgeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SkipResponseEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SkipResponseEdgeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.SkipResponseEdgeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.SkipResponseEdgeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsFailedEdge.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsFailedEdge.g.cs index c7dae18a..9922c269 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsFailedEdge.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsFailedEdge.g.cs @@ -17,106 +17,34 @@ public class SmsFailedEdgeJsonConverter : global::System.Text.Json.Serialization using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.NodeEdge? node = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); + node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("destination_node_id")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("transition_condition")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("transition_condition")) __score1++; - if (__jsonProps.Contains("transition_condition.prompt")) __score1++; - if (__jsonProps.Contains("transition_condition.type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeEdge? node = default; global::RetellAI.SmsFailedEdgeVariant2? smsFailedEdgeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsFailedEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsFailedEdgeVariant2).Name}"); - smsFailedEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsFailedEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsFailedEdgeVariant2).Name}"); + smsFailedEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (node == null && smsFailedEdgeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (node == null && smsFailedEdgeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsFailedEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsFailedEdgeVariant2).Name}"); - smsFailedEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.SmsFailedEdge( node, @@ -135,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsNode) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Node!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Node!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsSmsFailedEdgeVariant2) + if (value.IsSmsFailedEdgeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsFailedEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsFailedEdgeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.SmsFailedEdgeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.SmsFailedEdgeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsMessage.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsMessage.g.cs index 931f2361..92029373 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsMessage.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsMessage.g.cs @@ -17,98 +17,34 @@ public class SmsMessageJsonConverter : global::System.Text.Json.Serialization.Js using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.SmsMessageBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsMessageBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("content")) __score0++; - if (__jsonProps.Contains("created_timestamp")) __score0++; - if (__jsonProps.Contains("message_id")) __score0++; - if (__jsonProps.Contains("multimedia")) __score0++; - if (__jsonProps.Contains("role")) __score0++; - var __score1 = 0; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.SmsMessageBase? @base = default; object? smsMessageVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - smsMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); + smsMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && smsMessageVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && smsMessageVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - smsMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.SmsMessage( @base, @@ -127,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsMessageBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsSmsMessageVariant2) + if (value.IsSmsMessageVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.SmsMessageVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.SmsMessageVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsNode.g.cs index 7d1a536f..e392f1e9 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsNode.g.cs @@ -17,97 +17,34 @@ public class SmsNodeJsonConverter : global::System.Text.Json.Serialization.JsonC using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("failed_edge")) __score1++; - if (__jsonProps.Contains("instruction")) __score1++; - if (__jsonProps.Contains("success_edge")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.SmsNodeVariant2? smsNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsNodeVariant2).Name}"); - smsNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsNodeVariant2).Name}"); + smsNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && smsNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && smsNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsNodeVariant2).Name}"); - smsNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.SmsNode( @base, @@ -126,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsSmsNodeVariant2) + if (value.IsSmsNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.SmsNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.SmsNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsSuccessEdge.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsSuccessEdge.g.cs index 51447a06..da8fb382 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsSuccessEdge.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SmsSuccessEdge.g.cs @@ -17,106 +17,34 @@ public class SmsSuccessEdgeJsonConverter : global::System.Text.Json.Serializatio using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.NodeEdge? node = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); + node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("destination_node_id")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("transition_condition")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("transition_condition")) __score1++; - if (__jsonProps.Contains("transition_condition.prompt")) __score1++; - if (__jsonProps.Contains("transition_condition.type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeEdge? node = default; global::RetellAI.SmsSuccessEdgeVariant2? smsSuccessEdgeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsSuccessEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsSuccessEdgeVariant2).Name}"); - smsSuccessEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsSuccessEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsSuccessEdgeVariant2).Name}"); + smsSuccessEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (node == null && smsSuccessEdgeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (node == null && smsSuccessEdgeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsSuccessEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsSuccessEdgeVariant2).Name}"); - smsSuccessEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.SmsSuccessEdge( node, @@ -135,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsNode) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Node!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Node!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsSmsSuccessEdgeVariant2) + if (value.IsSmsSuccessEdgeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SmsSuccessEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SmsSuccessEdgeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.SmsSuccessEdgeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.SmsSuccessEdgeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.StateTransitionMessage.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.StateTransitionMessage.g.cs index 873a83ba..94be5a9f 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.StateTransitionMessage.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.StateTransitionMessage.g.cs @@ -17,98 +17,34 @@ public class StateTransitionMessageJsonConverter : global::System.Text.Json.Seri using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.StateTransitionMessageBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.StateTransitionMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.StateTransitionMessageBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("created_timestamp")) __score0++; - if (__jsonProps.Contains("former_state_name")) __score0++; - if (__jsonProps.Contains("message_id")) __score0++; - if (__jsonProps.Contains("new_state_name")) __score0++; - if (__jsonProps.Contains("role")) __score0++; - var __score1 = 0; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.StateTransitionMessageBase? @base = default; object? stateTransitionMessageVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.StateTransitionMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.StateTransitionMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - stateTransitionMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); + stateTransitionMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && stateTransitionMessageVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.StateTransitionMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.StateTransitionMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && stateTransitionMessageVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - stateTransitionMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.StateTransitionMessage( @base, @@ -127,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.StateTransitionMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.StateTransitionMessageBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsStateTransitionMessageVariant2) + if (value.IsStateTransitionMessageVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.StateTransitionMessageVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.StateTransitionMessageVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.StoredCallFilter.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.StoredCallFilter.g.cs index fd345fe6..fba7c937 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.StoredCallFilter.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.StoredCallFilter.g.cs @@ -17,140 +17,34 @@ public class StoredCallFilterJsonConverter : global::System.Text.Json.Serializat using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.CallFilter? callFilter = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CallFilter), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CallFilter).Name}"); + callFilter = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("agent")) __score0++; - if (__jsonProps.Contains("agent_tag")) __score0++; - if (__jsonProps.Contains("batch_call_id")) __score0++; - if (__jsonProps.Contains("batch_call_id.op")) __score0++; - if (__jsonProps.Contains("batch_call_id.type")) __score0++; - if (__jsonProps.Contains("batch_call_id.value")) __score0++; - if (__jsonProps.Contains("call_id")) __score0++; - if (__jsonProps.Contains("call_status")) __score0++; - if (__jsonProps.Contains("call_successful")) __score0++; - if (__jsonProps.Contains("call_successful.op")) __score0++; - if (__jsonProps.Contains("call_successful.type")) __score0++; - if (__jsonProps.Contains("call_successful.value")) __score0++; - if (__jsonProps.Contains("call_type")) __score0++; - if (__jsonProps.Contains("combined_cost")) __score0++; - if (__jsonProps.Contains("custom_analysis_data")) __score0++; - if (__jsonProps.Contains("custom_attributes")) __score0++; - if (__jsonProps.Contains("data_storage_setting")) __score0++; - if (__jsonProps.Contains("direction")) __score0++; - if (__jsonProps.Contains("disconnection_reason")) __score0++; - if (__jsonProps.Contains("duration_ms")) __score0++; - if (__jsonProps.Contains("dynamic_variables")) __score0++; - if (__jsonProps.Contains("e2e_latency_p50")) __score0++; - if (__jsonProps.Contains("end_timestamp")) __score0++; - if (__jsonProps.Contains("from_number")) __score0++; - if (__jsonProps.Contains("from_number.op")) __score0++; - if (__jsonProps.Contains("from_number.type")) __score0++; - if (__jsonProps.Contains("from_number.value")) __score0++; - if (__jsonProps.Contains("in_voicemail")) __score0++; - if (__jsonProps.Contains("in_voicemail.op")) __score0++; - if (__jsonProps.Contains("in_voicemail.type")) __score0++; - if (__jsonProps.Contains("in_voicemail.value")) __score0++; - if (__jsonProps.Contains("metadata")) __score0++; - if (__jsonProps.Contains("start_timestamp")) __score0++; - if (__jsonProps.Contains("to_number")) __score0++; - if (__jsonProps.Contains("to_number.op")) __score0++; - if (__jsonProps.Contains("to_number.type")) __score0++; - if (__jsonProps.Contains("to_number.value")) __score0++; - if (__jsonProps.Contains("tool_calls")) __score0++; - if (__jsonProps.Contains("user_sentiment")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("transfer_agent")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.CallFilter? callFilter = default; global::RetellAI.StoredCallFilterVariant2? storedCallFilterVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CallFilter), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CallFilter).Name}"); - callFilter = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.StoredCallFilterVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.StoredCallFilterVariant2).Name}"); - storedCallFilterVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.StoredCallFilterVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.StoredCallFilterVariant2).Name}"); + storedCallFilterVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (callFilter == null && storedCallFilterVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CallFilter), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CallFilter).Name}"); - callFilter = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (callFilter == null && storedCallFilterVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.StoredCallFilterVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.StoredCallFilterVariant2).Name}"); - storedCallFilterVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.StoredCallFilter( callFilter, @@ -169,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsCallFilter) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.CallFilter), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.CallFilter).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.CallFilter!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.CallFilter!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsStoredCallFilterVariant2) + if (value.IsStoredCallFilterVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.StoredCallFilterVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.StoredCallFilterVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.StoredCallFilterVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.StoredCallFilterVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SubagentNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SubagentNode.g.cs index 917c06db..ce604921 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SubagentNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.SubagentNode.g.cs @@ -17,157 +17,48 @@ public class SubagentNodeJsonConverter : global::System.Text.Json.Serialization. using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("allow_dtmf_interruption")) __score1++; - if (__jsonProps.Contains("interruption_sensitivity")) __score1++; - if (__jsonProps.Contains("reminder_max_count")) __score1++; - if (__jsonProps.Contains("reminder_trigger_ms")) __score1++; - if (__jsonProps.Contains("responsiveness")) __score1++; - if (__jsonProps.Contains("voice_speed")) __score1++; - var __score2 = 0; - if (__jsonProps.Contains("always_edge")) __score2++; - if (__jsonProps.Contains("edges")) __score2++; - if (__jsonProps.Contains("else_edge")) __score2++; - if (__jsonProps.Contains("finetune_conversation_examples")) __score2++; - if (__jsonProps.Contains("finetune_transition_examples")) __score2++; - if (__jsonProps.Contains("instruction")) __score2++; - if (__jsonProps.Contains("instruction.text")) __score2++; - if (__jsonProps.Contains("instruction.type")) __score2++; - if (__jsonProps.Contains("kb_config")) __score2++; - if (__jsonProps.Contains("kb_config.filter_score")) __score2++; - if (__jsonProps.Contains("kb_config.top_k")) __score2++; - if (__jsonProps.Contains("knowledge_base_ids")) __score2++; - if (__jsonProps.Contains("skip_response_edge")) __score2++; - if (__jsonProps.Contains("tool_ids")) __score2++; - if (__jsonProps.Contains("tools")) __score2++; - if (__jsonProps.Contains("type")) __score2++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - if (__score2 > __bestScore) { __bestScore = __score2; __bestIndex = 2; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.AgentOverrideConfig? agentOverrideConfig = default; - global::RetellAI.SubagentNodeVariant3? subagentNodeVariant3 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentOverrideConfig), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentOverrideConfig).Name}"); - agentOverrideConfig = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 2) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SubagentNodeVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SubagentNodeVariant3).Name}"); - subagentNodeVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentOverrideConfig), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentOverrideConfig).Name}"); + agentOverrideConfig = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && agentOverrideConfig == null && subagentNodeVariant3 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && agentOverrideConfig == null && subagentNodeVariant3 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentOverrideConfig), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentOverrideConfig).Name}"); - agentOverrideConfig = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - if (@base == null && agentOverrideConfig == null && subagentNodeVariant3 == null) + global::RetellAI.SubagentNodeVariant3? subagentNodeVariant3 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SubagentNodeVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SubagentNodeVariant3).Name}"); + subagentNodeVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SubagentNodeVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SubagentNodeVariant3).Name}"); - subagentNodeVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.SubagentNode( @base, @@ -188,24 +79,64 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsAgentOverrideConfig) + if (value.IsAgentOverrideConfig) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.AgentOverrideConfig), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.AgentOverrideConfig).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.AgentOverrideConfig!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.AgentOverrideConfig!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsSubagentNodeVariant3) + if (value.IsSubagentNodeVariant3) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.SubagentNodeVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.SubagentNodeVariant3).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.SubagentNodeVariant3!, typeInfo); + var __element2 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.SubagentNodeVariant3!, typeInfo); + if (__element2.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element2.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TestCaseDefinition.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TestCaseDefinition.g.cs index c554b43b..ad6400a5 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TestCaseDefinition.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TestCaseDefinition.g.cs @@ -17,104 +17,34 @@ public class TestCaseDefinitionJsonConverter : global::System.Text.Json.Serializ using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.TestCaseDefinitionInput? input = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TestCaseDefinitionInput), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TestCaseDefinitionInput).Name}"); + input = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("dynamic_variables")) __score0++; - if (__jsonProps.Contains("llm_model")) __score0++; - if (__jsonProps.Contains("metrics")) __score0++; - if (__jsonProps.Contains("name")) __score0++; - if (__jsonProps.Contains("response_engine")) __score0++; - if (__jsonProps.Contains("tool_mocks")) __score0++; - if (__jsonProps.Contains("user_prompt")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("creation_timestamp")) __score1++; - if (__jsonProps.Contains("test_case_definition_id")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - if (__jsonProps.Contains("user_modified_timestamp")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.TestCaseDefinitionInput? input = default; global::RetellAI.TestCaseDefinitionVariant2? testCaseDefinitionVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TestCaseDefinitionInput), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TestCaseDefinitionInput).Name}"); - input = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TestCaseDefinitionVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TestCaseDefinitionVariant2).Name}"); - testCaseDefinitionVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TestCaseDefinitionVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TestCaseDefinitionVariant2).Name}"); + testCaseDefinitionVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (input == null && testCaseDefinitionVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TestCaseDefinitionInput), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TestCaseDefinitionInput).Name}"); - input = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (input == null && testCaseDefinitionVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TestCaseDefinitionVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TestCaseDefinitionVariant2).Name}"); - testCaseDefinitionVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.TestCaseDefinition( input, @@ -133,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsInput) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TestCaseDefinitionInput), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TestCaseDefinitionInput).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Input!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Input!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsTestCaseDefinitionVariant2) + if (value.IsTestCaseDefinitionVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TestCaseDefinitionVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TestCaseDefinitionVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TestCaseDefinitionVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TestCaseDefinitionVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ToolCallInvocationMessage.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ToolCallInvocationMessage.g.cs index bad78271..7cf61ced 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ToolCallInvocationMessage.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ToolCallInvocationMessage.g.cs @@ -17,100 +17,34 @@ public class ToolCallInvocationMessageJsonConverter : global::System.Text.Json.S using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.ToolCallInvocationMessageBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ToolCallInvocationMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ToolCallInvocationMessageBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("arguments")) __score0++; - if (__jsonProps.Contains("created_timestamp")) __score0++; - if (__jsonProps.Contains("message_id")) __score0++; - if (__jsonProps.Contains("name")) __score0++; - if (__jsonProps.Contains("role")) __score0++; - if (__jsonProps.Contains("thought_signature")) __score0++; - if (__jsonProps.Contains("tool_call_id")) __score0++; - var __score1 = 0; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.ToolCallInvocationMessageBase? @base = default; object? toolCallInvocationMessageVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ToolCallInvocationMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ToolCallInvocationMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - toolCallInvocationMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); + toolCallInvocationMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && toolCallInvocationMessageVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ToolCallInvocationMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ToolCallInvocationMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && toolCallInvocationMessageVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - toolCallInvocationMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.ToolCallInvocationMessage( @base, @@ -129,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ToolCallInvocationMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ToolCallInvocationMessageBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsToolCallInvocationMessageVariant2) + if (value.IsToolCallInvocationMessageVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolCallInvocationMessageVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ToolCallInvocationMessageVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ToolCallResultMessage.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ToolCallResultMessage.g.cs index 4207a533..89bfb479 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ToolCallResultMessage.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.ToolCallResultMessage.g.cs @@ -17,99 +17,34 @@ public class ToolCallResultMessageJsonConverter : global::System.Text.Json.Seria using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.ToolCallResultMessageBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ToolCallResultMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ToolCallResultMessageBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("content")) __score0++; - if (__jsonProps.Contains("created_timestamp")) __score0++; - if (__jsonProps.Contains("message_id")) __score0++; - if (__jsonProps.Contains("role")) __score0++; - if (__jsonProps.Contains("successful")) __score0++; - if (__jsonProps.Contains("tool_call_id")) __score0++; - var __score1 = 0; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.ToolCallResultMessageBase? @base = default; object? toolCallResultMessageVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ToolCallResultMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ToolCallResultMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - toolCallResultMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); + toolCallResultMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && toolCallResultMessageVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ToolCallResultMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ToolCallResultMessageBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && toolCallResultMessageVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - toolCallResultMessageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.ToolCallResultMessage( @base, @@ -128,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ToolCallResultMessageBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ToolCallResultMessageBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsToolCallResultMessageVariant2) + if (value.IsToolCallResultMessageVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ToolCallResultMessageVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ToolCallResultMessageVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TransferCallNode.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TransferCallNode.g.cs index 92d3b2a3..e6aed8a9 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TransferCallNode.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TransferCallNode.g.cs @@ -17,101 +17,34 @@ public class TransferCallNodeJsonConverter : global::System.Text.Json.Serializat using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - } + global::RetellAI.NodeBase? @base = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - var __score1 = 0; - if (__jsonProps.Contains("custom_sip_headers")) __score1++; - if (__jsonProps.Contains("edge")) __score1++; - if (__jsonProps.Contains("ignore_e164_validation")) __score1++; - if (__jsonProps.Contains("instruction")) __score1++; - if (__jsonProps.Contains("speak_during_execution")) __score1++; - if (__jsonProps.Contains("transfer_destination")) __score1++; - if (__jsonProps.Contains("transfer_option")) __score1++; - if (__jsonProps.Contains("type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeBase? @base = default; global::RetellAI.TransferCallNodeVariant2? transferCallNodeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TransferCallNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TransferCallNodeVariant2).Name}"); - transferCallNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TransferCallNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TransferCallNodeVariant2).Name}"); + transferCallNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (@base == null && transferCallNodeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (@base == null && transferCallNodeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TransferCallNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TransferCallNodeVariant2).Name}"); - transferCallNodeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.TransferCallNode( @base, @@ -130,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!.Value, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!.Value, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsTransferCallNodeVariant2) + if (value.IsTransferCallNodeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TransferCallNodeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TransferCallNodeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TransferCallNodeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TransferCallNodeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TransferFailedEdge.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TransferFailedEdge.g.cs index a8be21bd..1954a4b9 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TransferFailedEdge.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.TransferFailedEdge.g.cs @@ -17,106 +17,34 @@ public class TransferFailedEdgeJsonConverter : global::System.Text.Json.Serializ using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.NodeEdge? node = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); + node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("destination_node_id")) __score0++; - if (__jsonProps.Contains("id")) __score0++; - if (__jsonProps.Contains("transition_condition")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("transition_condition")) __score1++; - if (__jsonProps.Contains("transition_condition.prompt")) __score1++; - if (__jsonProps.Contains("transition_condition.type")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.NodeEdge? node = default; global::RetellAI.TransferFailedEdgeVariant2? transferFailedEdgeVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TransferFailedEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TransferFailedEdgeVariant2).Name}"); - transferFailedEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TransferFailedEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TransferFailedEdgeVariant2).Name}"); + transferFailedEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (node == null && transferFailedEdgeVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - node = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (node == null && transferFailedEdgeVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TransferFailedEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TransferFailedEdgeVariant2).Name}"); - transferFailedEdgeVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.TransferFailedEdge( node, @@ -135,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsNode) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.NodeEdge), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.NodeEdge).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Node!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Node!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsTransferFailedEdgeVariant2) + if (value.IsTransferFailedEdgeVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.TransferFailedEdgeVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.TransferFailedEdgeVariant2).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.TransferFailedEdgeVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TransferFailedEdgeVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V2PhoneCallResponse.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V2PhoneCallResponse.g.cs index 04f686d1..7495e08a 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V2PhoneCallResponse.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V2PhoneCallResponse.g.cs @@ -17,157 +17,34 @@ public class V2PhoneCallResponseJsonConverter : global::System.Text.Json.Seriali using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.V2PhoneCallResponseVariant1? v2PhoneCallResponseVariant1 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2PhoneCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2PhoneCallResponseVariant1).Name}"); + v2PhoneCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("call_type")) __score0++; - if (__jsonProps.Contains("direction")) __score0++; - if (__jsonProps.Contains("from_number")) __score0++; - if (__jsonProps.Contains("telephony_identifier")) __score0++; - if (__jsonProps.Contains("telephony_identifier.twilio_call_sid")) __score0++; - if (__jsonProps.Contains("to_number")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("agent_id")) __score1++; - if (__jsonProps.Contains("agent_name")) __score1++; - if (__jsonProps.Contains("agent_tag")) __score1++; - if (__jsonProps.Contains("agent_version")) __score1++; - if (__jsonProps.Contains("call_analysis")) __score1++; - if (__jsonProps.Contains("call_analysis.call_successful")) __score1++; - if (__jsonProps.Contains("call_analysis.call_summary")) __score1++; - if (__jsonProps.Contains("call_analysis.custom_analysis_data")) __score1++; - if (__jsonProps.Contains("call_analysis.in_voicemail")) __score1++; - if (__jsonProps.Contains("call_analysis.user_sentiment")) __score1++; - if (__jsonProps.Contains("call_cost")) __score1++; - if (__jsonProps.Contains("call_cost.combined_cost")) __score1++; - if (__jsonProps.Contains("call_cost.product_costs")) __score1++; - if (__jsonProps.Contains("call_cost.total_duration_seconds")) __score1++; - if (__jsonProps.Contains("call_cost.total_duration_unit_price")) __score1++; - if (__jsonProps.Contains("call_id")) __score1++; - if (__jsonProps.Contains("call_status")) __score1++; - if (__jsonProps.Contains("collected_dynamic_variables")) __score1++; - if (__jsonProps.Contains("custom_sip_headers")) __score1++; - if (__jsonProps.Contains("data_storage_setting")) __score1++; - if (__jsonProps.Contains("disconnection_reason")) __score1++; - if (__jsonProps.Contains("duration_ms")) __score1++; - if (__jsonProps.Contains("end_timestamp")) __score1++; - if (__jsonProps.Contains("knowledge_base_retrieved_contents_url")) __score1++; - if (__jsonProps.Contains("latency")) __score1++; - if (__jsonProps.Contains("latency.asr")) __score1++; - if (__jsonProps.Contains("latency.e2e")) __score1++; - if (__jsonProps.Contains("latency.knowledge_base")) __score1++; - if (__jsonProps.Contains("latency.llm")) __score1++; - if (__jsonProps.Contains("latency.llm_websocket_network_rtt")) __score1++; - if (__jsonProps.Contains("latency.s2s")) __score1++; - if (__jsonProps.Contains("latency.tts")) __score1++; - if (__jsonProps.Contains("llm_token_usage")) __score1++; - if (__jsonProps.Contains("llm_token_usage.average")) __score1++; - if (__jsonProps.Contains("llm_token_usage.num_requests")) __score1++; - if (__jsonProps.Contains("llm_token_usage.values")) __score1++; - if (__jsonProps.Contains("metadata")) __score1++; - if (__jsonProps.Contains("opt_in_signed_url")) __score1++; - if (__jsonProps.Contains("public_log_url")) __score1++; - if (__jsonProps.Contains("recording_multi_channel_url")) __score1++; - if (__jsonProps.Contains("recording_url")) __score1++; - if (__jsonProps.Contains("retell_llm_dynamic_variables")) __score1++; - if (__jsonProps.Contains("scrubbed_recording_multi_channel_url")) __score1++; - if (__jsonProps.Contains("scrubbed_recording_url")) __score1++; - if (__jsonProps.Contains("scrubbed_transcript_with_tool_calls")) __score1++; - if (__jsonProps.Contains("start_timestamp")) __score1++; - if (__jsonProps.Contains("transcript")) __score1++; - if (__jsonProps.Contains("transcript_object")) __score1++; - if (__jsonProps.Contains("transcript_with_tool_calls")) __score1++; - if (__jsonProps.Contains("transfer_destination")) __score1++; - if (__jsonProps.Contains("transfer_end_timestamp")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.V2PhoneCallResponseVariant1? v2PhoneCallResponseVariant1 = default; global::RetellAI.V2CallBase? @base = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2PhoneCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2PhoneCallResponseVariant1).Name}"); - v2PhoneCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2CallBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2CallBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (v2PhoneCallResponseVariant1 == null && @base == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2PhoneCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2PhoneCallResponseVariant1).Name}"); - v2PhoneCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (v2PhoneCallResponseVariant1 == null && @base == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2CallBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.V2PhoneCallResponse( v2PhoneCallResponseVariant1, @@ -186,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsV2PhoneCallResponseVariant1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2PhoneCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2PhoneCallResponseVariant1).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.V2PhoneCallResponseVariant1!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.V2PhoneCallResponseVariant1!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsBase) + if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2CallBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V2WebCallResponse.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V2WebCallResponse.g.cs index bfa2c438..c85abb27 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V2WebCallResponse.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V2WebCallResponse.g.cs @@ -17,153 +17,34 @@ public class V2WebCallResponseJsonConverter : global::System.Text.Json.Serializa using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.V2WebCallResponseVariant1? v2WebCallResponseVariant1 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2WebCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2WebCallResponseVariant1).Name}"); + v2WebCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("access_token")) __score0++; - if (__jsonProps.Contains("call_type")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("agent_id")) __score1++; - if (__jsonProps.Contains("agent_name")) __score1++; - if (__jsonProps.Contains("agent_tag")) __score1++; - if (__jsonProps.Contains("agent_version")) __score1++; - if (__jsonProps.Contains("call_analysis")) __score1++; - if (__jsonProps.Contains("call_analysis.call_successful")) __score1++; - if (__jsonProps.Contains("call_analysis.call_summary")) __score1++; - if (__jsonProps.Contains("call_analysis.custom_analysis_data")) __score1++; - if (__jsonProps.Contains("call_analysis.in_voicemail")) __score1++; - if (__jsonProps.Contains("call_analysis.user_sentiment")) __score1++; - if (__jsonProps.Contains("call_cost")) __score1++; - if (__jsonProps.Contains("call_cost.combined_cost")) __score1++; - if (__jsonProps.Contains("call_cost.product_costs")) __score1++; - if (__jsonProps.Contains("call_cost.total_duration_seconds")) __score1++; - if (__jsonProps.Contains("call_cost.total_duration_unit_price")) __score1++; - if (__jsonProps.Contains("call_id")) __score1++; - if (__jsonProps.Contains("call_status")) __score1++; - if (__jsonProps.Contains("collected_dynamic_variables")) __score1++; - if (__jsonProps.Contains("custom_sip_headers")) __score1++; - if (__jsonProps.Contains("data_storage_setting")) __score1++; - if (__jsonProps.Contains("disconnection_reason")) __score1++; - if (__jsonProps.Contains("duration_ms")) __score1++; - if (__jsonProps.Contains("end_timestamp")) __score1++; - if (__jsonProps.Contains("knowledge_base_retrieved_contents_url")) __score1++; - if (__jsonProps.Contains("latency")) __score1++; - if (__jsonProps.Contains("latency.asr")) __score1++; - if (__jsonProps.Contains("latency.e2e")) __score1++; - if (__jsonProps.Contains("latency.knowledge_base")) __score1++; - if (__jsonProps.Contains("latency.llm")) __score1++; - if (__jsonProps.Contains("latency.llm_websocket_network_rtt")) __score1++; - if (__jsonProps.Contains("latency.s2s")) __score1++; - if (__jsonProps.Contains("latency.tts")) __score1++; - if (__jsonProps.Contains("llm_token_usage")) __score1++; - if (__jsonProps.Contains("llm_token_usage.average")) __score1++; - if (__jsonProps.Contains("llm_token_usage.num_requests")) __score1++; - if (__jsonProps.Contains("llm_token_usage.values")) __score1++; - if (__jsonProps.Contains("metadata")) __score1++; - if (__jsonProps.Contains("opt_in_signed_url")) __score1++; - if (__jsonProps.Contains("public_log_url")) __score1++; - if (__jsonProps.Contains("recording_multi_channel_url")) __score1++; - if (__jsonProps.Contains("recording_url")) __score1++; - if (__jsonProps.Contains("retell_llm_dynamic_variables")) __score1++; - if (__jsonProps.Contains("scrubbed_recording_multi_channel_url")) __score1++; - if (__jsonProps.Contains("scrubbed_recording_url")) __score1++; - if (__jsonProps.Contains("scrubbed_transcript_with_tool_calls")) __score1++; - if (__jsonProps.Contains("start_timestamp")) __score1++; - if (__jsonProps.Contains("transcript")) __score1++; - if (__jsonProps.Contains("transcript_object")) __score1++; - if (__jsonProps.Contains("transcript_with_tool_calls")) __score1++; - if (__jsonProps.Contains("transfer_destination")) __score1++; - if (__jsonProps.Contains("transfer_end_timestamp")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.V2WebCallResponseVariant1? v2WebCallResponseVariant1 = default; global::RetellAI.V2CallBase? @base = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2WebCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2WebCallResponseVariant1).Name}"); - v2WebCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2CallBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2CallBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (v2WebCallResponseVariant1 == null && @base == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2WebCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2WebCallResponseVariant1).Name}"); - v2WebCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (v2WebCallResponseVariant1 == null && @base == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2CallBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.V2WebCallResponse( v2WebCallResponseVariant1, @@ -182,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsV2WebCallResponseVariant1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2WebCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2WebCallResponseVariant1).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.V2WebCallResponseVariant1!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.V2WebCallResponseVariant1!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsBase) + if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2CallBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3ChatResponse.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3ChatResponse.g.cs index e0a5655c..313ea6b1 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3ChatResponse.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3ChatResponse.g.cs @@ -17,121 +17,34 @@ public class V3ChatResponseJsonConverter : global::System.Text.Json.Serializatio using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.ChatResponse? chatResponse = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatResponse).Name}"); + chatResponse = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("agent_id")) __score0++; - if (__jsonProps.Contains("chat_analysis")) __score0++; - if (__jsonProps.Contains("chat_analysis.chat_successful")) __score0++; - if (__jsonProps.Contains("chat_analysis.chat_summary")) __score0++; - if (__jsonProps.Contains("chat_analysis.custom_analysis_data")) __score0++; - if (__jsonProps.Contains("chat_analysis.user_sentiment")) __score0++; - if (__jsonProps.Contains("chat_cost")) __score0++; - if (__jsonProps.Contains("chat_cost.combined_cost")) __score0++; - if (__jsonProps.Contains("chat_cost.product_costs")) __score0++; - if (__jsonProps.Contains("chat_id")) __score0++; - if (__jsonProps.Contains("chat_status")) __score0++; - if (__jsonProps.Contains("chat_type")) __score0++; - if (__jsonProps.Contains("collected_dynamic_variables")) __score0++; - if (__jsonProps.Contains("custom_attributes")) __score0++; - if (__jsonProps.Contains("end_timestamp")) __score0++; - if (__jsonProps.Contains("message_with_tool_calls")) __score0++; - if (__jsonProps.Contains("metadata")) __score0++; - if (__jsonProps.Contains("retell_llm_dynamic_variables")) __score0++; - if (__jsonProps.Contains("start_timestamp")) __score0++; - if (__jsonProps.Contains("transcript")) __score0++; - if (__jsonProps.Contains("version")) __score0++; - var __score1 = 0; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.ChatResponse? chatResponse = default; object? v3ChatResponseVariant2 = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatResponse).Name}"); - chatResponse = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - v3ChatResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); + v3ChatResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (chatResponse == null && v3ChatResponseVariant2 == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatResponse).Name}"); - chatResponse = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (chatResponse == null && v3ChatResponseVariant2 == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - v3ChatResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.V3ChatResponse( chatResponse, @@ -150,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsChatResponse) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.ChatResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.ChatResponse).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.ChatResponse!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.ChatResponse!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsV3ChatResponseVariant2) + if (value.IsV3ChatResponseVariant2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.V3ChatResponseVariant2!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.V3ChatResponseVariant2!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3PhoneCallResponse.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3PhoneCallResponse.g.cs index 7cd8dd86..59f247db 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3PhoneCallResponse.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3PhoneCallResponse.g.cs @@ -17,153 +17,34 @@ public class V3PhoneCallResponseJsonConverter : global::System.Text.Json.Seriali using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.V3PhoneCallResponseVariant1? v3PhoneCallResponseVariant1 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3PhoneCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3PhoneCallResponseVariant1).Name}"); + v3PhoneCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("call_type")) __score0++; - if (__jsonProps.Contains("direction")) __score0++; - if (__jsonProps.Contains("from_number")) __score0++; - if (__jsonProps.Contains("telephony_identifier")) __score0++; - if (__jsonProps.Contains("telephony_identifier.twilio_call_sid")) __score0++; - if (__jsonProps.Contains("to_number")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("agent_id")) __score1++; - if (__jsonProps.Contains("agent_name")) __score1++; - if (__jsonProps.Contains("agent_tag")) __score1++; - if (__jsonProps.Contains("agent_version")) __score1++; - if (__jsonProps.Contains("call_analysis")) __score1++; - if (__jsonProps.Contains("call_analysis.call_successful")) __score1++; - if (__jsonProps.Contains("call_analysis.call_summary")) __score1++; - if (__jsonProps.Contains("call_analysis.custom_analysis_data")) __score1++; - if (__jsonProps.Contains("call_analysis.in_voicemail")) __score1++; - if (__jsonProps.Contains("call_analysis.user_sentiment")) __score1++; - if (__jsonProps.Contains("call_cost")) __score1++; - if (__jsonProps.Contains("call_cost.combined_cost")) __score1++; - if (__jsonProps.Contains("call_cost.product_costs")) __score1++; - if (__jsonProps.Contains("call_cost.total_duration_seconds")) __score1++; - if (__jsonProps.Contains("call_cost.total_duration_unit_price")) __score1++; - if (__jsonProps.Contains("call_id")) __score1++; - if (__jsonProps.Contains("call_status")) __score1++; - if (__jsonProps.Contains("collected_dynamic_variables")) __score1++; - if (__jsonProps.Contains("custom_sip_headers")) __score1++; - if (__jsonProps.Contains("data_storage_setting")) __score1++; - if (__jsonProps.Contains("disconnection_reason")) __score1++; - if (__jsonProps.Contains("duration_ms")) __score1++; - if (__jsonProps.Contains("end_timestamp")) __score1++; - if (__jsonProps.Contains("knowledge_base_retrieved_contents_url")) __score1++; - if (__jsonProps.Contains("latency")) __score1++; - if (__jsonProps.Contains("latency.asr")) __score1++; - if (__jsonProps.Contains("latency.e2e")) __score1++; - if (__jsonProps.Contains("latency.knowledge_base")) __score1++; - if (__jsonProps.Contains("latency.llm")) __score1++; - if (__jsonProps.Contains("latency.llm_websocket_network_rtt")) __score1++; - if (__jsonProps.Contains("latency.s2s")) __score1++; - if (__jsonProps.Contains("latency.tts")) __score1++; - if (__jsonProps.Contains("llm_token_usage")) __score1++; - if (__jsonProps.Contains("llm_token_usage.average")) __score1++; - if (__jsonProps.Contains("llm_token_usage.num_requests")) __score1++; - if (__jsonProps.Contains("llm_token_usage.values")) __score1++; - if (__jsonProps.Contains("metadata")) __score1++; - if (__jsonProps.Contains("opt_in_signed_url")) __score1++; - if (__jsonProps.Contains("public_log_url")) __score1++; - if (__jsonProps.Contains("recording_multi_channel_url")) __score1++; - if (__jsonProps.Contains("recording_url")) __score1++; - if (__jsonProps.Contains("retell_llm_dynamic_variables")) __score1++; - if (__jsonProps.Contains("scrubbed_recording_multi_channel_url")) __score1++; - if (__jsonProps.Contains("scrubbed_recording_url")) __score1++; - if (__jsonProps.Contains("start_timestamp")) __score1++; - if (__jsonProps.Contains("transfer_destination")) __score1++; - if (__jsonProps.Contains("transfer_end_timestamp")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.V3PhoneCallResponseVariant1? v3PhoneCallResponseVariant1 = default; global::RetellAI.V3CallBase? @base = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3PhoneCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3PhoneCallResponseVariant1).Name}"); - v3PhoneCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3CallBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3CallBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (v3PhoneCallResponseVariant1 == null && @base == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3PhoneCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3PhoneCallResponseVariant1).Name}"); - v3PhoneCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (v3PhoneCallResponseVariant1 == null && @base == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3CallBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.V3PhoneCallResponse( v3PhoneCallResponseVariant1, @@ -182,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsV3PhoneCallResponseVariant1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3PhoneCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3PhoneCallResponseVariant1).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.V3PhoneCallResponseVariant1!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.V3PhoneCallResponseVariant1!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsBase) + if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3CallBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3WebCallResponse.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3WebCallResponse.g.cs index 12baf451..ac4b7a35 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3WebCallResponse.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonConverters.V3WebCallResponse.g.cs @@ -17,149 +17,34 @@ public class V3WebCallResponseJsonConverter : global::System.Text.Json.Serializa using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); var __rawJson = __jsonDocument.RootElement.GetRawText(); - var __jsonProps = new global::System.Collections.Generic.HashSet(); - if (__jsonDocument.RootElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __jsonProp in __jsonDocument.RootElement.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name); - if (__jsonProp.Value.ValueKind == global::System.Text.Json.JsonValueKind.Object) - { - foreach (var __nestedJsonProp in __jsonProp.Value.EnumerateObject()) - { - __jsonProps.Add(__jsonProp.Name + "." + __nestedJsonProp.Name); - } - } - } + global::RetellAI.V3WebCallResponseVariant1? v3WebCallResponseVariant1 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3WebCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3WebCallResponseVariant1).Name}"); + v3WebCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { } - var __score0 = 0; - if (__jsonProps.Contains("access_token")) __score0++; - if (__jsonProps.Contains("call_type")) __score0++; - var __score1 = 0; - if (__jsonProps.Contains("agent_id")) __score1++; - if (__jsonProps.Contains("agent_name")) __score1++; - if (__jsonProps.Contains("agent_tag")) __score1++; - if (__jsonProps.Contains("agent_version")) __score1++; - if (__jsonProps.Contains("call_analysis")) __score1++; - if (__jsonProps.Contains("call_analysis.call_successful")) __score1++; - if (__jsonProps.Contains("call_analysis.call_summary")) __score1++; - if (__jsonProps.Contains("call_analysis.custom_analysis_data")) __score1++; - if (__jsonProps.Contains("call_analysis.in_voicemail")) __score1++; - if (__jsonProps.Contains("call_analysis.user_sentiment")) __score1++; - if (__jsonProps.Contains("call_cost")) __score1++; - if (__jsonProps.Contains("call_cost.combined_cost")) __score1++; - if (__jsonProps.Contains("call_cost.product_costs")) __score1++; - if (__jsonProps.Contains("call_cost.total_duration_seconds")) __score1++; - if (__jsonProps.Contains("call_cost.total_duration_unit_price")) __score1++; - if (__jsonProps.Contains("call_id")) __score1++; - if (__jsonProps.Contains("call_status")) __score1++; - if (__jsonProps.Contains("collected_dynamic_variables")) __score1++; - if (__jsonProps.Contains("custom_sip_headers")) __score1++; - if (__jsonProps.Contains("data_storage_setting")) __score1++; - if (__jsonProps.Contains("disconnection_reason")) __score1++; - if (__jsonProps.Contains("duration_ms")) __score1++; - if (__jsonProps.Contains("end_timestamp")) __score1++; - if (__jsonProps.Contains("knowledge_base_retrieved_contents_url")) __score1++; - if (__jsonProps.Contains("latency")) __score1++; - if (__jsonProps.Contains("latency.asr")) __score1++; - if (__jsonProps.Contains("latency.e2e")) __score1++; - if (__jsonProps.Contains("latency.knowledge_base")) __score1++; - if (__jsonProps.Contains("latency.llm")) __score1++; - if (__jsonProps.Contains("latency.llm_websocket_network_rtt")) __score1++; - if (__jsonProps.Contains("latency.s2s")) __score1++; - if (__jsonProps.Contains("latency.tts")) __score1++; - if (__jsonProps.Contains("llm_token_usage")) __score1++; - if (__jsonProps.Contains("llm_token_usage.average")) __score1++; - if (__jsonProps.Contains("llm_token_usage.num_requests")) __score1++; - if (__jsonProps.Contains("llm_token_usage.values")) __score1++; - if (__jsonProps.Contains("metadata")) __score1++; - if (__jsonProps.Contains("opt_in_signed_url")) __score1++; - if (__jsonProps.Contains("public_log_url")) __score1++; - if (__jsonProps.Contains("recording_multi_channel_url")) __score1++; - if (__jsonProps.Contains("recording_url")) __score1++; - if (__jsonProps.Contains("retell_llm_dynamic_variables")) __score1++; - if (__jsonProps.Contains("scrubbed_recording_multi_channel_url")) __score1++; - if (__jsonProps.Contains("scrubbed_recording_url")) __score1++; - if (__jsonProps.Contains("start_timestamp")) __score1++; - if (__jsonProps.Contains("transfer_destination")) __score1++; - if (__jsonProps.Contains("transfer_end_timestamp")) __score1++; - var __bestScore = 0; - var __bestIndex = -1; - if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; } - if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; } - - global::RetellAI.V3WebCallResponseVariant1? v3WebCallResponseVariant1 = default; global::RetellAI.V3CallBase? @base = default; - if (__bestIndex >= 0) + try { - if (__bestIndex == 0) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3WebCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3WebCallResponseVariant1).Name}"); - v3WebCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } - else if (__bestIndex == 1) - { - try - { - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3CallBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } - } + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3CallBase).Name}"); + @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); } - - if (v3WebCallResponseVariant1 == null && @base == null) + catch (global::System.Text.Json.JsonException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3WebCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3WebCallResponseVariant1).Name}"); - v3WebCallResponseVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - - if (v3WebCallResponseVariant1 == null && @base == null) + catch (global::System.InvalidOperationException) { - try - { - - var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? - throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3CallBase).Name}"); - @base = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); - } - catch (global::System.Text.Json.JsonException) - { - } - catch (global::System.InvalidOperationException) - { - } } - var __value = new global::RetellAI.V3WebCallResponse( v3WebCallResponseVariant1, @@ -178,18 +63,46 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); if (value.IsV3WebCallResponseVariant1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3WebCallResponseVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3WebCallResponseVariant1).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.V3WebCallResponseVariant1!, typeInfo); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.V3WebCallResponseVariant1!, typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } - else if (value.IsBase) + if (value.IsBase) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3CallBase), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3CallBase).Name}"); - global::System.Text.Json.JsonSerializer.Serialize(writer, value.Base!, typeInfo); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Base!, typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } } + writer.WriteEndObject(); } } } \ No newline at end of file diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonSerializerContext.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonSerializerContext.g.cs index b0add718..ade4dbd7 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonSerializerContext.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonSerializerContext.g.cs @@ -22,6 +22,7 @@ namespace RetellAI [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double_3")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.Dictionary))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.Dictionary))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "SystemCollectionsGeneric_ObjectList")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Text.Json.JsonElement?))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AlertMetricType), TypeInfoPropertyName = "AlertMetricType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AsrProvider), TypeInfoPropertyName = "AsrProvider2")] @@ -513,7 +514,6 @@ namespace RetellAI [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.OrganizationWebhookUrl))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.DateTimeOffset))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.OrganizationCpsConfig))] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AutoCreditReloadConfig))] internal sealed partial class SourceGenerationContextChunk0 : global::System.Text.Json.Serialization.JsonSerializerContext { } @@ -532,6 +532,7 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.LLMModel?), TypeInfoPropertyName = "NullableLLMModel_RetellAI_LLMModel")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double_3")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AutoCreditReloadConfig))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ConductorOverageConfig), TypeInfoPropertyName = "ConductorOverageConfig2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.OrganizationResponse), TypeInfoPropertyName = "OrganizationResponse2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.OrganizationResponseVariant2))] @@ -1025,7 +1026,6 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AgentPlaygroundCompletionResponseStatus2), TypeInfoPropertyName = "AgentPlaygroundCompletionResponseStatus22")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AgentPlaygroundCompletionResponse4))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AgentPlaygroundCompletionResponseStatus3), TypeInfoPropertyName = "AgentPlaygroundCompletionResponseStatus32")] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AgentPlaygroundCompletionResponse5))] internal sealed partial class SourceGenerationContextChunk1 : global::System.Text.Json.Serialization.JsonSerializerContext { } @@ -1044,6 +1044,7 @@ internal sealed partial class SourceGenerationContextChunk1 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.LLMModel?), TypeInfoPropertyName = "NullableLLMModel_RetellAI_LLMModel")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double_3")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AgentPlaygroundCompletionResponse5))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AgentPlaygroundCompletionResponseStatus4), TypeInfoPropertyName = "AgentPlaygroundCompletionResponseStatus42")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AgentPlaygroundCompletionResponse6))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.AgentPlaygroundCompletionResponseStatus5), TypeInfoPropertyName = "AgentPlaygroundCompletionResponseStatus52")] @@ -1537,7 +1538,6 @@ internal sealed partial class SourceGenerationContextChunk1 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.UpdateConversationFlowComponentResponse2))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.UpdateConversationFlowComponentResponseStatus2), TypeInfoPropertyName = "UpdateConversationFlowComponentResponseStatus22")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.UpdateConversationFlowComponentResponse3))] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.UpdateConversationFlowComponentResponseStatus3), TypeInfoPropertyName = "UpdateConversationFlowComponentResponseStatus32")] internal sealed partial class SourceGenerationContextChunk2 : global::System.Text.Json.Serialization.JsonSerializerContext { } @@ -1556,6 +1556,7 @@ internal sealed partial class SourceGenerationContextChunk2 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.LLMModel?), TypeInfoPropertyName = "NullableLLMModel_RetellAI_LLMModel")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double_3")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.UpdateConversationFlowComponentResponseStatus3), TypeInfoPropertyName = "UpdateConversationFlowComponentResponseStatus32")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.UpdateConversationFlowComponentResponse4))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.UpdateConversationFlowComponentResponseStatus4), TypeInfoPropertyName = "UpdateConversationFlowComponentResponseStatus42")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.UpdateConversationFlowComponentResponse5))] @@ -2049,7 +2050,6 @@ internal sealed partial class SourceGenerationContextChunk2 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ChatFilterUserSentimentValueItem?), TypeInfoPropertyName = "NullableChatFilterUserSentimentValueItem2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.OneOf?), TypeInfoPropertyName = "NullableOneOfStringFilterPresentFilter2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ListContactsRequestSortOrder?), TypeInfoPropertyName = "NullableListContactsRequestSortOrder2")] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ElseEdgeVariant2TransitionConditionType?), TypeInfoPropertyName = "NullableElseEdgeVariant2TransitionConditionType2")] internal sealed partial class SourceGenerationContextChunk3 : global::System.Text.Json.Serialization.JsonSerializerContext { } @@ -2068,6 +2068,7 @@ internal sealed partial class SourceGenerationContextChunk3 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.LLMModel?), TypeInfoPropertyName = "NullableLLMModel_RetellAI_LLMModel")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double_3")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ElseEdgeVariant2TransitionConditionType?), TypeInfoPropertyName = "NullableElseEdgeVariant2TransitionConditionType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ElseEdgeVariant2TransitionConditionPrompt?), TypeInfoPropertyName = "NullableElseEdgeVariant2TransitionConditionPrompt2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.EndCallToolType?), TypeInfoPropertyName = "NullableEndCallToolType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.EndCallToolExecutionMessageType?), TypeInfoPropertyName = "NullableEndCallToolExecutionMessageType2")] @@ -2561,7 +2562,6 @@ internal sealed partial class SourceGenerationContextChunk3 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ListRetellLLMResponseStatus2?), TypeInfoPropertyName = "NullableListRetellLLMResponseStatus22")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ListRetellLLMResponseStatus3?), TypeInfoPropertyName = "NullableListRetellLLMResponseStatus32")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ListRetellLLMResponseStatus4?), TypeInfoPropertyName = "NullableListRetellLLMResponseStatus42")] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ListRetellLLMResponseStatus5?), TypeInfoPropertyName = "NullableListRetellLLMResponseStatus52")] internal sealed partial class SourceGenerationContextChunk4 : global::System.Text.Json.Serialization.JsonSerializerContext { } @@ -2580,6 +2580,7 @@ internal sealed partial class SourceGenerationContextChunk4 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.LLMModel?), TypeInfoPropertyName = "NullableLLMModel_RetellAI_LLMModel")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "ListDouble_System_Collections_Generic_List_double_3")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ListRetellLLMResponseStatus5?), TypeInfoPropertyName = "NullableListRetellLLMResponseStatus52")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ListVoicesResponseStatus?), TypeInfoPropertyName = "NullableListVoicesResponseStatus2_3")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.ListVoicesResponseStatus2?), TypeInfoPropertyName = "NullableListVoicesResponseStatus22")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::RetellAI.OneOf?), TypeInfoPropertyName = "NullableOneOfAgentResponseChatAgentResponse2")] diff --git a/src/libs/RetellAI/Generated/RetellAI.JsonSerializerContextTypes.g.cs b/src/libs/RetellAI/Generated/RetellAI.JsonSerializerContextTypes.g.cs index dc751954..6cf9d731 100644 --- a/src/libs/RetellAI/Generated/RetellAI.JsonSerializerContextTypes.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.JsonSerializerContextTypes.g.cs @@ -20,6 +20,11 @@ public sealed partial class JsonSerializerContextTypes /// public global::System.Collections.Generic.Dictionary? StringObjectDictionary { get; set; } + /// + /// Runtime object lists used by dynamic JSON payloads such as tool arguments. + /// + public global::System.Collections.Generic.List? ObjectList { get; set; } + /// /// /// diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.AgentRequest.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.AgentRequest.g.cs index eee2c542..3e2c456d 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.AgentRequest.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.AgentRequest.g.cs @@ -335,7 +335,7 @@ public sealed partial class AgentRequest public global::RetellAI.CallScreeningOption? CallScreeningOption { get; set; } /// - /// Post call analysis data to extract from the call. This data will augment the pre-defined variables extracted in the call analysis. This will be available after the call ends. + /// Post Call Extraction data to extract from the call. This data will augment the pre-defined variables extracted in the call analysis. This will be available after the call ends. /// [global::System.Text.Json.Serialization.JsonPropertyName("post_call_analysis_data")] public global::System.Collections.Generic.IList? PostCallAnalysisData { get; set; } @@ -617,7 +617,7 @@ public sealed partial class AgentRequest /// If this option is set, the agent prompt will include call screen handling instructions for identity and call purpose questions. Set this to null to disable call screen prompt instructions. /// /// - /// Post call analysis data to extract from the call. This data will augment the pre-defined variables extracted in the call analysis. This will be available after the call ends. + /// Post Call Extraction data to extract from the call. This data will augment the pre-defined variables extracted in the call analysis. This will be available after the call ends. /// /// /// Available LLM models for agents. diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.CRMAnalysisDataMapping.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.CRMAnalysisDataMapping.g.cs index 8e446c8c..9a3f8d81 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.CRMAnalysisDataMapping.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.CRMAnalysisDataMapping.g.cs @@ -16,7 +16,7 @@ public sealed partial class CRMAnalysisDataMapping public required string FieldName { get; set; } /// - /// Name of the post-call analysis field to read the value from. A value that does not match the contact field's type is skipped rather than failing the conversation. + /// Name of the Post Call Extraction field to read the value from. A value that does not match the contact field's type is skipped rather than failing the conversation. /// [global::System.Text.Json.Serialization.JsonPropertyName("analysis_data_name")] [global::System.Text.Json.Serialization.JsonRequired] @@ -43,7 +43,7 @@ public sealed partial class CRMAnalysisDataMapping /// Contact field to write to. Must be an existing built-in or custom contact field, and cannot be phone_number, which identifies the contact. /// /// - /// Name of the post-call analysis field to read the value from. A value that does not match the contact field's type is skipped rather than failing the conversation. + /// Name of the Post Call Extraction field to read the value from. A value that does not match the contact field's type is skipped rather than failing the conversation. /// /// /// How to reconcile the new value with what the contact already holds. `overwrite` always replaces it, `fill_if_empty` writes only when the field is empty, and `merge` combines the existing text with the new value. `merge` is available on string fields only. diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.CallAnalysis.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.CallAnalysis.g.cs index 737e1e0d..7a7eeb89 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.CallAnalysis.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.CallAnalysis.g.cs @@ -42,7 +42,7 @@ public sealed partial class CallAnalysis public bool? CallSuccessful { get; set; } /// - /// Custom analysis data that was extracted based on the schema defined in agent post call analysis data. Can be empty if nothing is specified. + /// Custom analysis data that was extracted based on the schema defined in agent Post Call Extraction data. Can be empty if nothing is specified. /// [global::System.Text.Json.Serialization.JsonPropertyName("custom_analysis_data")] public object? CustomAnalysisData { get; set; } @@ -73,7 +73,7 @@ public sealed partial class CallAnalysis /// Example: true /// /// - /// Custom analysis data that was extracted based on the schema defined in agent post call analysis data. Can be empty if nothing is specified. + /// Custom analysis data that was extracted based on the schema defined in agent Post Call Extraction data. Can be empty if nothing is specified. /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.CallAnalysisCustomAnalysisData.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.CallAnalysisCustomAnalysisData.g.cs index 5a6c7919..a744c504 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.CallAnalysisCustomAnalysisData.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.CallAnalysisCustomAnalysisData.g.cs @@ -4,7 +4,7 @@ namespace RetellAI { /// - /// Custom analysis data that was extracted based on the schema defined in agent post call analysis data. Can be empty if nothing is specified. + /// Custom analysis data that was extracted based on the schema defined in agent Post Call Extraction data. Can be empty if nothing is specified. /// public sealed partial class CallAnalysisCustomAnalysisData { diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.CallPresetAnalysisData.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.CallPresetAnalysisData.g.cs index 74f739a9..a89b3125 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.CallPresetAnalysisData.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.CallPresetAnalysisData.g.cs @@ -4,7 +4,7 @@ namespace RetellAI { /// - /// System preset for post-call analysis (voice agents). Use in post_call_analysis_data to override prompts or mark fields optional. + /// System preset for Post Call Extraction (voice agents). Use in post_call_analysis_data to override prompts or mark fields optional. /// public sealed partial class CallPresetAnalysisData { diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.ChatAgentRequest.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.ChatAgentRequest.g.cs index d05fb895..f1dd18b1 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.ChatAgentRequest.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.ChatAgentRequest.g.cs @@ -112,7 +112,7 @@ public sealed partial class ChatAgentRequest public int? SignedUrlExpirationMs { get; set; } /// - /// Post chat analysis data to extract from the chat. This data will augment the pre-defined variables extracted in the chat analysis. This will be available after the chat ends. + /// Post Chat Extraction data to extract from the chat. This data will augment the pre-defined variables extracted in the chat analysis. This will be available after the chat ends. /// [global::System.Text.Json.Serialization.JsonPropertyName("post_chat_analysis_data")] public global::System.Collections.Generic.IList? PostChatAnalysisData { get; set; } @@ -207,7 +207,7 @@ public sealed partial class ChatAgentRequest /// Example: 86400000 /// /// - /// Post chat analysis data to extract from the chat. This data will augment the pre-defined variables extracted in the chat analysis. This will be available after the chat ends. + /// Post Chat Extraction data to extract from the chat. This data will augment the pre-defined variables extracted in the chat analysis. This will be available after the chat ends. /// /// /// Available LLM models for agents. diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.ChatAnalysis.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.ChatAnalysis.g.cs index 9c48133b..b3fc72c4 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.ChatAnalysis.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.ChatAnalysis.g.cs @@ -34,7 +34,7 @@ public sealed partial class ChatAnalysis public bool? ChatSuccessful { get; set; } /// - /// Custom analysis data that was extracted based on the schema defined in chat agent post chat analysis data. Can be empty if nothing is specified. + /// Custom analysis data that was extracted based on the schema defined in chat agent Post Chat Extraction data. Can be empty if nothing is specified. /// [global::System.Text.Json.Serialization.JsonPropertyName("custom_analysis_data")] public object? CustomAnalysisData { get; set; } @@ -61,7 +61,7 @@ public sealed partial class ChatAnalysis /// Example: true /// /// - /// Custom analysis data that was extracted based on the schema defined in chat agent post chat analysis data. Can be empty if nothing is specified. + /// Custom analysis data that was extracted based on the schema defined in chat agent Post Chat Extraction data. Can be empty if nothing is specified. /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.ChatAnalysisCustomAnalysisData.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.ChatAnalysisCustomAnalysisData.g.cs index e8b409bd..87865023 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.ChatAnalysisCustomAnalysisData.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.ChatAnalysisCustomAnalysisData.g.cs @@ -4,7 +4,7 @@ namespace RetellAI { /// - /// Custom analysis data that was extracted based on the schema defined in chat agent post chat analysis data. Can be empty if nothing is specified. + /// Custom analysis data that was extracted based on the schema defined in chat agent Post Chat Extraction data. Can be empty if nothing is specified. /// public sealed partial class ChatAnalysisCustomAnalysisData { diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.ChatPresetAnalysisData.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.ChatPresetAnalysisData.g.cs index 98afd60a..deb8ada4 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.ChatPresetAnalysisData.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.ChatPresetAnalysisData.g.cs @@ -4,7 +4,7 @@ namespace RetellAI { /// - /// System preset for post-chat analysis (chat agents). Use in post_chat_analysis_data to override prompts or mark fields optional. + /// System preset for Post Chat Extraction (chat agents). Use in post_chat_analysis_data to override prompts or mark fields optional. /// public sealed partial class ChatPresetAnalysisData { diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.ContactCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.ContactCall.g.cs index 13defd3e..8040fabe 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.ContactCall.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.ContactCall.g.cs @@ -48,20 +48,20 @@ public sealed partial class ContactCall public string? DisconnectionReason { get; set; } /// - /// Post-call analysis summary. + /// Post Call Extraction summary. /// [global::System.Text.Json.Serialization.JsonPropertyName("summary")] public string? Summary { get; set; } /// - /// User sentiment from post-call analysis. + /// User sentiment from Post Call Extraction. /// [global::System.Text.Json.Serialization.JsonPropertyName("sentiment")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::RetellAI.JsonConverters.ContactCallSentimentJsonConverter))] public global::RetellAI.ContactCallSentiment? Sentiment { get; set; } /// - /// Whether the call was deemed successful by post-call analysis. + /// Whether the call was deemed successful by Post Call Extraction. /// [global::System.Text.Json.Serialization.JsonPropertyName("successful")] public bool? Successful { get; set; } @@ -90,13 +90,13 @@ public sealed partial class ContactCall /// Reason the call ended. /// /// - /// Post-call analysis summary. + /// Post Call Extraction summary. /// /// - /// User sentiment from post-call analysis. + /// User sentiment from Post Call Extraction. /// /// - /// Whether the call was deemed successful by post-call analysis. + /// Whether the call was deemed successful by Post Call Extraction. /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.ContactCallSentiment.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.ContactCallSentiment.g.cs index e47fec18..cc2c1210 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.ContactCallSentiment.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.ContactCallSentiment.g.cs @@ -4,7 +4,7 @@ namespace RetellAI { /// - /// User sentiment from post-call analysis. + /// User sentiment from Post Call Extraction. /// public enum ContactCallSentiment { diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.ContactChat.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.ContactChat.g.cs index 65fc4b80..04d6164f 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.ContactChat.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.ContactChat.g.cs @@ -48,20 +48,20 @@ public sealed partial class ContactChat public string? DisconnectionReason { get; set; } /// - /// Post-chat analysis summary. + /// Post Chat Extraction summary. /// [global::System.Text.Json.Serialization.JsonPropertyName("summary")] public string? Summary { get; set; } /// - /// User sentiment from post-chat analysis. + /// User sentiment from Post Chat Extraction. /// [global::System.Text.Json.Serialization.JsonPropertyName("sentiment")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::RetellAI.JsonConverters.ContactChatSentimentJsonConverter))] public global::RetellAI.ContactChatSentiment? Sentiment { get; set; } /// - /// Whether the chat was deemed successful by post-chat analysis. + /// Whether the chat was deemed successful by Post Chat Extraction. /// [global::System.Text.Json.Serialization.JsonPropertyName("successful")] public bool? Successful { get; set; } @@ -90,13 +90,13 @@ public sealed partial class ContactChat /// Reason the chat ended. /// /// - /// Post-chat analysis summary. + /// Post Chat Extraction summary. /// /// - /// User sentiment from post-chat analysis. + /// User sentiment from Post Chat Extraction. /// /// - /// Whether the chat was deemed successful by post-chat analysis. + /// Whether the chat was deemed successful by Post Chat Extraction. /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.ContactChatSentiment.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.ContactChatSentiment.g.cs index 9863317d..2721cffb 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.ContactChatSentiment.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.ContactChatSentiment.g.cs @@ -4,7 +4,7 @@ namespace RetellAI { /// - /// User sentiment from post-chat analysis. + /// User sentiment from Post Chat Extraction. /// public enum ContactChatSentiment { diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.PostCallAnalysisData.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.PostCallAnalysisData.g.cs index 0aee637d..604ef911 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.PostCallAnalysisData.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.PostCallAnalysisData.g.cs @@ -5,7 +5,7 @@ namespace RetellAI { /// - /// Post-call analysis item (custom data or voice preset). Use for voice agent post_call_analysis_data; validates only call presets (call_summary, call_successful, user_sentiment). + /// Post Call Extraction item (custom data or voice preset). Use for voice agent post_call_analysis_data; validates only call presets (call_summary, call_successful, user_sentiment). /// public readonly partial struct PostCallAnalysisData : global::System.IEquatable { @@ -47,7 +47,7 @@ public bool TryPickAnalysisData( : throw new global::System.InvalidOperationException($"Expected union variant 'AnalysisData' but the value was {ToString()}."); /// - /// System preset for post-call analysis (voice agents). Use in post_call_analysis_data to override prompts or mark fields optional. + /// System preset for Post Call Extraction (voice agents). Use in post_call_analysis_data to override prompts or mark fields optional. /// #if NET6_0_OR_GREATER public global::RetellAI.CallPresetAnalysisData? Preset { get; init; } diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.PostChatAnalysisData.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.PostChatAnalysisData.g.cs index 193efaea..69606677 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.PostChatAnalysisData.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.PostChatAnalysisData.g.cs @@ -5,7 +5,7 @@ namespace RetellAI { /// - /// Post-chat analysis item (custom data or chat preset). Use for chat agent post_chat_analysis_data; validates only chat presets (chat_summary, chat_successful, user_sentiment). + /// Post Chat Extraction item (custom data or chat preset). Use for chat agent post_chat_analysis_data; validates only chat presets (chat_summary, chat_successful, user_sentiment). /// public readonly partial struct PostChatAnalysisData : global::System.IEquatable { @@ -47,7 +47,7 @@ public bool TryPickAnalysisData( : throw new global::System.InvalidOperationException($"Expected union variant 'AnalysisData' but the value was {ToString()}."); /// - /// System preset for post-chat analysis (chat agents). Use in post_chat_analysis_data to override prompts or mark fields optional. + /// System preset for Post Chat Extraction (chat agents). Use in post_chat_analysis_data to override prompts or mark fields optional. /// #if NET6_0_OR_GREATER public global::RetellAI.ChatPresetAnalysisData? Preset { get; init; } diff --git a/src/libs/RetellAI/Generated/RetellAI.Models.PresetAnalysisData.g.cs b/src/libs/RetellAI/Generated/RetellAI.Models.PresetAnalysisData.g.cs index 2dd3c43c..c849b1e5 100644 --- a/src/libs/RetellAI/Generated/RetellAI.Models.PresetAnalysisData.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.Models.PresetAnalysisData.g.cs @@ -4,7 +4,7 @@ namespace RetellAI { /// - /// System preset for post-call or post-chat analysis (summary, success, sentiment). Presets can be included in post_call_analysis_data or post_chat_analysis_data to override prompts or mark fields optional. + /// System preset for Post Call or Post Chat Extraction (summary, success, sentiment). Presets can be included in post_call_analysis_data or post_chat_analysis_data to override prompts or mark fields optional. /// public sealed partial class PresetAnalysisData { diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetCrmConfig.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetCrmConfig.g.cs index 8982f6fd..28c91cd1 100644 --- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetCrmConfig.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetCrmConfig.g.cs @@ -40,7 +40,7 @@ partial void ProcessGetCrmConfigResponseContent( ref string content); /// - /// Get the organization's CRM configuration: which CRM app is linked, the custom contact fields defined for it, and how post-call analysis data is written back to contacts. Returns an empty configuration when nothing has been set up yet. + /// Get the organization's CRM configuration: which CRM app is linked, the custom contact fields defined for it, and how Post Call Extraction data is written back to contacts. Returns an empty configuration when nothing has been set up yet. /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with @@ -57,7 +57,7 @@ partial void ProcessGetCrmConfigResponseContent( return __response.Body; } /// - /// Get the organization's CRM configuration: which CRM app is linked, the custom contact fields defined for it, and how post-call analysis data is written back to contacts. Returns an empty configuration when nothing has been set up yet. + /// Get the organization's CRM configuration: which CRM app is linked, the custom contact fields defined for it, and how Post Call Extraction data is written back to contacts. Returns an empty configuration when nothing has been set up yet. /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.RerunCallAnalysis.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.RerunCallAnalysis.g.cs index 5eb1e065..42c56935 100644 --- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.RerunCallAnalysis.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.RerunCallAnalysis.g.cs @@ -42,7 +42,7 @@ partial void ProcessRerunCallAnalysisResponseContent( ref string content); /// - /// Rerun post-call analysis for a specific call. This operation incurs charges. + /// Rerun Post Call Extraction for a specific call. This operation incurs charges. /// /// /// Example: call_119c3f8e47135a29e65947eeb34cf12d @@ -64,7 +64,7 @@ partial void ProcessRerunCallAnalysisResponseContent( return __response.Body; } /// - /// Rerun post-call analysis for a specific call. This operation incurs charges. + /// Rerun Post Call Extraction for a specific call. This operation incurs charges. /// /// /// Example: call_119c3f8e47135a29e65947eeb34cf12d diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.RerunChatAnalysis.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.RerunChatAnalysis.g.cs index f9c0a568..29543df3 100644 --- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.RerunChatAnalysis.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.RerunChatAnalysis.g.cs @@ -42,7 +42,7 @@ partial void ProcessRerunChatAnalysisResponseContent( ref string content); /// - /// Rerun post-chat analysis for a specific chat. This operation incurs charges. + /// Rerun Post Chat Extraction for a specific chat. This operation incurs charges. /// /// /// Example: chat_16b980523634a6dc504898cda492e939 @@ -64,7 +64,7 @@ partial void ProcessRerunChatAnalysisResponseContent( return __response.Body; } /// - /// Rerun post-chat analysis for a specific chat. This operation incurs charges. + /// Rerun Post Chat Extraction for a specific chat. This operation incurs charges. /// /// /// Example: chat_16b980523634a6dc504898cda492e939 diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.UpdateAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.UpdateAgent.g.cs index e9748c58..9943c21d 100644 --- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.UpdateAgent.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.UpdateAgent.g.cs @@ -100,8 +100,6 @@ partial void ProcessUpdateAgentResponseContent( global::RetellAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { - request = request ?? throw new global::System.ArgumentNullException(nameof(request)); - PrepareArguments( client: HttpClient); PrepareUpdateAgentArguments( @@ -820,7 +818,7 @@ partial void ProcessUpdateAgentResponseContent( /// If this option is set, the agent prompt will include call screen handling instructions for identity and call purpose questions. Set this to null to disable call screen prompt instructions. /// /// - /// Post call analysis data to extract from the call. This data will augment the pre-defined variables extracted in the call analysis. This will be available after the call ends. + /// Post Call Extraction data to extract from the call. This data will augment the pre-defined variables extracted in the call analysis. This will be available after the call ends. /// /// /// Available LLM models for agents. diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.UpdateChatAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.UpdateChatAgent.g.cs index 907963a4..b79e5cbd 100644 --- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.UpdateChatAgent.g.cs +++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.UpdateChatAgent.g.cs @@ -704,7 +704,7 @@ partial void ProcessUpdateChatAgentResponseContent( /// Example: 86400000 /// /// - /// Post chat analysis data to extract from the chat. This data will augment the pre-defined variables extracted in the chat analysis. This will be available after the chat ends. + /// Post Chat Extraction data to extract from the chat. This data will augment the pre-defined variables extracted in the chat analysis. This will be available after the chat ends. /// /// /// Available LLM models for agents. diff --git a/src/libs/RetellAI/openapi.yaml b/src/libs/RetellAI/openapi.yaml index e15a96af..6f7a8639 100644 --- a/src/libs/RetellAI/openapi.yaml +++ b/src/libs/RetellAI/openapi.yaml @@ -1035,12 +1035,12 @@ components: type: array items: $ref: '#/components/schemas/PostCallAnalysisData' - description: Post call analysis data to extract from the call. This data will augment the pre-defined variables extracted in the call analysis. This will be available after the call ends. + description: Post Call Extraction data to extract from the call. This data will augment the pre-defined variables extracted in the call analysis. This will be available after the call ends. nullable: true post_call_analysis_model: $ref: '#/components/schemas/NullableLLMModel' example: gpt-4.1-mini - description: The model to use for post call analysis. Default to gpt-4.1. + description: The model to use for Post Call Extraction. Default to gpt-4.1. begin_message_delay_ms: type: integer example: 1000 @@ -1279,7 +1279,7 @@ components: description: The version of the agent to swap to. If not specified, will use the latest version post_call_analysis_setting: $ref: '#/components/schemas/PostCallAnalysisSetting' - description: Post call analysis setting for the agent swap + description: Post Call Extraction setting for the agent swap webhook_setting: $ref: '#/components/schemas/AgentSwapWebhookSetting' description: Webhook setting for the agent swap, defaults to only source. @@ -1332,7 +1332,7 @@ components: directly. Defaults to "prompt". post_call_analysis_setting: $ref: '#/components/schemas/PostCallAnalysisSetting' - description: Post call analysis setting for the agent swap. + description: Post Call Extraction setting for the agent swap. webhook_setting: $ref: '#/components/schemas/AgentSwapWebhookSetting' description: Webhook setting for the agent swap, defaults to only source. @@ -1363,12 +1363,12 @@ components: oneOf: - $ref: '#/components/schemas/AnalysisData' - $ref: '#/components/schemas/CallPresetAnalysisData' - description: Post-call analysis item (custom data or voice preset). Use for voice agent post_call_analysis_data; validates only call presets (call_summary, call_successful, user_sentiment). + description: Post Call Extraction item (custom data or voice preset). Use for voice agent post_call_analysis_data; validates only call presets (call_summary, call_successful, user_sentiment). PostChatAnalysisData: oneOf: - $ref: '#/components/schemas/AnalysisData' - $ref: '#/components/schemas/ChatPresetAnalysisData' - description: Post-chat analysis item (custom data or chat preset). Use for chat agent post_chat_analysis_data; validates only chat presets (chat_summary, chat_successful, user_sentiment). + description: Post Chat Extraction item (custom data or chat preset). Use for chat agent post_chat_analysis_data; validates only chat presets (chat_summary, chat_successful, user_sentiment). AverageMetric: type: object required: @@ -1652,7 +1652,7 @@ components: description: Whether the agent seems to have a successful call with the user, where the agent finishes the task, and the call was complete without being cutoff. custom_analysis_data: type: object - description: Custom analysis data that was extracted based on the schema defined in agent post call analysis data. Can be empty if nothing is specified. + description: Custom analysis data that was extracted based on the schema defined in agent Post Call Extraction data. Can be empty if nothing is specified. CallLatency: type: object properties: @@ -2034,12 +2034,12 @@ components: type: array items: $ref: '#/components/schemas/PostChatAnalysisData' - description: Post chat analysis data to extract from the chat. This data will augment the pre-defined variables extracted in the chat analysis. This will be available after the chat ends. + description: Post Chat Extraction data to extract from the chat. This data will augment the pre-defined variables extracted in the chat analysis. This will be available after the chat ends. nullable: true post_chat_analysis_model: $ref: '#/components/schemas/NullableLLMModel' example: gpt-4.1-mini - description: The model to use for post chat analysis. Default to gpt-4.1. + description: The model to use for Post Chat Extraction. Default to gpt-4.1. pii_config: $ref: '#/components/schemas/PIIConfig' description: Configuration for PII scrubbing from transcripts and recordings. @@ -2116,7 +2116,7 @@ components: description: Whether the agent seems to have a successful chat with the user, where the agent finishes the task, and the call was complete without being cutoff. custom_analysis_data: type: object - description: Custom analysis data that was extracted based on the schema defined in chat agent post chat analysis data. Can be empty if nothing is specified. + description: Custom analysis data that was extracted based on the schema defined in chat agent Post Chat Extraction data. Can be empty if nothing is specified. ChatResponse: type: object required: @@ -2232,7 +2232,7 @@ components: description: Combined cost of all individual costs in cents example: 70 chat_analysis: - description: Post chat analysis that includes information such as sentiment, status, summary, and custom defined data to extract. Available after chat ends. Subscribe to `chat_analyzed` webhook + description: Post Chat Extraction that includes information such as sentiment, status, summary, and custom defined data to extract. Available after chat ends. Subscribe to `chat_analyzed` webhook event type to receive it once ready. $ref: '#/components/schemas/ChatAnalysis' V3ChatResponse: @@ -5454,8 +5454,8 @@ components: - type - name - description - description: System preset for post-call or post-chat analysis (summary, success, sentiment). Presets can be included in post_call_analysis_data or post_chat_analysis_data to override prompts or mark - fields optional. + description: System preset for Post Call or Post Chat Extraction (summary, success, sentiment). Presets can be included in post_call_analysis_data or post_chat_analysis_data to override prompts or + mark fields optional. properties: type: type: string @@ -5487,7 +5487,7 @@ components: required: - type - name - description: System preset for post-call analysis (voice agents). Use in post_call_analysis_data to override prompts or mark fields optional. + description: System preset for Post Call Extraction (voice agents). Use in post_call_analysis_data to override prompts or mark fields optional. properties: type: type: string @@ -5517,7 +5517,7 @@ components: required: - type - name - description: System preset for post-chat analysis (chat agents). Use in post_chat_analysis_data to override prompts or mark fields optional. + description: System preset for Post Chat Extraction (chat agents). Use in post_chat_analysis_data to override prompts or mark fields optional. properties: type: type: string @@ -7996,7 +7996,7 @@ components: are prefixed with "sip:" and may include a ";transport=..." portion (if transport is known) where the transport type can be "tls", "tcp" or "udp". nullable: true call_analysis: - description: Post call analysis that includes information such as sentiment, status, summary, and custom defined data to extract. Available after call ends. Subscribe to `call_analyzed` webhook + description: Post Call Extraction that includes information such as sentiment, status, summary, and custom defined data to extract. Available after call ends. Subscribe to `call_analyzed` webhook event type to receive it once ready. $ref: '#/components/schemas/CallAnalysis' call_cost: @@ -8224,7 +8224,7 @@ components: are prefixed with "sip:" and may include a ";transport=..." portion (if transport is known) where the transport type can be "tls", "tcp" or "udp". nullable: true call_analysis: - description: Post call analysis that includes information such as sentiment, status, summary, and custom defined data to extract. Available after call ends. Subscribe to `call_analyzed` webhook + description: Post Call Extraction that includes information such as sentiment, status, summary, and custom defined data to extract. Available after call ends. Subscribe to `call_analyzed` webhook event type to receive it once ready. $ref: '#/components/schemas/CallAnalysis' call_cost: @@ -8725,7 +8725,7 @@ components: description: Reason the call ended. summary: type: string - description: Post-call analysis summary. + description: Post Call Extraction summary. sentiment: type: string enum: @@ -8733,10 +8733,10 @@ components: - Positive - Neutral - Unknown - description: User sentiment from post-call analysis. + description: User sentiment from Post Call Extraction. successful: type: boolean - description: Whether the call was deemed successful by post-call analysis. + description: Whether the call was deemed successful by Post Call Extraction. ContactChat: type: object required: @@ -8766,7 +8766,7 @@ components: description: Reason the chat ended. summary: type: string - description: Post-chat analysis summary. + description: Post Chat Extraction summary. sentiment: type: string enum: @@ -8774,10 +8774,10 @@ components: - Positive - Neutral - Unknown - description: User sentiment from post-chat analysis. + description: User sentiment from Post Chat Extraction. successful: type: boolean - description: Whether the chat was deemed successful by post-chat analysis. + description: Whether the chat was deemed successful by Post Chat Extraction. ContactConversationListResponse: type: object properties: @@ -9110,7 +9110,7 @@ components: description: Contact field to write to. Must be an existing built-in or custom contact field, and cannot be phone_number, which identifies the contact. analysis_data_name: type: string - description: Name of the post-call analysis field to read the value from. A value that does not match the contact field's type is skipped rather than failing the conversation. + description: Name of the Post Call Extraction field to read the value from. A value that does not match the contact field's type is skipped rather than failing the conversation. update_mode: type: string description: How to reconcile the new value with what the contact already holds. `overwrite` always replaces it, `fill_if_empty` writes only when the field is empty, and `merge` combines the existing @@ -11566,7 +11566,7 @@ paths: $ref: '#/components/responses/InternalServerError' /rerun-call-analysis/{call_id}: put: - description: Rerun post-call analysis for a specific call. This operation incurs charges. + description: Rerun Post Call Extraction for a specific call. This operation incurs charges. operationId: rerunCallAnalysis parameters: - in: path @@ -11599,7 +11599,7 @@ paths: $ref: '#/components/responses/InternalServerError' /rerun-chat-analysis/{chat_id}: put: - description: Rerun post-chat analysis for a specific chat. This operation incurs charges. + description: Rerun Post Chat Extraction for a specific chat. This operation incurs charges. operationId: rerunChatAnalysis parameters: - in: path @@ -13088,7 +13088,7 @@ paths: $ref: '#/components/responses/InternalServerError' /get-crm-config: get: - description: 'Get the organization''s CRM configuration: which CRM app is linked, the custom contact fields defined for it, and how post-call analysis data is written back to contacts. Returns an + description: 'Get the organization''s CRM configuration: which CRM app is linked, the custom contact fields defined for it, and how Post Call Extraction data is written back to contacts. Returns an empty configuration when nothing has been set up yet.' operationId: getCrmConfig x-retell-sdk-resource: crm